"Fossies" - the Fresh Open Source Software Archive  

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

text_element.py  (relax-4.1.3.src.tar.bz2):text_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 graphics import fetch_icon from graphics import fetch_icon
from gui.fonts import font from gui.fonts import font
from gui.string_conv import str_to_gui from gui.string_conv import str_to_gui
class Text_ctrl: class Text_ctrl:
"""The analysis specific text control. """The analysis specific text control.
This consists of three elements: wx.StaticText, wx.TextCtrl, and wx.Button. This consists of three elements: wx.StaticText, wx.TextCtrl, and wx.Button.
""" """
skipping to change at line 92 skipping to change at line 93
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 text input field. # The text input field.
self.field = control(parent, -1, str_to_gui(default)) self.field = control(parent, -1, str_to_gui(default))
self.field.SetMinSize((-1, size_horizontal)) self.field.SetMinSize((-1, size_horizontal))
self.field.SetFont(font.normal) self.field.SetFont(font.normal)
self.field.SetEditable(editable) self.field.SetEditable(editable)
if not editable: if not editable:
colour = parent.GetBackgroundColour() colour = parent.GetBackgroundColour()
self.field.SetOwnBackgroundColour(colour) self.field.SetOwnBackgroundColour(colour)
sizer.Add(self.field, 1, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) sizer.Add(self.field, 1, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
# Spacer. # Spacer.
sizer.AddSpacer((spacer, -1)) if dep_check.wx_classic:
sizer.AddSpacer((spacer, -1))
else:
sizer.AddSpacer(spacer)
# The button. # The button.
if button: if button:
# Function is in the control class. # Function is in the control class.
if isinstance(fn, str): if isinstance(fn, str):
# The function. # The function.
fn = getattr(field, fn) fn = getattr(field, fn)
# Add the button. # Add the button.
self.button = wx.lib.buttons.ThemedGenBitmapTextButton(parent, -1, N one, str_to_gui(button_text)) self.button = wx.lib.buttons.ThemedGenBitmapTextButton(parent, -1, N one, str_to_gui(button_text))
self.button.SetBitmapLabel(wx.Bitmap(icon, wx.BITMAP_TYPE_ANY)) self.button.SetBitmapLabel(wx.Bitmap(icon, wx.BITMAP_TYPE_ANY))
self.button.SetMinSize((width_button, size_horizontal)) self.button.SetMinSize((width_button, size_horizontal))
self.button.SetFont(font.normal) self.button.SetFont(font.normal)
parent.Bind(wx.EVT_BUTTON, fn, self.button) parent.Bind(wx.EVT_BUTTON, fn, self.button)
sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE , 0) sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE , 0)
# No button, so add a spacer. # No button, so add a spacer.
else: else:
sizer.AddSpacer((width_button, -1)) if dep_check.wx_classic:
sizer.AddSpacer((width_button, -1))
else:
sizer.AddSpacer(width_button)
# 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)
# Tooltip. # Tooltip.
if tooltip: if tooltip:
self.label.SetToolTipString(tooltip) self.label.SetToolTip(wx.ToolTip(tooltip))
self.field.SetToolTipString(tooltip) self.field.SetToolTip(wx.ToolTip(tooltip))
if button and tooltip_button: if button and tooltip_button:
self.button.SetToolTipString(tooltip_button) self.button.SetToolTip(wx.ToolTip(tooltip_button))
def Enable(self, enable=True): def Enable(self, enable=True):
"""Enable or disable the element for user input. """Enable or disable the element for user input.
@keyword enable: The flag specifying if the element should be enabled or disabled. @keyword enable: The flag specifying if the element should be enabled or disabled.
@type enable: bool @type enable: bool
""" """
# Call the control and button methods. # Call the control and button methods.
self.field.Enable(enable) self.field.Enable(enable)
 End of changes. 7 change blocks. 
7 lines changed or deleted 17 lines changed or added

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