1
2
3
4
5
6 import wx
7
8
9 import gettext
10
11
12
13 from Gnumed.wxpython.gmTextCtrl import cTextCtrl
14 from Gnumed.wxpython.gmMeasurementWidgets import cUnitPhraseWheel
15 from Gnumed.wxpython.gmSubstanceMgmtWidgets import cSubstancePhraseWheel
16
17
18
21
22 kwds["style"] = kwds.get("style", 0) | wx.BORDER_NONE | wx.TAB_TRAVERSAL
23 wx.ScrolledWindow.__init__(self, *args, **kwds)
24 self._PRW_substance = cSubstancePhraseWheel(self, wx.ID_ANY, "")
25 self._TCTRL_amount = cTextCtrl(self, wx.ID_ANY, "")
26 self._PRW_unit = cUnitPhraseWheel(self, wx.ID_ANY, "")
27 self._PRW_dose_unit = cUnitPhraseWheel(self, wx.ID_ANY, "")
28 self._LBL_info = wx.StaticText(self, wx.ID_ANY, "")
29
30 self.__set_properties()
31 self.__do_layout()
32
33
35
36 self.SetScrollRate(10, 10)
37 self._PRW_substance.SetToolTip(_("Select an existing or type in a new substance."))
38 self._TCTRL_amount.SetToolTip(_("Enter the amount of substance (such as the \"5\" in \"5mg/ml\")."))
39 self._PRW_unit.SetToolTip(_("The unit of the amount of substance (such as the \"mg\" in \"5mg/ml\")."))
40 self._PRW_dose_unit.SetToolTip(_("The unit of the reference amount (such as the \"ml\" in \"5mg/ml\"). If left empty it means \"per delivery unit\" (such as tablet, sachet, capsule, suppository)."))
41
42
44
45 _gszr_main = wx.FlexGridSizer(4, 2, 1, 3)
46 __szr_unit = wx.BoxSizer(wx.HORIZONTAL)
47 __lbl_substance = wx.StaticText(self, wx.ID_ANY, _("Substance"))
48 __lbl_substance.SetForegroundColour(wx.Colour(255, 0, 0))
49 _gszr_main.Add(__lbl_substance, 0, wx.ALIGN_CENTER_VERTICAL, 0)
50 _gszr_main.Add(self._PRW_substance, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
51 __lbl_amount = wx.StaticText(self, wx.ID_ANY, _("Amount"))
52 __lbl_amount.SetForegroundColour(wx.Colour(255, 0, 0))
53 _gszr_main.Add(__lbl_amount, 0, wx.ALIGN_CENTER_VERTICAL, 0)
54 _gszr_main.Add(self._TCTRL_amount, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 10)
55 __lbl_unit = wx.StaticText(self, wx.ID_ANY, _("Unit"))
56 __lbl_unit.SetForegroundColour(wx.Colour(255, 0, 0))
57 _gszr_main.Add(__lbl_unit, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
58 __szr_unit.Add(self._PRW_unit, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 5)
59 __lbl_dose_unit = wx.StaticText(self, wx.ID_ANY, _("pro"))
60 __szr_unit.Add(__lbl_dose_unit, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
61 __szr_unit.Add(self._PRW_dose_unit, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 10)
62 _gszr_main.Add(__szr_unit, 1, 0, 0)
63 _gszr_main.Add((20, 20), 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
64 _gszr_main.Add(self._LBL_info, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 0)
65 self.SetSizer(_gszr_main)
66 _gszr_main.Fit(self)
67 _gszr_main.AddGrowableCol(1)
68 self.Layout()
69
70
71
72