View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000510 | ascend | pygtk gui | public | 2011-04-15 05:14 | 2013-02-26 13:42 |
Reporter | aakash | ||||
Assigned To | aakash | ||||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Linux | OS | Ubuntu | OS Version | 10.04 LTS |
Product Version | 0.9.7 | ||||
Target Version | 0.9.9 | Fixed in Version | 0.9.8 | ||
Summary | 0000510: Greying out of unnecessary menu items and buttons. | ||||
Description | Presently, all menu items and buttons are set as sensitive, irrespective of the present state. For instance, when no model has been selected, clicking the 'solve' button would generate a warning. This patch is aimed at eliminating all such issues. With this fix, all those buttons which need a model to be loaded are set sensitive only once a model has been loaded. Similarly, if no observer is there, the “copy observer matrix” option will be disabled. Basically, at any given state, only the usable options/buttons will be active and the rest will be greyed out. | ||||
Tags | No tags attached. | ||||
|
fix510.patch (6,662 bytes)
Index: pygtk/modelview.py =================================================================== --- pygtk/modelview.py (revision 3357) +++ pygtk/modelview.py (working copy) @@ -18,6 +18,7 @@ def __init__(self,browser,glade): self.browser = browser # the parent object: the entire ASCEND browser + self.glade = glade self.notes = browser.library.getAnnotationDatabase() self.modelview = glade.get_widget("browserview") @@ -119,8 +120,10 @@ self.sim = sim self.modelstore.clear() self.otank = {} # map path -> (name,value) + self.browser.disable_menu() try: self.make( self.sim.getName(),self.sim.getModel() ) + self.browser.enable_on_model_tree_build() except Exception,e: self.browser.reporter.reportError("Error building tree: %s" % e); self.browser.maintabs.set_current_page(1); @@ -216,6 +219,8 @@ _name, _instance = self.otank[path] if _instance.isReal(): + if _instance.getValue() == newtext: + return # only real-valued things can have units _e = RealAtomEntry(_instance,newtext); @@ -344,6 +349,18 @@ nn = self.notes.getNotes(self.sim.getModel().getType(),ascpy.SymChar("inline"),_name) for n in nn: print "%s: (%s) %s" % (n.getId(),str(n.getLanguage()),n.getText()) + + self.glade.get_widget("free_variable").set_sensitive(False) + self.glade.get_widget("fix_variable").set_sensitive(False) + self.glade.get_widget("propsmenuitem").set_sensitive(False) + if _instance.isReal(): + self.unitsmenuitem.set_sensitive(True) + if _instance.getType().isRefinedSolverVar(): + self.glade.get_widget("propsmenuitem").set_sensitive(True) + if _instance.isFixed(): + self.glade.get_widget("free_variable").set_sensitive(True) + else: + self.glade.get_widget("fix_variable").set_sensitive(True) if not _contextmenu: #print "NOT DOING ANYTHING ABOUT %s" % gtk.gdk.keyval_name(event.keyval) Index: pygtk/gtkbrowser.py =================================================================== --- pygtk/gtkbrowser.py (revision 3357) +++ pygtk/gtkbrowser.py (working copy) @@ -242,9 +242,12 @@ glade = gtk.glade.XML(self.glade_file,"browserwin") + self.glade = glade self.window = glade.get_widget("browserwin") + self.disable_menu() + self.disable_on_first_run() if not self.window: raise RuntimeError("Couldn't load window from glade file") @@ -600,6 +603,8 @@ self.filename = filename # call the low-level 'load' command... self.library.load(filename) + self.disable_menu() + self.enable_on_file_open() except RuntimeError,e: self.statusbar.pop(_context) raise @@ -705,6 +710,7 @@ try: self.sim.build() + self.enable_on_sim_build() except RuntimeError,e: self.reporter.reportError("Couldn't build system: %s" % str(e)); return 1 @@ -1319,6 +1325,8 @@ self.observers.append(_obs) self.tabs[_tab] = _obs self.currentobservertab = _tab + self.glade.get_widget("copy_observer_matrix").set_sensitive(True) + self.glade.get_widget("keep_observed").set_sensitive(True) return _obs def sync_observers(self): @@ -1335,6 +1343,62 @@ _observer = self.tabs[self.currentobservertab] _observer.add_instance(instance) + def disable_menu(self): + self.glade.get_widget("free_variable").set_sensitive(False) + self.glade.get_widget("fix_variable").set_sensitive(False) + self.glade.get_widget("propsmenuitem").set_sensitive(False) + self.glade.get_widget("copy_observer_matrix").set_sensitive(False) + self.glade.get_widget("sparsity").set_sensitive(False) + self.glade.get_widget("incidencegraph").set_sensitive(False) + self.glade.get_widget("diagnose_blocks").set_sensitive(False) + self.glade.get_widget("show_fixed_vars").set_sensitive(False) + self.glade.get_widget("show_freeable_vars").set_sensitive(False) + self.glade.get_widget("show_fixable_variables").set_sensitive(False) + self.glade.get_widget("show_variables_near_bounds").set_sensitive(False) + self.glade.get_widget("show_vars_far_from_nominals1").set_sensitive(False) + self.glade.get_widget("checkbutton").set_sensitive(False) + self.glade.get_widget("solvebutton").set_sensitive(False) + self.glade.get_widget("integratebutton").set_sensitive(False) + self.glade.get_widget("methodrunbutton").set_sensitive(False) + self.glade.get_widget("repaint_tree").set_sensitive(False) + self.glade.get_widget("check1").set_sensitive(False) + self.glade.get_widget("solve1").set_sensitive(False) + self.glade.get_widget("integrate1").set_sensitive(False) + self.glade.get_widget("units").set_sensitive(False) + self.glade.get_widget("add_observer").set_sensitive(False) + self.glade.get_widget("keep_observed").set_sensitive(False) + self.glade.get_widget("preferences").set_sensitive(False) + def enable_on_sim_build(self): + self.glade.get_widget("sparsity").set_sensitive(True) + self.glade.get_widget("incidencegraph").set_sensitive(True) + self.glade.get_widget("diagnose_blocks").set_sensitive(True) + self.glade.get_widget("show_fixed_vars").set_sensitive(True) + self.glade.get_widget("show_freeable_vars").set_sensitive(True) + self.glade.get_widget("show_fixable_variables").set_sensitive(True) + self.glade.get_widget("show_variables_near_bounds").set_sensitive(True) + self.glade.get_widget("show_vars_far_from_nominals1").set_sensitive(True) + def disable_on_first_run(self): + self.glade.get_widget("reloadbutton").set_sensitive(False) + self.glade.get_widget("reload").set_sensitive(False) + self.glade.get_widget("show_external_functions").set_sensitive(False) + self.glade.get_widget("notes_view").set_sensitive(False) + def enable_on_file_open(self): + self.glade.get_widget("reloadbutton").set_sensitive(True) + self.glade.get_widget("reload").set_sensitive(True) + self.glade.get_widget("show_external_functions").set_sensitive(True) + self.glade.get_widget("notes_view").set_sensitive(True) + def enable_on_model_tree_build(self): + self.glade.get_widget("repaint_tree").set_sensitive(True) + self.glade.get_widget("checkbutton").set_sensitive(True) + self.glade.get_widget("solvebutton").set_sensitive(True) + self.glade.get_widget("integratebutton").set_sensitive(True) + self.glade.get_widget("methodrunbutton").set_sensitive(True) + self.glade.get_widget("check1").set_sensitive(True) + self.glade.get_widget("solve1").set_sensitive(True) + self.glade.get_widget("integrate1").set_sensitive(True) + self.glade.get_widget("units").set_sensitive(True) + self.glade.get_widget("add_observer").set_sensitive(True) + self.glade.get_widget("preferences").set_sensitive(True) if __name__ == "__main__": b = Browser(); b.run() |
|
|
|
|
|
will need to be merged to trunk |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-04-15 05:14 | aakash | New Issue | |
2011-04-15 05:14 | aakash | File Added: fix510.patch | |
2011-04-15 05:19 | aakash | File Added: 2463osy.png | |
2011-04-15 05:19 | aakash | File Added: 2eycpso.png | |
2011-06-09 18:03 | svn | ||
2011-06-09 18:57 | svn | ||
2011-06-09 18:57 | svn | Status | new => resolved |
2011-06-09 18:57 | svn | Resolution | open => fixed |
2011-08-09 23:08 | john | Assigned To | => aakash |
2011-08-09 23:08 | john | Status | resolved => assigned |
2011-08-09 23:09 | john | Note Added: 0000754 | |
2011-08-09 23:09 | john | Status | assigned => resolved |
2011-08-09 23:09 | john | Fixed in Version | => 0.9.8 |
2013-02-26 13:42 | john | Target Version | => 0.9.9 |