"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gui/analyses/elements/spin_element.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.

spin_element.py  (relax-4.1.3.src.tar.bz2):spin_element.py  (relax-5.0.0.src.tar.bz2)
############################################################################### ###############################################################################
# # # #
# Copyright (C) 2009-2010 Michael Bieri # # Copyright (C) 2009-2010 Michael Bieri #
# Copyright (C) 2009-2011,2013 Edward d'Auvergne # # Copyright (C) 2009-2011,2013,2016 Edward d'Auvergne #
# # # #
# This file is part of the program relax (http://www.nmr-relax.com). # # This file is part of the program relax (http://www.nmr-relax.com). #
# # # #
# This program is free software: you can redistribute it and/or modify # # This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by # # it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or # # the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. # # (at your option) any later version. #
# # # #
# This program is distributed in the hope that it will be useful, # # This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of # # but WITHOUT ANY WARRANTY; without even the implied warranty of #
skipping to change at line 31 skipping to change at line 31
############################################################################### ###############################################################################
# Module docstring. # Module docstring.
"""Module containing the base class for all frames.""" """Module containing the base class for all frames."""
# Python module imports. # Python module imports.
import wx import wx
import wx.lib.buttons import wx.lib.buttons
# relax module imports. # relax module imports.
import dep_check
from gui.fonts import font from gui.fonts import font
class Spin_ctrl: class Spin_ctrl:
"""The analysis specific spin control.""" """The analysis specific spin control."""
def __init__(self, box, parent, text="", default=0, min=0, max=1000, tooltip =None, control=wx.SpinCtrl, width_text=200, width_button=80, spacer=0): def __init__(self, box, parent, text="", default=0, min=0, max=1000, tooltip =None, control=wx.SpinCtrl, width_text=200, width_button=80, spacer=0):
"""Create a text selection element using a spinner for the frame. """Create a text selection element using a spinner for the frame.
This consists of a horizontal layout with a static text element and a sp in control This consists of a horizontal layout with a static text element and a sp in control
skipping to change at line 79 skipping to change at line 80
self.label = wx.StaticText(parent, -1, text) self.label = wx.StaticText(parent, -1, text)
self.label.SetMinSize((width_text, -1)) self.label.SetMinSize((width_text, -1))
self.label.SetFont(font.normal) self.label.SetFont(font.normal)
sizer.Add(self.label, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) sizer.Add(self.label, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
# The size for all elements, based on this text. # The size for all elements, based on this text.
size = self.label.GetSize() size = self.label.GetSize()
size_horizontal = size[1] + 8 size_horizontal = size[1] + 8
# Spacer. # Spacer.
sizer.AddSpacer((spacer, -1)) if dep_check.wx_classic:
sizer.AddSpacer((spacer, -1))
else:
sizer.AddSpacer(spacer)
# The spin control. # The spin control.
self.control = control(parent, -1, text, min=min, max=max) self.control = control(parent, -1, text, min=min, max=max)
self.control.SetMinSize((-1, size_horizontal)) self.control.SetMinSize((-1, size_horizontal))
self.control.SetFont(font.normal) self.control.SetFont(font.normal)
sizer.Add(self.control, 1, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0 ) sizer.Add(self.control, 1, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0 )
self.control.SetValue(default) self.control.SetValue(default)
# Spacer. # Spacer.
sizer.AddSpacer((spacer, -1)) if dep_check.wx_classic:
sizer.AddSpacer((spacer, -1))
else:
sizer.AddSpacer(spacer)
# No button, so add a spacer. # No button, so add a spacer.
sizer.AddSpacer((width_button, -1)) if dep_check.wx_classic:
sizer.AddSpacer((width_button, -1))
else:
sizer.AddSpacer(width_button)
# Tooltip. # Tooltip.
if tooltip: if tooltip:
self.label.SetToolTipString(tooltip) self.label.SetToolTip(wx.ToolTip(tooltip))
self.control.SetToolTipString(tooltip) self.control.SetToolTip(wx.ToolTip(tooltip))
# Add the element to the box. # Add the element to the box.
box.Add(sizer, 0, wx.ALL|wx.EXPAND, 0) box.Add(sizer, 0, wx.ALL|wx.EXPAND, 0)
def Enable(self, enable=True): def Enable(self, enable=True):
"""Enable or disable the window for user input. """Enable or disable the window for user input.
@keyword enable: The flag specifying if the control should be enabled or disabled. @keyword enable: The flag specifying if the control should be enabled or disabled.
@type enable: bool @type enable: bool
""" """
 End of changes. 6 change blocks. 
6 lines changed or deleted 16 lines changed or added

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