mailr13862 - in /branches/gui_testing/gui: ./ analyses/ components/ user_functions/


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

Header


Content

Posted by edward on July 25, 2011 - 17:30:
Author: bugman
Date: Mon Jul 25 17:30:51 2011
New Revision: 13862

URL: http://svn.gna.org/viewcvs/relax?rev=13862&view=rev
Log:
Shifted all of the font definition into the new fonts module.


Added:
    branches/gui_testing/gui/fonts.py
Modified:
    branches/gui_testing/gui/analyses/auto_model_free.py
    branches/gui_testing/gui/analyses/base.py
    branches/gui_testing/gui/analyses/results.py
    branches/gui_testing/gui/components/grid.py
    branches/gui_testing/gui/components/relax_data.py
    branches/gui_testing/gui/components/spectrum.py
    branches/gui_testing/gui/pipe_editor.py
    branches/gui_testing/gui/relax_gui.py
    branches/gui_testing/gui/user_functions/base.py

Modified: branches/gui_testing/gui/analyses/auto_model_free.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_model_free.py?rev=13862&r1=13861&r2=13862&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/auto_model_free.py (original)
+++ branches/gui_testing/gui/analyses/auto_model_free.py Mon Jul 25 17:30:51 
2011
@@ -46,6 +46,7 @@
 from gui.components.relax_data import Relax_data_list
 from gui.controller import Redirect_text
 from gui.filedialog import opendir
+from gui.fonts import font
 from gui.message import error_message, missing_data
 from gui.misc import gui_to_int, protected_exec
 from gui import paths
@@ -245,7 +246,7 @@
         # Text.
         label_maxiter = wx.StaticText(self, -1, "Maximum interations")
         label_maxiter.SetMinSize((240, 17))
-        label_maxiter.SetFont(self.gui.font_normal)
+        label_maxiter.SetFont(font.normal)
         sizer.Add(label_maxiter, 1, 
wx.ADJUST_MINSIZE|wx.ALIGN_CENTER_VERTICAL, 0)
 
         # Spinner.
@@ -669,7 +670,7 @@
 
             # Set the properties.
             button.SetMinSize((20, 25))
-            button.SetFont(self.gui.font_button)
+            button.SetFont(font_button)
             button.SetToolTipString(text[i])
 
             # Default is on.

Modified: branches/gui_testing/gui/analyses/base.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/base.py?rev=13862&r1=13861&r2=13862&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/base.py (original)
+++ branches/gui_testing/gui/analyses/base.py Mon Jul 25 17:30:51 2011
@@ -35,6 +35,7 @@
 
 # relax GUI module imports.
 from gui import paths
+from gui.fonts import font
 from gui.misc import add_border, int_to_gui, str_to_gui
 from gui.user_functions.base import UF_page
 
@@ -117,7 +118,7 @@
 
         # The font and button properties.
         button.SetMinSize((width, height))
-        button.SetFont(self.gui.font_normal)
+        button.SetFont(font.normal)
 
         # Bind the click.
         self.gui.Bind(wx.EVT_BUTTON, fn, button)
@@ -184,7 +185,7 @@
 
         # The font and control properties.
         field.SetMinSize((width, height))
