2
# -*- coding: utf-8 -*-
4
# LORZE erasandcad, a 2D CAD with an intuitive user interface, simple and easy.
5
# http://erasand.jimdo.com/python-programme/lorze/
6
# (C) 2012, Andreas Ulrich
8
# This file is part of “LORZE erasandcad“
10
# “LORZE erasandcad“ is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
12
# “LORZE erasandcad“ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License along with LORZE erasandcad. If not, see <http://www.gnu.org/licenses/>.
17
import wx.html as html
19
# name for translations texts
23
class LorzeHelp(wx.Dialog):
26
def __init__(self, parent, options):
30
# LorzeOptions() of parent class
31
self.__options= options
33
# get settings for dialog from options
34
dlgborder= self.__options.GetDlgBorder()
35
wdlg, hdlg= self.DialogueSize()
38
wx.Dialog.__init__(self, self.__parent, wx.ID_ANY, _(u'LORZE erasandcad HELP'), size= (wdlg, hdlg), style= wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
41
htmlhelp= html.HtmlWindow(self, wx.ID_ANY, style=wx.NO_BORDER)
44
wxlang= locale.getdefaultlocale()
47
htmlhelp.LoadFile('../Documentation/HTML/DE_hilfe.html')
49
htmlhelp.LoadPage('../Documentation/HTML/EN_help.html')
52
buttonok= wx.Button(self, label= _(u'OK'))
55
buttonok.Bind(wx.EVT_BUTTON, self.OnExit)
56
self.Bind(wx.EVT_CLOSE, self.OnDialogueClose)
59
vbox= wx.BoxSizer(wx.VERTICAL)
60
vbox.Add(htmlhelp, 2, wx.EXPAND|wx.ALL, dlgborder)
61
vbox.Add(buttonok, 0, wx.ALIGN_RIGHT|wx.ALL, dlgborder)
67
def DialogueSize(self):
68
wdlg, hdlg= self.__options.GetDlgHelpSize()
70
# get size from parent
71
wparent, hparent= self.__parent.GetSize()
75
# correct height to parent size
79
# correct width to parent size
85
def OnDialogueClose(self, event):
86
# last commando before close the dialogue, read dialogue size
87
wdlg, hdlg= self.GetSize()
89
# set sizes to options
90
self.__options.SetDlgHelpSize(wdlg, hdlg)
95
def OnExit(self, event):
99
class TestFrame(wx.Frame):
102
wx.Frame.__init__(self, None, title= u'Test Dialog Load/ Save Object')
104
self.__options= LorzeOptions()
106
buttontest= wx.Button(self, label= u'Help')
107
buttonexit= wx.Button(self, label= u'Exit')
108
buttontest.Bind(wx.EVT_BUTTON, self.OnTest)
109
buttonexit.Bind(wx.EVT_BUTTON, self.OnExit)
111
vbox= wx.BoxSizer(wx.VERTICAL)
120
def OnTest(self, event):
121
dlg= LorzeHelp(self, self.__options)
126
def OnExit(self, event):
130
if __name__== '__main__':
131
from lrzoptions import LorzeOptions
135
# internationalization
137
wxloc.AddCatalogLookupPathPrefix('./in18')
138
# get system language ('xx_XX', 'CHARSET')
139
wxlang= locale.getdefaultlocale()
140
wxlang= wxlang[0][:2]
141
# select translations
143
wxloc.AddCatalog('lorze_de')