mailr13017 - /1.3/gui/analyses/base.py


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

Header


Content

Posted by edward on June 14, 2011 - 19:53:
Author: bugman
Date: Tue Jun 14 19:53:10 2011
New Revision: 13017

URL: http://svn.gna.org/viewcvs/relax?rev=13017&view=rev
Log:
Added an icon to the 'Change' buttons throughout the GUI.


Modified:
    1.3/gui/analyses/base.py

Modified: 1.3/gui/analyses/base.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/base.py?rev=13017&r1=13016&r2=13017&view=diff
==============================================================================
--- 1.3/gui/analyses/base.py (original)
+++ 1.3/gui/analyses/base.py Tue Jun 14 19:53:10 2011
@@ -42,13 +42,15 @@
     width_text = 240
     width_button = 100
 
-    def add_button_open(self, box, parent, fn=None, width=-1, height=-1):
+    def add_button_open(self, box, parent, icon=paths.icon_16x16.open, 
fn=None, width=-1, height=-1):
         """Add a button for opening and changing files and directories.
 
         @param box:         The box element to pack the control into.
         @type box:          wx.BoxSizer instance
         @param parent:      The parent GUI element.
         @type parent:       wx object
+        @keyword icon:      The path of the icon to use for the button.
+        @type icon:         str
         @keyword fn:        The function or method to execute when clicking 
on the button.
         @type fn:           func
         @keyword width:     The minimum width of the control.
@@ -58,7 +60,8 @@
         """
 
         # The button.
-        button = wx.Button(parent, -1, "Change")
+        button = buttons.ThemedGenBitmapTextButton(parent, -1, None, " 
Change")
+        button.SetBitmapLabel(wx.Bitmap(icon, wx.BITMAP_TYPE_ANY))
 
         # The font and button properties.
         button.SetMinSize((width, height))
@@ -290,7 +293,7 @@
         return field
 
 
-    def add_text_sel_element(self, box, parent, text="", default="", 
control=wx.TextCtrl, fn=None, editable=True, button=False):
+    def add_text_sel_element(self, box, parent, text="", default="", 
control=wx.TextCtrl, icon=paths.icon_16x16.open, fn=None, editable=True, 
button=False):
         """Create a text selection element for the frame.
 
         This consists of a horizontal layout with a static text element, a 
text control, and an optional button.
@@ -305,10 +308,14 @@
         @type default:          str
         @keyword control:       The control class to use.
         @type control:          wx.TextCtrl derived class
+        @keyword icon:          The path of the icon to use for the button.
+        @type icon:             str
         @keyword fn:            The function or method to execute when 
clicking on the button.  If this is a string, then an equivalent function 
will be searched for in the control object.
         @type fn:               func or str
         @keyword editable:      A flag specifying if the control is editable 
or not.
         @type editable:         bool
+        @keyword button:        A flag which if True will cause a button to 
appear.
+        @type button:           bool
         @return:                The text control object.
         @rtype:                 control object
         """
@@ -340,7 +347,7 @@
                 fn = getattr(field, fn)
 
             # Add the button.
-            self.add_button_open(sizer, parent, fn=fn, 
width=self.width_button, height=size_horizontal)
+            self.add_button_open(sizer, parent, icon=icon, fn=fn, 
width=self.width_button, height=size_horizontal)
 
         # No button, so add a spacer.
         else:




Related Messages


Powered by MHonArc, Updated Tue Jun 14 20:00:01 2011