"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gui/input_elements/value.py" between
relax-4.1.3.src.tar.bz2 and relax-5.0.0.src.tar.bz2

About: relax allows the study of molecular dynamics through the analysis of experimental NMR data. Organic molecules, proteins, RNA, DNA, sugars, and other biomolecules are all supported.

value.py  (relax-4.1.3.src.tar.bz2):value.py  (relax-5.0.0.src.tar.bz2)
skipping to change at line 30 skipping to change at line 30
############################################################################### ###############################################################################
# Module docstring. # Module docstring.
"""GUI element for the user input of values.""" """GUI element for the user input of values."""
# Python module imports. # Python module imports.
from copy import deepcopy from copy import deepcopy
import wx import wx
# relax module imports. # relax module imports.
import dep_check
from gui.errors import gui_raise from gui.errors import gui_raise
from gui.fonts import font from gui.fonts import font
from gui.string_conv import float_to_gui, gui_to_float, gui_to_int, gui_to_str, int_to_gui, str_to_gui from gui.string_conv import float_to_gui, gui_to_float, gui_to_int, gui_to_str, int_to_gui, str_to_gui
from lib.errors import RelaxError from lib.errors import RelaxError
class Value: class Value:
"""GUI element for the input of all types of simple Python objects. """GUI element for the input of all types of simple Python objects.
The supported Python types include: The supported Python types include:
- floats - floats
skipping to change at line 142 skipping to change at line 143
text = wx.StaticText(parent, -1, desc, style=wx.ALIGN_LEFT) text = wx.StaticText(parent, -1, desc, style=wx.ALIGN_LEFT)
text.SetFont(font.normal) text.SetFont(font.normal)
sub_sizer.Add(text, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 0) sub_sizer.Add(text, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 0)
# The divider. # The divider.
if not divider: if not divider:
raise RelaxError("The divider position has not been supplied.") raise RelaxError("The divider position has not been supplied.")
# Spacing. # Spacing.
x, y = text.GetSize() x, y = text.GetSize()
sub_sizer.AddSpacer((divider - x, 0)) if dep_check.wx_classic:
sub_sizer.AddSpacer((divider - x, 0))
else:
sub_sizer.AddSpacer(divider - x)
# Initialise the text input field. # Initialise the text input field.
if self.element_type == 'text': if self.element_type == 'text':
# Set up the text control. # Set up the text control.
self._field = wx.TextCtrl(parent, -1, '') self._field = wx.TextCtrl(parent, -1, '')
# Read only field. # Read only field.
if read_only: if read_only:
# Cannot edit. # Cannot edit.
self._field.SetEditable(False) self._field.SetEditable(False)
skipping to change at line 219 skipping to change at line 223
sizer.Add(sub_sizer, 1, wx.EXPAND|wx.ALL, 0) sizer.Add(sub_sizer, 1, wx.EXPAND|wx.ALL, 0)
# Spacing below the widget. # Spacing below the widget.
if spacer == None: if spacer == None:
sizer.AddStretchSpacer() sizer.AddStretchSpacer()
else: else:
sizer.AddSpacer(spacer) sizer.AddSpacer(spacer)
# Tooltip. # Tooltip.
if tooltip: if tooltip:
text.SetToolTipString(tooltip) text.SetToolTip(wx.ToolTip(tooltip))
self._field.SetToolTipString(tooltip) self._field.SetToolTip(wx.ToolTip(tooltip))
def Clear(self): def Clear(self):
"""Special method for clearing or resetting the GUI element.""" """Special method for clearing or resetting the GUI element."""
# Clear the value from a TextCtrl. # Clear the value from a TextCtrl.
if self.element_type == 'text': if self.element_type == 'text':
self._field.Clear() self._field.Clear()
# Clear the value from a ComboBox. # Clear the value from a ComboBox.
if self.element_type == 'combo': if self.element_type == 'combo':
 End of changes. 3 change blocks. 
3 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)