Package Gnumed :: Package timelinelib :: Package wxgui :: Package components :: Package propertyeditors :: Module progresseditor |
[frames] | no frames]

# Source Code for Module Gnumed.timelinelib.wxgui.components.propertyeditors.progresseditor

     1  # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018  Rickard Lindberg, Roger Lindberg
     2  #
     3  # This file is part of Timeline.
     4  #
     5  # Timeline is free software: you can redistribute it and/or modify
     6  # it under the terms of the GNU General Public License as published by
     7  # the Free Software Foundation, either version 3 of the License, or
     8  # (at your option) any later version.
     9  #
    10  # Timeline is distributed in the hope that it will be useful,
    11  # but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  # GNU General Public License for more details.
    14  #
    15  # You should have received a copy of the GNU General Public License
    16  # along with Timeline.  If not, see <http://www.gnu.org/licenses/>.
    17
    18
    19  import wx
    20
    21  from timelinelib.wxgui.components.propertyeditors.baseeditor import BaseEditor
    22
    23
    24 -class ProgressEditorGuiCreator(wx.Panel):
    25
    26 -    def __init__(self, parent):
    27          wx.Panel.__init__(self, parent)
    28
    29 -    def create_sizer(self):
    30          return wx.GridBagSizer(vgap=10, hgap=10)
    31
    32 -    def create_controls(self):
    33          label = wx.StaticText(self, label=_("Progress %:"))
    34          self.data = self._create_color_chooser_control()
    35          return (label, self.data)
    36
    37 -    def put_controls_in_sizer(self, sizer, controls):
    38          label, spin_ctrl = controls
    39          span = wx.GBSpan(rowspan=1, colspan=1)
    40          sizer.Add(label, wx.GBPosition(row=1, col=0), span)
    41          sizer.Add(spin_ctrl, wx.GBPosition(row=1, col=1), span)
    42
    43 -    def _create_color_chooser_control(self):
    44          progress = wx.SpinCtrl(self, size=(50, -1))
    45          progress.SetRange(0, 100)
    46          return progress
    47
    48
    49 -class ProgressEditor(BaseEditor, ProgressEditorGuiCreator):
    50
    51 -    def __init__(self, parent, editor, name=""):
    52          BaseEditor.__init__(self, parent, editor)
    53          ProgressEditorGuiCreator.__init__(self, parent)
    54          self.create_gui()
    55
    56 -    def focus(self):
    57          super(ProgressEditor, self).focus()
    58          self._select_all()
    59
    60 -    def _select_all(self):
    61          self.data.SetSelection(0, -1)
    62
    63 -    def clear_data(self):
    64          self.data.SetValue(0)
    65