ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since eb38181 was
d85c194,
checked in by Piotr Rozyczko <piotr.rozyczko@…>, 9 years ago
|
Remaining modules refactored
|
-
Property mode set to
100644
|
File size:
1.8 KB
|
Rev | Line | |
---|
[b0ab6cb] | 1 | """ |
---|
| 2 | Console Module display message of a dialog |
---|
| 3 | """ |
---|
[91f151a] | 4 | import wx |
---|
| 5 | import sys |
---|
[b699768] | 6 | from sas.sascalc.dataloader.loader import Loader |
---|
[91f151a] | 7 | |
---|
| 8 | _BOX_WIDTH = 60 |
---|
[b0ab6cb] | 9 | CONSOLE_WIDTH = 340 |
---|
| 10 | CONSOLE_HEIGHT = 240 |
---|
[49ab5d7] | 11 | if sys.platform.count("win32") > 0: |
---|
[91f151a] | 12 | _STATICBOX_WIDTH = 450 |
---|
| 13 | PANEL_WIDTH = 500 |
---|
| 14 | PANEL_HEIGHT = 550 |
---|
| 15 | FONT_VARIANT = 0 |
---|
| 16 | else: |
---|
| 17 | _STATICBOX_WIDTH = 480 |
---|
| 18 | PANEL_WIDTH = 530 |
---|
| 19 | PANEL_HEIGHT = 560 |
---|
| 20 | FONT_VARIANT = 1 |
---|
[49ab5d7] | 21 | |
---|
[91f151a] | 22 | class ConsoleDialog(wx.Dialog): |
---|
[7343319] | 23 | """ |
---|
| 24 | Data summary dialog |
---|
| 25 | """ |
---|
[b0ab6cb] | 26 | def __init__(self, parent=None, manager=None, data=None, |
---|
| 27 | title="Data Summary", size=(PANEL_WIDTH, PANEL_HEIGHT)): |
---|
| 28 | wx.Dialog.__init__(self, parent=parent, title=title, size=size) |
---|
[49ab5d7] | 29 | |
---|
[91f151a] | 30 | self.parent = parent |
---|
| 31 | self._manager = manager |
---|
| 32 | self._data = data |
---|
| 33 | self.sizer = wx.BoxSizer(wx.VERTICAL) |
---|
[49ab5d7] | 34 | self.msg_txt = wx.TextCtrl(self, size=(PANEL_WIDTH - 40, |
---|
| 35 | PANEL_HEIGHT - 60), |
---|
[91f151a] | 36 | style=wx.TE_MULTILINE) |
---|
| 37 | self.msg_txt.SetEditable(False) |
---|
| 38 | self.msg_txt.SetValue('No message available') |
---|
[49ab5d7] | 39 | self.sizer.Add(self.msg_txt, 1, wx.EXPAND | wx.ALL, 10) |
---|
[91f151a] | 40 | if self._data is not None: |
---|
| 41 | self.set_message(msg=self._data.__str__()) |
---|
[49ab5d7] | 42 | |
---|
[91f151a] | 43 | self.SetSizer(self.sizer) |
---|
[49ab5d7] | 44 | |
---|
[91f151a] | 45 | def set_manager(self, manager): |
---|
| 46 | """ |
---|
[b0ab6cb] | 47 | Set the manager of this window |
---|
[91f151a] | 48 | """ |
---|
| 49 | self._manager = manager |
---|
[49ab5d7] | 50 | |
---|
| 51 | def set_message(self, msg=""): |
---|
[91f151a] | 52 | """ |
---|
[49ab5d7] | 53 | Display the message received |
---|
[91f151a] | 54 | """ |
---|
| 55 | self.msg_txt.SetValue(str(msg)) |
---|
[49ab5d7] | 56 | |
---|
[b0ab6cb] | 57 | if __name__ == "__main__": |
---|
[49ab5d7] | 58 | |
---|
| 59 | app = wx.App() |
---|
[91f151a] | 60 | # Instantiate a loader |
---|
| 61 | loader = Loader() |
---|
| 62 | # Load data |
---|
[b0ab6cb] | 63 | test_data = loader.load("MAR07232_rest.ASC") |
---|
| 64 | dlg = ConsoleDialog(data=test_data) |
---|
[91f151a] | 65 | dlg.ShowModal() |
---|
[49ab5d7] | 66 | app.MainLoop() |
---|
Note: See
TracBrowser
for help on using the repository browser.