-        field.SetFont(self.gui.font_normal)
+        field.SetFont(font.normal)
 
         # Add the control to the box.
         box.Add(field, 1, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
@@ -289,7 +290,7 @@
 
         # The font and label properties.
         label.SetMinSize((width, height))
-        label.SetFont(self.gui.font_normal)
+        label.SetFont(font.normal)
 
         # Add the label to the box.
         box.Add(label, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
@@ -311,7 +312,7 @@
         label = wx.StaticText(self, -1, text)
 
         # The font properties.
-        label.SetFont(self.gui.font_subtitle)
+        label.SetFont(font.subtitle)
 
         # Add the subtitle to the box, with spacing.
         box.AddSpacer(20)
@@ -332,7 +333,7 @@
         label = wx.StaticText(self, -1, text)
 
         # The font properties.
-        label.SetFont(self.gui.font_normal)
+        label.SetFont(font.normal)
 
         # Add the text to the box, with spacing.
         box.AddSpacer(10)
@@ -365,7 +366,7 @@
 
         # The font and control properties.
         field.SetMinSize((width, height))
-        field.SetFont(self.gui.font_normal)
+        field.SetFont(font.normal)
 
         # Editable (change the colour if not).
         field.SetEditable(editable)
@@ -471,7 +472,7 @@
         label = wx.StaticText(self, -1, text)
 
         # The font properties.
-        label.SetFont(self.gui.font_title)
+        label.SetFont(font.title)
 
         # Pack the title, with spacing.
         box.AddSpacer(10)

Modified: branches/gui_testing/gui/analyses/results.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/results.py?rev=13862&r1=13861&r2=13862&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/results.py (original)
+++ branches/gui_testing/gui/analyses/results.py Mon Jul 25 17:30:51 2011
@@ -32,6 +32,7 @@
 
 # relaxGUI module imports.
 from gui.analyses.results_analysis import see_results
+from gui.fonts import font
 from gui.misc import add_border, gui_to_str, str_to_gui
 
 
@@ -129,7 +130,7 @@
         label = wx.StaticText(self, -1, "Analysis selection")
 
         # The font and label properties.
-        label.SetFont(self.gui.font_subtitle)
+        label.SetFont(font.subtitle)
 
         # Add the label to the analysis box.
         sizer.Add(label, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)

Modified: branches/gui_testing/gui/components/grid.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/components/grid.py?rev=13862&r1=13861&r2=13862&view=diff
==============================================================================
--- branches/gui_testing/gui/components/grid.py (original)
+++ branches/gui_testing/gui/components/grid.py Mon Jul 25 17:30:51 2011
@@ -36,6 +36,7 @@
 
 # relaxGUI module imports.
 from gui.filedialog import multi_openfile, opendir, openfile
+from gui.fonts import font
 from gui.message import error_message
 from gui.misc import add_border
 from gui import paths
@@ -250,7 +251,7 @@
 
         # A static box to hold all the widgets, and its sizer.
         stat_box = wx.StaticBox(self.parent, -1, "Peak lists")
-        stat_box.SetFont(self.gui.font_subtitle)
+        stat_box.SetFont(font.subtitle)
         sub_sizer = wx.StaticBoxSizer(stat_box, wx.VERTICAL)
 
         # Add the sizer to the static box and the static box to the main box.
@@ -360,8 +361,8 @@
         self.grid.SetColLabelValue(2, "No. of cycles")
 
         # Properties.
-        self.grid.SetDefaultCellFont(self.gui.font_normal)
-        self.grid.SetLabelFont(self.gui.font_normal_bold)
+        self.grid.SetDefaultCellFont(font.normal)
+        self.grid.SetLabelFont(font.normal_bold)
 
         # Text height.
         height = self.delay_time.GetSize()[1]

Modified: branches/gui_testing/gui/components/relax_data.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/components/relax_data.py?rev=13862&r1=13861&r2=13862&view=diff
==============================================================================
--- branches/gui_testing/gui/components/relax_data.py (original)
+++ branches/gui_testing/gui/components/relax_data.py Mon Jul 25 17:30:51 2011
@@ -32,6 +32,7 @@
 from status import Status; status = Status()
 
 # relax GUI module imports.
+from gui.fonts import font
 from gui.misc import add_border, float_to_gui, str_to_gui
 from gui import paths
 
@@ -78,7 +79,7 @@
 
         # A static box to hold all the widgets, and its sizer.
         stat_box = wx.StaticBox(self.panel, -1, "Relaxation data list")
-        stat_box.SetFont(self.gui.font_subtitle)
+        stat_box.SetFont(font.subtitle)
         sub_sizer = wx.StaticBoxSizer(stat_box, wx.VERTICAL)
 
         # Add the sizer to the static box and the static box to the main box.
@@ -215,8 +216,8 @@
         self.grid.SetColLabelValue(2, "Frequency (Hz)")
 
         # Properties.
-        self.grid.SetDefaultCellFont(self.gui.font_normal)
-        self.grid.SetLabelFont(self.gui.font_normal_bold)
+        self.grid.SetDefaultCellFont(font.normal)
+        self.grid.SetLabelFont(font.normal_bold)
 
         # Set the row label widths.
         self.grid.SetRowLabelSize(self.col_label_width)

Modified: branches/gui_testing/gui/components/spectrum.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/components/spectrum.py?rev=13862&r1=13861&r2=13862&view=diff
==============================================================================
--- branches/gui_testing/gui/components/spectrum.py (original)
+++ branches/gui_testing/gui/components/spectrum.py Mon Jul 25 17:30:51 2011
@@ -33,6 +33,7 @@
 from generic_fns.spectrum import replicated_flags, replicated_ids
 
 # relax GUI module imports.
+from gui.fonts import font
 from gui.misc import add_border, float_to_gui, str_to_gui
 from gui import paths
 
@@ -82,7 +83,7 @@
 
         # A static box to hold all the widgets, and its sizer.
         stat_box = wx.StaticBox(self.panel, -1, "Spectra list")
-        stat_box.SetFont(self.gui.font_subtitle)
+        stat_box.SetFont(font.subtitle)
         sub_sizer = wx.StaticBoxSizer(stat_box, wx.VERTICAL)
 
         # Add the sizer to the static box and the static box to the main box.
@@ -216,8 +217,8 @@
         self.grid.CreateGrid(1, 1)
 
         # Properties.
-        self.grid.SetDefaultCellFont(self.gui.font_normal)
-        self.grid.SetLabelFont(self.gui.font_normal_bold)
+        self.grid.SetDefaultCellFont(font.normal)
+        self.grid.SetLabelFont(font.normal_bold)
 
         # Set the row label widths.
         self.grid.SetRowLabelSize(self.col_label_width)

Added: branches/gui_testing/gui/fonts.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/fonts.py?rev=13862&view=auto
==============================================================================
--- branches/gui_testing/gui/fonts.py (added)
+++ branches/gui_testing/gui/fonts.py Mon Jul 25 17:30:51 2011
@@ -1,0 +1,53 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2011 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax.                                    
 #
+#                                                                            
 #
+# relax is free software; you can redistribute it and/or modify              
 #
+# it under the terms of the GNU General Public License as published by       
 #
+# the Free Software Foundation; either version 2 of the License, or          
 #
+# (at your option) any later version.                                        
 #
+#                                                                            
 #
+# relax is distributed in the hope that it will be useful,                   
 #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
+# GNU General Public License for more details.                               
 #
+#                                                                            
 #
+# You should have received a copy of the GNU General Public License          
 #
+# along with relax; if not, write to the Free Software                       
 #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
 #
+#                                                                            
 #
+###############################################################################
+
+# Module docstring.
+"""A standard set of font definitions for consistency throughout the GUI."""
+
+# Python module imports.
+import wx
+
+
+class Font:
+    """A storage container for the fonts."""
+
+    def setup(self):
+        """To be called by the main wx app, so that the fonts can be 
initialised correctly."""
+
+        # The fonts.
+        self.smaller =     wx.Font(6,  wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, 
"Sans")
+        self.small =       wx.Font(8,  wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, 
"Sans")
+        self.button =      wx.Font(8,  wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, 
"Sans")
+        self.normal =      wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, 
"Sans")
+        self.normal_bold = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD,   0, 
"Sans")
+        self.subtitle =    wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD,   0, 
"Sans")
+        self.font_14 =     wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, 
"Sans")
+        self.title =       wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, 
"Sans")
+
+        # Modern fixed-width fonts.
+        self.modern_8 = wx.Font(8, wx.MODERN, wx.NORMAL, wx.NORMAL, 0)
+        self.modern_10 = wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL, 0)
+
+
+
+# Initialise the class for importing.
+font = Font()

