mailr26552 - /trunk/gui/spin_viewer/frame.py


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

Header


Content

Posted by edward on November 12, 2014 - 18:14:
Author: bugman
Date: Wed Nov 12 18:14:37 2014
New Revision: 26552

URL: http://svn.gna.org/viewcvs/relax?rev=26552&view=rev
Log:
Shifted the spin viewer GUI window toolbar button wx IDs to the module 
namespace.

This should conserve wx IDs as the window is created and destroyed, as only 2 
IDs will be taken from
the small pool for the entire lifetime of the program.


Modified:
    trunk/gui/spin_viewer/frame.py

Modified: trunk/gui/spin_viewer/frame.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/spin_viewer/frame.py?rev=26552&r1=26551&r2=26552&view=diff
==============================================================================
--- trunk/gui/spin_viewer/frame.py      (original)
+++ trunk/gui/spin_viewer/frame.py      Wed Nov 12 18:14:37 2014
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2010-2013 Edward d'Auvergne                                  
 #
+# Copyright (C) 2010-2014 Edward d'Auvergne                                  
 #
 # Copyright (C) 2013-2014 Troels E. Linnet                                   
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
@@ -39,6 +39,12 @@
 from status import Status; status = Status()
 
 
+# wx IDs for the toolbar.
+TB_SPIN_LOADER_ID = wx.NewId()
+TB_REFRESH = wx.NewId()
+
+
+
 class Spin_view_window(wx.Frame):
     """A window element for the tree view."""
 
@@ -97,7 +103,7 @@
                 wx.CallAfter(item.Enable, enable)
 
         # The spin loader.
-        wx.CallAfter(self.bar.EnableTool, self.spin_loader_id, enable)
+        wx.CallAfter(self.bar.EnableTool, TB_SPIN_LOADER_ID, enable)
 
         # The pipe selector.
         wx.CallAfter(self.pipe_name.Enable, enable)
@@ -276,19 +282,17 @@
         self.bar = self.CreateToolBar(wx.TB_HORIZONTAL|wx.TB_FLAT|wx.TB_TEXT)
 
         # The spin loading button.
-        self.spin_loader_id = wx.NewId()
         tooltip = "Load spins from either a sequence file or from a 3D 
structure file."
-        self.bar.AddLabelTool(self.spin_loader_id, "Load spins", 
wx.Bitmap(fetch_icon('relax.spin', '32x32'), wx.BITMAP_TYPE_ANY), 
bmpDisabled=wx.Bitmap(fetch_icon('relax.spin_grey', '32x32'), 
wx.BITMAP_TYPE_ANY), shortHelp=tooltip, longHelp=tooltip)
-        self.Bind(wx.EVT_TOOL, self.load_spins_wizard, 
id=self.spin_loader_id)
+        self.bar.AddLabelTool(TB_SPIN_LOADER_ID, "Load spins", 
wx.Bitmap(fetch_icon('relax.spin', '32x32'), wx.BITMAP_TYPE_ANY), 
bmpDisabled=wx.Bitmap(fetch_icon('relax.spin_grey', '32x32'), 
wx.BITMAP_TYPE_ANY), shortHelp=tooltip, longHelp=tooltip)
+        self.Bind(wx.EVT_TOOL, self.load_spins_wizard, id=TB_SPIN_LOADER_ID)
 
         # A separator.
         self.bar.AddSeparator()
 
         # The refresh button.
-        id = wx.NewId()
         tooltip = "Refresh the spin view."
-        self.bar.AddLabelTool(id, "Refresh", 
wx.Bitmap(fetch_icon('oxygen.actions.view-refresh', '32x32'), 
wx.BITMAP_TYPE_ANY), shortHelp=tooltip, longHelp=tooltip)
-        self.Bind(wx.EVT_TOOL, self.refresh, id=id)
+        self.bar.AddLabelTool(TB_REFRESH, "Refresh", 
wx.Bitmap(fetch_icon('oxygen.actions.view-refresh', '32x32'), 
wx.BITMAP_TYPE_ANY), shortHelp=tooltip, longHelp=tooltip)
+        self.Bind(wx.EVT_TOOL, self.refresh, id=TB_REFRESH)
 
         # A separator.
         self.bar.AddSeparator()




Related Messages


Powered by MHonArc, Updated Wed Nov 12 18:20:02 2014