1
2
3
4
5
6 import wx
7 import wx.adv
8
9
10 import gettext
11
12
13
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 from Gnumed.wxpython.gmSubstanceMgmtWidgets import cDrugProductPhraseWheel
23 self._PRW_product_name = cDrugProductPhraseWheel(self, wx.ID_ANY, "")
24 from Gnumed.wxpython.gmMedicationWidgets import cSubstancePreparationPhraseWheel
25 self._PRW_preparation = cSubstancePreparationPhraseWheel(self, wx.ID_ANY, "")
26 self._CHBOX_is_fake = wx.CheckBox(self, wx.ID_ANY, _("Fake product"))
27 self._TCTRL_components = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
28 self._BTN_manage_components = wx.Button(self, wx.ID_ANY, _("&Manage"), style=wx.BU_EXACTFIT)
29 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)
30 from Gnumed.wxpython.gmATCWidgets import cATCPhraseWheel
31 self._PRW_atc = cATCPhraseWheel(self, wx.ID_ANY, "")
32 self._TCTRL_external_code = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
33 from Gnumed.wxpython.gmPhraseWheel import cPhraseWheel
34 self._PRW_external_code_type = cPhraseWheel(self, wx.ID_ANY, "", style=wx.TE_READONLY)
35
36 self.__set_properties()
37 self.__do_layout()
38
39 self.Bind(wx.EVT_BUTTON, self._on_manage_components_button_pressed, self._BTN_manage_components)
40
41
43
44 self.SetScrollRate(10, 10)
45 self._CHBOX_is_fake.SetForegroundColour(wx.Colour(255, 127, 0))
46 self._CHBOX_is_fake.SetToolTip(_("Mark as a fake: use if product does not commercially exist and you want to create a \"generic\" product."))
47 self._TCTRL_components.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
48 self._BTN_manage_components.SetToolTip(_("Manage the components of this drug."))
49 self._HL_atc_list.SetToolTip(_("Browse ATC list."))
50 self._TCTRL_external_code.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
51 self._TCTRL_external_code.SetToolTip(_("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."))
52 self._PRW_external_code_type.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
53 self._PRW_external_code_type.SetToolTip(_("The type of the external code of this drug, if any."))
54
55
57
58 _gszr_main = wx.FlexGridSizer(6, 2, 1, 3)
59 __szr_external_code = wx.BoxSizer(wx.HORIZONTAL)
60 __szr_prep = wx.BoxSizer(wx.HORIZONTAL)
61 __lbl_name = wx.StaticText(self, wx.ID_ANY, _("Product name"))
62 __lbl_name.SetForegroundColour(wx.Colour(255, 0, 0))
63 _gszr_main.Add(__lbl_name, 0, wx.ALIGN_CENTER_VERTICAL, 0)
64 _gszr_main.Add(self._PRW_product_name, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
65 __lbl_preparation = wx.StaticText(self, wx.ID_ANY, _("Preparation"))
66 __lbl_preparation.SetForegroundColour(wx.Colour(255, 0, 0))
67 _gszr_main.Add(__lbl_preparation, 0, wx.ALIGN_CENTER_VERTICAL, 0)
68 __szr_prep.Add(self._PRW_preparation, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 10)
69 __szr_prep.Add(self._CHBOX_is_fake, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
70 _gszr_main.Add(__szr_prep, 1, wx.EXPAND, 0)
71 __lbl_components = wx.StaticText(self, wx.ID_ANY, _("Components"))
72 __lbl_components.SetForegroundColour(wx.Colour(255, 0, 0))
73 _gszr_main.Add(__lbl_components, 0, wx.TOP, 3)
74 _gszr_main.Add(self._TCTRL_components, 1, wx.EXPAND | wx.RIGHT, 5)
75 _gszr_main.Add((20, 20), 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
76 _gszr_main.Add(self._BTN_manage_components, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.TOP, 3)
77 _gszr_main.Add(self._HL_atc_list, 0, wx.ALIGN_CENTER_VERTICAL, 0)
78 _gszr_main.Add(self._PRW_atc, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
79 __lbl_external_code = wx.StaticText(self, wx.ID_ANY, _("External code"))
80 _gszr_main.Add(__lbl_external_code, 0, wx.ALIGN_CENTER_VERTICAL, 0)
81 __szr_external_code.Add(self._TCTRL_external_code, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 10)
82 __lbl_external_code_type = wx.StaticText(self, wx.ID_ANY, _("Type:"))
83 __szr_external_code.Add(__lbl_external_code_type, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
84 __szr_external_code.Add(self._PRW_external_code_type, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
85 _gszr_main.Add(__szr_external_code, 1, wx.EXPAND, 0)
86 self.SetSizer(_gszr_main)
87 _gszr_main.Fit(self)
88 _gszr_main.AddGrowableRow(2)
89 _gszr_main.AddGrowableCol(1)
90 self.Layout()
91
92
94 print("Event handler '_on_manage_components_button_pressed' not implemented!")
95 event.Skip()
96
97
98