/[ascend]/trunk/pygtk/modelview.py
ViewVC logotype

Diff of /trunk/pygtk/modelview.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1703 by jpye, Fri Mar 30 04:45:36 2007 UTC revision 1704 by jpye, Sun Jan 6 04:54:18 2008 UTC
# Line 5  import ascpy Line 5  import ascpy
5    
6  from varentry import *  from varentry import *
7  from properties import *  from properties import *
8    from unitsdialog import *
9    
10  BROWSER_FIXED_COLOR = "#008800"  BROWSER_FIXED_COLOR = "#008800"
11  BROWSER_FREE_COLOR = "#000088"  BROWSER_FREE_COLOR = "#000088"
# Line 82  class ModelView: Line 83  class ModelView:
83          _img.set_from_file(self.browser.options.assets_dir+'/observe.png')          _img.set_from_file(self.browser.options.assets_dir+'/observe.png')
84          self.observemenuitem.set_image(_img)          self.observemenuitem.set_image(_img)
85    
86            self.unitsmenuitem = gtk.ImageMenuItem("Select _Units",True);
87            _img = gtk.Image()
88            _img.set_from_file(self.browser.options.assets_dir+'/ruler.png')
89            self.unitsmenuitem.set_image(_img)
90    
91          self.fixmenuitem.show(); self.fixmenuitem.set_sensitive(False)          self.fixmenuitem.show(); self.fixmenuitem.set_sensitive(False)
92          self.freemenuitem.show(); self.freemenuitem.set_sensitive(False)          self.freemenuitem.show(); self.freemenuitem.set_sensitive(False)
93          self.observemenuitem.show(); self.observemenuitem.set_sensitive(False)          self.observemenuitem.show(); self.observemenuitem.set_sensitive(False)
94            self.unitsmenuitem.show(); self.unitsmenuitem.set_sensitive(False)
95    
96          self.propsmenuitem.show()          self.propsmenuitem.show()
97          self.treecontext.append(self.fixmenuitem)          self.treecontext.append(self.fixmenuitem)
98          self.treecontext.append(self.freemenuitem)          self.treecontext.append(self.freemenuitem)
# Line 94  class ModelView: Line 102  class ModelView:
102          _sep = gtk.SeparatorMenuItem(); _sep.show()          _sep = gtk.SeparatorMenuItem(); _sep.show()
103          self.treecontext.append(_sep)          self.treecontext.append(_sep)
104          self.treecontext.append(self.propsmenuitem)          self.treecontext.append(self.propsmenuitem)
105            self.treecontext.append(self.unitsmenuitem)
106          self.fixmenuitem.connect("activate",self.fix_activate)          self.fixmenuitem.connect("activate",self.fix_activate)
107          self.freemenuitem.connect("activate",self.free_activate)          self.freemenuitem.connect("activate",self.free_activate)
108          self.propsmenuitem.connect("activate",self.props_activate)          self.propsmenuitem.connect("activate",self.props_activate)
109          self.observemenuitem.connect("activate",self.observe_activate)          self.observemenuitem.connect("activate",self.observe_activate)
110            self.unitsmenuitem.connect("activate",self.units_activate)
111    
112          if not self.treecontext:          if not self.treecontext:
113              raise RuntimeError("Couldn't create browsercontext")              raise RuntimeError("Couldn't create browsercontext")
# Line 321  class ModelView: Line 331  class ModelView:
331          _canpop = False;          _canpop = False;
332          # self.browser.reporter.reportError("Right click on %s" % self.otank[_path][0])          # self.browser.reporter.reportError("Right click on %s" % self.otank[_path][0])
333          _instance = self.otank[_path][1]          _instance = self.otank[_path][1]
334    
335            if _instance.isReal() and _instance.isAtom():
336                self.unitsmenuitem.set_sensitive(True)
337            else:
338                self.unitsmenuitem.set_sensitive(False)
339    
340          if _instance.getType().isRefinedSolverVar():          if _instance.getType().isRefinedSolverVar():
341              _canpop = True              _canpop = True
342              self.observemenuitem.set_sensitive(True)              self.observemenuitem.set_sensitive(True)
# Line 465  class ModelView: Line 481  class ModelView:
481              if (f and not val) or (not f and val):              if (f and not val) or (not f and val):
482                  instance.setFixed(val)                  instance.setFixed(val)
483                  self.browser.do_solve_if_auto()                  self.browser.do_solve_if_auto()
484    
485        def units_activate(self,*args):
486            model,iter = self.modelview.get_selection().get_selected()
487            typename = None
488            if iter is not None:
489                typename = model.get_value(iter,1)
490            _un = UnitsDialog(self.browser,self.browser.window,typename)
491            _un.run()
492    

Legend:
Removed from v.1703  
changed lines
  Added in v.1704

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22