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._TCTRL_expansion = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
19 self._RBTN_private = wx.RadioButton(self, -1, _("&Me only"), style=wx.RB_GROUP)
20 self._RBTN_public = wx.RadioButton(self, -1, _("&All users"))
21
22 self.__set_properties()
23 self.__do_layout()
24
25
27
28 self.SetScrollRate(10, 10)
29 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."))
30 self._TCTRL_expansion.SetToolTipString(_("This is the text the keyword will expand to. You can use any text-based punctuation and formatting."))
31 self._TCTRL_expansion.Enable(False)
32 self._RBTN_private.SetToolTipString(_("Select this if you want to use this text expansion just for yourself."))
33 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)."))
34 self._RBTN_public.SetValue(1)
35
36
37 - def __do_layout(self):
38
39 _gszr_main = wx.FlexGridSizer(7, 2, 1, 3)
40 __szr_scope = wx.BoxSizer(wx.HORIZONTAL)
41 __lbl_keyword = wx.StaticText(self, -1, _("Keyword"))
42 _gszr_main.Add(__lbl_keyword, 0, wx.ALIGN_CENTER_VERTICAL, 0)
43 _gszr_main.Add(self._TCTRL_keyword, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
44 __lbl_expansion = wx.StaticText(self, -1, _("Expand to"))
45 _gszr_main.Add(__lbl_expansion, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
46 _gszr_main.Add(self._TCTRL_expansion, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
47 __lbl_scope = wx.StaticText(self, -1, _("Scope"))
48 _gszr_main.Add(__lbl_scope, 0, wx.ALIGN_CENTER_VERTICAL, 0)
49 __szr_scope.Add(self._RBTN_private, 0, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
50 __szr_scope.Add(self._RBTN_public, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
51 _gszr_main.Add(__szr_scope, 1, wx.EXPAND, 0)
52 self.SetSizer(_gszr_main)
53 _gszr_main.Fit(self)
54 _gszr_main.AddGrowableRow(1)
55 _gszr_main.AddGrowableCol(1)
56
57
58
59