1
2
3
4
5 import wx
6
7
8
9
10
11
14
15 from Gnumed.wxpython import gmMedicationWidgets
16 from Gnumed.wxpython import gmPhraseWheel
17
18
19 kwds["style"] = wx.NO_BORDER|wx.TAB_TRAVERSAL
20 wx.ScrolledWindow.__init__(self, *args, **kwds)
21 self._PRW_brand = gmMedicationWidgets.cBrandedDrugPhraseWheel(self, -1, "", style=wx.NO_BORDER)
22 self._PRW_preparation = gmMedicationWidgets.cSubstancePreparationPhraseWheel(self, -1, "", style=wx.NO_BORDER)
23 self._CHBOX_is_fake = wx.CheckBox(self, -1, _("Fake brand"))
24 self._TCTRL_components = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY)
25 self._BTN_manage_components = wx.Button(self, -1, _("&Manage"), style=wx.BU_EXACTFIT)
26 self._PRW_atc = gmMedicationWidgets.cATCPhraseWheel(self, -1, "", style=wx.NO_BORDER)
27 self._TCTRL_external_code = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY|wx.NO_BORDER)
28 self._PRW_external_code_type = gmPhraseWheel.cPhraseWheel(self, -1, "", style=wx.TE_READONLY|wx.NO_BORDER)
29
30 self.__set_properties()
31 self.__do_layout()
32
33 self.Bind(wx.EVT_BUTTON, self._on_manage_components_button_pressed, self._BTN_manage_components)
34
35
37
38 self.SetScrollRate(10, 10)
39 self._CHBOX_is_fake.SetForegroundColour(wx.Colour(255, 127, 0))
40 self._CHBOX_is_fake.SetToolTipString(_("Mark as a fake: use if brand does not commercially exist and you want to create a \"generic\" brand."))
41 self._TCTRL_components.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
42 self._BTN_manage_components.SetToolTipString(_("Manage the components of this drug."))
43 self._TCTRL_external_code.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
44 self._TCTRL_external_code.SetToolTipString(_("An external code for this drug.\n\nIn most cases either a national drug identifier or the ID of this drug in an external database.\n\nIn any case, GNUmed will never actively do anything with this code apart from display and making it available when passing this drug to external applications."))
45 self._PRW_external_code_type.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
46 self._PRW_external_code_type.SetToolTipString(_("The type of the external code of this drug, if any."))
47
48
50
51 _gszr_main = wx.FlexGridSizer(6, 2, 1, 3)
52 __szr_external_code = wx.BoxSizer(wx.HORIZONTAL)
53 __szr_prep = wx.BoxSizer(wx.HORIZONTAL)
54 __lbl_brand = wx.StaticText(self, -1, _("Brand name"))
55 __lbl_brand.SetForegroundColour(wx.Colour(255, 0, 0))
56 _gszr_main.Add(__lbl_brand, 0, wx.ALIGN_CENTER_VERTICAL, 0)
57 _gszr_main.Add(self._PRW_brand, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
58 __lbl_preparation = wx.StaticText(self, -1, _("Preparation"))
59 __lbl_preparation.SetForegroundColour(wx.Colour(255, 0, 0))
60 _gszr_main.Add(__lbl_preparation, 0, wx.ALIGN_CENTER_VERTICAL, 0)
61 __szr_prep.Add(self._PRW_preparation, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)
62 __szr_prep.Add(self._CHBOX_is_fake, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
63 _gszr_main.Add(__szr_prep, 1, wx.EXPAND, 0)
64 __lbl_components = wx.StaticText(self, -1, _("Components"))
65 __lbl_components.SetForegroundColour(wx.Colour(255, 0, 0))
66 _gszr_main.Add(__lbl_components, 0, wx.TOP, 3)
67 _gszr_main.Add(self._TCTRL_components, 1, wx.RIGHT|wx.EXPAND, 5)
68 _gszr_main.Add((20, 20), 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
69 _gszr_main.Add(self._BTN_manage_components, 0, wx.TOP|wx.BOTTOM|wx.ALIGN_CENTER_HORIZONTAL, 3)
70 __lbl_atc = wx.StaticText(self, -1, _("ATC code"))
71 _gszr_main.Add(__lbl_atc, 0, wx.ALIGN_CENTER_VERTICAL, 0)
72 _gszr_main.Add(self._PRW_atc, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
73 __lbl_external_code = wx.StaticText(self, -1, _("External code"))
74 _gszr_main.Add(__lbl_external_code, 0, wx.ALIGN_CENTER_VERTICAL, 0)
75 __szr_external_code.Add(self._TCTRL_external_code, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)
76 __lbl_external_code_type = wx.StaticText(self, -1, _("Type:"))
77 __szr_external_code.Add(__lbl_external_code_type, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 5)
78 __szr_external_code.Add(self._PRW_external_code_type, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
79 _gszr_main.Add(__szr_external_code, 1, wx.EXPAND, 0)
80 self.SetSizer(_gszr_main)
81 _gszr_main.Fit(self)
82 _gszr_main.AddGrowableRow(2)
83 _gszr_main.AddGrowableCol(1)
84
85
87 print "Event handler `_on_manage_components_button_pressed' not implemented"
88 event.Skip()
89
90
91