Changeset 976604d in sasview
- Timestamp:
- Mar 25, 2011 12:05:47 PM (14 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 84e5533
- Parents:
- dd1718e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/gui_manager.py
r4c01978 r976604d 1028 1028 self._data_panel.load_data_list(data_state) 1029 1029 self._mgr.GetPane(self._data_panel.window_name).Show(True) 1030 1030 1031 def load_from_cmd(self, path): 1032 """ 1033 """ 1034 print "load_from_cmd", path 1035 if path is None: 1036 return 1037 else: 1038 path = os.path.abspath(path) 1039 if not os.path.isfile(path): 1040 print "return abs path", path 1041 return 1042 1043 print "find a path -->", path 1044 1045 basename = os.path.basename(path) 1046 root, extension = os.path.splitext(basename) 1047 if extension.lower() not in EXTENSIONS: 1048 self.load_data(path) 1049 print "load data" 1050 else: 1051 self.load_state(path) 1052 "load state" 1053 1031 1054 def load_state(self, path): 1032 1055 """ 1033 1056 """ 1034 if path and os.path.isfile(path):1057 if path and (path is not None) and os.path.isfile(path): 1035 1058 basename = os.path.basename(path) 1036 1059 if APPLICATION_STATE_EXTENSION is not None \ … … 1784 1807 gui_style = DEFAULT_STYLE, 1785 1808 size=size) 1786 #try to load file at the start1787 #try:1788 # self.open_file()1789 #except:1790 # raise1791 1809 self.s_screen = None 1792 1810 # Display a splash screen on top of the frame. … … 1809 1827 self.frame.special.SetCurrent() 1810 1828 self.SetTopWindow(self.frame) 1811 import time 1812 1829 self.input_file = None 1830 self.dir = None 1831 print "sys.argv", sys.argv 1832 if len(sys.argv) >= 2: 1833 print "sys.argv 0", sys.argv[0] 1834 cmd = sys.argv[0].lower() 1835 if os.path.isfile(cmd): 1836 basename = os.path.basename(cmd) 1837 self.dir = os.path.dirname(cmd) 1838 print "basename", basename 1839 if basename in ['sansview.py', 'sansview.exe']: 1840 print "sys.argv 1", sys.argv[1] 1841 self.input_file = sys.argv[1] 1813 1842 return True 1814 1815 def load(self, path): 1816 """ 1817 """ 1843 1844 def open_file(self): 1845 """ 1846 open a state file at the start of the application 1847 """ 1848 1818 1849 if self.frame is not None: 1819 self.frame.load(path) 1820 1821 def open_file(self): 1822 """ 1823 open a state file at the start of the application 1824 """ 1825 if len(sys.argv) >= 2: 1826 if sys.argv[0].lower() in ['sansview.py', 'sansview.exe']: 1827 path = sys.argv[1] 1828 if os.path.isfile(path): 1829 self.load(path) 1830 else: 1831 print "SansView cannot read this file: %s" % str(path) 1850 self.frame.load_from_cmd(path=self.input_file) 1851 1832 1852 1833 1853 def set_manager(self, manager): … … 1844 1864 self.frame.build_gui() 1845 1865 self.frame.post_init() 1866 #try to load file at the start 1867 try: 1868 self.open_file() 1869 except: 1870 raise 1846 1871 if self.s_screen is not None and self.s_screen.IsShown(): 1847 1872 self.s_screen.Close()
Note: See TracChangeset
for help on using the changeset viewer.