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._TCTRL_data_file = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
20 self._BTN_select_data_file = wx.Button(self, -1, _("Se&lect"), style=wx.BU_EXACTFIT)
21 self._LBL_text = wx.StaticText(self, -1, _("Text"))
22 self._TCTRL_expansion = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
23 self._RBTN_private = wx.RadioButton(self, -1, _("&Me only"), style=wx.RB_GROUP)
24 self._RBTN_public = wx.RadioButton(self, -1, _("&All users"))
25 self._TCTRL_key_id = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
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._TCTRL_data_file.SetToolTipString(_("File from which to load the binary data."))
39 self._TCTRL_data_file.Enable(False)
40 self._BTN_select_data_file.SetToolTipString(_("Select a file from which to load the binary data."))
41 self._BTN_select_data_file.Enable(False)
42 self._LBL_text.SetForegroundColour(wx.Colour(255, 127, 0))
43 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."))
44 self._TCTRL_expansion.Enable(False)
45 self._RBTN_private.SetToolTipString(_("Select this if you want to use this text expansion just for yourself."))
46 self._RBTN_private.Enable(False)
47 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)."))
48 self._RBTN_public.Enable(False)
49 self._RBTN_public.SetValue(1)
50 self._TCTRL_key_id.SetToolTipString(_("Optional: ID of a GnuPG key.\nIf set the expansion data or text stored in the database is assumed to be encrypted with this ID and will be decrypted as needed. Thus you will need the passphrase for that key if you want to use this expansion."))
51 self._TCTRL_key_id.Enable(False)
52
53
54 - def __do_layout(self):
55
56 _gszr_main = wx.FlexGridSizer(6, 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._TCTRL_data_file, 1, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
68 __szr_file.Add(self._BTN_select_data_file, 0, wx.ALIGN_CENTER_VERTICAL, 0)
69 _gszr_main.Add(__szr_file, 1, wx.EXPAND, 0)
70 _gszr_main.Add(self._LBL_text, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
71 _gszr_main.Add(self._TCTRL_expansion, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
72 __lbl_scope = wx.StaticText(self, -1, _("Scope"))
73 _gszr_main.Add(__lbl_scope, 0, wx.ALIGN_CENTER_VERTICAL, 0)
74 __szr_scope.Add(self._RBTN_private, 0, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
75 __szr_scope.Add(self._RBTN_public, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
76 _gszr_main.Add(__szr_scope, 1, wx.EXPAND, 0)
77 __lbl_key_id = wx.StaticText(self, -1, _("Key ID"))
78 _gszr_main.Add(__lbl_key_id, 0, wx.ALIGN_CENTER_VERTICAL, 0)
79 _gszr_main.Add(self._TCTRL_key_id, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
80 self.SetSizer(_gszr_main)
81 _gszr_main.Fit(self)
82 _gszr_main.AddGrowableRow(3)
83 _gszr_main.AddGrowableCol(1)
84
85
87 print "Event handler `_on_select_data_file_button_pressed' not implemented"
88 event.Skip()
89
90
91