1
2
3
4
5 import wx
6
9
10 from Gnumed.wxpython import gmDataMiningWidgets, gmPhraseWheel
11
12
13 kwds["style"] = wx.NO_BORDER | wx.TAB_TRAVERSAL
14 wx.ScrolledWindow.__init__(self, *args, **kwds)
15 self._splitter = wx.SplitterWindow(self, -1, style=wx.SP_3D | wx.SP_BORDER)
16 self.splitter_top_panel = wx.Panel(self._splitter, -1, style=wx.NO_BORDER | wx.TAB_TRAVERSAL)
17 self._PRW_report_name = gmPhraseWheel.cPhraseWheel(self.splitter_top_panel, -1, "", style=wx.NO_BORDER)
18 self._TCTRL_query = wx.TextCtrl(self.splitter_top_panel, -1, "", style=wx.TE_MULTILINE | wx.TE_WORDWRAP | wx.NO_BORDER)
19 self._BTN_run = wx.Button(self.splitter_top_panel, -1, _("Run"), style=wx.BU_EXACTFIT)
20 self._BTN_visualize = wx.Button(self.splitter_top_panel, -1, _("Visualize"), style=wx.BU_EXACTFIT)
21 self._BTN_clear = wx.Button(self.splitter_top_panel, -1, _("Clear"), style=wx.BU_EXACTFIT)
22 self._BTN_save = wx.Button(self.splitter_top_panel, -1, _("Save"), style=wx.BU_EXACTFIT)
23 self._BTN_delete = wx.Button(self.splitter_top_panel, -1, _("Delete"), style=wx.BU_EXACTFIT)
24 self._BTN_contribute = wx.Button(self.splitter_top_panel, -1, _("Contribute"), style=wx.BU_EXACTFIT)
25 self._BTN_schema = wx.Button(self.splitter_top_panel, -1, _("Schema"), style=wx.BU_EXACTFIT)
26 self._splitter_bottom_panel = wx.Panel(self._splitter, -1, style=wx.NO_BORDER | wx.TAB_TRAVERSAL)
27 self._LCTRL_result = gmDataMiningWidgets.cPatientListingCtrl(self._splitter_bottom_panel, -1, style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.SIMPLE_BORDER)
28
29 self.__set_properties()
30 self.__do_layout()
31
32 self.Bind(wx.EVT_BUTTON, self._on_run_button_pressed, self._BTN_run)
33 self.Bind(wx.EVT_BUTTON, self._on_visualize_button_pressed, self._BTN_visualize)
34 self.Bind(wx.EVT_BUTTON, self._on_clear_button_pressed, self._BTN_clear)
35 self.Bind(wx.EVT_BUTTON, self._on_save_button_pressed, self._BTN_save)
36 self.Bind(wx.EVT_BUTTON, self._on_delete_button_pressed, self._BTN_delete)
37 self.Bind(wx.EVT_BUTTON, self._on_contribute_button_pressed, self._BTN_contribute)
38 self.Bind(wx.EVT_BUTTON, self._on_schema_button_pressed, self._BTN_schema)
39
40
42
43 self.SetScrollRate(10, 10)
44 self._PRW_report_name.SetToolTipString(_("If you want to save this query into the database for later use you must provide a descriptive label for it here."))
45 self._TCTRL_query.SetToolTipString(_("Enter the SQL commands to run here. It doesn't matter whether or not you enter a trailing \";\".\n\nNote that:\n- the query is run in a read-only transaction\n- the result list will be artificially limited to the first 1000 rows\n- you can include a column named \"pk_patient\" to make the result rows activate the corresponding patient on double-clicking"))
46 self._BTN_run.SetToolTipString(_("Run the query and present the results below."))
47 self._BTN_run.SetDefault()
48 self._BTN_visualize.SetToolTipString(_("Visualize data from two numeric columns of the result list below."))
49 self._BTN_visualize.Enable(False)
50 self._BTN_clear.SetToolTipString(_("Clear all fields."))
51 self._BTN_save.SetToolTipString(_("Save the report definition."))
52 self._BTN_delete.SetToolTipString(_("Delete this report definition."))
53 self._BTN_contribute.SetToolTipString(_("Contribute this report definition to the GNUmed community. The report name and SQL command will be sent to the mailing list.\n\nPatient data will NOT be put AT RISK.\n\nYou may want to be careful about the SQL itself as it just might contain bits of sensitive data in, say, the WHERE conditions."))
54 self._BTN_schema.SetToolTipString(_("Show the database schema definition in your web browser."))
55
56
58
59 _szr_main = wx.BoxSizer(wx.VERTICAL)
60 __szr_splitter_bottom = wx.BoxSizer(wx.VERTICAL)
61 _fgszr_top = wx.FlexGridSizer(3, 2, 1, 4)
62 _szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
63 __LBL_report_name = wx.StaticText(self.splitter_top_panel, -1, _("Report"))
64 _fgszr_top.Add(__LBL_report_name, 0, wx.ALIGN_CENTER_VERTICAL, 0)
65 _fgszr_top.Add(self._PRW_report_name, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
66 __LBL_query = wx.StaticText(self.splitter_top_panel, -1, _("\nCommand\n(SQL)"))
67 _fgszr_top.Add(__LBL_query, 0, wx.ALIGN_CENTER_VERTICAL, 0)
68 _fgszr_top.Add(self._TCTRL_query, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
69 _fgszr_top.Add((20, 20), 0, wx.EXPAND, 0)
70 _szr_buttons.Add(self._BTN_run, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
71 _szr_buttons.Add(self._BTN_visualize, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
72 _szr_buttons.Add(self._BTN_clear, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
73 _szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
74 _szr_buttons.Add(self._BTN_save, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
75 _szr_buttons.Add(self._BTN_delete, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
76 _szr_buttons.Add(self._BTN_contribute, 0, wx.ALIGN_CENTER_VERTICAL, 0)
77 _szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
78 _szr_buttons.Add(self._BTN_schema, 0, wx.ALIGN_CENTER_VERTICAL, 0)
79 _fgszr_top.Add(_szr_buttons, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
80 self.splitter_top_panel.SetSizer(_fgszr_top)
81 _fgszr_top.AddGrowableRow(1)
82 _fgszr_top.AddGrowableCol(1)
83 __szr_splitter_bottom.Add(self._LCTRL_result, 1, wx.EXPAND, 0)
84 self._splitter_bottom_panel.SetSizer(__szr_splitter_bottom)
85 self._splitter.SplitHorizontally(self.splitter_top_panel, self._splitter_bottom_panel, 125)
86 _szr_main.Add(self._splitter, 1, wx.EXPAND, 0)
87 self.SetSizer(_szr_main)
88 _szr_main.Fit(self)
89
90
92 print "Event handler `_on_run_button_pressed' not implemented"
93 event.Skip()
94
96 print "Event handler `_on_clear_button_pressed' not implemented"
97 event.Skip()
98
100 print "Event handler `_on_save_button_pressed' not implemented"
101 event.Skip()
102
104 print "Event handler `_on_contribute_button_pressed' not implemented"
105 event.Skip()
106
108 print "Event handler `_on_delete_button_pressed' not implemented"
109 event.Skip()
110
112 print "Event handler `_on_schema_button_pressed' not implemented"
113 event.Skip()
114
116 print "Event handler `_on_visualize_button_pressed' not implemented"
117 event.Skip()
118
119
120