1
2
3
4
5
6 import wx
7
8
9 import gettext
10
11
12
13
14
15
18
19 kwds["style"] = kwds.get("style", 0) | wx.BORDER_NONE | wx.TAB_TRAVERSAL
20 wx.ScrolledWindow.__init__(self, *args, **kwds)
21 self._RBTN_tobacco = wx.RadioButton(self, wx.ID_ANY, _("&Nicotine"))
22 self._RBTN_c2 = wx.RadioButton(self, wx.ID_ANY, _("&Alcohol"))
23 self._RBTN_other_substance = wx.RadioButton(self, wx.ID_ANY, _("&Other:"))
24 from Gnumed.wxpython.gmSubstanceMgmtWidgets import cSubstancePhraseWheel
25 self._PRW_substance = cSubstancePhraseWheel(self, wx.ID_ANY, "")
26 self._RBTN_nonharmful_use = wx.RadioButton(self, wx.ID_ANY, _("&Non-harmful use"), style=wx.RB_GROUP)
27 self._RBTN_harmful_use = wx.RadioButton(self, wx.ID_ANY, _("&Harmful use"))
28 self._RBTN_presently_addicted = wx.RadioButton(self, wx.ID_ANY, _("Presently &addicted"))
29 self._RBTN_previously_addicted = wx.RadioButton(self, wx.ID_ANY, _("Previously &addicted"))
30 from Gnumed.wxpython.gmTextCtrl import cTextCtrl
31 self._TCTRL_comment = cTextCtrl(self, wx.ID_ANY, "")
32 from Gnumed.wxpython.gmDateTimeInput import cDateInputPhraseWheel
33 self._DPRW_quit_when = cDateInputPhraseWheel(self, wx.ID_ANY, "")
34 self._LBL_confirm_date = wx.StaticText(self, wx.ID_ANY, _("?"))
35 self._CHBOX_confirm = wx.CheckBox(self, wx.ID_ANY, _("&Reconfirm as of today"))
36
37 self.__set_properties()
38 self.__do_layout()
39
40 self.Bind(wx.EVT_RADIOBUTTON, self._on_substance_rbutton_selected, self._RBTN_tobacco)
41 self.Bind(wx.EVT_RADIOBUTTON, self._on_substance_rbutton_selected, self._RBTN_c2)
42 self.Bind(wx.EVT_RADIOBUTTON, self._on_substance_rbutton_selected, self._RBTN_other_substance)
43
44
46
47 self.SetScrollRate(10, 10)
48 self._RBTN_tobacco.SetToolTip(_("Select for documenting smoking status."))
49 self._RBTN_tobacco.SetValue(1)
50 self._RBTN_c2.SetToolTip(_("Select for documenting alcohol use status."))
51 self._RBTN_other_substance.SetToolTip(_("Select for documenting use of substances other than nicotine or alcohol."))
52 self._PRW_substance.SetToolTip(_("Select the abused substance."))
53 self._PRW_substance.Enable(False)
54 self._RBTN_nonharmful_use.SetToolTip(_("Select if the substance use is not considered harmful (say, no use or non-harmful use)."))
55 self._RBTN_nonharmful_use.SetValue(1)
56 self._RBTN_harmful_use.SetToolTip(_("Select if substance is use considered harmful."))
57 self._RBTN_presently_addicted.SetToolTip(_("Select if the patient is presently addicted to this substance."))
58 self._RBTN_previously_addicted.SetToolTip(_("Select if the patient was previously addicted to this substance."))
59 self._TCTRL_comment.SetToolTip(_("A comment on this substance use:\n- type of product used\n- frequency\n- amount\n- when started\n- attempts to quit\n..."))
60 self._DPRW_quit_when.SetToolTip(_("When did the patient quit?\n\nYou can also set a target quit date here."))
61 self._CHBOX_confirm.SetToolTip(_("Check here to confirm for today."))
62 self._CHBOX_confirm.SetValue(1)
63
64
66
67 _gszr_main = wx.FlexGridSizer(7, 2, 1, 3)
68 __szr_confirm = wx.BoxSizer(wx.HORIZONTAL)
69 __szr_addiction = wx.BoxSizer(wx.HORIZONTAL)
70 __szr_status = wx.BoxSizer(wx.HORIZONTAL)
71 __szr_substance = wx.BoxSizer(wx.HORIZONTAL)
72 __lbl_substance = wx.StaticText(self, wx.ID_ANY, _("Substance"))
73 __lbl_substance.SetForegroundColour(wx.Colour(255, 0, 0))
74 _gszr_main.Add(__lbl_substance, 0, wx.ALIGN_CENTER_VERTICAL, 0)
75 __szr_substance.Add(self._RBTN_tobacco, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
76 __szr_substance.Add(self._RBTN_c2, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
77 __szr_substance.Add(self._RBTN_other_substance, 0, wx.ALIGN_CENTER_VERTICAL, 5)
78 _gszr_main.Add(__szr_substance, 1, 0, 0)
79 _gszr_main.Add((20, 20), 1, wx.EXPAND, 0)
80 _gszr_main.Add(self._PRW_substance, 1, wx.EXPAND, 0)
81 __lbl_status = wx.StaticText(self, wx.ID_ANY, _("Status"))
82 __lbl_status.SetForegroundColour(wx.Colour(255, 0, 0))
83 _gszr_main.Add(__lbl_status, 0, wx.ALIGN_CENTER_VERTICAL, 0)
84 __szr_status.Add(self._RBTN_nonharmful_use, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
85 __szr_status.Add(self._RBTN_harmful_use, 0, wx.ALIGN_CENTER_VERTICAL, 3)
86 _gszr_main.Add(__szr_status, 1, 0, 0)
87 _gszr_main.Add((20, 20), 1, wx.EXPAND, 0)
88 __szr_addiction.Add(self._RBTN_presently_addicted, 0, wx.ALIGN_CENTER_VERTICAL, 3)
89 __szr_addiction.Add(self._RBTN_previously_addicted, 0, wx.ALIGN_CENTER_VERTICAL, 3)
90 _gszr_main.Add(__szr_addiction, 1, 0, 0)
91 __lbl_comment = wx.StaticText(self, wx.ID_ANY, _("Comment"))
92 _gszr_main.Add(__lbl_comment, 0, wx.ALIGN_CENTER_VERTICAL, 0)
93 _gszr_main.Add(self._TCTRL_comment, 0, wx.EXPAND, 0)
94 __lbl_quit_when = wx.StaticText(self, wx.ID_ANY, _("Quit date"))
95 _gszr_main.Add(__lbl_quit_when, 0, wx.ALIGN_CENTER_VERTICAL, 0)
96 _gszr_main.Add(self._DPRW_quit_when, 0, wx.EXPAND, 0)
97 __lbl_last_confirmed = wx.StaticText(self, wx.ID_ANY, _("Last confirmed"))
98 _gszr_main.Add(__lbl_last_confirmed, 0, wx.ALIGN_CENTER_VERTICAL, 0)
99 __szr_confirm.Add(self._LBL_confirm_date, 1, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
100 __szr_confirm.Add(self._CHBOX_confirm, 0, wx.ALIGN_CENTER_VERTICAL, 0)
101 _gszr_main.Add(__szr_confirm, 1, 0, 0)
102 self.SetSizer(_gszr_main)
103 _gszr_main.Fit(self)
104 _gszr_main.AddGrowableCol(1)
105 self.Layout()
106
107
109 print("Event handler '_on_substance_rbutton_selected' not implemented!")
110 event.Skip()
111
112
113