[Mumps2Py:] [185] added checkbox item to the File menu to control showing the ' translation pane'.

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


Revision: 185
Author:   pgallot
Date:     2008-03-26 19:22:51 +0100 (Wed, 26 Mar 2008)

Log Message:
-----------
added checkbox item to the File menu to control showing the 'translation pane'.

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


Modified: trunk/mumps2py_ui.pyw
===================================================================
--- trunk/mumps2py_ui.pyw	2008-03-22 15:09:28 UTC (rev 184)
+++ trunk/mumps2py_ui.pyw	2008-03-26 18:22:51 UTC (rev 185)
@@ -118,7 +118,6 @@
             child_widget.config(cursor = busy_cursor)
         self.root.update_idletasks()
 
-
 class Mumps2pyUI(GenericUI):
     """The class which provides the User Interface to Mumps2Py"""
     def __init__(self, my_root):
@@ -127,7 +126,8 @@
         self.modules = None
         self.before_window = None
         self.after_window = None
-        self.show_after = True
+        self.show_after = BooleanVar()
+        self.show_after.set(False)
         self.current_file = None
         self.current_module = None
         self.module_dict = {}
@@ -243,7 +243,7 @@
                 
     def __display_after(self, translation):
         """populate the after window with the translation of the Mumps module"""
-        if not self.show_after:
+        if not self.show_after.get():
             return
 
         self.after_window.delete(0.0, END)
@@ -299,7 +299,6 @@
 
         self.message("blacklist rules for %d routines created" %
                      len(the_mod_name_list))
-
         
     def parsegivenmodule(self, popup):
         """select the routine specified by the popup"""
@@ -522,7 +521,6 @@
         self.busy(False)
         self.message("%s created." % extract_fname)
 
-
     def parse_for_errors(self):
         """identify all modules that trigger a ParseError"""
         if not self.modules:
@@ -578,8 +576,7 @@
             rpt_window.insert(END, r_name, r_name)
             rpt_window.insert(END, " (blacklist)\n", blacklist)
             rpt_window.insert(END, "%s\n" % error)
-
-        
+      
     def parseuntilmodule(self, popup):
         """analyze the tokens up until the module specified by popup"""
         mod_name = self.entry_val.get()
@@ -765,6 +762,17 @@
 
             mumps2py_test.add_regression_test(test_file)
             self.message(test_file + " added.")
+
+    def and_after(self):
+        """recreate the window with or without the after window"""
+        child_list = self.root.winfo_children()
+        for child_widget in child_list:
+            if not isinstance(child_widget, Toplevel):
+                child_list.extend(child_widget.winfo_children())
+                child_widget.forget()
+        self.make_dialog()
+        self.process_current_routine()
+        self.root.update_idletasks()
     
     def make_dialog_menus(self, menu_bar):
         """Set up the User Interface's menus"""
@@ -778,6 +786,9 @@
         file_btn.menu.add_command( label = "Create m2p file", \
                                   underline = 1, \
                                   command = (lambda s = self: s.file_m2p()))
+        file_btn.menu.add_checkbutton(label = "Show Translation Pane",
+                                      variable = self.show_after,
+                                      command = lambda s = self: s.and_after())
         file_btn.menu.add_command( label = "Save",
                                    underline = 0, \
                                    command = (lambda s = self: s.file_save()))
@@ -862,7 +873,7 @@
         menu_bar.pack(fill = X)
         self.make_dialog_menus(menu_bar)
 
-        if self.show_after:
+        if self.show_after.get():
             text_width = 60
         else:
             text_width = 120
@@ -873,11 +884,12 @@
         b4_frame.pack(anchor = NW, side = LEFT, expand = YES, fill = BOTH)
         self.before_window = window1
 
-        if self.show_after:
+        if self.show_after.get():
             after_frame, window2 = self.create_scrolled_text(self.root, \
                                                             width = text_width)
 
-            after_frame.pack(anchor = NE, side = RIGHT, expand = YES, fill = BOTH)
+            after_frame.pack(anchor = NE, side = RIGHT,
+                             expand = YES, fill = BOTH)
             self.after_window = window2
 
 UI = Mumps2pyUI(ROOT)


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