Package Gnumed :: Package timelinelib :: Package wxgui :: Package dialogs :: Package systeminfo :: Module view
[frames] | no frames]

Source Code for Module Gnumed.timelinelib.wxgui.dialogs.systeminfo.view

  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 timelinelib.wxgui.framework import Dialog 
 20  from timelinelib.wxgui.dialogs.systeminfo.controller import SystemInfoDialogController 
 21   
 22   
23 -class SystemInfoDialog(Dialog):
24 25 """ 26 <BoxSizerVertical> 27 <FlexGridSizer name="grid" rows="0" columns="2" border="ALL" > 28 <StaticText align="ALIGN_CENTER_VERTICAL" label="$(system_version)"/> 29 <StaticText align="ALIGN_CENTER_VERTICAL" name="system_version" /> 30 <StaticText align="ALIGN_CENTER_VERTICAL" label="$(python_version)" /> 31 <StaticText align="ALIGN_CENTER_VERTICAL" name="python_version" /> 32 <StaticText align="ALIGN_CENTER_VERTICAL" label="$(wxpython_version)" /> 33 <StaticText align="ALIGN_CENTER_VERTICAL" name="wxpython_version" /> 34 <StaticText align="ALIGN_CENTER_VERTICAL" label="$(locale_setting)" /> 35 <StaticText align="ALIGN_CENTER_VERTICAL" name="locale_setting" /> 36 <StaticText align="ALIGN_CENTER_VERTICAL" label="$(date_format)" /> 37 <StaticText align="ALIGN_CENTER_VERTICAL" name="date_format" /> 38 <StaticText align="ALIGN_CENTER_VERTICAL" label="$(config_file)" /> 39 <StaticText align="ALIGN_CENTER_VERTICAL" name="config_file" /> 40 </FlexGridSizer> 41 <BoxSizerHorizontal> 42 <StretchSpacer/> 43 <DialogButtonsCloseSizer border="LEFT|RIGHT|BOTTOM" align="ALIGN_RIGHT"/> 44 </BoxSizerHorizontal> 45 </BoxSizerVertical> 46 """ 47
48 - def __init__(self, parent):
49 Dialog.__init__(self, SystemInfoDialogController, parent, { 50 "system_version": _("System version:"), 51 "python_version": _("Python version:"), 52 "wxpython_version": _("wxPython version:"), 53 "locale_setting": _("Locale setting:"), 54 "date_format": _("Locale date format:"), 55 "config_file": _("Configuration file:"), 56 }, title=_("System Information")) 57 self.controller.on_init(parent)
58
59 - def SetSystemVersion(self, value):
60 self.system_version.SetLabel(value)
61
62 - def SetPythonVersion(self, value):
63 self.python_version.SetLabel(value)
64
65 - def SetWxPythonVersion(self, value):
66 self.wxpython_version.SetLabel(value)
67
68 - def SetLocaleSetting(self, value):
69 self.locale_setting.SetLabel(value)
70
71 - def SetDateFormat(self, value):
72 self.date_format.SetLabel(value)
73
74 - def SetConfigFile(self, value):
75 self.config_file.SetLabel(value)
76 77
78 -def show_system_info_dialog(*args, **kwargs):
79 dialog = SystemInfoDialog(get_frame_window(args[0])) 80 try: 81 dialog.ShowModal() 82 finally: 83 dialog.Destroy()
84 85
86 -def get_frame_window(evt):
87 frame = get_frame_from_invoking_window(evt) 88 if frame is None: 89 frame = get_frame_from_menu_bar(evt) 90 return frame
91 92
93 -def get_frame_from_invoking_window(evt):
94 evt_object = evt.GetEventObject() 95 if hasattr(evt_object, 'InvokingWindow'): 96 return evt_object.InvokingWindow
97 98
99 -def get_frame_from_menu_bar(evt):
100 evt_object = evt.GetEventObject() 101 if hasattr(evt_object, 'MenuBar'): 102 menu_bar = evt_object.MenuBar 103 if hasattr(menu_bar, 'Parent'): 104 return menu_bar.Parent
105