1 | """ |
---|
2 | This module provides a GUI for the file converter |
---|
3 | """ |
---|
4 | |
---|
5 | import wx |
---|
6 | import sys |
---|
7 | from wx.lib.scrolledpanel import ScrolledPanel |
---|
8 | from sas.sasgui.guiframe.panel_base import PanelBase |
---|
9 | from sas.sasgui.perspectives.calculator import calculator_widgets as widget |
---|
10 | |
---|
11 | # Panel size |
---|
12 | if sys.platform.count("win32") > 0: |
---|
13 | PANEL_TOP = 0 |
---|
14 | _STATICBOX_WIDTH = 410 |
---|
15 | _BOX_WIDTH = 200 |
---|
16 | PANEL_SIZE = 440 |
---|
17 | FONT_VARIANT = 0 |
---|
18 | else: |
---|
19 | PANEL_TOP = 60 |
---|
20 | _STATICBOX_WIDTH = 430 |
---|
21 | _BOX_WIDTH = 200 |
---|
22 | PANEL_SIZE = 460 |
---|
23 | FONT_VARIANT = 1 |
---|
24 | |
---|
25 | class ConverterPanel(ScrolledPanel, PanelBase): |
---|
26 | |
---|
27 | def __init__(self, parent, base=None, *args, **kwargs): |
---|
28 | ScrolledPanel.__init__(self, parent, *args, **kwargs) |
---|
29 | PanelBase.__init__(self) |
---|
30 | |
---|
31 | self.SetWindowVariant(variant=FONT_VARIANT) |
---|
32 | |
---|
33 | self.base = base |
---|
34 | self.parent = parent |
---|
35 | |
---|
36 | self._do_layout |
---|
37 | self.SetAutoLayout(True) |
---|
38 | self.Layout() |
---|
39 | |
---|
40 | def _do_layout(self): |
---|
41 | # TODO: Get this working |
---|
42 | vbox = wx.BoxSizer(wx.VERTICAL) |
---|
43 | |
---|
44 | inputsection = wx.StaticBox(self, -1, "Input File") |
---|
45 | inputsection_sizer = wx.StaticBoxSizer(inputsection, wx.VERTICAL) |
---|
46 | |
---|
47 | input_grid = wx.GridBagSizer(5, 5) |
---|
48 | |
---|
49 | input_box = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1)) |
---|
50 | input_grid.Add(input_box, (0,0), (1,1), wx.LEFT, 5) |
---|
51 | |
---|
52 | inputsection_sizer.Add(input_grid) |
---|
53 | |
---|
54 | vbox.Add(input_section, (0,0), (0,1), wx.TOP, 15) |
---|
55 | |
---|
56 | vbox.Fit(self) |
---|
57 | self.SetSizer(vbox) |
---|
58 | |
---|
59 | class ConverterWindow(widget.CHILD_FRAME): |
---|
60 | |
---|
61 | def __init__(self, parent=None, title='File Converter', base=None, |
---|
62 | manager=None, size=(PANEL_SIZE * 1.05, PANEL_SIZE / 1.55), |
---|
63 | *args, **kwargs): |
---|
64 | kwargs['title'] = title |
---|
65 | kwargs['size'] = size |
---|
66 | widget.CHILD_FRAME.__init__(self, parent, *args, **kwargs) |
---|
67 | |
---|
68 | self.manager = manager |
---|
69 | self.panel = ConverterPanel(self, base=None) |
---|
70 | self.Bind(wx.EVT_CLOSE, self.on_close) |
---|
71 | self.SetPosition((wx.LEFT, PANEL_TOP)) |
---|
72 | self.Show(True) |
---|
73 | |
---|
74 | def on_close(self, event): |
---|
75 | if self.manager is not None: |
---|
76 | self.manager.converter_frame = None |
---|
77 | self.Destroy() |
---|