1
2
3
4
5 import wx
6
7
8
9
10
11
12 -class wxgTextExpansionEditAreaPnl(wx.ScrolledWindow):
13 - def __init__(self, *args, **kwds):
14
15 kwds["style"] = wx.NO_BORDER | wx.TAB_TRAVERSAL
16 wx.ScrolledWindow.__init__(self, *args, **kwds)
17 self._TCTRL_keyword = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
18 self._LBL_data = wx.StaticText(self, -1, _("File"))
19 self._BTN_select_data_file = wx.Button(self, -1, _("Se&lect"), style=wx.BU_EXACTFIT)
20 self._TCTRL_data_file = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
21 self._CHBOX_is_encrypted = wx.CheckBox(self, -1, _("Encrypted"))
22 self._LBL_text = wx.StaticText(self, -1, _("Text"))
23 self._TCTRL_expansion = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
24 self._RBTN_private = wx.RadioButton(self, -1, _("&Me only"), style=wx.RB_GROUP)
25 self._RBTN_public = wx.RadioButton(self, -1, _("&All users"))
26
27 self.__set_properties()
28 self.__do_layout()
29
30 self.Bind(wx.EVT_BUTTON, self._on_select_data_file_button_pressed, self._BTN_select_data_file)
31
32
34
35 self.SetScrollRate(10, 10)
36 self._TCTRL_keyword.SetToolTipString(_("The keyword you want to trigger this text expansion.\n\nTry to avoid words or abbreviations in their day-to-day form as you may want to use them verbatim. Rather prefix or suffix your keywords with, say, \"*\" or \"$\". It is wise to not suffix keywords with typical word separators, such as:\n\n ! ? . , : ; ) ] } / ' \" SPACE TAB LINEBREAK\n\nas those are needed to detect when to trigger keyword expansion."))
37 self._LBL_data.SetForegroundColour(wx.Colour(255, 127, 0))
38 self._BTN_select_data_file.SetToolTipString(_("Select a file from which to load the binary data."))
39 self._BTN_select_data_file.Enable(False)
40 self._TCTRL_data_file.SetToolTipString(_("File from which to load the binary data."))
41 self._TCTRL_data_file.Enable(False)
42 self._CHBOX_is_encrypted.SetToolTipString(_("Check this if the data file is encrypted and needs decryption before use."))
43 self._CHBOX_is_encrypted.Enable(False)
44 self._LBL_text.SetForegroundColour(wx.Colour(255, 127, 0))
45 self._TCTRL_expansion.SetToolTipString(_("This is the text the keyword will expand to. You can use any text-based punctuation and formatting.\n\nAny $[HINT]$ will make GNUmed prompt the user for input while displaying HINT for guidance."))
46 self._TCTRL_expansion.Enable(False)
47 self._RBTN_private.SetToolTipString(_("Select this if you want to use this text expansion just for yourself."))
48 self._RBTN_private.Enable(False)
49 self._RBTN_public.SetToolTipString(_("Select this if you want to enable all GNUmed users to invoke this expansion (unless they have defined their own expansion with the same keyword)."))
50 self._RBTN_public.Enable(False)
51 self._RBTN_public.SetValue(1)
52
53
54 - def __do_layout(self):
55
56 _gszr_main = wx.FlexGridSizer(5, 2, 1, 3)
57 __szr_scope = wx.BoxSizer(wx.HORIZONTAL)
58 __szr_file = wx.BoxSizer(wx.HORIZONTAL)
59 __lbl_keyword = wx.StaticText(self, -1, _("Keyword"))
60 __lbl_keyword.SetForegroundColour(wx.Colour(255, 0, 0))
61 _gszr_main.Add(__lbl_keyword, 0, wx.ALIGN_CENTER_VERTICAL, 0)
62 _gszr_main.Add(self._TCTRL_keyword, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
63 _gszr_main.Add((20, 20), 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
64 __lbl_expands_to = wx.StaticText(self, -1, _("Expansion"))
65 _gszr_main.Add(__lbl_expands_to, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0)
66 _gszr_main.Add(self._LBL_data, 0, wx.ALIGN_CENTER_VERTICAL, 0)
67 __szr_file.Add(self._BTN_select_data_file, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
68 __szr_file.Add(self._TCTRL_data_file, 1, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
69 __szr_file.Add(self._CHBOX_is_encrypted, 0, wx.ALIGN_CENTER_VERTICAL, 0)
70 _gszr_main.Add(__szr_file, 1, wx.EXPAND, 0)
71 _gszr_main.Add(self._LBL_text, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
72 _gszr_main.Add(self._TCTRL_expansion, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
73 __lbl_scope = wx.StaticText(self, -1, _("Scope"))
74 _gszr_main.Add(__lbl_scope, 0, wx.ALIGN_CENTER_VERTICAL, 0)
75 __szr_scope.Add(self._RBTN_private, 0, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
76 __szr_scope.Add(self._RBTN_public, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
77 __szr_scope.Add((20, 20), 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
78 _gszr_main.Add(__szr_scope, 1, wx.EXPAND, 0)
79 self.SetSizer(_gszr_main)
80 _gszr_main.Fit(self)
81 _gszr_main.AddGrowableRow(3)
82 _gszr_main.AddGrowableCol(1)
83
84
86 print "Event handler `_on_select_data_file_button_pressed' not implemented"
87 event.Skip()
88
89
90