Modified: branches/gui_testing/gui/pipe_editor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/pipe_editor.py?rev=13862&r1=13861&r2=13862&view=diff
==============================================================================
--- branches/gui_testing/gui/pipe_editor.py (original)
+++ branches/gui_testing/gui/pipe_editor.py Mon Jul 25 17:30:51 2011
@@ -33,6 +33,7 @@
 
 # relax GUI module imports.
 from gui.components.menu import build_menu_item
+from gui.fonts import font
 from gui.message import question
 from gui.misc import add_border, gui_to_str, str_to_gui
 from gui.paths import icon_16x16, icon_22x22, WIZARD_IMAGE_PATH
@@ -223,8 +224,8 @@
         self.grid.SetColLabelValue(3, "Analysis tab")
 
         # Properties.
-        self.grid.SetDefaultCellFont(self.gui.font_normal)
-        self.grid.SetLabelFont(self.gui.font_normal_bold)
+        self.grid.SetDefaultCellFont(font.normal)
+        self.grid.SetLabelFont(font.normal_bold)
 
         # Set the row label widths.
         self.grid.SetRowLabelSize(self.width_col_label)

Modified: branches/gui_testing/gui/relax_gui.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/relax_gui.py?rev=13862&r1=13861&r2=13862&view=diff
==============================================================================
--- branches/gui_testing/gui/relax_gui.py (original)
+++ branches/gui_testing/gui/relax_gui.py Mon Jul 25 17:30:51 2011
@@ -54,6 +54,7 @@
 from gui.spin_viewer.frame import Spin_view_window
 from gui.controller import Controller
 from gui.filedialog import opendir, openfile, savefile
