/[ascend]/trunk/pygtk/interface/properties.py
ViewVC logotype

Diff of /trunk/pygtk/interface/properties.py

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

revision 270 by johnpye, Sat Feb 4 08:00:21 2006 UTC revision 271 by johnpye, Sat Feb 4 09:08:54 2006 UTC
# Line 9  class VarPropsWin: Line 9  class VarPropsWin:
9          self.instance = instance;          self.instance = instance;
10          self.browser = browser;          self.browser = browser;
11    
         # values being edited:  
         self.lower = 0  
         self.upper = 1  
         self.nominal = 0.5  
         self.fixed = True  
         self.status = ascend.ASCXX_VAR_STATUS_UNKNOWN  
   
12          # GUI config          # GUI config
13          _xml = gtk.glade.XML(GLADE_FILE,"varpropswin")          _xml = gtk.glade.XML(GLADE_FILE,"varpropswin")
14          self.varpropswin = _xml.get_widget("varpropswin")          self.varpropswin = _xml.get_widget("varpropswin")
# Line 25  class VarPropsWin: Line 18  class VarPropsWin:
18          self.lowerentry = _xml.get_widget("lowerentry");          self.lowerentry = _xml.get_widget("lowerentry");
19          self.upperentry = _xml.get_widget("upperentry");          self.upperentry = _xml.get_widget("upperentry");
20          self.nominalentry = _xml.get_widget("nominalentry");          self.nominalentry = _xml.get_widget("nominalentry");
21                        self.fixed = _xml.get_widget("fixed");
22            self.free = _xml.get_widget("free");
23    
24          self.statusimg = _xml.get_widget("statusimg"); self.statusimg = None          self.statusimg = _xml.get_widget("statusimg"); self.statusimg = None
25    
26          self.othernamesbutton = _xml.get_widget("othernamesbutton"); self.othernamesbutton.set_label("100 other names...")          self.othernames = _xml.get_widget("othernames");
27    
28          self.fill_values()          self.fill_values()
29    
# Line 58  class VarPropsWin: Line 53  class VarPropsWin:
53          self.varname.set_text(self.browser.sim.getInstanceName(self.instance));          self.varname.set_text(self.browser.sim.getInstanceName(self.instance));
54    
55          if self.instance.isFixed():          if self.instance.isFixed():
56              pass              self.fixed.set_active(True);
57            else:
58                self.free.set_active(True);
59    
60            self.clique = self.instance.getClique()
61            print "CLIQUE:",self.clique
62    
63            if len(self.clique) > 1:
64                self.othernames.set_label("%d other names..." % len(self.clique));
65                self.othernames.set_sensitive(True)
66            else:
67                self.othernames.set_label("No other names");
68                self.othernames.set_sensitive(False)
69    
70      def apply_changes(self):      def apply_changes(self):
71          print "APPLY"          print "APPLY"
# Line 81  class VarPropsWin: Line 88  class VarPropsWin:
88                  self.color_entry(_k,"#FFBBBB");                  self.color_entry(_k,"#FFBBBB");
89                  failed = True;                  failed = True;
90                    
91            self.instance.setFixed(self.fixed.get_active())
92    
93          if failed:          if failed:
94              raise InputError("Invalid inputs are highlighted in the GUI")              raise InputError(None) # no message
95    
96          self.browser.refreshtree()          self.browser.do_solve_if_auto()
97    
98      def color_entry(self,entry,color):      def color_entry(self,entry,color):
99          entry.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))          entry.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
# Line 105  class VarPropsWin: Line 114  class VarPropsWin:
114              return True;              return True;
115          return False;          return False;
116    
117        def on_othernames_clicked(self,*args):
118            print "OTHER NAMES..."
119            s = self.instance.getClique();
120            for i in s:
121                print self.browser.sim.getInstanceName(i)
122    
123      def run(self):      def run(self):
124            self.valueentry.grab_focus()
125          _continue = True;          _continue = True;
126          while _continue:          while _continue:
127              _res = self.varpropswin.run();              _res = self.varpropswin.run();

Legend:
Removed from v.270  
changed lines
  Added in v.271

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