1
2
3
4
5
6 import wx
7 import wx.adv
8
9
10 import gettext
11
12
13
14
15
16
18 - def __init__(self, *args, **kwds):
19
20 kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
21 wx.Dialog.__init__(self, *args, **kwds)
22 self.SetSize((600, 641))
23 self._LBL_msg = wx.StaticText(self, wx.ID_ANY, "")
24 self._TCTRL_data = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_WORDWRAP)
25 from Gnumed.wxpython.gmTextCtrl import cTextCtrl
26 self._TCTRL_text = cTextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_WORDWRAP)
27 self._CHBOX_is_already_formatted = wx.CheckBox(self, wx.ID_ANY, _("Do not reformat text"))
28 self._HCTRL_ReST = wx.adv.HyperlinkCtrl(self, wx.ID_ANY, _("Formatting help"), _("http://docutils.sourceforge.net/docs/user/rst/quickref.html"))
29 self._BTN_save = wx.Button(self, wx.ID_SAVE, "")
30 self._BTN_clear = wx.Button(self, wx.ID_CLEAR, "")
31 self._BTN_restore = wx.Button(self, wx.ID_REVERT_TO_SAVED, "")
32 self._BTN_cancel = wx.Button(self, wx.ID_CANCEL, "")
33
34 self.__set_properties()
35 self.__do_layout()
36
37 self.Bind(wx.EVT_BUTTON, self._on_save_button_pressed, self._BTN_save)
38 self.Bind(wx.EVT_BUTTON, self._on_clear_button_pressed, self._BTN_clear)
39 self.Bind(wx.EVT_BUTTON, self._on_restore_button_pressed, self._BTN_restore)
40
41
43
44 self.SetTitle(_("Generic multi line text entry dialog"))
45 self.SetSize((600, 641))
46 self._CHBOX_is_already_formatted.SetToolTip(_("This is an option for power users.\n\nGNUmed will normally check your input for parts that\nneed escaping or transforming for proper output. It will\nalso convert any ReST formatting, if possible.\n\nCheck this option if you do NOT want GNUmed to apply\nANY modifications to ANY of your input into this dialog.\n\nThis is useful when you have entered raw formatting,\nlike HTML or LaTeX, and you are confident it should be\nput into the output as-is. Note that this will also disable\nReST post-processing."))
47 self._CHBOX_is_already_formatted.Enable(False)
48 self._HCTRL_ReST.SetToolTip(_("If you are writing a letter, and the letter is processed\nby LaTeX, you can use reStructuredText markup to\nformat some aspects of your text.\n\nLists, tables, and emphasis will mainly be useful.\n\nFollow the link for details."))
49 self._BTN_restore.Enable(False)
50
51
52 - def __do_layout(self):
53
54 __szr_main = wx.BoxSizer(wx.VERTICAL)
55 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
56 __szr_options = wx.BoxSizer(wx.HORIZONTAL)
57 __szr_main.Add(self._LBL_msg, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
58 __szr_main.Add(self._TCTRL_data, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 5)
59 __szr_main.Add(self._TCTRL_text, 4, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 5)
60 __szr_options.Add(self._CHBOX_is_already_formatted, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
61 __szr_options.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
62 __szr_options.Add(self._HCTRL_ReST, 0, wx.ALIGN_CENTER_VERTICAL, 0)
63 __szr_main.Add(__szr_options, 0, wx.ALL | wx.EXPAND, 5)
64 __szr_buttons.Add(self._BTN_save, 0, wx.EXPAND, 5)
65 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
66 __szr_buttons.Add(self._BTN_clear, 0, wx.EXPAND | wx.RIGHT, 5)
67 __szr_buttons.Add(self._BTN_restore, 0, wx.EXPAND, 3)
68 __szr_buttons.Add((20, 20), 3, wx.EXPAND, 0)
69 __szr_buttons.Add(self._BTN_cancel, 0, wx.EXPAND, 3)
70 __szr_main.Add(__szr_buttons, 0, wx.ALL | wx.EXPAND, 4)
71 self.SetSizer(__szr_main)
72 self.Layout()
73 self.Centre()
74
75
77 print("Event handler '_on_save_button_pressed' not implemented!")
78 event.Skip()
79
81 print("Event handler '_on_clear_button_pressed' not implemented!")
82 event.Skip()
83
85 print("Event handler '_on_restore_button_pressed' not implemented!")
86 event.Skip()
87
88
89