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

Diff of /trunk/pygtk/gtkbrowser.py

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

revision 855 by johnpye, Mon Sep 18 15:10:48 2006 UTC revision 856 by johnpye, Thu Sep 21 12:54:43 2006 UTC
# Line 9  def print_loading_status(status,msg=None Line 9  def print_loading_status(status,msg=None
9      sys.stderr.flush()      sys.stderr.flush()
10    
11  try:  try:
12      print_loading_status("Loading PSYCO")      #print_loading_status("Loading PSYCO")
   
13      #try:      #try:
14      #   import psyco      #   import psyco
15      #   psyco.full()      #   psyco.full()
# Line 458  class Browser: Line 457  class Browser:
457          self.modelview = ModelView(self, glade)          self.modelview = ModelView(self, glade)
458    
459          #--------          #--------
460            # set up the tabs
461            self.tabs = {}
462            self.activetab = None # most recent observer tab
463    
464            #--------
465          # set the state of the 'auto' toggle          # set the state of the 'auto' toggle
466    
467          self.is_auto = self.prefs.getBoolPref("Browser","auto_solve",True)          self.is_auto = self.prefs.getBoolPref("Browser","auto_solve",True)
# Line 792  class Browser: Line 796  class Browser:
796          _db.run();          _db.run();
797    
798      def on_add_observer_click(self,*args):      def on_add_observer_click(self,*args):
         if len(self.observers) > 0:  
             self.reporter.reportError("Not supported: multiple observers")  
             return  
799          self.create_observer()          self.create_observer()
800    
801      def on_keep_observed_click(self,*args):      def on_keep_observed_click(self,*args):
802          if len(self.observers) > 1:          print "KEEPING..."
             self.reporter.reportError("Not supported: multiple observers")  
             return  
803          if len(self.observers) <= 0:          if len(self.observers) <= 0:
804              self.reporter.reportError("No observer defined!")              self.reporter.reportError("No observer defined!")
805              return              return
806          self.observers[0].do_add_row()          self.tabs[self.currentobservertab].do_add_row()
807    
808      def on_copy_observer_matrix_click(self,*args):      def on_copy_observer_matrix_click(self,*args):
809          if self.clip == None:          if self.clip == None:
810              self.clip = gtk.Clipboard()              self.clip = gtk.Clipboard()
811    
         if len(self.observers) > 1:  
             self.reporter.reportError("Not supported: multiple observers")  
             return  
812          if len(self.observers) <= 0:          if len(self.observers) <= 0:
813              self.reporter.reportError("No observer defined!")              self.reporter.reportError("No observer defined!")
814              return              return
815          self.observers[0].copy_to_clipboard(self.clip)          self.tabs[self.currentobservertab].copy_to_clipboard(self.clip)
816    
817      def on_use_relation_sharing_toggle(self,checkmenuitem,*args):      def on_use_relation_sharing_toggle(self,checkmenuitem,*args):
818          _v = checkmenuitem.get_active()          _v = checkmenuitem.get_active()
# Line 1087  class Browser: Line 1083  class Browser:
1083          _dialog = InfoDialog(self,self.window,text,title)          _dialog = InfoDialog(self,self.window,text,title)
1084          _dialog.run()          _dialog.run()
1085    
1086        def on_maintabs_switch_page(self,notebook,page,pagenum):
1087            print("Page switched to %d" % pagenum)
1088            if pagenum in self.tabs.keys():
1089                self.currentobservertab = pagenum
1090    
1091      def create_observer(self,name=None):      def create_observer(self,name=None):
1092          _xml = gtk.glade.XML(self.glade_file,"observervbox");          _xml = gtk.glade.XML(self.glade_file,"observervbox");
1093          _label = gtk.Label();          _label = gtk.Label();
# Line 1094  class Browser: Line 1095  class Browser:
1095          _obs = ObserverTab(xml=_xml, name=name, browser=self, tab=_tab)          _obs = ObserverTab(xml=_xml, name=name, browser=self, tab=_tab)
1096          _label.set_text(_obs.name)          _label.set_text(_obs.name)
1097          self.observers.append(_obs)          self.observers.append(_obs)
1098            self.tabs[_tab] = _obs
1099            self.currentobservertab = _tab
1100          return _obs          return _obs
1101            
1102      def sync_observers(self):      def sync_observers(self):
# Line 1105  class Browser: Line 1108  class Browser:
1108          return False          return False
1109    
1110      def observe(self,instance):      def observe(self,instance):
             if len(self.observers) > 1:  
                 self.reporter.reportError("Not implemented: multiple observers (currently %d observers)" %  
                     len(self.observers) )  
                 return  
1111              if len(self.observers) ==0:              if len(self.observers) ==0:
1112                  self.create_observer()                  self.create_observer()
1113              _observer = self.observers[0]              _observer = self.tabs[self.currentobservertab]
1114              _observer.add_instance(instance)              _observer.add_instance(instance)
1115    
1116  if __name__ == "__main__":  if __name__ == "__main__":

Legend:
Removed from v.855  
changed lines
  Added in v.856

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