/[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 784 by johnpye, Sat Jul 15 07:23:50 2006 UTC revision 785 by johnpye, Wed Jul 26 14:29:09 2006 UTC
# Line 284  class Browser: Line 284  class Browser:
284          self.close_on_converged.set_active(self.prefs.getBoolPref("SolverReporter","close_on_converged",True))          self.close_on_converged.set_active(self.prefs.getBoolPref("SolverReporter","close_on_converged",True))
285          self.close_on_nonconverged=glade.get_widget("close_on_nonconverged")          self.close_on_nonconverged=glade.get_widget("close_on_nonconverged")
286          self.close_on_nonconverged.set_active(self.prefs.getBoolPref("SolverReporter","close_on_nonconverged",True))          self.close_on_nonconverged.set_active(self.prefs.getBoolPref("SolverReporter","close_on_nonconverged",True))
287            self.solver_engine=glade.get_widget("solver_engine")
288    
289          self.use_relation_sharing=glade.get_widget("use_relation_sharing")          self.use_relation_sharing=glade.get_widget("use_relation_sharing")
290          self.use_relation_sharing.set_active(self.prefs.getBoolPref("Compiler","use_relation_sharing",True))          self.use_relation_sharing.set_active(self.prefs.getBoolPref("Compiler","use_relation_sharing",True))
# Line 378  class Browser: Line 379  class Browser:
379          self.reporter = ascpy.getReporter()          self.reporter = ascpy.getReporter()
380          self.reporter.setPythonErrorCallback(self.error_callback)          self.reporter.setPythonErrorCallback(self.error_callback)
381    
382    
383            #-------
384            # Solver engine list
385    
386            _slvlist = ascpy.getSolvers()
387            self.solver_engine_menu = gtk.Menu()
388            self.solver_engine_menu.show()
389            self.solver_engine.set_submenu(self.solver_engine_menu)
390            self.solver_engine_menu_dict = {}
391            _fmi = None
392            _qrslv = None
393            for _s in _slvlist:
394                _mi = gtk.RadioMenuItem(_fmi,_s.getName(),False)
395                if _fmi==None:
396                    _fmi = _mi
397                _mi.show()
398                _mi.connect('toggled',self.on_select_solver_toggled,_s.getName())
399                self.solver_engine_menu.append(_mi)
400                self.solver_engine_menu_dict[_s.getName()]=_mi  
401            
402            _mi = self.solver_engine_menu_dict.get('CMSlv')
403            _mi.set_active(1)
404    
405          #--------          #--------
406          # Assign an icon to the main window          # Assign an icon to the main window
407    
# Line 477  class Browser: Line 501  class Browser:
501          print_loading_status("ASCEND is now running")          print_loading_status("ASCEND is now running")
502          gtk.main()          gtk.main()
503    
504    #   ------------------
505    #   SOLVER LIST
506    
507        def set_solver(self,solvername):
508            self.solver = ascpy.Solver(solvername)
509            self.reporter.reportNote("Set solver engine to '%s'" % solvername)
510    
511  #   --------------------------------------------  #   --------------------------------------------
512  #   MAJOR GUI COMMANDS  #   MAJOR GUI COMMANDS
513    
# Line 486  class Browser: Line 517  class Browser:
517      def on_free_variable_activate(self,*args):      def on_free_variable_activate(self,*args):
518          self.modelview.on_free_variable_activate(*args)          self.modelview.on_free_variable_activate(*args)
519    
520        def on_select_solver_toggled(self,widget,solvername):
521            if widget.get_active():
522                self.set_solver(solvername)
523    
524      def do_open(self,filename):      def do_open(self,filename):
525          # TODO does the user want to lose their work?          # TODO does the user want to lose their work?
526          # TODO do we need to chdir?          # TODO do we need to chdir?
# Line 591  class Browser: Line 626  class Browser:
626          print "DONE BUILDING"          print "DONE BUILDING"
627          self.stop_waiting()          self.stop_waiting()
628    
629          self.sim.setSolver(ascpy.Solver("QRSlv"))          self.sim.setSolver(self.solver)
630    
631          # methods          # methods
632          self.methodstore.clear()          self.methodstore.clear()
# Line 626  class Browser: Line 661  class Browser:
661          else:          else:
662              reporter = SimpleSolverReporter(self)              reporter = SimpleSolverReporter(self)
663    
664          self.sim.solve(ascpy.Solver("QRSlv"),reporter)          self.sim.solve(self.solver,reporter)
665    
666          self.stop_waiting()          self.stop_waiting()
667                    

Legend:
Removed from v.784  
changed lines
  Added in v.785

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