Changeset adf44c2 in sasview
- Timestamp:
- May 17, 2011 5:23:12 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:
- f843099
- Parents:
- 2c63857b
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_panel.py
r60fff67 radf44c2 49 49 PLUGINS_WLIST = config.PLUGINS_WLIST 50 50 APPLICATION_WLIST = config.APPLICATION_WLIST 51 52 PANEL_WIDTH = 235 53 PANEL_HEIGHT = 700 51 try: 52 PANEL_WIDTH = config.DATA_PANEL_WIDTH 53 PANEL_HEIGHT = config.DATA_PANEL_HEIGHT 54 except: 55 PANEL_WIDTH = 235 56 PANEL_HEIGHT = 700 54 57 CBOX_WIDTH = 140 55 58 BUTTON_WIDTH = 80 -
guiframe/gui_manager.py
r60fff67 radf44c2 17 17 import xml 18 18 19 20 # Try to find a local config 21 import imp 22 path = os.getcwd() 23 if(os.path.isfile("%s/%s.py" % (path, 'local_config'))) or \ 24 (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): 25 fObj, path_config, descr = imp.find_module('local_config', [path]) 26 try: 27 config = imp.load_module('local_config', fObj, path_config, descr) 28 except: 29 # Didn't find local config, load the default 30 import config 31 finally: 32 if fObj: 33 fObj.close() 34 else: 35 # Try simply importing local_config 36 import local_config as config 37 PATH_APP = path 38 #import compileall 39 import py_compile 40 c_name = os.path.join(path, 'custom_config.py') 41 if(os.path.isfile("%s/%s.py" % (path, 'custom_config'))): 42 py_compile.compile(file=c_name) 43 #compileall.compile_dir(dir=path, force=True, quiet=0) 44 cfObj, path_cconfig, descr = imp.find_module('custom_config', [path]) 19 45 try: 20 # Try to find a local config 21 import imp 22 path = os.getcwd() 23 if(os.path.isfile("%s/%s.py" % (path, 'local_config'))) or \ 24 (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): 25 fObj, path, descr = imp.find_module('local_config', [path]) 26 config = imp.load_module('local_config', fObj, path, descr) 27 else: 28 # Try simply importing local_config 29 import local_config as config 46 custom_config = imp.load_module('custom_config', cfObj, path_cconfig, descr) 30 47 except: 31 # Didn't find local config, load the default 32 import config 48 custom_config = None 49 finally: 50 if cfObj: 51 cfObj.close() 52 33 53 34 54 import warnings … … 56 76 APPLICATION_NAME = config.__appname__ 57 77 SPLASH_SCREEN_PATH = config.SPLASH_SCREEN_PATH 58 DEFAULT_STYLE = config.DEFAULT_STYLE 78 59 79 SPLASH_SCREEN_WIDTH = config.SPLASH_SCREEN_WIDTH 60 80 SPLASH_SCREEN_HEIGHT = config.SPLASH_SCREEN_HEIGHT 61 81 SS_MAX_DISPLAY_TIME = config.SS_MAX_DISPLAY_TIME 62 PLOPANEL_WIDTH = config.PLOPANEL_WIDTH 82 83 try: 84 DATALOADER_SHOW = custom_config.DATALOADER_SHOW 85 TOOLBAR_SHOW = custom_config.TOOLBAR_SHOW 86 FIXED_PANEL = custom_config.FIXED_PANEL 87 WELCOME_PANEL_SHOW = custom_config.WELCOME_PANEL_SHOW 88 PLOPANEL_WIDTH = custom_config.PLOPANEL_WIDTH 89 DATAPANEL_WIDTH = custom_config.DATAPANEL_WIDTH 90 GUIFRAME_WIDTH = custom_config.GUIFRAME_WIDTH 91 GUIFRAME_HEIGHT = custom_config.GUIFRAME_HEIGHT 92 DEFAULT_PERSPECTIVE = custom_config.DEFAULT_PERSPECTIVE 93 except: 94 DATALOADER_SHOW = True 95 TOOLBAR_SHOW = True 96 FIXED_PANEL = True 97 WELCOME_PANEL_SHOW = False 98 PLOPANEL_WIDTH = config.PLOPANEL_WIDTH 99 DATAPANEL_WIDTH = config.DATAPANEL_WIDTH 100 GUIFRAME_WIDTH = config.GUIFRAME_WIDTH 101 GUIFRAME_HEIGHT = config.GUIFRAME_HEIGHT 102 DEFAULT_PERSPECTIVE = None 103 104 DEFAULT_STYLE = config.DEFAULT_STYLE 105 106 107 63 108 PLOPANEL_HEIGTH = config.PLOPANEL_HEIGTH 64 GUIFRAME_WIDTH = config.GUIFRAME_WIDTH 65 GUIFRAME_HEIGHT = config.GUIFRAME_HEIGHT 66 DATAPANEL_WIDTH = 235 109 DATAPANEL_HEIGHT = config.DATAPANEL_HEIGHT 67 110 PLUGIN_STATE_EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS 68 111 extension_list = [] … … 87 130 def __init__(self, parent, title, 88 131 size=(GUIFRAME_WIDTH, GUIFRAME_HEIGHT), 89 gui_style= GUIFRAME.DEFAULT_STYLE,132 gui_style=DEFAULT_STYLE, 90 133 pos=wx.DefaultPosition): 91 134 """ … … 99 142 self._window_width, self._window_height = size 100 143 self.__gui_style = gui_style 101 102 144 # Logging info 103 145 logging.basicConfig(level=logging.DEBUG, … … 120 162 if os.path.isfile(ico_file): 121 163 self.SetIcon(wx.Icon(ico_file, wx.BITMAP_TYPE_ICO)) 122 164 self.path = PATH_APP 123 165 ## Application manager 124 166 self._input_file = None … … 193 235 self.Bind(EVT_NEW_LOAD_DATA, self.on_load_data) 194 236 195 237 self.setup_custom_conf() 238 239 def setup_custom_conf(self): 240 """ 241 Set up custom configuration if exists 242 """ 243 if custom_config == None: 244 return 245 246 if not FIXED_PANEL: 247 self.__gui_style &= (~GUIFRAME.FIXED_PANEL) 248 self.__gui_style |= GUIFRAME.FLOATING_PANEL 249 250 if not DATALOADER_SHOW: 251 self.__gui_style &= (~GUIFRAME.MANAGER_ON) 252 253 if not TOOLBAR_SHOW: 254 self.__gui_style &= (~GUIFRAME.TOOLBAR_ON) 255 256 if WELCOME_PANEL_SHOW: 257 self.__gui_style |= GUIFRAME.WELCOME_PANEL_ON 258 259 def set_custom_default_perspective(self): 260 """ 261 Set default starting perspective 262 """ 263 if custom_config == None: 264 return 265 for plugin in self.plugins: 266 try: 267 if plugin.sub_menu == DEFAULT_PERSPECTIVE: 268 269 plugin.on_perspective(event=None) 270 #self._check_applications_menu() 271 break 272 except: 273 pass 274 return 275 196 276 def on_load_data(self, event): 197 277 """ … … 300 380 self._data_panel.fill_cbox_analysis(self.plugins) 301 381 self.post_init() 302 #self.show_welcome_panel(None) 382 # Set Custom default 383 self.set_custom_default_perspective() 384 385 style = self.__gui_style & GUIFRAME.TOOLBAR_ON 386 if (style == GUIFRAME.TOOLBAR_ON) & (not self._toolbar.IsShown()): 387 self._on_toggle_toolbar() 388 389 # Set Custom deafult start page 390 welcome_style = self.__gui_style & GUIFRAME.WELCOME_PANEL_ON 391 if welcome_style == GUIFRAME.WELCOME_PANEL_ON: 392 self.show_welcome_panel(None) 393 303 394 #self.Show(True) 304 395 #self._check_update(None) … … 354 445 msg = "Plugin %s already loaded" % plugin.sub_menu 355 446 logging.info(msg) 356 is_loaded = True 447 is_loaded = True 357 448 if not is_loaded: 449 358 450 self.plugins.append(plugin) 359 451 360 452 361 453 def _get_local_plugins(self): … … 430 522 self._current_perspective = plug 431 523 plugins.append(plug) 524 432 525 msg = "Found plug-in: %s" % module.PLUGIN_ID 433 526 logging.info(msg) … … 658 751 BestSize(wx.Size(PLOPANEL_WIDTH, 659 752 PLOPANEL_HEIGTH))) 660 753 661 754 self._popup_fixed_panel(p) 662 755 … … 670 763 BestSize(wx.Size(PLOPANEL_WIDTH, 671 764 PLOPANEL_HEIGTH))) 765 672 766 self._popup_floating_panel(p) 673 767 … … 801 895 self._help_menu = wx.Menu() 802 896 style = self.__gui_style & GUIFRAME.WELCOME_PANEL_ON 803 if style == GUIFRAME.WELCOME_PANEL_ON :897 if style == GUIFRAME.WELCOME_PANEL_ON or custom_config != None: 804 898 # add the welcome panel menu item 805 899 if self.defaultPanel is not None: … … 851 945 self._toolbar_menu = self._view_menu.Append(id,'&Show Toolbar', '') 852 946 wx.EVT_MENU(self, id, self._on_toggle_toolbar) 853 self._menubar.Append(self._view_menu, '&View') 854 947 948 if custom_config != None: 949 self._view_menu.AppendSeparator() 950 id = wx.NewId() 951 preference_menu = self._view_menu.Append(id,'Startup Setting', '') 952 wx.EVT_MENU(self, id, self._on_preference_menu) 953 954 self._menubar.Append(self._view_menu, '&View') 955 956 def _on_preference_menu(self, event): 957 """ 958 Build a panel to allow to edit Mask 959 """ 960 961 from sans.guiframe.startup_configuration \ 962 import StartupConfiguration as ConfDialog 963 964 self.panel = ConfDialog(parent=self, gui=self.__gui_style) 965 #self.panel.Bind(wx.EVT_CLOSE, self._draw_masked_model) 966 self.panel.ShowModal() 967 #wx.PostEvent(self.parent, event) 968 969 def _draw_masked_model(self,event): 970 """ 971 Draw model image w/mask 972 """ 973 event.Skip() 974 975 is_valid_qrange = self._update_paramv_on_fit() 976 977 if is_valid_qrange: 978 # try re draw the model plot if it exists 979 self._draw_model() 980 self.panel.Destroy() # frame 981 self.set_npts2fit() 982 elif self.model == None: 983 self.panel.Destroy() 984 self.set_npts2fit() 985 msg= "No model is found on updating MASK in the model plot... " 986 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 987 else: 988 msg = ' Please consider your Q range, too.' 989 self.panel.ShowMessage(msg) 990 855 991 def _add_menu_window(self): 856 992 """ … … 1117 1253 self._mgr.GetPane(self.panels[id].window_name).IsShown() 1118 1254 self._mgr.GetPane(self.panels[id].window_name).Hide() 1119 #if self._toolbar != None and not self._toolbar.IsShown(): 1255 style = self.__gui_style & GUIFRAME.TOOLBAR_ON 1256 if (style == GUIFRAME.TOOLBAR_ON) & (self._toolbar.IsShown()): 1120 1257 # self._toolbar.Show(True) 1121 #self._on_toggle_toolbar()1258 self._on_toggle_toolbar() 1122 1259 1123 1260 self._mgr.Update() … … 1581 1718 :param panels: list of panels 1582 1719 """ 1583 style = self.__gui_style & GUIFRAME.TOOLBAR_ON1584 if (style == GUIFRAME.TOOLBAR_ON) & (not self._toolbar.IsShown()):1585 self._on_toggle_toolbar()1720 #style = self.__gui_style & GUIFRAME.TOOLBAR_ON 1721 #if (style == GUIFRAME.TOOLBAR_ON) & (not self._toolbar.IsShown()): 1722 # self._on_toggle_toolbar() 1586 1723 for item in self.panels: 1587 1724 # Check whether this is a sticky panel -
guiframe/gui_style.py
r5342eb8 radf44c2 19 19 WELCOME_PANEL_ON = 128 20 20 DEFAULT_STYLE = SINGLE_APPLICATION|DATALOADER_ON|PLOTTING_ON|FIXED_PANEL 21 MULTIPLE_APPLICATIONS = DEFAULT_STYLE |WELCOME_PANEL_ON21 MULTIPLE_APPLICATIONS = DEFAULT_STYLE 22 22 23 23 class GUIFRAME_ID: -
guiframe/local_perspectives/plotting/Plotter1D.py
r248b918 radf44c2 74 74 75 75 ## Default locations 76 self._default_save_location = os.getcwd() 76 self._default_save_location = os.getcwd() 77 self.size = None 77 78 ## Graph 78 79 self.graph = Graph() … … 144 145 self.canvas.set_resizing(self.resizing) 145 146 self.parent.set_schedule(True) 146 147 pos_x, pos_y = self.GetPositionTuple() 148 if pos_x != 0 and pos_y != 0: 149 self.size, _ = self.GetClientSizeTuple() 147 150 148 151 def set_resizing(self, resizing=False): -
sansview/local_config.py
r0c26793 radf44c2 58 58 PLOPANEL_WIDTH = 415 59 59 PLOPANEL_HEIGTH = 370 60 DATAPANEL_WIDTH = 235 61 DATAPANEL_HEIGHT = 700 60 62 SPLASH_SCREEN_PATH = os.path.join("images","SVwelcome_mini.png") 61 63 DEFAULT_STYLE = GUIFRAME.MULTIPLE_APPLICATIONS|GUIFRAME.MANAGER_ON\ … … 64 66 SPLASH_SCREEN_HEIGHT = 366 65 67 SS_MAX_DISPLAY_TIME = 5000 #5 sec 68 WELCOME_PANEL_SHOW = False 66 69 SetupIconFile_win = os.path.join("images", "ball.ico") 67 70 SetupIconFile_mac = os.path.join("images", "ball.icns")
Note: See TracChangeset
for help on using the changeset viewer.