1
2
3
4
5
6 import wx
7
8
9 import gettext
10
11
12
13 from Gnumed.wxpython.gmTextCtrl import cTextCtrl
14
15
16
19
20 kwds["style"] = kwds.get("style", 0) | wx.BORDER_NONE | wx.TAB_TRAVERSAL
21 wx.ScrolledWindow.__init__(self, *args, **kwds)
22 self._TCTRL_title = cTextCtrl(self, wx.ID_ANY, "")
23 self._TCTRL_hint = cTextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE)
24 self._TCTRL_source = cTextCtrl(self, wx.ID_ANY, "")
25 self._TCTRL_query = cTextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE)
26 self._TCTRL_recommendation_query = cTextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE)
27 self._TCTRL_url = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_AUTO_URL)
28 self._BTN_check_url = wx.Button(self, wx.ID_ANY, _("Chec&k"), style=wx.BU_EXACTFIT)
29 self._CHBOX_is_active = wx.CheckBox(self, wx.ID_ANY, _("&Active"), style=wx.CHK_2STATE)
30 self._CHBOX_highlight = wx.CheckBox(self, wx.ID_ANY, _("&Highlight"), style=wx.CHK_2STATE)
31 self._RBTN_popup_none = wx.RadioButton(self, wx.ID_ANY, _("None"))
32 self._RBTN_popup_single = wx.RadioButton(self, wx.ID_ANY, _("Individual"))
33 self._RBTN_popup_multiple = wx.RadioButton(self, wx.ID_ANY, _("Aggregate"))
34
35 self.__set_properties()
36 self.__do_layout()
37
38 self.Bind(wx.EVT_BUTTON, self._on_check_url_button_pressed, self._BTN_check_url)
39
40
42
43 self.SetScrollRate(10, 10)
44 self._TCTRL_title.SetToolTip(_("Required: A concise, unique title for this automatic hint."))
45 self._TCTRL_hint.SetToolTip(_("Required: The full text to be displayed when the conditions for this automatic hint apply."))
46 self._TCTRL_source.SetToolTip(_("Required: Who is responsible for this automatic hint (inhouse and possibly externally)."))
47 self._TCTRL_query.SetToolTip(_("Required: The SQL query to be run for checking whether this automatic hint applies and should be displayed.\n\nMust return TRUE / FALSE.\n\nAny occurrence of ID_ACTIVE_PATIENT will be replaced by the internal GNUmed ID of the currently active patient."))
48 self._TCTRL_recommendation_query.SetToolTip(_("Optional: The SQL query to be run for retrieving further information and perhaps a recommendation in case this automatic hint applies.\n\nMust return NULL or a string (TEXT).\n\nAny occurrence of ID_ACTIVE_PATIENT will be replaced by the internal GNUmed ID of the currently active patient."))
49 self._TCTRL_url.SetToolTip(_("Optional: An URL under which additional information can be found."))
50 self._BTN_check_url.SetToolTip(_("Explicitely check the URL given."))
51 self._CHBOX_is_active.SetToolTip(_("Whether or not this automatic hint is active. If not active it will not be displayed even if the SQL-defined conditions do match.\n\nCave: This setting applies across ALL PATIENTS."))
52 self._CHBOX_is_active.SetValue(1)
53 self._CHBOX_highlight.SetToolTip(_("Whether or not to highlight this hint among others (where deemed appropriate)."))
54 self._CHBOX_highlight.SetValue(1)
55 self._RBTN_popup_none.SetToolTip(_("Do not show this hint with a popup."))
56 self._RBTN_popup_single.SetToolTip(_("Show hint in individual popup."))
57 self._RBTN_popup_multiple.SetToolTip(_("Show hint with other hints in aggregate popup."))
58 self._RBTN_popup_multiple.SetValue(1)
59
60
62
63 _gszr_main = wx.FlexGridSizer(7, 2, 1, 3)
64 __szr_options = wx.BoxSizer(wx.HORIZONTAL)
65 __szr_url = wx.BoxSizer(wx.HORIZONTAL)
66 __lbl_title = wx.StaticText(self, wx.ID_ANY, _("Title"))
67 __lbl_title.SetForegroundColour(wx.Colour(255, 0, 0))
68 _gszr_main.Add(__lbl_title, 0, wx.ALIGN_CENTER_VERTICAL, 0)
69 _gszr_main.Add(self._TCTRL_title, 0, wx.EXPAND, 0)
70 __lbl_hint = wx.StaticText(self, wx.ID_ANY, _("Description"))
71 __lbl_hint.SetForegroundColour(wx.Colour(255, 0, 0))
72 _gszr_main.Add(__lbl_hint, 0, wx.ALIGN_CENTER_VERTICAL, 0)
73 _gszr_main.Add(self._TCTRL_hint, 1, wx.EXPAND, 0)
74 __lbl_source = wx.StaticText(self, wx.ID_ANY, _("Source"))
75 __lbl_source.SetForegroundColour(wx.Colour(255, 0, 0))
76 _gszr_main.Add(__lbl_source, 0, wx.ALIGN_CENTER_VERTICAL, 0)
77 _gszr_main.Add(self._TCTRL_source, 0, wx.EXPAND, 0)
78 __lbl_query = wx.StaticText(self, wx.ID_ANY, _("Applicability\ncheck\n(SQL query)"))
79 __lbl_query.SetForegroundColour(wx.Colour(255, 0, 0))
80 _gszr_main.Add(__lbl_query, 0, 0, 0)
81 _gszr_main.Add(self._TCTRL_query, 2, wx.EXPAND, 0)
82 __lbl_recommendation_query = wx.StaticText(self, wx.ID_ANY, _("Retrieval of\nrecommendation\n(SQL query)"))
83 _gszr_main.Add(__lbl_recommendation_query, 0, 0, 0)
84 _gszr_main.Add(self._TCTRL_recommendation_query, 2, wx.EXPAND, 0)
85 __lbl_url = wx.StaticText(self, wx.ID_ANY, _("URL"))
86 _gszr_main.Add(__lbl_url, 0, wx.ALIGN_CENTER_VERTICAL, 0)
87 __szr_url.Add(self._TCTRL_url, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 3)
88 __szr_url.Add(self._BTN_check_url, 0, 0, 0)
89 _gszr_main.Add(__szr_url, 1, wx.EXPAND, 0)
90 __lbl_options = wx.StaticText(self, wx.ID_ANY, _("Options"))
91 _gszr_main.Add(__lbl_options, 0, wx.ALIGN_CENTER_VERTICAL, 0)
92 __szr_options.Add(self._CHBOX_is_active, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
93 __szr_options.Add(self._CHBOX_highlight, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
94 __szr_options.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
95 __lbl_popup_type = wx.StaticText(self, wx.ID_ANY, _("Popup:"))
96 __szr_options.Add(__lbl_popup_type, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
97 __szr_options.Add(self._RBTN_popup_none, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
98 __szr_options.Add(self._RBTN_popup_single, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
99 __szr_options.Add(self._RBTN_popup_multiple, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
100 __szr_options.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
101 __szr_options.Add((0, 0), 0, 0, 0)
102 _gszr_main.Add(__szr_options, 1, wx.EXPAND, 0)
103 self.SetSizer(_gszr_main)
104 _gszr_main.Fit(self)
105 _gszr_main.AddGrowableRow(1)
106 _gszr_main.AddGrowableRow(3)
107 _gszr_main.AddGrowableRow(4)
108 _gszr_main.AddGrowableCol(1)
109 self.Layout()
110
111
113 print("Event handler '_on_check_url_button_pressed' not implemented!")
114 event.Skip()
115
116
117