1
2
3
4
5
6 import wx
7 import wx.adv
8
9
10 import gettext
11
12
13
14 from Gnumed.wxpython.gmTextCtrl import cTextCtrl
15 from Gnumed.wxpython.gmListWidgets import cReportListCtrl
16 from Gnumed.wxpython.gmATCWidgets import cATCPhraseWheel
17 from Gnumed.wxpython.gmLOINCWidgets import cLOINCPhraseWheel
18
19
20
23
24 kwds["style"] = kwds.get("style", 0) | wx.BORDER_NONE | wx.TAB_TRAVERSAL
25 wx.ScrolledWindow.__init__(self, *args, **kwds)
26 self._TCTRL_substance = cTextCtrl(self, wx.ID_ANY, "")
27 self._HL_atc_list = wx.adv.HyperlinkCtrl(self, wx.ID_ANY, _("ATC Code"), _("http://www.whocc.no/atc_ddd_index/"), style=wx.adv.HL_DEFAULT_STYLE)
28 self._PRW_atc = cATCPhraseWheel(self, wx.ID_ANY, "")
29 self._TCTRL_instructions = cTextCtrl(self, wx.ID_ANY, "")
30 self._HL_loinc_list = wx.adv.HyperlinkCtrl(self, wx.ID_ANY, _("LOINCs"), _("https://search.loinc.org"), style=wx.adv.HL_DEFAULT_STYLE)
31 self._PRW_loinc = cLOINCPhraseWheel(self, wx.ID_ANY, "")
32 self._BTN_add_loinc = wx.Button(self, wx.ID_ANY, _("Add"), style=wx.BU_EXACTFIT)
33 self._LCTRL_loincs = cReportListCtrl(self, wx.ID_ANY, style=wx.BORDER_NONE | wx.LC_REPORT)
34 self._BTN_remove_loincs = wx.Button(self, wx.ID_ANY, _("Remove"), style=wx.BU_EXACTFIT)
35
36 self.__set_properties()
37 self.__do_layout()
38
39 self.Bind(wx.EVT_BUTTON, self._on_add_loinc_button_pressed, self._BTN_add_loinc)
40 self.Bind(wx.EVT_BUTTON, self._on_remove_loincs_button_pressed, self._BTN_remove_loincs)
41
42
44
45 self.SetScrollRate(10, 10)
46 self._TCTRL_substance.SetToolTip(_("Enter the name of the substance.\n\nExamples:\n- metoprolol\n- tobacco\n- alcohol\n- marihuana\n- aloe vera\n- ibuprofen"))
47 self._HL_atc_list.SetToolTip(_("Browse ATC list."))
48 self._TCTRL_instructions.SetToolTip(_("Generic intake instructions for this substance."))
49 self._HL_loinc_list.SetToolTip(_("Browse LOINC list."))
50 self._BTN_add_loinc.SetToolTip(_("Add LOINC code to list of LOINC codes to monitor."))
51 self._BTN_remove_loincs.SetToolTip(_("Remove selected LOINC codes from the list of codes to monitor."))
52
53
55
56 _gszr_main = wx.FlexGridSizer(6, 2, 1, 3)
57 __szr_loinc_selection = wx.BoxSizer(wx.HORIZONTAL)
58 __lbl_substance = wx.StaticText(self, wx.ID_ANY, _("Substance"))
59 __lbl_substance.SetForegroundColour(wx.Colour(255, 0, 0))
60 _gszr_main.Add(__lbl_substance, 0, wx.ALIGN_CENTER_VERTICAL, 0)
61 _gszr_main.Add(self._TCTRL_substance, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
62 _gszr_main.Add(self._HL_atc_list, 0, wx.ALIGN_CENTER_VERTICAL, 0)
63 _gszr_main.Add(self._PRW_atc, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
64 __lbl_instructions = wx.StaticText(self, wx.ID_ANY, _("Instructions"))
65 _gszr_main.Add(__lbl_instructions, 0, wx.ALIGN_CENTER_VERTICAL, 0)
66 _gszr_main.Add(self._TCTRL_instructions, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
67 _gszr_main.Add(self._HL_loinc_list, 0, wx.ALIGN_CENTER_VERTICAL, 0)
68 __szr_loinc_selection.Add(self._PRW_loinc, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 3)
69 __szr_loinc_selection.Add(self._BTN_add_loinc, 0, wx.ALIGN_CENTER_VERTICAL, 0)
70 _gszr_main.Add(__szr_loinc_selection, 1, wx.EXPAND, 0)
71 _gszr_main.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
72 _gszr_main.Add(self._LCTRL_loincs, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
73 _gszr_main.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
74 _gszr_main.Add(self._BTN_remove_loincs, 0, wx.ALIGN_CENTER, 0)
75 self.SetSizer(_gszr_main)
76 _gszr_main.Fit(self)
77 _gszr_main.AddGrowableRow(4)
78 _gszr_main.AddGrowableCol(1)
79 self.Layout()
80
81
83 print("Event handler '_on_add_loinc_button_pressed' not implemented!")
84 event.Skip()
85
87 print("Event handler '_on_remove_loincs_button_pressed' not implemented!")
88 event.Skip()
89
90
91