[Mumps2Py:] [165] the 'parse for errors' report can now blacklist specific routines that cause ParseErrors.

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


Revision: 165
Author:   pgallot
Date:     2008-03-10 19:20:50 +0000 (Mon, 10 Mar 2008)

Log Message:
-----------
the 'parse for errors' report can now blacklist specific routines that cause ParseErrors.

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


Modified: trunk/mumps2py_ui.pyw
===================================================================
--- trunk/mumps2py_ui.pyw	2008-03-10 19:18:04 UTC (rev 164)
+++ trunk/mumps2py_ui.pyw	2008-03-10 19:20:50 UTC (rev 165)
@@ -262,6 +262,16 @@
             self.process_current_routine()
             return
 
+    def blacklist_mod(self, mod_name):
+        """blacklist the selected routine in the m2p file"""
+        extension = os.path.splitext(self.current_file)[1]
+        if extension != ".m2p":
+            self.message("blacklisting only works with an m2p file", "Sorry")
+            return
+
+        mumps2py.add_m2p_filter_out_rule(self.current_file, mod_name)
+        self.message("blacklist rule for %s created" % mod_name)
+
     def parsegivenmodule(self, popup):
         """select the routine specified by the popup"""
         popup.destroy()
@@ -444,11 +454,19 @@
             return
         
         for r_name, error in error_list:
+            blacklist = r_name + '_bl'
             rpt_window.tag_configure(r_name, foreground = 'red',
                                      font = ("Consolas", 18))
+            rpt_window.tag_configure(blacklist, foreground = 'purple',
+                                     font = ("Consolas", 12))
+
             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.tag_bind(blacklist, '<1>', lambda e, s = self, \
+                    n = r_name: s.blacklist_mod(n))
+
+            rpt_window.insert(END, r_name, r_name)
+            rpt_window.insert(END, " (blacklist)\n", blacklist)
             rpt_window.insert(END, "%s\n" % error)
 
         
@@ -564,8 +582,8 @@
 
     def file_m2p(self):
         """ creates an m2p from the current list of modules."""
-        if self.modules:
-            base_fname = self.modules[0].input_file
+        if self.current_file:
+            base_fname = self.current_file
             dlg_title = "confirm input file"
         else:
             base_fname = "./tesfiles/fm22.rsa"
@@ -588,6 +606,7 @@
                                                    )
         if m2p_fname:
             if input_fname:
+                self.current_file = m2p_fname
                 mumps2py.create_m2p_file(m2p_fname, input_fname)
                 self.message(m2p_fname + " created.")
                 


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