- Timestamp:
- Jul 2, 2015 11:32:45 AM (9 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:
- d06c34c
- Parents:
- f21d496
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/gui_manager.py
rf21d496 r78f75d02 231 231 Initialize the Frame object 232 232 """ 233 234 233 PARENT_FRAME.__init__(self, parent=parent, title=title, pos=pos, size=size) 235 234 # title … … 360 359 frame.SetIcon(icon) 361 360 except: 362 pass361 logging.error("ViewerFrame.put_icon: could not set icon") 363 362 364 363 def get_client_size(self): … … 748 747 self._toolbar.Realize() 749 748 750 751 749 def build_gui(self): 752 750 """ … … 774 772 # Append item from plugin under menu file if necessary 775 773 self._populate_file_menu() 776 777 774 778 775 if not wx.VERSION_STRING >= '3.0.0.0': … … 1494 1491 for item in plugin.populate_file_menu(): 1495 1492 m_name, m_hint, m_handler = item 1496 id = wx.NewId()1497 self._file_menu.Append( id, m_name, m_hint)1498 wx.EVT_MENU(self, id, m_handler)1493 wx_id = wx.NewId() 1494 self._file_menu.Append(wx_id, m_name, m_hint) 1495 wx.EVT_MENU(self, wx_id, m_handler) 1499 1496 self._file_menu.AppendSeparator() 1500 1497 1501 1498 style1 = self.__gui_style & GUIFRAME.MULTIPLE_APPLICATIONS 1502 1499 if OPEN_SAVE_MENU: 1503 id = wx.NewId()1500 wx_id = wx.NewId() 1504 1501 hint_load_file = "read all analysis states saved previously" 1505 self._save_appl_menu = self._file_menu.Append( id, '&Open Project', hint_load_file)1506 wx.EVT_MENU(self, id, self._on_open_state_project)1502 self._save_appl_menu = self._file_menu.Append(wx_id, '&Open Project', hint_load_file) 1503 wx.EVT_MENU(self, wx_id, self._on_open_state_project) 1507 1504 1508 1505 if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: … … 1510 1507 hint_load_file = "Read a status files and load" 1511 1508 hint_load_file += " them into the analysis" 1512 id = wx.NewId()1513 self._save_appl_menu = self._file_menu.Append( id,1509 wx_id = wx.NewId() 1510 self._save_appl_menu = self._file_menu.Append(wx_id, 1514 1511 '&Open Analysis', hint_load_file) 1515 wx.EVT_MENU(self, id, self._on_open_state_application)1512 wx.EVT_MENU(self, wx_id, self._on_open_state_application) 1516 1513 if OPEN_SAVE_MENU: 1517 1514 self._file_menu.AppendSeparator() 1518 id = wx.NewId()1519 self._file_menu.Append( id, '&Save Project',1515 wx_id = wx.NewId() 1516 self._file_menu.Append(wx_id, '&Save Project', 1520 1517 'Save the state of the whole analysis') 1521 wx.EVT_MENU(self, id, self._on_save_project)1518 wx.EVT_MENU(self, wx_id, self._on_save_project) 1522 1519 if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 1523 id = wx.NewId()1524 self._save_appl_menu = self._file_menu.Append( id, \1520 wx_id = wx.NewId() 1521 self._save_appl_menu = self._file_menu.Append(wx_id, \ 1525 1522 '&Save Analysis', 'Save state of the current active analysis panel') 1526 wx.EVT_MENU(self, id, self._on_save_application)1523 wx.EVT_MENU(self, wx_id, self._on_save_application) 1527 1524 if not sys.platform == 'darwin': 1528 1525 self._file_menu.AppendSeparator() 1529 id = wx.NewId()1530 self._file_menu.Append( id, '&Quit', 'Exit')1531 wx.EVT_MENU(self, id, self.Close)1526 wx_id = wx.NewId() 1527 self._file_menu.Append(wx_id, '&Quit', 'Exit') 1528 wx.EVT_MENU(self, wx_id, self.Close) 1532 1529 1533 1530 def _add_menu_file(self): … … 1700 1697 """ 1701 1698 """ 1702 message = ""1703 1699 log_msg = '' 1704 output = []1705 error_message = ""1706 1700 basename = os.path.basename(path) 1707 root, extension = os.path.splitext(basename)1701 _, extension = os.path.splitext(basename) 1708 1702 if extension.lower() not in EXTENSIONS: 1709 1703 log_msg = "File Loader cannot " … … 2371 2365 total_plot_list.append(theory_data) 2372 2366 for new_plot in total_plot_list: 2373 id = new_plot.id2374 2367 for group_id in new_plot.list_group_id: 2375 wx.PostEvent(self, NewPlotEvent(id= id,2368 wx.PostEvent(self, NewPlotEvent(id=new_plot.id, 2376 2369 group_id=group_id, 2377 2370 action='remove')) 2378 2371 #remove res plot: Todo: improve 2379 wx.CallAfter(self._remove_res_plot, id)2372 wx.CallAfter(self._remove_res_plot, new_plot.id) 2380 2373 self._data_manager.delete_data(data_id=data_id, 2381 2374 theory_id=theory_id) … … 2412 2405 ext_num = dlg.GetFilterIndex() 2413 2406 if ext_num == 0: 2414 format = '.txt'2407 ext_format = '.txt' 2415 2408 else: 2416 format = '.xml'2417 path = os.path.splitext(path)[0] + format2409 ext_format = '.xml' 2410 path = os.path.splitext(path)[0] + ext_format 2418 2411 mypath = os.path.basename(path) 2419 2412 2420 2413 #Instantiate a loader 2421 2414 loader = Loader() 2422 format = ".txt"2423 if os.path.splitext(mypath)[1].lower() == format:2415 ext_format = ".txt" 2416 if os.path.splitext(mypath)[1].lower() == ext_format: 2424 2417 # Make sure the ext included in the file name 2425 2418 # especially on MAC 2426 fName = os.path.splitext(path)[0] + format2419 fName = os.path.splitext(path)[0] + ext_format 2427 2420 self._onsaveTXT(data, fName) 2428 format = ".xml"2429 if os.path.splitext(mypath)[1].lower() == format:2421 ext_format = ".xml" 2422 if os.path.splitext(mypath)[1].lower() == ext_format: 2430 2423 # Make sure the ext included in the file name 2431 2424 # especially on MAC 2432 fName = os.path.splitext(path)[0] + format2433 loader.save(fName, data, format)2425 fName = os.path.splitext(path)[0] + ext_format 2426 loader.save(fName, data, ext_format) 2434 2427 try: 2435 2428 self._default_save_location = os.path.dirname(path) … … 2554 2547 ext_num = dlg.GetFilterIndex() 2555 2548 if ext_num == 0: 2556 format = '.dat'2549 ext_format = '.dat' 2557 2550 else: 2558 format = ''2559 path = os.path.splitext(path)[0] + format2551 ext_format = '' 2552 path = os.path.splitext(path)[0] + ext_format 2560 2553 mypath = os.path.basename(path) 2561 2554 … … 2563 2556 loader = Loader() 2564 2557 2565 format = ".dat"2566 if os.path.splitext(mypath)[1].lower() == format:2558 ext_format = ".dat" 2559 if os.path.splitext(mypath)[1].lower() == ext_format: 2567 2560 # Make sure the ext included in the file name 2568 2561 # especially on MAC 2569 fileName = os.path.splitext(path)[0] + format2570 loader.save(fileName, data, format)2562 fileName = os.path.splitext(path)[0] + ext_format 2563 loader.save(fileName, data, ext_format) 2571 2564 try: 2572 2565 self._default_save_location = os.path.dirname(path) … … 3161 3154 3162 3155 3163 class ViewApp(wx.App):3156 class SasViewApp(wx.App): 3164 3157 """ 3165 Toy application to test this Frame3158 SasView application 3166 3159 """ 3167 3160 def OnInit(self): … … 3249 3242 if len(os.listdir(model_folder)) > 0: 3250 3243 try: 3251 for file in os.listdir(model_folder):3252 file_path = os.path.join(model_folder, file )3244 for filename in os.listdir(model_folder): 3245 file_path = os.path.join(model_folder, filename) 3253 3246 if os.path.isfile(file_path): 3254 3247 os.remove(file_path) … … 3269 3262 """ 3270 3263 #try to load file at the start 3271 try: 3272 self.open_file() 3273 except: 3274 raise 3264 self.open_file() 3275 3265 self.frame.build_gui() 3276 3266
Note: See TracChangeset
for help on using the changeset viewer.