[Mumps2Py:] [153] clicking on a routine name in the list of routines now sets that routine as the current routine , and displays it.

[ Thread Index | Date Index | More lists.mumps2py.org/discuss Archives ]


Revision: 153
Author:   pgallot
Date:     2008-03-03 22:08:18 +0000 (Mon, 03 Mar 2008)

Log Message:
-----------
clicking on a routine name in the list of routines now sets that routine as the current routine, and displays it.

Modified Paths:
--------------
    trunk/mumps2py_ui.pyw


Modified: trunk/mumps2py_ui.pyw
===================================================================
--- trunk/mumps2py_ui.pyw	2008-03-03 22:04:25 UTC (rev 152)
+++ trunk/mumps2py_ui.pyw	2008-03-03 22:08:18 UTC (rev 153)
@@ -160,6 +160,33 @@
         for line in translation:
             self.after_window.insert(END, line)
 
+    def process_current_routine(self):
+        """ parse and translate the current routine"""
+        the_module = self.current_module
+        self.__display_before(the_module)
+        try:
+            mumps2py.parse_routine(the_module)
+            translation = mumps2py.translate(the_module)
+            self.__display_after(translation)
+        except mumps2py.ParseError, err:
+            self.message(err.error_msg(), "Parse Error")
+        except mumps2py.TranslationError, err:
+            self.message(err.error_msg(), "Translation Error")
+
+    def select_mod(self, mod_name):
+        """ make the selected routine the current routine"""
+        if self.modules:
+            for the_module in self.modules:
+                if the_module.mod_name == mod_name:
+                    self.current_module = the_module
+                    self.process_current_routine()
+                    return
+
+    def parsegivenmodule(self, popup):
+        """select the routine specified by the popup"""
+        popup.destroy()
+        self.select_mod(self.entry_val.get())
+        
     def list_mods(self):
         """displays an intermediate decomposition of the Mumps code"""
         if not self.modules:
@@ -167,7 +194,11 @@
 
         routinelist_window = self.info_window("routines in this file")
         for routine in self.modules:
-            routinelist_window.insert(END, str(routine) + '\n')
+            r_name = str(routine)
+            routinelist_window.tag_configure(r_name, foreground = 'blue')
+            routinelist_window.tag_bind(r_name, '<1>', lambda e, s = self, \
+                                        n = r_name: s.select_mod(n))
+            routinelist_window.insert(END, r_name + '\n', r_name)
 
     def display_decomposed(self, a_module = None):
         """displays an intermediate decomposition of the Mumps code"""
@@ -262,7 +293,6 @@
         for routine, ref in ref_list:
             rpt_window.insert(END, "%s\n%s\n\n" % (routine, str(ref)))
             
-
     def parse_fromlinemodule(self, popup):
         """parse from the module containing the line specified by popup"""
         start_line = int(self.entry_val.get())
@@ -277,24 +307,6 @@
                     self.message(err.error_msg(),
                                  "Parse Error in " + the_module.mod_name)
 
-    def parsegivenmodule(self, popup):
-        """parse the module specified by popup"""
-        mod_name = self.entry_val.get()
-        popup.destroy()
-        if self.modules:
-            for the_module in self.modules:
-                if the_module.mod_name == mod_name:
-                    self.current_module = the_module
-                    self.__display_before(the_module)
-                    try:
-                        mumps2py.parse_routine(the_module)
-                        translation = mumps2py.translate(the_module)
-                        self.__display_after(translation)
-                    except mumps2py.ParseError, err:
-                        self.message(err.error_msg(), "Parse Error")
-                    except mumps2py.TranslationError, err:
-                        self.message(err.error_msg(), "Translation Error")
-
     def parse_all(self):
         """parse all the modules in a Mumps file"""
         if self.modules and len(self.modules) > 1:


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/