[Mumps2Py:] [154] Clicking on the names of referring routines, and of routines with errors will now set the current routine to the named routine .

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


Revision: 154
Author:   pgallot
Date:     2008-03-03 23:09:35 +0000 (Mon, 03 Mar 2008)

Log Message:
-----------
Clicking on the names of referring routines, and of routines with errors will now set the current routine to the named routine.

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


Modified: trunk/mumps2py_ui.pyw
===================================================================
--- trunk/mumps2py_ui.pyw	2008-03-03 22:08:18 UTC (rev 153)
+++ trunk/mumps2py_ui.pyw	2008-03-03 23:09:35 UTC (rev 154)
@@ -259,16 +259,14 @@
         
         title = "routines referring to %s" % self.current_module.mod_name
         rpt_window = self.info_window(title)
-        ref_list = []
-        modcnt = 0
+        ref_dict = {}
         try:
             input_file = fileinput.input(self.modules[0].input_file)
-            tstart = time.time()
-            for modcnt, the_module in enumerate(self.modules):
+            for the_module in self.modules:
                 if the_module == self.current_module:
                     continue
                 entryrefs = {}
-                print the_module.mod_name
+                mod_name = the_module.mod_name
                 if the_module.tokenlist_isempty():
                     mumps2py.parse_routine(the_module, input_file)
                 for token in the_module.tokenized():
@@ -279,19 +277,26 @@
                         if ref.__dict__.has_key('routine') and \
                            isinstance(ref.routine, StringType) and \
                            ref.routine == self.current_module.mod_name:
-                            ref_list.append((the_module.mod_name, ref))
+                            ref_routines = ref_dict.get(mod_name, [])
+                            ref_routines.append(ref)
+                            ref_dict[mod_name] = ref_routines
 
                 the_module.empty_tokenlist() # keep memory usage down
         except mumps2py.ParseError, err:
             self.message(err.error_msg(),
                          "Parse Error in " + the_module.mod_name)
         finally:
-            print time.time() - tstart, "seconds to parse %d routines" % \
-                  modcnt
             fileinput.close()
 
-        for routine, ref in ref_list:
-            rpt_window.insert(END, "%s\n%s\n\n" % (routine, str(ref)))
+        routine_list = ref_dict.keys()
+        routine_list.sort()
+        for r_name in routine_list:
+            rpt_window.tag_configure(r_name, foreground = 'blue')
+            rpt_window.tag_bind(r_name, '<1>', lambda e, s = self, \
+                                n = r_name: s.select_mod(n))
+            rpt_window.insert(END, "\n%s\n" % r_name, r_name)
+            for ref in ref_dict[r_name]:
+                rpt_window.insert(END, "%s\n" % str(ref))
             
     def parse_fromlinemodule(self, popup):
         """parse from the module containing the line specified by popup"""
@@ -351,15 +356,19 @@
             fileinput.close()
 
         rpt_window = self.info_window("Errors in " + os.path.basename(f_name))
-        rpt_window.tag_configure('Fail', foreground = 'red',
-                                     font = ("Consolas", 18))
+        #rpt_window.tag_configure('Fail', foreground = 'red',
+        #                             font = ("Consolas", 18))
         if len(error_list) == 0:
             rpt_window.insert(END, "No parsing errors found.")
             return
         
-        for routine, error in error_list:
-            rpt_window.insert(END, routine + "\n", 'Fail')
-            rpt_window.insert(END, error + "\n")
+        for r_name, error in error_list:
+            rpt_window.tag_configure(r_name, foreground = 'red',
+                                     font = ("Consolas", 18))
+            rpt_window.tag_bind(r_name, '<1>', lambda e, s = self, \
+                                n = r_name: s.select_mod(n))
+            rpt_window.insert(END, r_name + '\n', r_name)
+            rpt_window.insert(END, "%s\n" % error)
 
         
     def parseuntilmodule(self, popup):


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