mailr15699 - /1.3/gui/spin_viewer/tree.py


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

Header


Content

Posted by edward on April 12, 2012 - 15:26:
Author: bugman
Date: Thu Apr 12 15:26:50 2012
New Revision: 15699

URL: http://svn.gna.org/viewcvs/relax?rev=15699&view=rev
Log:
Bug fix for the relax GUI spin viewer window.

When right clicking on nothing in the tree view, an error would occur.  Now, 
instead, a special menu
pops up with a single entry for loading spins.


Modified:
    1.3/gui/spin_viewer/tree.py

Modified: 1.3/gui/spin_viewer/tree.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/spin_viewer/tree.py?rev=15699&r1=15698&r2=15699&view=diff
==============================================================================
--- 1.3/gui/spin_viewer/tree.py (original)
+++ 1.3/gui/spin_viewer/tree.py Thu Apr 12 15:26:50 2012
@@ -152,8 +152,12 @@
         # The python data.
         self.info = self.tree.GetItemPyData(item)
 
+        # Bring up the default menu.
+        if self.info == None:
+            self.menu_default()
+
         # Bring up the root menu.
-        if self.info == 'root':
+        elif self.info == 'root':
             self.menu_root()
 
         # Bring up the molecule menu.
@@ -353,6 +357,27 @@
 
         # Return the associated python data.
         return self.tree.GetItemPyData(item)
+
+
+    def menu_default(self):
+        """The right click root menu."""
+
+        # The menu.
+        menu = wx.Menu()
+
+        # The load spins entry.
+        item = build_menu_item(menu, id=self.MENU_ROOT_LOAD_SPINS, 
text="Load spins", icon=paths.icon_16x16.spin)
+        menu.AppendItem(item)
+        if status.exec_lock.locked():
+            item.Enable(False)
+
+        # The menu actions.
+        self.Bind(wx.EVT_MENU, self.gui.spin_viewer.load_spins_wizard, 
id=self.MENU_ROOT_LOAD_SPINS)
+
+        # Show the menu.
+        if status.show_gui:
+            self.PopupMenu(menu)
+            menu.Destroy()
 
 
     def menu_molecule(self):




Related Messages


Powered by MHonArc, Updated Thu Apr 12 16:00:01 2012