mailr17490 - in /trunk/gui: relax_gui.py spin_viewer/frame.py uf_objects.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on September 18, 2012 - 18:15:
Author: bugman
Date: Tue Sep 18 18:15:51 2012
New Revision: 17490

URL: http://svn.gna.org/viewcvs/relax?rev=17490&view=rev
Log:
Window ordering bug fix for the user function windows launched from the spin 
viewer window.

The spin viewer window no longer hides behind the main relax window after the 
launch of the user
function.


Modified:
    trunk/gui/relax_gui.py
    trunk/gui/spin_viewer/frame.py
    trunk/gui/uf_objects.py

Modified: trunk/gui/relax_gui.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/relax_gui.py?rev=17490&r1=17489&r2=17490&view=diff
==============================================================================
--- trunk/gui/relax_gui.py (original)
+++ trunk/gui/relax_gui.py Tue Sep 18 18:15:51 2012
@@ -871,6 +871,23 @@
                 page.sync_ds(upload)
 
 
+    def uf_call(self, event=None):
+        """Catch the user function call to properly specify the parent 
window.
+
+        @keyword event: The wx event.
+        @type event:    wx event
+        """
+
+        # The user function ID.
+        uf_id = event.GetId()
+
+        # Get the user function name.
+        name = uf_store.get_uf(uf_id)
+
+        # Call the user function GUI object.
+        uf_store[name](event=event, wx_parent=self)
+
+
     def update_status_bar(self):
         """Update the status bar info."""
 

Modified: trunk/gui/spin_viewer/frame.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/spin_viewer/frame.py?rev=17490&r1=17489&r2=17490&view=diff
==============================================================================
--- trunk/gui/spin_viewer/frame.py (original)
+++ trunk/gui/spin_viewer/frame.py Tue Sep 18 18:15:51 2012
@@ -302,6 +302,23 @@
         self.bar.Realize()
 
 
+    def uf_call(self, event=None):
+        """Catch the user function call to properly specify the parent 
window.
+
+        @keyword event: The wx event.
+        @type event:    wx event
+        """
+
+        # The user function ID.
+        uf_id = event.GetId()
+
+        # Get the user function name.
+        name = uf_store.get_uf(uf_id)
+
+        # Call the user function GUI object.
+        uf_store[name](event=event, wx_parent=self)
+
+
     def update_pipes(self, event=None):
         """Update the spin view data pipe selector.
 

Modified: trunk/gui/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/uf_objects.py?rev=17490&r1=17489&r2=17490&view=diff
==============================================================================
--- trunk/gui/uf_objects.py (original)
+++ trunk/gui/uf_objects.py Tue Sep 18 18:15:51 2012
@@ -111,8 +111,7 @@
                 class_list.append(class_name)
 
             # Create the user function menu entry.
-            uf_id = wx.NewId()
-            sub_menu.AppendItem(build_menu_item(sub_menu, id=uf_id, 
text=data.menu_text, icon=fetch_icon(data.gui_icon, size='16x16')))
+            sub_menu.AppendItem(build_menu_item(sub_menu, 
id=uf_store[name]._uf_id, text=data.menu_text, icon=fetch_icon(data.gui_icon, 
size='16x16')))
 
         # No sub menu.
         else:
@@ -122,8 +121,7 @@
                 class_item = None
 
             # The menu item.
-            uf_id = wx.NewId()
-            menu.AppendItem(build_menu_item(menu, id=uf_id, 
text=data.menu_text, icon=fetch_icon(data.gui_icon, size='16x16')))
+            menu.AppendItem(build_menu_item(menu, id=uf_store[name]._uf_id, 
text=data.menu_text, icon=fetch_icon(data.gui_icon, size='16x16')))
 
         # New menu.
         if menu_index == 0 and not search(pattern, name):
@@ -131,7 +129,7 @@
             menu_index = 1
 
         # Bind the menu item to the parent.
-        parent.Bind(wx.EVT_MENU, uf_store[name], id=uf_id)
+        parent.Bind(wx.EVT_MENU, parent.uf_call, id=uf_store[name]._uf_id)
 
     # Add the very last sub menu.
     if class_item != None:
@@ -251,6 +249,9 @@
         # Initialise the wizard storage.
         self.wizard = None
 
+        # Create a unique wx ID for the user function.
+        self._uf_id = wx.NewId()
+
 
     def create_page(self, wizard=None, sync=None):
         """Create the user function wizard page GUI object.
@@ -960,3 +961,18 @@
 
         # Already instantiated, so return the instance.
         return self._instance
+
+
+    def get_uf(self, id=0):
+        """Return the name of the user function corresponding to the given 
wx ID.
+
+        @keyword id:    The unique wx ID number.
+        @type id:       int
+        @return:        The name of the user function.
+        @rtype:         str
+        """
+
+        # Loop over the elements, returning the name when a match occurs.
+        for name in self.keys():
+            if self[name]._uf_id == id:
+                return name




Related Messages


Powered by MHonArc, Updated Tue Sep 18 19:40:02 2012