Changeset 278cc25 in sasview
- Timestamp:
- May 27, 2008 2:32:45 PM (17 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:
- 4a5de6f
- Parents:
- 14b8154
- Location:
- guiframe
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/aboutbox.py
r41d466f r278cc25 28 28 import imp 29 29 path = os.getcwd() 30 if(os.path.isfile("%s/%s.py" % (path, 'config'))): 31 fObj, path, descr = imp.find_module('config', [path]) 32 config = imp.load_module('config', fObj, path, descr) 30 if(os.path.isfile("%s/%s.py" % (path, 'local_config'))) or \ 31 (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): 32 fObj, path, descr = imp.find_module('local_config', [path]) 33 config = imp.load_module('local_config', fObj, path, descr) 34 else: 35 # Try simply importing local_config 36 import local_config as config 33 37 except: 38 # Didn't find local config, load the default 34 39 import config 35 40 -
guiframe/gui_manager.py
radfcab3 r278cc25 15 15 import imp 16 16 path = os.getcwd() 17 if(os.path.isfile("%s/%s.py" % (path, 'config'))): 17 if(os.path.isfile("%s/%s.py" % (path, 'config'))) or \ 18 (os.path.isfile("%s/%s.pyc" % (path, 'config'))): 18 19 fObj, path, descr = imp.find_module('config', [path]) 19 config = imp.load_module('config', fObj, path, descr) 20 config = imp.load_module('config', fObj, path, descr) 21 else: 22 raise RuntimeError, "Look for default config" 20 23 except: 21 24 # Didn't find local config, load the default … … 39 42 40 43 path = os.path.dirname(__file__) 41 self.SetIcon(wx.Icon(os.path.join(path,'images/ball.ico'), wx.BITMAP_TYPE_ICO)) 44 ico_file = os.path.join(path,'images/ball.ico') 45 if os.path.isfile(ico_file): 46 self.SetIcon(wx.Icon(ico_file, wx.BITMAP_TYPE_ICO)) 42 47 43 48 ## Application manager … … 58 63 self.defaultPanel = DefaultPanel(self, -1, style=wx.RAISED_BORDER) 59 64 60 # Set up the layout 61 self._setup_layout() 62 63 # Set up the menu 64 self._setup_menus() 65 66 self.Fit() 65 # self.build_gui() 67 66 68 67 # Register the close event so it calls our own method … … 71 70 self.Bind(EVT_STATUS, self._on_status_event) 72 71 72 def build_gui(self): 73 # Set up the layout 74 self._setup_layout() 75 76 # Set up the menu 77 self._setup_menus() 78 79 self.Fit() 80 73 81 def _setup_layout(self): 74 82 """ … … 86 94 87 95 self._mgr.Update() 96 97 def add_perspective(self, plugin): 98 """ 99 Add a perspective if it doesn't already 100 exist. 101 """ 102 is_loaded = False 103 for item in self.plugins: 104 if plugin.__class__==item.PLUGIN_ID.__class__: 105 print "Plugin %s already loaded" % plugin.__class__.__name__ 106 is_loaded = True 107 108 if not is_loaded: 109 self.plugins.append(plugin) 88 110 89 111 def _find_plugins(self, dir="perspectives"): … … 96 118 print "Looking for plug-ins in %s" % dir 97 119 # List of plug-in objects 120 121 #path_exe = os.getcwd() 122 #path_plugs = os.path.join(path_exe, dir) 123 f = open("load.log",'w') 124 f.write(os.getcwd()+'\n\n') 125 #f.write(str(os.listdir(dir))+'\n') 126 127 98 128 plugins = [] 99 129 # Go through files in panels directory … … 113 143 try: 114 144 if toks[1]=='': 145 f.write("trying to import \n") 115 146 mod_path = '.'.join([dir, name]) 147 f.write("mod_path= %s\n" % mod_path) 116 148 module = __import__(mod_path, globals(), locals(), [name]) 149 f.write(str(module)+'\n') 117 150 else: 118 151 (file, path, info) = imp.find_module(name, path) … … 128 161 except: 129 162 print sys.exc_value 163 f.write(str(sys.exc_value)+'\n') 130 164 finally: 131 165 if not file==None: … … 134 168 # Should raise and catch at a higher level and display error on status bar 135 169 pass 170 f.write(str(plugins)+'\n') 171 f.close() 136 172 return plugins 137 173 … … 516 552 print "Special?", self.frame.special.__class__.__name__ 517 553 self.frame.special.SetCurrent() 518 self.frame.post_init()519 554 self.SetTopWindow(self.frame) 520 555 return True … … 527 562 self.frame.set_manager(manager) 528 563 564 def build_gui(self): 565 """ 566 Build the GUI 567 """ 568 self.frame.build_gui() 569 self.frame.post_init() 570 571 def add_perspective(self, perspective): 572 """ 573 Manually add a perspective to the application GUI 574 """ 575 self.frame.add_perspective(perspective) 576 529 577 530 578 if __name__ == "__main__": -
guiframe/local_perspectives/plotting/plotting.py
r383189f9 r278cc25 52 52 ## Unique ID (from gui_manager) 53 53 self.uid = None 54 55 ## Action IDs for internal call-backs 56 self.action_ids = {} 54 57 55 58 ## Graph … … 83 86 # Check axis labels 84 87 #TODO: Should re-factor this 85 if event.plot._xunit != self.graph.prop["xunit"]:86 87 88 if event.plot._yunit != self.graph.prop["yunit"]:89 88 #if event.plot._xunit != self.graph.prop["xunit"]: 89 self.graph.xaxis(event.plot._xaxis, event.plot._xunit) 90 91 #if event.plot._yunit != self.graph.prop["yunit"]: 92 self.graph.yaxis(event.plot._yaxis, event.plot._yunit) 90 93 91 94 self.graph.render(self) … … 100 103 slicerpop = PanelMenu() 101 104 slicerpop.set_plots(self.plots) 105 106 # Option to save the data displayed 107 id = wx.NewId() 108 for plot in self.graph.plottables: 109 name = plot.name 110 slicerpop.Append(id, "&Save %s points" % name) 111 self.action_ids[str(id)] = plot 112 wx.EVT_MENU(self, id, self._onSave) 102 113 103 114 # Various plot options … … 127 138 pos = self.ScreenToClient(pos) 128 139 self.PopupMenu(slicerpop, pos) 140 141 def _onSave(self, evt): 142 """ 143 Save a data set to a text file 144 @param evt: Menu event 145 """ 146 import os 147 id = str(evt.GetId()) 148 if id in self.action_ids: 149 150 path = None 151 dlg = wx.FileDialog(self, "Choose a file", os.getcwd(), "", "*.txt", wx.SAVE) 152 if dlg.ShowModal() == wx.ID_OK: 153 path = dlg.GetPath() 154 mypath = os.path.basename(path) 155 print path 156 dlg.Destroy() 157 158 if not path == None: 159 out = open(path, 'w') 160 has_errors = True 161 if self.action_ids[id].dy==None or self.action_ids[id].dy==[]: 162 has_errors = False 163 164 # Sanity check 165 if has_errors: 166 try: 167 if len(self.action_ids[id].y) != len(self.action_ids[id].dy): 168 print "Y and dY have different lengths" 169 has_errors = False 170 except: 171 has_errors = False 172 173 if has_errors: 174 out.write("<X> <Y> <dY>\n") 175 else: 176 out.write("<X> <Y>\n") 177 178 for i in range(len(self.action_ids[id].x)): 179 if has_errors: 180 out.write("%g %g %g\n" % (self.action_ids[id].x[i], 181 self.action_ids[id].y[i], 182 self.action_ids[id].dy[i])) 183 else: 184 out.write("%g %g\n" % (self.action_ids[id].x[i], 185 self.action_ids[id].y[i])) 186 187 out.close() 188 129 189 130 190 def _onToggleScale(self, event): -
guiframe/release_notes.txt
rfa452e4 r278cc25 23 23 - Make sure that when a plottable is sent a second time for update, that we replace the lables too! 24 24 - Add help menu entry for each module 25 - Put debug info in log file, because we can't access it from a py2exe executable 26 - Allow the application to load perspectives by hand. Then the automatic loading is only 27 for additionally installed plug-ins. 28 - Fix the damned images directory folder... 25 29
Note: See TracChangeset
for help on using the changeset viewer.