Changeset 9466f2d6 in sasview for sansview/perspectives/fitting
- Timestamp:
- Mar 29, 2011 11:08:55 AM (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:
- 29ef718
- Parents:
- 852354c8
- Location:
- sansview/perspectives/fitting
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r66ff250 r9466f2d6 1818 1818 Fill panel's combo box according to the type of model selected 1819 1819 """ 1820 self.model_list_box = self.parent.update_model_list()1821 1820 if self.shape_rbutton.GetValue(): 1822 1821 ##fill the combobox with form factor list -
sansview/perspectives/fitting/fitpage.py
r9a22655 r9466f2d6 50 50 self._set_bookmark_flag(False) 51 51 self._set_save_flag(False) 52 52 53 54 53 55 def _on_fit_complete(self): 54 56 """ … … 532 534 self.initialize_combox() 533 535 wx.EVT_COMBOBOX(self.formfactorbox, -1, self._on_select_model) 536 534 537 wx.EVT_COMBOBOX(self.structurebox, -1, self._on_select_model) 535 538 wx.EVT_COMBOBOX(self.multifactorbox, -1, self._on_select_model) … … 997 1000 call back for model selection 998 1001 """ 999 if self.plugin_rbutton.GetValue(): 1000 self._show_combox_helper() 1001 print "went here" 1002 1002 1003 1003 1004 self._on_select_model_helper() … … 1059 1060 event = PageInfoEvent(page = self) 1060 1061 wx.PostEvent(self.parent, event) 1062 #update list of plugins if new plugin is available 1063 if self.plugin_rbutton.GetValue(): 1064 temp = self.parent.update_model_list() 1065 if temp: 1066 self.model_list_box = temp 1067 current_val = self.formfactorbox.GetValue() 1068 pos = self.formfactorbox.GetSelection() 1069 self._show_combox_helper() 1070 self.formfactorbox.SetSelection(pos) 1071 self.formfactorbox.SetValue(current_val) 1061 1072 self.SetupScrolling() 1073 1062 1074 1063 1075 def _onparamEnter(self,event): -
sansview/perspectives/fitting/fitpanel.py
r66ff250 r9466f2d6 78 78 """ 79 79 """ 80 self.model_list_box = self.menu_mng.update() 81 return self.model_list_box 80 temp = self.menu_mng.update() 81 if len(temp): 82 self.model_list_box = temp 83 return temp 82 84 83 85 -
sansview/perspectives/fitting/fitting.py
r58e0c83 r9466f2d6 69 69 self.calc_1D = None 70 70 self.fit_thread_list = {} 71 71 self.fit_panel = None 72 72 # Start with a good default 73 73 self.elapsed = 0.022 -
sansview/perspectives/fitting/models.py
r9a22655 r9466f2d6 3 3 import wx.lib.newevent 4 4 import imp 5 import os,sys,math 5 import os 6 import sys 7 import math 6 8 import os.path 7 8 (ModelEvent, EVT_MODEL) = wx.lib.newevent.NewEvent()9 from sans.guiframe.events import StatusEvent10 9 # Time is needed by the log method 11 10 import time 12 11 12 from sans.guiframe.events import StatusEvent 13 13 # Explicitly import from the pluginmodel module so that py2exe 14 14 # places it in the distribution. The Model1DPlugin class is used 15 15 # as the base class of plug-in models. 16 16 from sans.models.pluginmodel import Model1DPlugin 17 17 18 PLUGIN_DIR = 'plugins' 19 18 20 def log(message): 19 21 """ … … 23 25 out.close() 24 26 25 def findModels(): 26 """ 27 """ 28 log("looking for models in: %s/plugins" % os.getcwd()) 29 if os.path.isdir('plugins'): 30 return _findModels('plugins') 31 return [] 32 27 33 28 def _check_plugin(model, name): 34 29 """ … … 82 77 try: 83 78 list = os.listdir(dir) 84 #always recompile the folder plugin85 import compileall86 compileall.compile_dir(dir, force=1)87 79 for item in list: 88 80 toks = os.path.splitext(os.path.basename(item)) … … 166 158 ## Event owner (guiframe) 167 159 event_owner = None 160 last_time_dir_modified = 0 161 168 162 def __init__(self): 169 163 """ … … 172 166 self._getModelList() 173 167 168 def findModels(self): 169 """ 170 find plugin model in directory of plugin .recompile all file 171 in the directory if file were modified 172 """ 173 if self.is_changed(): 174 #always recompile the folder plugin 175 import compileall 176 compileall.compile_dir(dir=PLUGIN_DIR, force=1) 177 log("looking for models in: %s/plugins" % os.getcwd()) 178 return _findModels(PLUGIN_DIR) 179 return {} 180 181 174 182 def _getModelList(self): 175 183 """ … … 392 400 393 401 #Looking for plugins 394 self.stored_plugins = findModels()402 self.stored_plugins = self.findModels() 395 403 self.plugins = self.stored_plugins.values() 396 404 self.plugins.append(ReflectivityModel) … … 400 408 return 0 401 409 410 def is_changed(self): 411 """ 412 check the last time the plugin dir has changed and return true 413 is the directory was modified else return false 414 """ 415 is_modified = False 416 if os.path.isdir(PLUGIN_DIR): 417 temp = os.path.getmtime(PLUGIN_DIR) 418 if self.last_time_dir_modified != temp: 419 is_modified = True 420 self.last_time_dir_modified = temp 421 return is_modified 402 422 403 423 def update(self): 404 424 """ 405 """ 406 new_plugins = findModels() 407 for name, plug in new_plugins.iteritems(): 408 if name not in self.stored_plugins.keys(): 409 self.stored_plugins[name] = plug 410 self.plugins.append(plug) 411 self.model_combobox.set_list("Customized Models", self.plugins) 412 return self.model_combobox.get_list() 425 return a dictionary of model if 426 new models were added else return empty dictionary 427 """ 428 new_plugins = self.findModels() 429 if len(new_plugins) > 0: 430 for name, plug in new_plugins.iteritems(): 431 if name not in self.stored_plugins.keys(): 432 self.stored_plugins[name] = plug 433 self.plugins.append(plug) 434 self.model_combobox.set_list("Customized Models", self.plugins) 435 return self.model_combobox.get_list() 436 else: 437 return {} 413 438 414 439 def populate_menu(self, modelmenu, event_owner):
Note: See TracChangeset
for help on using the changeset viewer.