Package Gnumed :: Package timelinelib :: Package wxgui :: Module framework |
[frames] | no frames]

# Source Code for Module Gnumed.timelinelib.wxgui.framework

     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  from humblewx import Controller
    20  from humblewx import SMALL_BORDER
    21  import humblewx
    22  import wx
    23
    24  from timelinelib.wxgui.utils import display_error_message
    25  from timelinelib.wxgui.utils import display_information_message
    26  from timelinelib.wxgui.utils import _set_focus_and_select
    27
    28
    29 -class Dialog(humblewx.Dialog):
    30
    31 -    def EndModalOk(self):
    32          self.EndModal(wx.ID_OK)
    33
    34 -    def DisplayErrorMessage(self, message, focus_widget=None):
    35          display_error_message(message, parent=self)
    36          if focus_widget is not None:
    37              _set_focus_and_select(focus_widget)
    38
    39 -    def DisplayInformationMessage(self, caption, message):
    40          display_information_message(caption, message, parent=self)
    41
    42
    43 -class Panel(wx.Panel, humblewx.GuiCreator):
    44
    45 -    def __init__(self, controller_class, parent, variables={}, **kwargs):
    46          wx.Panel.__init__(self, parent, **kwargs)
    47          component = self._create(controller_class, variables)
    48          if isinstance(component, wx.Sizer):
    49              self.SetSizerAndFit(component)
    50