Changeset 7dfdd56 in sasview for sansguiframe/src/sans/guiframe
- Timestamp:
- Apr 25, 2012 9:14:43 AM (13 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:
- 567e88d
- Parents:
- 036e9ba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/gui_manager.py
r036e9ba r7dfdd56 122 122 custom_config = _find_local_config('custom_config', os.getcwd()) 123 123 if custom_config is None: 124 msg = "Custom_config file was not imported"125 logging.info(msg )124 msgConfig = "Custom_config file was not imported" 125 logging.info(msgConfig) 126 126 else: 127 127 logging.info("using custom_config in %s" % os.getcwd()) … … 215 215 """ 216 216 217 wx.Frame.__init__(self, parent=parent, title=title, pos=pos, size=size)217 wx.Frame.__init__(self, parent=parent, title=title, pos=pos, size=size) 218 218 # title 219 219 self.title = title … … 263 263 #tool bar 264 264 self._toolbar = None 265 # Status bar 266 self.sb = None 265 267 # number of plugins 266 268 self._num_perspectives = 0 … … 293 295 #data manager 294 296 self.batch_on = False 295 from data_manager import DataManager297 from sans.guiframe.data_manager import DataManager 296 298 self._data_manager = DataManager() 297 299 self._data_panel = DataPanel(parent=self) 298 300 if self.panel_on_focus is not None: 299 self._data_panel.set_panel_on_focus(self.panel_on_focus.window_caption) 301 self._data_panel.set_panel_on_focus( 302 self.panel_on_focus.window_caption) 300 303 # list of plot panels in schedule to full redraw 301 304 self.schedule = False … … 349 352 t = time.localtime(time.time()) 350 353 time_str = time.strftime("%b %d %H;%M of %Y", t) 351 name = "Batch" + time_str352 354 details = "File Generated by %s : %s" % (APPLICATION_NAME, 353 355 str(plugin_name)) … … 492 494 excel_app.Visible = 1 493 495 except: 494 msg = "Error occured when calling Excel\n" 495 msg += "Check that Excel in installed in this machine or \n"496 msg +="Check that %s really exists.\n" % str(file_name)496 msg = "Error occured when calling Excel\n" + 497 "Check that Excel in installed in this machine or \n" + 498 "Check that %s really exists.\n" % str(file_name) 497 499 wx.PostEvent(self, StatusEvent(status=msg, 498 500 info="error")) … … 577 579 def get_data_manager(self): 578 580 """ 581 return the data manager. 579 582 """ 580 583 return self._data_manager … … 582 585 def get_toolbar(self): 583 586 """ 587 return the toolbar. 584 588 """ 585 589 return self._toolbar … … 622 626 self._data_panel.disable_app_combo(enable) 623 627 if self._menubar is not None: 624 for menu, _ in self._menubar.GetMenus():628 for menu, _ in self._menubar.GetMenus(): 625 629 for items in menu.GetMenuItems(): 626 630 items.Enable(enable) … … 677 681 def build_gui(self): 678 682 """ 683 Build the GUI by setting up the toolbar, menu and layout. 679 684 """ 680 685 # set tool bar … … 720 725 """ 721 726 # Status bar 722 from gui_statusbar import StatusBar727 from sans.guiframe.gui_statusbar import StatusBar 723 728 self.sb = StatusBar(self, wx.ID_ANY) 724 729 self.SetStatusBar(self.sb) … … 750 755 field = self.sb.get_msg_position() 751 756 wx.Frame.PushStatusText(self, field=field, 752 757 string="FIXME: PushStatusText called without text") 753 758 754 759 def add_perspective(self, plugin): … … 807 812 808 813 """ 809 import imp810 814 plugins = [] 811 815 # Go through files in panels directory … … 935 939 data_pane = self._mgr.GetPane(self.panels["data_panel"].window_name) 936 940 if style != GUIFRAME.MANAGER_ON: 937 self._mgr.GetPane(self.panels["data_panel"].window_name).Hide()941 data_pane.Hide() 938 942 else: 939 self._mgr.GetPane(self.panels["data_panel"].window_name).Show()943 data_pane.Show() 940 944 941 945 # Add the panels to the AUI manager … … 971 975 def update_data(self, prev_data, new_data): 972 976 """ 973 """ 974 prev_id, data_state = self._data_manager.update_data(prev_data=prev_data, 975 new_data=new_data) 977 Update the data. 978 """ 979 prev_id, data_state = self._data_manager.update_data( 980 prev_data=prev_data, new_data=new_data) 976 981 977 982 self._data_panel.remove_by_id(prev_id) … … 980 985 def update_theory(self, data_id, theory, state=None): 981 986 """ 987 Update the theory 982 988 """ 983 989 data_state = self._data_manager.update_theory(data_id=data_id, … … 1010 1016 def delete_data(self, data): 1011 1017 """ 1018 Delete the data. 1012 1019 """ 1013 1020 self._current_perspective.delete_data(data) … … 1233 1240 menu_list = self._current_perspective.populate_menu(self) 1234 1241 if menu_list: 1235 for (menu, name) in menu_list:1242 for (menu, name) in menu_list: 1236 1243 if self._applications_menu_pos == -1: 1237 1244 self._menubar.Append(menu, name) 1238 1245 else: 1239 self._menubar.Insert(self._applications_menu_pos, menu, name) 1246 self._menubar.Insert(self._applications_menu_pos, 1247 menu, name) 1240 1248 self._applications_menu_name = name 1241 1249 … … 1263 1271 self._help_menu.AppendSeparator() 1264 1272 id = wx.NewId() 1265 self._help_menu.Append(id, '&Tutorial', 'Software tutorial')1273 self._help_menu.Append(id, '&Tutorial', 'Software tutorial') 1266 1274 wx.EVT_MENU(self, id, self._onTutorial) 1267 1275 … … 1269 1277 self._help_menu.AppendSeparator() 1270 1278 id = wx.NewId() 1271 self._help_menu.Append(id, '&About', 'Software information')1279 self._help_menu.Append(id, '&About', 'Software information') 1272 1280 wx.EVT_MENU(self, id, self._onAbout) 1273 1281 … … 1300 1308 style1 = self.__gui_style & GUIFRAME.TOOLBAR_ON 1301 1309 if style1 == GUIFRAME.TOOLBAR_ON: 1302 self._toolbar_menu = self._view_menu.Append(id, '&Hide Toolbar', '')1310 self._toolbar_menu = self._view_menu.Append(id, '&Hide Toolbar', '') 1303 1311 else: 1304 self._toolbar_menu = self._view_menu.Append(id, '&Show Toolbar', '')1312 self._toolbar_menu = self._view_menu.Append(id, '&Show Toolbar', '') 1305 1313 wx.EVT_MENU(self, id, self._on_toggle_toolbar) 1306 1314 … … 1314 1322 self._view_menu.AppendSeparator() 1315 1323 id = wx.NewId() 1316 preference_menu = self._view_menu.Append(id, 'Startup Setting', '')1324 preference_menu = self._view_menu.Append(id, 'Startup Setting', '') 1317 1325 wx.EVT_MENU(self, id, self._on_preference_menu) 1318 1326 … … 1396 1404 id = wx.NewId() 1397 1405 hint = "Clean up the dock area for plots on new-plot" 1398 preferences_menu.AppendCheckItem(id, '&CleanUp Dock on NewPlot', hint) 1406 preferences_menu.AppendCheckItem(id, '&CleanUp Dock on NewPlot', 1407 hint) 1399 1408 wx.EVT_MENU(self, id, self.on_cleanup_dock) 1400 1409 flag = self.cleanup_plots … … 1407 1416 self._menubar.Remove(pos) 1408 1417 #wx.EVT_MENU(self, id, self.show_preferences_panel) 1409 """ 1410 if len(self.plugins) == 2: 1411 plug = self.plugins[1] 1412 pers = plug.get_perspective() 1413 1414 if len(pers) > 1: 1415 self._window_menu = wx.Menu() 1416 for item in self.panels: 1417 if item == 'default': 1418 continue 1419 panel = self.panels[item] 1420 if panel.window_name in pers: 1421 self._window_menu.Append(int(item), 1422 panel.window_caption, 1423 "Show %s window" % panel.window_caption) 1424 wx.EVT_MENU(self, int(item), self.on_view) 1425 self._menubar.Append(self._window_menu, '&Window') 1426 """ 1418 #if len(self.plugins) == 2: 1419 # plug = self.plugins[1] 1420 # pers = plug.get_perspective() 1421 # 1422 # if len(pers) > 1: 1423 # self._window_menu = wx.Menu() 1424 # for item in self.panels: 1425 # if item == 'default': 1426 # continue 1427 # panel = self.panels[item] 1428 # if panel.window_name in pers: 1429 # self._window_menu.Append(int(item), 1430 # panel.window_caption, 1431 # "Show %s window" % panel.window_caption) 1432 # wx.EVT_MENU(self, int(item), self.on_view) 1433 # self._menubar.Append(self._window_menu, '&Window') 1427 1434 1428 1435 1429 1436 def _add_menu_application(self): 1430 1437 """ 1431 1432 1438 # Attach a menu item for each defined perspective or application. 1433 1439 # Only add the perspective menu if there are more than one perspectives … … 1484 1490 #append item from plugin under menu file if necessary 1485 1491 self._populate_file_menu() 1486 style = self.__gui_style & GUIFRAME.DATALOADER_ON1487 1492 style1 = self.__gui_style & GUIFRAME.MULTIPLE_APPLICATIONS 1488 1493 if OPEN_SAVE_MENU: … … 1560 1565 def get_style(self): 1561 1566 """ 1567 Return the gui style 1562 1568 """ 1563 1569 return self.__gui_style … … 1789 1795 def clear_panel(self): 1790 1796 """ 1797 Clear the panel 1791 1798 """ 1792 1799 for item in self.panels: … … 1893 1900 print log_msg 1894 1901 return 1895 message = ""1896 1902 log_msg = '' 1897 1903 output = {} … … 1964 1970 return PLUGINS_WLIST 1965 1971 try: 1966 # Find the extension of the perspective and get that as 1st item in list 1972 # Find the extension of the perspective 1973 # and get that as 1st item in list 1967 1974 ind = None 1968 1975 app_ext = self._current_perspective._extensions … … 1977 1984 plug_wlist.insert(0, ind) 1978 1985 try: 1979 plug_wlist = '|'.join(plug_wlist)1986 plug_wlist = '|'.join(plug_wlist) 1980 1987 except: 1981 1988 plug_wlist = '' … … 2139 2146 f=urllib2.urlopen(config.__update_URL__, 2140 2147 timeout=1.0) 2141 content =f.read()2148 content = f.read() 2142 2149 except: 2143 2150 content = "0.0.0" … … 2195 2202 """ 2196 2203 if config._do_aboutbox: 2197 import aboutbox2204 import sans.guiframe.aboutbox 2198 2205 dialog = aboutbox.DialogAbout(None, -1, "") 2199 2206 dialog.ShowModal() … … 2616 2623 dx_val = 0.0 2617 2624 if data.dxl != None: 2618 if index == 0: x_st = "Xl" 2625 if index == 0: 2626 x_st = "Xl" 2619 2627 dx_val = data.dxl[index] 2620 2628 elif data.dxw != None: 2621 if index == 0: x_st = "Xw" 2629 if index == 0: 2630 x_st = "Xw" 2622 2631 dx_val = data.dxw[index] 2623 2632
Note: See TracChangeset
for help on using the changeset viewer.