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

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

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

revision 163 by johnpye, Mon Jan 2 09:57:02 2006 UTC revision 164 by johnpye, Tue Jan 3 09:54:43 2006 UTC
# Line 88  class Browser: Line 88  class Browser:
88    
89          self.maintabs = glade.get_widget("maintabs")          self.maintabs = glade.get_widget("maintabs")
90    
91            self.statusbar = glade.get_widget("statusbar")
92    
93            #-------------------
94            # waitwin
95    
96            self.waitwin = gtk.gdk.Window(self.window.window,
97                gtk.gdk.screen_width(),
98                gtk.gdk.screen_height(),
99                gtk.gdk.WINDOW_CHILD,
100                0,
101                gtk.gdk.INPUT_ONLY)
102    
103            _cursor = gtk.gdk.Cursor(gtk.gdk.WATCH)
104            self.waitwin.set_cursor(_cursor)
105    
106          #-------------------          #-------------------
107          # pixbufs to be used in the error listing          # pixbufs to be used in the error listing
108    
# Line 225  class Browser: Line 240  class Browser:
240                    
241      def run(self):      def run(self):
242          self.window.show()          self.window.show()
         gtk.threads_enter();  
243          gtk.main()          gtk.main()
         gtk.threads_leave();  
244    
245  #   --------------------------------------------  #   --------------------------------------------
246  #   MAJOR GUI COMMANDS  #   MAJOR GUI COMMANDS
# Line 237  class Browser: Line 250  class Browser:
250          # TODO does the user want to lose their work?          # TODO does the user want to lose their work?
251          # TODO do we need to chdir?          # TODO do we need to chdir?
252    
253            _context = self.statusbar.get_context_id("do_open")
254    
255          self.errorstore.clear()          self.errorstore.clear()
256    
257          self.treestore.clear()          self.treestore.clear()
258          self.otank = {}          self.otank = {}
259            
260          self.library.clear()          self.library.clear()
261    
262            self.statusbar.push(_context,"Loading '"+filename+"'")
263          self.library.load(filename)          self.library.load(filename)
264            self.statusbar.pop(_context)
265    
266          self.filename = filename          self.filename = filename
267    
# Line 267  class Browser: Line 285  class Browser:
285    
286          self.sim = None;          self.sim = None;
287          self.maintabs.set_current_page(0);          self.maintabs.set_current_page(0);
288        
289        def start_waiting(self, message):
290            self.waitcontext = self.statusbar.get_context_id("waiting")
291            self.statusbar.push(self.waitcontext,message)
292    
293            if self.waitwin:
294                self.waitwin.show()
295    
296            while gtk.events_pending():
297                gtk.main_iteration()
298            
299        def stop_waiting(self):
300            if self.waitwin:
301                self.statusbar.pop(self.waitcontext)
302                self.waitwin.hide()
303                    
304      def do_sim(self, type_object):      def do_sim(self, type_object):
305          self.sim = None;          self.sim = None;
306          # TODO: clear out old simulation first!          # TODO: clear out old simulation first!
307    
308          print "DO_SIM(%s)" % str(type_object.getName())              print "DO_SIM(%s)" % str(type_object.getName())    
309            self.start_waiting("Compiling...")
310    
311          self.sim = type_object.getSimulation(str(type_object.getName())+"_sim")          self.sim = type_object.getSimulation(str(type_object.getName())+"_sim")
312          print "...DONE 'getSimulation'"              print "...DONE 'getSimulation'"    
313            self.stop_waiting()
314    
315            self.start_waiting("Building simulation...")
316          print "BUILDING SIMULATION"          print "BUILDING SIMULATION"
317          self.sim.build();          self.sim.build()
318          print "DONE BUILDING"          print "DONE BUILDING"
319            self.stop_waiting()
320    
321          # empty things out first          # empty things out first
322          self.methodstore.clear()          self.methodstore.clear()
# Line 301  class Browser: Line 339  class Browser:
339          if not self.sim:          if not self.sim:
340              self.reporter.reportError("No model selected yet")              self.reporter.reportError("No model selected yet")
341    
342            _context = self.statusbar.get_context_id("do_solve")
343            self.statusbar.push(_context,"Solving...")
344            while gtk.events_pending():
345                gtk.main_iteration()
346    
347          self.sim.solve(ascend.Solver("QRSlv"))          self.sim.solve(ascend.Solver("QRSlv"))
348    
349            self.statusbar.pop(_context)
350          self.refreshtree()          self.refreshtree()
351    
352      def do_check(self):      def do_check(self):
# Line 713  class Browser: Line 758  class Browser:
758    
759  def test():  def test():
760      import ascend      import ascend
     gtk.threads_init();  
761      b = Browser();      b = Browser();
762      b.run()      b.run()
763    

Legend:
Removed from v.163  
changed lines
  Added in v.164

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