+from gui.fonts import font
 from gui.menu import Menu
 from gui.message import dir_message, error_message, question
 from gui import paths
@@ -98,7 +99,7 @@
         self.init_data()
 
         # Set up some standard interface-wide fonts.
-        self.setup_fonts()
+        font.setup()
 
         # The user function GUI elements.
         self.user_functions = User_functions(self)
@@ -350,24 +351,6 @@
             ds.relax_gui.free_file_format.reset()
 
 
-    def setup_fonts(self):
-        """Initialise a series of fonts to be used throughout the GUI."""
-
-        # The fonts.
-        self.font_smaller =     wx.Font(6,  wx.DEFAULT, wx.NORMAL, 
wx.NORMAL, 0, "Sans")
-        self.font_small =       wx.Font(8,  wx.DEFAULT, wx.NORMAL, 
wx.NORMAL, 0, "Sans")
-        self.font_button =      wx.Font(8,  wx.DEFAULT, wx.NORMAL, 
wx.NORMAL, 0, "Sans")
-        self.font_normal =      wx.Font(10, wx.DEFAULT, wx.NORMAL, 
wx.NORMAL, 0, "Sans")
-        self.font_normal_bold = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD,  
 0, "Sans")
-        self.font_subtitle =    wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD,  
 0, "Sans")
-        self.font_14 =          wx.Font(14, wx.DEFAULT, wx.NORMAL, 
wx.NORMAL, 0, "Sans")
-        self.font_title =       wx.Font(16, wx.DEFAULT, wx.NORMAL, 
wx.NORMAL, 0, "Sans")
-
-        # Modern fixed-width fonts.
-        self.font_8_modern = wx.Font(8, wx.MODERN, wx.NORMAL, wx.NORMAL, 0)
-        self.font_10_modern = wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL, 0)
-
-
     def show_controller(self, event):
         """Display the relax controller window.
 

Modified: branches/gui_testing/gui/user_functions/base.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/user_functions/base.py?rev=13862&r1=13861&r2=13862&view=diff
==============================================================================
--- branches/gui_testing/gui/user_functions/base.py (original)
+++ branches/gui_testing/gui/user_functions/base.py Mon Jul 25 17:30:51 2011
@@ -34,6 +34,7 @@
 from status import Status; status = Status()
 
 # relax GUI imports.
+from gui.fonts import font
 from gui.misc import str_to_gui
 from gui.wizard import Wiz_page
 
@@ -188,11 +189,11 @@
 
             # Format.
             if type == 'title':
-                text_elements[-1].SetFont(self.gui.font_subtitle)
+                text_elements[-1].SetFont(font.subtitle)
             elif type == 'desc':
-                text_elements[-1].SetFont(self.gui.font_normal)
+                text_elements[-1].SetFont(font.normal)
             elif type == 'table':
-                text_elements[-1].SetFont(self.gui.font_8_modern)
+                text_elements[-1].SetFont(font.modern_8)
 
             # Wrap the text.
             text_elements[-1].Wrap(self._main_size - 20)




Related Messages


Powered by MHonArc, Updated Mon Jul 25 17:40:02 2011