Exemple #1
0
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self,
                          id=wxID_FRAME1,
                          name='',
                          parent=prnt,
                          pos=wx.Point(556, 295),
                          size=wx.Size(516, 476),
                          style=wx.DEFAULT_FRAME_STYLE,
                          title='Everything')
        self._init_utils()
        self.SetClientSize(wx.Size(508, 449))
        self.SetMenuBar(self.menuBar1)
        self.Center(wx.BOTH)

        self.toolBar1 = wx.ToolBar(id=wxID_FRAME1TOOLBAR1,
                                   name='toolBar1',
                                   parent=self,
                                   pos=wx.Point(0, 0),
                                   size=wx.Size(508, 27),
                                   style=wx.TB_HORIZONTAL | wx.NO_BORDER)
        self.SetToolBar(self.toolBar1)

        self.statusBar1 = wx.StatusBar(id=wxID_FRAME1STATUSBAR1,
                                       name='statusBar1',
                                       parent=self,
                                       style=0)
        self.statusBar1.SetPosition(wx.Point(0, 308))
        self.statusBar1.SetSize(wx.Size(422, 20))
        self._init_coll_statusBar1_Fields(self.statusBar1)
        self.SetStatusBar(self.statusBar1)

        self.notebook1 = wx.Notebook(id=wxID_FRAME1NOTEBOOK1,
                                     name='notebook1',
                                     parent=self,
                                     pos=wx.Point(0, 27),
                                     size=wx.Size(508, 383),
                                     style=0)

        self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1,
                               name='panel1',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)

        self.splitterWindow1 = wx.SplitterWindow(id=wxID_FRAME1SPLITTERWINDOW1,
                                                 name='splitterWindow1',
                                                 parent=self.panel1,
                                                 point=wx.Point(8, 8),
                                                 size=wx.Size(200, 100),
                                                 style=wx.SP_3D)

        self.scrolledWindow1 = wx.ScrolledWindow(id=wxID_FRAME1SCROLLEDWINDOW1,
                                                 name='scrolledWindow1',
                                                 parent=self.splitterWindow1,
                                                 pos=wx.Point(2, 2),
                                                 size=wx.Size(98, 96),
                                                 style=wx.SUNKEN_BORDER
                                                 | wx.TAB_TRAVERSAL)
        self.scrolledWindow1.SetToolTipString('wxScrolledWindow')

        self.sashWindow1 = wx.SashWindow(id=wxID_FRAME1SASHWINDOW1,
                                         name='sashWindow1',
                                         parent=self.splitterWindow1,
                                         pos=wx.Point(107, 2),
                                         size=wx.Size(91, 96),
                                         style=wx.CLIP_CHILDREN | wx.SW_3D)
        self.splitterWindow1.SplitVertically(self.scrolledWindow1,
                                             self.sashWindow1, 100)

        self.sashLayoutWindow1 = wx.SashLayoutWindow(
            id=wxID_FRAME1SASHLAYOUTWINDOW1,
            name='sashLayoutWindow1',
            parent=self.panel1,
            pos=wx.Point(8, 120),
            size=wx.Size(200, 80),
            style=wx.CLIP_CHILDREN | wx.SW_3D)

        self.window1 = wx.Window(id=wxID_FRAME1WINDOW1,
                                 name='window1',
                                 parent=self.panel1,
                                 pos=wx.Point(216, 120),
                                 size=wx.Size(96, 80),
                                 style=wx.SIMPLE_BORDER)
        self.window1.SetCursor(self.stockCursor1)

        self.dynamicSashWindow1 = wx.gizmos.DynamicSashWindow(
            id=wxID_FRAME1DYNAMICSASHWINDOW1,
            name='dynamicSashWindow1',
            parent=self.panel1,
            pos=wx.Point(216, 8),
            size=wx.Size(100, 100),
            style=wx.CLIP_CHILDREN)

        self.panel2 = wx.Panel(id=wxID_FRAME1PANEL2,
                               name='panel2',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)

        self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
                                         label='staticText1',
                                         name='staticText1',
                                         parent=self.panel2,
                                         pos=wx.Point(16, 16),
                                         size=wx.Size(52, 13),
                                         style=0)

        self.textCtrl1 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL1,
                                     name='textCtrl1',
                                     parent=self.panel2,
                                     pos=wx.Point(16, 40),
                                     size=wx.Size(100, 21),
                                     style=0,
                                     value='textCtrl1')

        self.comboBox1 = wx.ComboBox(choices=[],
                                     id=wxID_FRAME1COMBOBOX1,
                                     name='comboBox1',
                                     parent=self.panel2,
                                     pos=wx.Point(16, 72),
                                     size=wx.Size(125, 21),
                                     style=0,
                                     validator=wx.DefaultValidator,
                                     value='comboBox1')

        self.choice1 = wx.Choice(choices=[],
                                 id=wxID_FRAME1CHOICE1,
                                 name='choice1',
                                 parent=self.panel2,
                                 pos=wx.Point(16, 104),
                                 size=wx.Size(125, 21),
                                 style=0,
                                 validator=wx.DefaultValidator)

        self.checkBox1 = wx.CheckBox(id=wxID_FRAME1CHECKBOX1,
                                     label='checkBox1',
                                     name='checkBox1',
                                     parent=self.panel2,
                                     pos=wx.Point(16, 136),
                                     size=wx.Size(73, 13),
                                     style=0)

        self.radioButton1 = wx.RadioButton(id=wxID_FRAME1RADIOBUTTON1,
                                           label='radioButton1',
                                           name='radioButton1',
                                           parent=self.panel2,
                                           pos=wx.Point(16, 160),
                                           size=wx.Size(80, 20),
                                           style=0)

        self.slider1 = wx.Slider(id=wxID_FRAME1SLIDER1,
                                 maxValue=100,
                                 minValue=0,
                                 name='slider1',
                                 parent=self.panel2,
                                 point=wx.Point(152, 16),
                                 size=wx.Size(136, 20),
                                 style=wx.SL_HORIZONTAL,
                                 validator=wx.DefaultValidator,
                                 value=0)
        self.slider1.Bind(wx.EVT_SCROLL, self.OnSlider1Slider)

        self.scrollBar1 = wx.ScrollBar(id=wxID_FRAME1SCROLLBAR1,
                                       name='scrollBar1',
                                       parent=self.panel2,
                                       pos=wx.Point(16, 192),
                                       size=wx.Size(120, 14),
                                       style=wx.SB_HORIZONTAL)
        self.scrollBar1.SetThumbPosition(0)

        self.staticBitmap1 = wx.StaticBitmap(
            bitmap=Everything_img.getBoaBitmap(),
            id=wxID_FRAME1STATICBITMAP1,
            name='staticBitmap1',
            parent=self.panel2,
            pos=wx.Point(160, 136),
            size=wx.Size(16, 16),
            style=0)

        self.staticLine1 = wx.StaticLine(id=wxID_FRAME1STATICLINE1,
                                         name='staticLine1',
                                         parent=self.panel2,
                                         pos=wx.Point(15, 216),
                                         size=wx.Size(121, 2),
                                         style=0)

        self.staticBox1 = wx.StaticBox(id=wxID_FRAME1STATICBOX1,
                                       label='staticBox1',
                                       name='staticBox1',
                                       parent=self.panel2,
                                       pos=wx.Point(152, 120),
                                       size=wx.Size(144, 40),
                                       style=0)

        self.htmlWindow1 = wx.html.HtmlWindow(id=wxID_FRAME1HTMLWINDOW1,
                                              name='htmlWindow1',
                                              parent=self.panel2,
                                              pos=wx.Point(152, 168),
                                              size=wx.Size(144, 80),
                                              style=wx.html.HW_SCROLLBAR_AUTO)

        self.lEDNumberCtrl1 = wx.gizmos.LEDNumberCtrl(
            id=wxID_FRAME1LEDNUMBERCTRL1,
            parent=self.panel2,
            pos=wx.Point(152, 40),
            size=wx.Size(136, 40),
            style=wx.gizmos.LED_ALIGN_CENTER)
        self.lEDNumberCtrl1.SetValue('123')

        self.panel3 = wx.Panel(id=wxID_FRAME1PANEL3,
                               name='panel3',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)

        self.button1 = wx.Button(id=wxID_FRAME1BUTTON1,
                                 label='button1',
                                 name='button1',
                                 parent=self.panel3,
                                 pos=wx.Point(16, 16),
                                 size=wx.Size(75, 23),
                                 style=0)
        self.button1.Bind(wx.EVT_BUTTON,
                          self.OnButton1Button,
                          id=wxID_FRAME1BUTTON1)
        self.button1.Bind(wx.EVT_LEFT_UP, self.OnButton1LeftUp)

        self.bitmapButton1 = wx.BitmapButton(
            bitmap=Everything_img.getBoaBitmap(),
            id=wxID_FRAME1BITMAPBUTTON1,
            name='bitmapButton1',
            parent=self.panel3,
            pos=wx.Point(16, 56),
            size=wx.Size(72, 24),
            style=wx.BU_AUTODRAW,
            validator=wx.DefaultValidator)
        self.bitmapButton1.Bind(wx.EVT_BUTTON,
                                self.OnBitmapbutton1Button,
                                id=wxID_FRAME1BITMAPBUTTON1)

        self.spinButton1 = wx.SpinButton(id=wxID_FRAME1SPINBUTTON1,
                                         name='spinButton1',
                                         parent=self.panel3,
                                         pos=wx.Point(136, 96),
                                         size=wx.Size(32, 16),
                                         style=wx.SP_HORIZONTAL)
        self.spinButton1.Bind(wx.EVT_COMMAND_SCROLL,
                              self.OnSpinbutton1CommandScroll,
                              id=wxID_FRAME1SPINBUTTON1)

        self.toggleButton1 = wx.ToggleButton(id=wxID_FRAME1TOGGLEBUTTON1,
                                             label='toggleButton1',
                                             name='toggleButton1',
                                             parent=self.panel3,
                                             pos=wx.Point(104, 16),
                                             size=wx.Size(81, 23),
                                             style=0)
        self.toggleButton1.Bind(wx.EVT_BUTTON,
                                self.OnTogglebutton1Button,
                                id=wxID_FRAME1TOGGLEBUTTON1)

        self.genButton1 = wx.lib.buttons.GenButton(id=wxID_FRAME1GENBUTTON1,
                                                   label='genButton1',
                                                   name='genButton1',
                                                   parent=self.panel3,
                                                   pos=wx.Point(16, 160),
                                                   size=wx.Size(88, 37),
                                                   style=0)

        self.genBitmapButton1 = wx.lib.buttons.GenBitmapButton(
            id=wxID_FRAME1GENBITMAPBUTTON1,
            bitmap=Everything_img.getBoaBitmap(),
            name='genBitmapButton1',
            parent=self.panel3,
            pos=wx.Point(16, 192),
            size=wx.Size(59, 58),
            style=0)

        self.genToggleButton1 = wx.lib.buttons.GenToggleButton(
            id=wxID_FRAME1GENTOGGLEBUTTON1,
            label='genToggleButton1',
            name='genToggleButton1',
            parent=self.panel3,
            pos=wx.Point(104, 160),
            size=wx.Size(113, 37),
            style=0)

        self.genBitmapToggleButton1 = wx.lib.buttons.GenBitmapToggleButton(
            id=wxID_FRAME1GENBITMAPTOGGLEBUTTON1,
            bitmap=Everything_img.getBoaBitmap(),
            name='genBitmapToggleButton1',
            parent=self.panel3,
            pos=wx.Point(72, 192),
            size=wx.Size(59, 58),
            style=0)

        self.genBitmapTextToggleButton1 = wx.lib.buttons.GenBitmapTextToggleButton(
            id=wxID_FRAME1GENBITMAPTEXTTOGGLEBUTTON1,
            bitmap=Everything_img.getBoaBitmap(),
            label='genBitmapTextToggleButton1',
            name='genBitmapTextToggleButton1',
            parent=self.panel3,
            pos=wx.Point(128, 192),
            size=wx.Size(88, 58),
            style=0)

        self.contextHelpButton1 = wx.ContextHelpButton(parent=self.panel3,
                                                       pos=wx.Point(136, 64),
                                                       size=wx.Size(20, 19),
                                                       style=wx.BU_AUTODRAW)

        self.panel4 = wx.Panel(id=wxID_FRAME1PANEL4,
                               name='panel4',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)

        self.radioBox1 = wx.RadioBox(choices=['asd'],
                                     id=wxID_FRAME1RADIOBOX1,
                                     label='radioBox1',
                                     majorDimension=1,
                                     name='radioBox1',
                                     parent=self.panel4,
                                     point=wx.Point(16, 16),
                                     size=wx.DefaultSize,
                                     style=wx.RA_SPECIFY_COLS,
                                     validator=wx.DefaultValidator)

        self.listBox1 = wx.ListBox(choices=[],
                                   id=wxID_FRAME1LISTBOX1,
                                   name='listBox1',
                                   parent=self.panel4,
                                   pos=wx.Point(16, 64),
                                   size=wx.Size(115, 63),
                                   style=0,
                                   validator=wx.DefaultValidator)

        self.checkListBox1 = wx.CheckListBox(choices=[],
                                             id=wxID_FRAME1CHECKLISTBOX1,
                                             name='checkListBox1',
                                             parent=self.panel4,
                                             pos=wx.Point(16, 136),
                                             size=wx.Size(115, 63),
                                             style=0,
                                             validator=wx.DefaultValidator)

        self.grid1 = wx.grid.Grid(id=wxID_FRAME1GRID1,
                                  name='grid1',
                                  parent=self.panel4,
                                  pos=wx.Point(144, 16),
                                  size=wx.Size(128, 112),
                                  style=0)

        self.listCtrl1 = wx.ListCtrl(id=wxID_FRAME1LISTCTRL1,
                                     name='listCtrl1',
                                     parent=self.panel4,
                                     pos=wx.Point(280, 16),
                                     size=wx.Size(100, 30),
                                     style=wx.LC_ICON,
                                     validator=wx.DefaultValidator)

        self.treeCtrl1 = wx.TreeCtrl(id=wxID_FRAME1TREECTRL1,
                                     name='treeCtrl1',
                                     parent=self.panel4,
                                     pos=wx.Point(280, 56),
                                     size=wx.Size(100, 80),
                                     style=wx.TR_HAS_BUTTONS,
                                     validator=wx.DefaultValidator)

        self.editableListBox1 = wx.gizmos.EditableListBox(
            id=wxID_FRAME1EDITABLELISTBOX1,
            label='editableListBox1',
            name='editableListBox1',
            parent=self.panel4,
            pos=wx.Point(152, 152),
            size=wx.Size(200, 100))

        self.panel5 = wx.Panel(id=wxID_FRAME1PANEL5,
                               name='panel5',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)
        self.panel5.SetAutoLayout(True)

        self.window2 = wx.Window(id=wxID_FRAME1WINDOW2,
                                 name='window2',
                                 parent=self.panel5,
                                 pos=wx.Point(446, 16),
                                 size=wx.Size(40, 40),
                                 style=0)
        self.window2.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window2.SetConstraints(
            LayoutAnchors(self.window2, False, True, True, False))

        self.window3 = wx.Window(id=wxID_FRAME1WINDOW3,
                                 name='window3',
                                 parent=self.panel5,
                                 pos=wx.Point(16, 299),
                                 size=wx.Size(40, 40),
                                 style=0)
        self.window3.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window3.SetConstraints(
            LayoutAnchors(self.window3, True, False, False, True))

        self.window4 = wx.Window(id=wxID_FRAME1WINDOW4,
                                 name='window4',
                                 parent=self.panel5,
                                 pos=wx.Point(446, 299),
                                 size=wx.Size(40, 40),
                                 style=0)
        self.window4.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window4.SetConstraints(
            LayoutAnchors(self.window4, False, False, True, True))

        self.window5 = wx.Window(id=wxID_FRAME1WINDOW5,
                                 name='window5',
                                 parent=self.panel5,
                                 pos=wx.Point(16, 16),
                                 size=wx.Size(40, 40),
                                 style=0)
        self.window5.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window5.SetConstraints(
            LayoutAnchors(self.window5, True, True, False, False))

        self.window6 = wx.Window(id=wxID_FRAME1WINDOW6,
                                 name='window6',
                                 parent=self.panel5,
                                 pos=wx.Point(192, 16),
                                 size=wx.Size(126, 40),
                                 style=0)
        self.window6.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window6.SetConstraints(
            LayoutAnchors(self.window6, True, True, True, False))

        self.window7 = wx.Window(id=wxID_FRAME1WINDOW7,
                                 name='window7',
                                 parent=self.panel5,
                                 pos=wx.Point(446, 120),
                                 size=wx.Size(40, 115),
                                 style=0)
        self.window7.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window7.SetConstraints(
            LayoutAnchors(self.window7, False, True, True, True))

        self.window8 = wx.Window(id=wxID_FRAME1WINDOW8,
                                 name='window8',
                                 parent=self.panel5,
                                 pos=wx.Point(192, 299),
                                 size=wx.Size(126, 40),
                                 style=0)
        self.window8.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window8.SetConstraints(
            LayoutAnchors(self.window8, True, False, True, True))

        self.window9 = wx.Window(id=wxID_FRAME1WINDOW9,
                                 name='window9',
                                 parent=self.panel5,
                                 pos=wx.Point(16, 120),
                                 size=wx.Size(40, 115),
                                 style=0)
        self.window9.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window9.SetConstraints(
            LayoutAnchors(self.window9, True, True, False, True))

        self.window10 = wx.Window(id=wxID_FRAME1WINDOW10,
                                  name='window10',
                                  parent=self.panel5,
                                  pos=wx.Point(225, 147),
                                  size=wx.Size(40, 40),
                                  style=0)
        self.window10.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window10.SetConstraints(
            LayoutAnchors(self.window10, False, False, False, False))

        self.panel6 = wx.Panel(id=wxID_FRAME1PANEL6,
                               name='panel6',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)

        self.gauge1 = wx.Gauge(id=wxID_FRAME1GAUGE1,
                               name='gauge1',
                               parent=self.panel2,
                               pos=wx.Point(152, 88),
                               range=100,
                               size=wx.Size(136, 16),
                               style=wx.GA_SMOOTH | wx.GA_HORIZONTAL,
                               validator=wx.DefaultValidator)
        self.gauge1.SetValue(50)

        self._init_coll_toolBar1_Tools(self.toolBar1)
        self._init_coll_notebook1_Pages(self.notebook1)
Exemple #2
0
    def create_main_panel(self):
        self.init_plot()
        self.panel = wx.Panel(self)
        ################################################################################################################
        self.hboxfig = wx.StaticBox(self.panel, -1, 'Simulation')
        self.vsizerfig = wx.StaticBoxSizer(self.hboxfig, wx.VERTICAL)
        self.canvas = FigCanvas(self.panel, -1, self.fig)
        ################################################################################################################
        self.vboxvariables = wx.StaticBox(self.panel, -1, 'Variables')
        self.subbox1 = wx.StaticBoxSizer(self.vboxvariables, wx.HORIZONTAL)
        self.radio_n_contigs = wx.RadioButton(self.panel,
                                              -1,
                                              label="N contigs",
                                              style=wx.RB_GROUP)
        self.radio_mean_contigs = wx.RadioButton(
            self.panel, -1, label="Mean contigs length (kb)")
        self.radio_dist_g0 = wx.RadioButton(self.panel,
                                            -1,
                                            label="Distance from G0")
        self.radio_slope = wx.RadioButton(self.panel, -1, label="Slope")
        self.radio_dist_intra = wx.RadioButton(self.panel,
                                               -1,
                                               label="Max intra distance (kb)")

        self.subbox1.Add(self.radio_n_contigs, border=5, flag=wx.ALL)
        self.subbox1.AddSpacer(5)
        self.subbox1.Add(self.radio_mean_contigs, border=5, flag=wx.ALL)
        self.subbox1.AddSpacer(5)
        self.subbox1.Add(self.radio_dist_g0, border=5, flag=wx.ALL)
        self.subbox1.AddSpacer(5)
        self.subbox1.Add(self.radio_slope, border=5, flag=wx.ALL)
        self.subbox1.AddSpacer(5)
        self.subbox1.Add(self.radio_dist_intra, border=5, flag=wx.ALL)
        ################################################################################################################
        self.xmin_control = BoundControlBox(self.panel, -1, "X min", 0)
        self.xmax_control = BoundControlBox(self.panel, -1, "X max", 50)
        self.ymin_control = BoundControlBox(self.panel, -1, "Y min", 0)
        self.ymax_control = BoundControlBox(self.panel, -1, "Y max", 100)

        self.subbox2 = wx.BoxSizer(wx.HORIZONTAL)
        self.subbox2.Add(self.xmin_control, border=5, flag=wx.ALL)
        self.subbox2.Add(self.xmax_control, border=5, flag=wx.ALL)
        self.subbox2.AddSpacer(24)
        self.subbox2.Add(self.ymin_control, border=5, flag=wx.ALL)
        self.subbox2.Add(self.ymax_control, border=5, flag=wx.ALL)
        ################################################################################################################
        self.vsizerfig.Add(
            self.canvas,
            border=15,
            flag=wx.ALL | wx.GROW,
        )
        self.vsizerfig.AddSpacer(3)
        self.vsizerfig.Add(
            self.subbox1,
            border=15,
            flag=wx.ALL | wx.GROW,
        )
        self.vsizerfig.AddSpacer(3)
        self.vsizerfig.Add(
            self.subbox2,
            border=15,
            flag=wx.ALL | wx.GROW,
        )
        ################################################################################################################
        ################################################################################################################
        self.vsizer_left = wx.FlexGridSizer(2, 1, 1, 1)
        self.layout_parameters()
        self.vsizer_left.Add(self.vsizer_param, 1, flag=wx.EXPAND)
        self.layout_run()
        self.vsizer_left.Add(self.vsizer_run, 1, flag=wx.EXPAND)
        ################################################################################################################
        self.BigHbox = wx.BoxSizer(wx.HORIZONTAL)
        self.BigHbox.Add(self.vsizer_left, 0.5, border=15, flag=wx.ALL)
        self.BigHbox.Add(
            self.vsizerfig,
            10,
            border=15,
            flag=wx.LEFT | wx.TOP | wx.GROW,
        )
        # self.BigHbox.Add(self.canvas, 10, border=15, flag=wx.LEFT | wx.TOP | wx.GROW,)

        self.panel.SetSizer(self.BigHbox)
        self.BigHbox.Fit(self)
        self.panel.SetMinSize(self.BigHbox.GetMinSize())
Exemple #3
0
    def _do_layout(self):
        vbox = wx.GridBagSizer(0, 0)
        iy_vb = 0

        # ----- I(q) data -----
        databox = wx.StaticBox(self, -1, "I(q) data source")

        boxsizer1 = wx.StaticBoxSizer(databox, wx.VERTICAL)
        boxsizer1.SetMinSize((self._default_width, 50))
        pars_sizer = wx.GridBagSizer(5, 5)

        iy = 0
        self.file_radio = wx.StaticText(self, -1, "Name:")
        pars_sizer.Add(self.file_radio, (iy, 0), (1, 1),
                       wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)

        self.plot_data = DataFileTextCtrl(self, -1, size=(260, 20))

        pars_sizer.Add(self.plot_data, (iy, 1), (1, 1),
                       wx.EXPAND | wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 15)

        radio_sizer = wx.GridBagSizer(5, 5)

        self.bck_est_ctl = wx.RadioButton(self, -1, "Estimate background level",
            name="estimate_bck", style=wx.RB_GROUP)
        self.bck_man_ctl = wx.RadioButton(self, -1, "Input manual background level",
            name="manual_bck")

        self.bck_est_ctl.Bind(wx.EVT_RADIOBUTTON, self._on_bck_changed)
        self.bck_man_ctl.Bind(wx.EVT_RADIOBUTTON, self._on_bck_changed)

        radio_sizer.Add(self.bck_est_ctl, (0,0), (1,1), wx.LEFT | wx.EXPAND)
        radio_sizer.Add(self.bck_man_ctl, (0,1), (1,1), wx.RIGHT | wx.EXPAND)

        iy += 1
        pars_sizer.Add(radio_sizer, (iy, 0), (1, 2),
                       wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)

        background_label = wx.StaticText(self, -1, "Background: ")
        self.bck_input = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
            size=(60, 20), value="0.0")
        self.bck_input.Disable()
        self.bck_input.Bind(wx.EVT_TEXT, self._read_pars)
        background_units = wx.StaticText(self, -1, "[A^(-1)]", size=(55, 20))
        iy += 1

        background_sizer = wx.GridBagSizer(5, 5)

        background_sizer.Add(background_label, (0, 0), (1,1),
            wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 23)
        background_sizer.Add(self.bck_input, (0, 1), (1,1),
            wx.LEFT | wx.ADJUST_MINSIZE, 5)
        background_sizer.Add(background_units, (0, 2), (1,1),
            wx.LEFT | wx.ADJUST_MINSIZE, 5)
        pars_sizer.Add(background_sizer, (iy, 0), (1, 2),
            wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)

        boxsizer1.Add(pars_sizer, 0, wx.EXPAND)
        vbox.Add(boxsizer1, (iy_vb, 0), (1, 1),
                 wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ADJUST_MINSIZE | wx.TOP, 5)

        # ----- Add slit parameters -----
        if True:
            sbox = wx.StaticBox(self, -1, "Slit parameters")
            sboxsizer = wx.StaticBoxSizer(sbox, wx.VERTICAL)
            sboxsizer.SetMinSize((self._default_width, 20))

            sizer_slit = wx.GridBagSizer(5, 5)

            label_sheight = wx.StaticText(self, -1, "Height", size=(40, 20))
            label_swidth = wx.StaticText(self, -1, "Width", size=(40, 20))
            label_sunits2 = wx.StaticText(self, -1, "[A^(-1)]", size=(55, 20))
            self.sheight_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60, 20))
            self.swidth_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60, 20))
            hint_msg = "Enter slit height in units of Q or leave blank."
            self.sheight_ctl.SetToolTipString(hint_msg)
            hint_msg = "Enter slit width in units of Q or leave blank."
            self.swidth_ctl.SetToolTipString(hint_msg)

            iy = 0
            sizer_slit.Add(label_sheight, (iy, 0), (1, 1), wx.LEFT | wx.EXPAND, 5)
            sizer_slit.Add(self.sheight_ctl, (iy, 1), (1, 1), wx.LEFT | wx.EXPAND, 5)
            sizer_slit.Add(label_swidth, (iy, 2), (1, 1), wx.LEFT | wx.EXPAND, 5)
            sizer_slit.Add(self.swidth_ctl, (iy, 3), (1, 1), wx.LEFT | wx.EXPAND, 5)
            sizer_slit.Add(label_sunits2, (iy, 4), (1, 1), wx.LEFT | wx.EXPAND, 5)

            sboxsizer.Add(sizer_slit, wx.TOP, 15)
            iy_vb += 1
            vbox.Add(sboxsizer, (iy_vb, 0), (1, 1),
                     wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ADJUST_MINSIZE, 5)

        # ----- Q range -----
        qbox = wx.StaticBox(self, -1, "Q range")
        qboxsizer = wx.StaticBoxSizer(qbox, wx.VERTICAL)
        qboxsizer.SetMinSize((self._default_width, 20))

        sizer_q = wx.GridBagSizer(5, 5)

        label_qmin = wx.StaticText(self, -1, "Q min", size=(40, 20))
        label_qmax = wx.StaticText(self, -1, "Q max", size=(40, 20))
        label_qunits2 = wx.StaticText(self, -1, "[A^(-1)]", size=(55, 20))
        self.qmin_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60, 20))
        self.qmax_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60, 20))
        hint_msg = "Select a lower bound for Q or leave blank."
        self.qmin_ctl.SetToolTipString(hint_msg)
        hint_msg = "Select an upper bound for Q or leave blank."
        self.qmax_ctl.SetToolTipString(hint_msg)
        self.qmin_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed)
        self.qmax_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed)

        iy = 0
        sizer_q.Add(label_qmin, (iy, 0), (1, 1), wx.LEFT | wx.EXPAND, 5)
        sizer_q.Add(self.qmin_ctl, (iy, 1), (1, 1), wx.LEFT | wx.EXPAND, 5)
        sizer_q.Add(label_qmax, (iy, 2), (1, 1), wx.LEFT | wx.EXPAND, 5)
        sizer_q.Add(self.qmax_ctl, (iy, 3), (1, 1), wx.LEFT | wx.EXPAND, 5)
        sizer_q.Add(label_qunits2, (iy, 4), (1, 1), wx.LEFT | wx.EXPAND, 5)
        qboxsizer.Add(sizer_q, wx.TOP, 15)

        iy_vb += 1
        vbox.Add(qboxsizer, (iy_vb, 0), (1, 1),
                 wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ADJUST_MINSIZE, 5)

        # ----- Parameters -----
        parsbox = wx.StaticBox(self, -1, "Parameters")
        boxsizer2 = wx.StaticBoxSizer(parsbox, wx.VERTICAL)
        boxsizer2.SetMinSize((self._default_width, 50))

        explanation = "P(r) is found by fitting a set of base functions"
        explanation += " to I(Q). The minimization involves"
        explanation += " a regularization term to ensure a smooth P(r)."
        explanation += " The regularization constant gives the size of that "
        explanation += "term. The suggested value is the value above which the"
        explanation += " output P(r) will have only one peak."
        label_explain = wx.StaticText(self, -1, explanation, size=(280, 90))
        boxsizer2.Add(label_explain, wx.LEFT | wx.BOTTOM, 5)

        label_nfunc = wx.StaticText(self, -1, "Number of terms")
        label_nfunc.SetMinSize((120, 20))
        label_alpha = wx.StaticText(self, -1, "Regularization constant")
        label_dmax = wx.StaticText(self, -1, "Max distance [A]")
        self.label_sugg = wx.StaticText(self, -1, "Suggested value")

        self.nfunc_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60, 20))
        self.nfunc_ctl.SetToolTipString("Number of terms in the expansion.")
        self.alpha_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60, 20))
        hint_msg = "Control parameter for the size of the regularization term."
        self.alpha_ctl.SetToolTipString(hint_msg)
        self.dmax_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60, 20))
        hint_msg = "Maximum distance between any two points in the system."
        self.dmax_ctl.SetToolTipString(hint_msg)
        wx_id = wx.NewId()
        self.alpha_estimate_ctl = wx.Button(self, wx_id, "")
        self.Bind(wx.EVT_BUTTON, self._on_accept_alpha, id=wx_id)
        self.alpha_estimate_ctl.Enable(False)
        self.alpha_estimate_ctl.SetToolTipString("Waiting for estimate...")

        wx_id = wx.NewId()
        self.nterms_estimate_ctl = wx.Button(self, wx_id, "")
        #self.nterms_estimate_ctl.Hide()
        self.Bind(wx.EVT_BUTTON, self._on_accept_nterms, id=wx_id)
        self.nterms_estimate_ctl.Enable(False)

        self.nterms_estimate_ctl.SetToolTipString("Waiting for estimate...")

        self.nfunc_ctl.Bind(wx.EVT_TEXT, self._read_pars)
        self.alpha_ctl.Bind(wx.EVT_TEXT, self._read_pars)
        self.dmax_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed)

        # Distance explorator
        wx_id = wx.NewId()
        self.distance_explorator_ctl = wx.Button(self, wx_id, "Explore")
        self.Bind(wx.EVT_BUTTON, self._on_explore, id=wx_id)


        sizer_params = wx.GridBagSizer(5, 5)

        iy = 0
        sizer_params.Add(self.label_sugg, (iy, 2), (1, 1), wx.LEFT, 15)
        iy += 1
        sizer_params.Add(label_nfunc, (iy, 0), (1, 1), wx.LEFT, 15)
        sizer_params.Add(self.nfunc_ctl, (iy, 1), (1, 1), wx.RIGHT, 0)
        sizer_params.Add(self.nterms_estimate_ctl, (iy, 2), (1, 1), wx.LEFT, 15)
        iy += 1
        sizer_params.Add(label_alpha, (iy, 0), (1, 1), wx.LEFT, 15)
        sizer_params.Add(self.alpha_ctl, (iy, 1), (1, 1), wx.RIGHT, 0)
        sizer_params.Add(self.alpha_estimate_ctl, (iy, 2), (1, 1), wx.LEFT, 15)
        iy += 1
        sizer_params.Add(label_dmax, (iy, 0), (1, 1), wx.LEFT, 15)
        sizer_params.Add(self.dmax_ctl, (iy, 1), (1, 1), wx.RIGHT, 0)
        sizer_params.Add(self.distance_explorator_ctl, (iy, 2),
                         (1, 1), wx.LEFT, 15)

        boxsizer2.Add(sizer_params, 0)

        iy_vb += 1
        vbox.Add(boxsizer2, (iy_vb, 0), (1, 1),
                 wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ADJUST_MINSIZE, 5)


        # ----- Results -----
        resbox = wx.StaticBox(self, -1, "Outputs")
        ressizer = wx.StaticBoxSizer(resbox, wx.VERTICAL)
        ressizer.SetMinSize((self._default_width, 50))

        label_rg = wx.StaticText(self, -1, "Rg")
        label_rg_unit = wx.StaticText(self, -1, "[A]")
        label_iq0 = wx.StaticText(self, -1, "I(Q=0)")
        label_iq0_unit = wx.StaticText(self, -1, "[A^(-1)]")
        label_bck = wx.StaticText(self, -1, "Background")
        label_bck_unit = wx.StaticText(self, -1, "[A^(-1)]")
        self.rg_ctl = OutputTextCtrl(self, -1, size=(60, 20))
        hint_msg = "Radius of gyration for the computed P(r)."
        self.rg_ctl.SetToolTipString(hint_msg)
        self.iq0_ctl = OutputTextCtrl(self, -1, size=(60, 20))
        hint_msg = "Scattering intensity at Q=0 for the computed P(r)."
        self.iq0_ctl.SetToolTipString(hint_msg)
        self.bck_ctl = OutputTextCtrl(self, -1, size=(60, 20))
        self.bck_ctl.SetToolTipString("Value of estimated constant background.")

        label_time = wx.StaticText(self, -1, "Computation time")
        label_time_unit = wx.StaticText(self, -1, "secs")
        label_time.SetMinSize((120, 20))
        label_chi2 = wx.StaticText(self, -1, "Chi2/dof")
        label_osc = wx.StaticText(self, -1, "Oscillations")
        label_pos = wx.StaticText(self, -1, "Positive fraction")
        label_pos_err = wx.StaticText(self, -1, "1-sigma positive fraction")

        self.time_ctl = OutputTextCtrl(self, -1, size=(60, 20))
        hint_msg = "Computation time for the last inversion, in seconds."
        self.time_ctl.SetToolTipString(hint_msg)

        self.chi2_ctl = OutputTextCtrl(self, -1, size=(60, 20))
        self.chi2_ctl.SetToolTipString("Chi^2 over degrees of freedom.")

        # Oscillation parameter
        self.osc_ctl = OutputTextCtrl(self, -1, size=(60, 20))
        hint_msg = "Oscillation parameter. P(r) for a sphere has an "
        hint_msg += " oscillation parameter of 1.1."
        self.osc_ctl.SetToolTipString(hint_msg)

        # Positive fraction figure of merit
        self.pos_ctl = OutputTextCtrl(self, -1, size=(60, 20))
        hint_msg = "Fraction of P(r) that is positive. "
        hint_msg += "Theoretically, P(r) is defined positive."
        self.pos_ctl.SetToolTipString(hint_msg)

        # 1-simga positive fraction figure of merit
        self.pos_err_ctl = OutputTextCtrl(self, -1, size=(60, 20))
        message = "Fraction of P(r) that is at least 1 standard deviation"
        message += " greater than zero.\n"
        message += "This figure of merit tells you about the size of the "
        message += "P(r) errors.\n"
        message += "If it is close to 1 and the other figures of merit are bad,"
        message += " consider changing the maximum distance."
        self.pos_err_ctl.SetToolTipString(message)

        sizer_res = wx.GridBagSizer(5, 5)

        iy = 0
        sizer_res.Add(label_rg, (iy, 0), (1, 1), wx.LEFT | wx.EXPAND, 15)
        sizer_res.Add(self.rg_ctl, (iy, 1), (1, 1), wx.RIGHT | wx.EXPAND, 15)
        sizer_res.Add(label_rg_unit, (iy, 2), (1, 1), wx.RIGHT | wx.EXPAND, 15)
        iy += 1
        sizer_res.Add(label_iq0, (iy, 0), (1, 1), wx.LEFT | wx.EXPAND, 15)
        sizer_res.Add(self.iq0_ctl, (iy, 1), (1, 1), wx.RIGHT | wx.EXPAND, 15)
        sizer_res.Add(label_iq0_unit, (iy, 2), (1, 1), wx.RIGHT | wx.EXPAND, 15)
        iy += 1
        sizer_res.Add(label_bck, (iy, 0), (1, 1), wx.LEFT | wx.EXPAND, 15)
        sizer_res.Add(self.bck_ctl, (iy, 1), (1, 1), wx.RIGHT | wx.EXPAND, 15)
        sizer_res.Add(label_bck_unit, (iy, 2), (1, 1), wx.RIGHT | wx.EXPAND, 15)
        iy += 1
        sizer_res.Add(label_time, (iy, 0), (1, 1), wx.LEFT | wx.EXPAND, 15)
        sizer_res.Add(self.time_ctl, (iy, 1), (1, 1), wx.RIGHT | wx.EXPAND, 15)
        sizer_res.Add(label_time_unit, (iy, 2), (1, 1), wx.RIGHT | wx.EXPAND, 15)
        iy += 1
        sizer_res.Add(label_chi2, (iy, 0), (1, 1), wx.LEFT | wx.EXPAND, 15)
        sizer_res.Add(self.chi2_ctl, (iy, 1), (1, 1), wx.RIGHT | wx.EXPAND, 15)
        iy += 1
        sizer_res.Add(label_osc, (iy, 0), (1, 1), wx.LEFT | wx.EXPAND, 15)
        sizer_res.Add(self.osc_ctl, (iy, 1), (1, 1), wx.RIGHT | wx.EXPAND, 15)

        iy += 1
        sizer_res.Add(label_pos, (iy, 0), (1, 1), wx.LEFT | wx.EXPAND, 15)
        sizer_res.Add(self.pos_ctl, (iy, 1), (1, 1), wx.RIGHT | wx.EXPAND, 15)

        iy += 1
        sizer_res.Add(label_pos_err, (iy, 0), (1, 1), wx.LEFT | wx.EXPAND, 15)
        sizer_res.Add(self.pos_err_ctl, (iy, 1), (1, 1), wx.RIGHT | wx.EXPAND, 15)

        ressizer.Add(sizer_res, 0)
        iy_vb += 1
        vbox.Add(ressizer, (iy_vb, 0), (1, 1),
                 wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ADJUST_MINSIZE, 5)

        # ----- Buttons -----
        wx_id = wx.NewId()
        button_ok = wx.Button(self, wx_id, "Compute")
        button_ok.SetToolTipString("Perform P(r) inversion.")
        self.Bind(wx.EVT_BUTTON, self._on_invert, id=wx_id)

        self.button_help = wx.Button(self, -1, "HELP")
        self.button_help.SetToolTipString("Get help on P(r) inversion.")
        self.button_help.Bind(wx.EVT_BUTTON, self.on_help)

        self._set_reset_flag(True)
        self._set_save_flag(True)
        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
        sizer_button.Add((20, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        sizer_button.Add(button_ok, 0, wx.LEFT | wx.ADJUST_MINSIZE, 10)
        sizer_button.Add(self.button_help, 0, wx.LEFT | wx.ADJUST_MINSIZE, 10)

        iy_vb += 1
        vbox.Add(sizer_button, (iy_vb, 0), (1, 1),
                 wx.EXPAND | wx.BOTTOM | wx.TOP | wx.RIGHT, 10)

        self.Bind(wx.EVT_TEXT_ENTER, self._on_invert)

        self.SetSizer(vbox)
Exemple #4
0
    def makeControlbar(self):
        """Make controlbar."""

        # init toolbar
        panel = mwx.bgrPanel(self,
                             -1,
                             images.lib['bgrControlbar'],
                             size=(-1, mwx.CONTROLBAR_HEIGHT))

        # make elements
        massType_label = wx.StaticText(panel, -1, "Mass:")
        massType_label.SetFont(wx.SMALL_FONT)

        self.massTypeMo_radio = wx.RadioButton(panel,
                                               -1,
                                               "Mo",
                                               style=wx.RB_GROUP)
        self.massTypeMo_radio.SetFont(wx.SMALL_FONT)
        self.massTypeMo_radio.SetValue(True)

        self.massTypeAv_radio = wx.RadioButton(panel, -1, "Av")
        self.massTypeAv_radio.SetFont(wx.SMALL_FONT)
        self.massTypeAv_radio.SetValue(config.compoundsSearch['massType'])

        maxCharge_label = wx.StaticText(panel, -1, "Max charge:")
        maxCharge_label.SetFont(wx.SMALL_FONT)

        self.maxCharge_value = wx.TextCtrl(
            panel,
            -1,
            str(config.compoundsSearch['maxCharge']),
            size=(30, mwx.SMALL_TEXTCTRL_HEIGHT),
            validator=mwx.validator('int'))
        self.maxCharge_value.SetFont(wx.SMALL_FONT)

        self.radicals_check = wx.CheckBox(panel, -1, "M*")
        self.radicals_check.SetFont(wx.SMALL_FONT)
        self.radicals_check.SetValue(config.compoundsSearch['radicals'])

        adducts_label = wx.StaticText(panel, -1, "Adducts:")
        adducts_label.SetFont(wx.SMALL_FONT)

        self.adductNa_check = wx.CheckBox(panel, -1, "Na")
        self.adductNa_check.SetFont(wx.SMALL_FONT)
        self.adductNa_check.SetValue(
            config.compoundsSearch['adducts'].count('Na'))

        self.adductK_check = wx.CheckBox(panel, -1, "K")
        self.adductK_check.SetFont(wx.SMALL_FONT)
        self.adductK_check.SetValue(
            config.compoundsSearch['adducts'].count('K'))

        self.adductLi_check = wx.CheckBox(panel, -1, "Li")
        self.adductLi_check.SetFont(wx.SMALL_FONT)
        self.adductLi_check.SetValue(
            config.compoundsSearch['adducts'].count('Li'))

        self.adductNH4_check = wx.CheckBox(panel, -1, "NH4")
        self.adductNH4_check.SetFont(wx.SMALL_FONT)
        self.adductNH4_check.SetValue(
            config.compoundsSearch['adducts'].count('NH4'))

        self.adductH2O_check = wx.CheckBox(panel, -1, "-H2O")
        self.adductH2O_check.SetFont(wx.SMALL_FONT)
        self.adductH2O_check.SetValue(
            config.compoundsSearch['adducts'].count('-H2O'))

        self.adductACN_check = wx.CheckBox(panel, -1, "ACN")
        self.adductACN_check.SetFont(wx.SMALL_FONT)
        self.adductACN_check.SetValue(
            config.compoundsSearch['adducts'].count('ACN'))

        self.adductMeOH_check = wx.CheckBox(panel, -1, "MeOH")
        self.adductMeOH_check.SetFont(wx.SMALL_FONT)
        self.adductMeOH_check.SetValue(
            config.compoundsSearch['adducts'].count('MeOH'))

        # pack elements
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.AddSpacer(mwx.CONTROLBAR_LSPACE)
        sizer.Add(massType_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
        sizer.Add(self.massTypeMo_radio, 0,
                  wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
        sizer.Add(self.massTypeAv_radio, 0, wx.ALIGN_CENTER_VERTICAL)
        sizer.AddSpacer(20)
        sizer.Add(maxCharge_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
        sizer.Add(self.maxCharge_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                  5)
        sizer.Add(self.radicals_check, 0, wx.ALIGN_CENTER_VERTICAL)
        sizer.AddSpacer(20)
        sizer.Add(adducts_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
        sizer.Add(self.adductNa_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                  5)
        sizer.Add(self.adductK_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                  5)
        sizer.Add(self.adductLi_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                  5)
        sizer.Add(self.adductNH4_check, 0, wx.ALIGN_CENTER_VERTICAL)
        sizer.AddSpacer(20)
        sizer.Add(self.adductH2O_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                  5)
        sizer.Add(self.adductACN_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                  5)
        sizer.Add(self.adductMeOH_check, 0, wx.ALIGN_CENTER_VERTICAL)
        sizer.AddSpacer(mwx.CONTROLBAR_RSPACE)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(sizer, 1, wx.EXPAND)
        mainSizer.Fit(panel)
        panel.SetSizer(mainSizer)

        return panel
    def __init__(self, parent, dictOptions={}):
        wx.Panel.__init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL)
        self.parent = parent

        # Orientation
        self.box_orientation_staticbox = wx.StaticBox(self, -1,
                                                      _(u"Orientation"))
        self.ctrl_radio_portrait = wx.RadioButton(self,
                                                  -1,
                                                  u"",
                                                  style=wx.RB_GROUP)
        self.ctrl_image_portrait = wx.StaticBitmap(
            self, -1,
            wx.Bitmap(
                Chemins.GetStaticPath(
                    u"Images/32x32/Orientation_vertical.png"),
                wx.BITMAP_TYPE_ANY))
        self.ctrl_radio_paysage = wx.RadioButton(self, -1, u"")
        self.ctrl_image_paysage = wx.StaticBitmap(
            self, -1,
            wx.Bitmap(
                Chemins.GetStaticPath(
                    u"Images/32x32/Orientation_horizontal.png"),
                wx.BITMAP_TYPE_ANY))

        # Textes
        self.box_document_staticbox = wx.StaticBox(self, -1, _(u"Document"))
        self.label_titre = wx.StaticText(self, -1, _(u"Titre :"))
        self.ctrl_titre = wx.TextCtrl(self, -1, u"")
        self.label_introduction = wx.StaticText(self, -1, _(u"Introduction :"))
        self.ctrl_introduction = wx.TextCtrl(self, -1, u"")
        self.label_conclusion = wx.StaticText(self, -1, _(u"Conclusion :"))
        self.ctrl_conclusion = wx.TextCtrl(self, -1, u"")

        # Paramètres généraux
        self.box_options_staticbox = wx.StaticBox(self, -1,
                                                  _(u"Options d'impression"))
        self.ctrl_parametres = CTRL_Parametres(self)
        self.ctrl_parametres.Importation()
        self.bouton_reinitialisation = CTRL_Propertygrid.Bouton_reinitialisation(
            self, self.ctrl_parametres)
        self.bouton_sauvegarde = CTRL_Propertygrid.Bouton_sauvegarde(
            self, self.ctrl_parametres)
        self.ctrl_parametres.SetMinSize((440, 120))

        self.__do_layout()

        # Properties
        self.ctrl_radio_portrait.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour sélectionner une orientation portrait")))
        self.ctrl_image_portrait.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour sélectionner une orientation portrait")))
        self.ctrl_radio_paysage.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour sélectionner une orientation paysage")))
        self.ctrl_image_paysage.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour sélectionner une orientation paysage")))
        self.ctrl_titre.SetToolTip(
            wx.ToolTip(_(u"Vous pouvez modifier ici le titre du document")))
        self.ctrl_introduction.SetToolTip(
            wx.ToolTip(
                _(u"Vous pouvez modifier ici l'introduction du document")))
        self.ctrl_conclusion.SetToolTip(
            wx.ToolTip(
                _(u"Vous pouvez modifier ici la conclusion du document")))

        # Bind
        self.ctrl_image_portrait.Bind(wx.EVT_LEFT_DOWN,
                                      self.OnLeftDownPortrait)
        self.ctrl_image_paysage.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDownPaysage)

        # Init contrôle
        if dictOptions.has_key("titre") and dictOptions["titre"] != None:
            self.ctrl_titre.SetValue(dictOptions["titre"])
        if dictOptions.has_key(
                "introduction") and dictOptions["introduction"] != None:
            self.ctrl_introduction.SetValue(dictOptions["introduction"])
        if dictOptions.has_key(
                "conclusion") and dictOptions["conclusion"] != None:
            self.ctrl_conclusion.SetValue(dictOptions["conclusion"])
        if dictOptions.has_key(
                "orientation") and dictOptions["orientation"] != None:
            self.SetOrientation(dictOptions["orientation"])
Exemple #6
0
    def __init__(self, parent, ID, app):
        """Latest is optional extra. If not given it will be fetched.
        """
        self.app = app
        # get latest version info if poss
        if app.updater in [False, None]:
            # user has turned off check for updates in prefs so check now
            app.updater = updater = Updater(app=self.app)
            # don't need a warning - we'll provide one ourselves
            self.latest = updater.getLatestInfo(warnMsg=False)
        else:
            self.latest = app.updater.latest
        self.runningVersion = app.updater.runningVersion
        wx.Dialog.__init__(self,
                           parent,
                           ID,
                           title=_translate('PsychoPy Updates'),
                           size=(100, 200))

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        # set the actual content of status msg later in self.updateStatus()
        self.statusMessage = wx.StaticText(self,
                                           -1,
                                           "msg",
                                           style=wx.ALIGN_CENTER)
        mainSizer.Add(self.statusMessage, flag=wx.EXPAND | wx.ALL, border=5)
        # ctrls for auto-update from web
        msg = _translate(" Auto-update (will fetch latest version)")
        self.useLatestBtn = wx.RadioButton(self, -1, msg, style=wx.RB_GROUP)
        self.Bind(wx.EVT_RADIOBUTTON, self.onRadioSelect, self.useLatestBtn)
        self.progressBar = wx.Gauge(self, -1, 100, size=(250, 25))
        mainSizer.Add(self.useLatestBtn, flag=wx.ALIGN_LEFT | wx.ALL, border=5)
        mainSizer.Add(self.progressBar, flag=wx.EXPAND | wx.ALL, border=5)
        # ctrls for updating from specific zip file
        msg = _translate(" Use zip file below (download a PsychoPy release "
                         "file ending .zip)")
        self.useZipBtn = wx.RadioButton(self, -1, msg)
        self.Bind(wx.EVT_RADIOBUTTON, self.onRadioSelect, self.useZipBtn)
        self.fileBrowseCtrl = wx.lib.filebrowsebutton.FileBrowseButton(
            self,
            -1,
            size=(450, -1),
            changeCallback=self.onFileBrowse,
            fileMask='*.zip')
        mainSizer.Add(self.useZipBtn, flag=wx.ALIGN_LEFT | wx.ALL, border=5)
        mainSizer.Add(self.fileBrowseCtrl,
                      flag=wx.ALIGN_LEFT | wx.ALL,
                      border=5)
        # ctrls for buttons (install/cancel)
        self.installBtn = wx.Button(self, -1, _translate('Install'))
        self.Bind(wx.EVT_BUTTON, self.onInstall, self.installBtn)
        self.installBtn.SetDefault()
        self.cancelBtn = wx.Button(self, -1, _translate('Close'))
        self.Bind(wx.EVT_BUTTON, self.onCancel, self.cancelBtn)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        btnSizer.Add(self.installBtn, flag=wx.ALIGN_RIGHT)
        btnSizer.Add(self.cancelBtn, flag=wx.ALIGN_RIGHT | wx.LEFT, border=5)
        mainSizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)

        self.SetSizerAndFit(mainSizer)
        self.SetAutoLayout(True)

        # positioning and sizing
        self.updateStatus()
        self.Center()
        self.ShowModal()
Exemple #7
0
    def __init__(self, parent, page):
        PageInstaller.__init__(self, parent)

        # group_sizer -> [option_button, ...]
        self.group_option_map = {}

        sizer_main = wx.FlexGridSizer(2, 1, 10, 10)
        label_step_name = balt.StaticText(self,
                                          page.name,
                                          style=wx.ALIGN_CENTER)
        label_step_name.SetFont(
            wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        sizer_main.Add(label_step_name, 0, wx.EXPAND)
        sizer_content = wx.GridSizer(1, 2, 5, 5)

        sizer_extra = wx.GridSizer(2, 1, 5, 5)
        self.bmp_item = balt.Picture(self, 0, 0, background=None)
        self._img_cache = {}  # creating images can be really expensive
        self.text_item = balt.RoTextCtrl(self, autotooltip=False)
        sizer_extra.Add(self.bmp_item, 1, wx.EXPAND | wx.ALL)
        sizer_extra.Add(self.text_item, 1, wx.EXPAND | wx.ALL)

        panel_groups = wx.ScrolledWindow(self, -1)
        panel_groups.SetScrollbars(20, 20, 50, 50)
        sizer_groups = wx.FlexGridSizer(len(page), 1, 5, 5)
        for row in xrange(len(page)):
            sizer_groups.AddGrowableRow(row)
        for group in page:
            options_num = len(group)

            sizer_group = wx.FlexGridSizer(2, 1, 7, 7)
            sizer_group.AddGrowableRow(1)
            sizer_group.group_object = group
            sizer_group.Add(balt.StaticText(panel_groups, group.name))

            sizer_options = wx.GridSizer(options_num, 1, 2, 2)
            sizer_group.Add(sizer_options)

            first_selectable = None
            any_selected = False

            # whenever there is a required option in a exactlyone/atmostone group
            # all other options need to be disable to ensure the required stays
            # selected
            required_disable = False

            # group type forces selection
            group_force_selection = group.type in (
                "SelectExactlyOne",
                "SelectAtLeastOne",
            )

            for option in group:
                if group.type in ("SelectExactlyOne", "SelectAtMostOne"):
                    radio_style = wx.RB_GROUP if option is group[0] else 0
                    button = wx.RadioButton(panel_groups,
                                            label=option.name,
                                            style=radio_style)
                else:
                    button = balt.checkBox(panel_groups, label=option.name)
                    if group.type == "SelectAll":
                        button.SetValue(True)
                        any_selected = True
                        button.Disable()

                if option.type == "Required":
                    button.SetValue(True)
                    any_selected = True
                    if group.type in ("SelectExactlyOne", "SelectAtMostOne"):
                        required_disable = True
                    else:
                        button.Disable()
                elif option.type == "Recommended":
                    if not any_selected or not group_force_selection:
                        button.SetValue(True)
                        any_selected = True
                elif option.type in ("Optional", "CouldBeUsable"):
                    if first_selectable is None:
                        first_selectable = button
                elif option.type == "NotUsable":
                    button.SetValue(False)
                    button.Disable()

                button.option_object = option
                sizer_options.Add(button)
                button.Bind(wx.EVT_ENTER_WINDOW, self.on_hover)
                self.group_option_map.setdefault(sizer_group,
                                                 []).append(button)

            if not any_selected and group_force_selection:
                if first_selectable is not None:
                    first_selectable.SetValue(True)
                    any_selected = True

            if required_disable:
                for button in self.group_option_map[sizer_group]:
                    button.Disable()

            if group.type == "SelectAtMostOne":
                none_button = wx.RadioButton(panel_groups, label="None")
                if not any_selected:
                    none_button.SetValue(True)
                elif required_disable:
                    none_button.Disable()
                sizer_options.Add(none_button)

            sizer_groups.Add(sizer_group, wx.ID_ANY, wx.EXPAND)

        panel_groups.SetSizer(sizer_groups)
        sizer_content.Add(panel_groups, 1, wx.EXPAND)
        sizer_content.Add(sizer_extra, 1, wx.EXPAND)
        sizer_main.Add(sizer_content, 1, wx.EXPAND)
        sizer_main.AddGrowableRow(1)
        sizer_main.AddGrowableCol(0)

        self.SetSizer(sizer_main)
        self.Layout()
Exemple #8
0
    def __DoLayout(self):
        """Layout the panel"""
        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        vsizer = wx.BoxSizer(wx.VERTICAL)

        # Top Section
        topvsizer = wx.BoxSizer(wx.VERTICAL)

        # Platform dependant labels
        if wx.Platform == '__WXMSW__':
            findlbl = wx.StaticText(self, ID_FIND_LBL, _("Find what") + u":")
        else:
            findlbl = wx.StaticText(self, ID_FIND_LBL, _("Find") + u":")

        # Search Field
        fhsizer = wx.BoxSizer(wx.HORIZONTAL)
        fhsizer.Add(self._ftxt, 1, wx.EXPAND)
        topvsizer.AddMany([(findlbl, 0, wx.ALIGN_LEFT), ((3, 3), 0),
                           (fhsizer, 0, wx.EXPAND)])

        # Replace field
        rhsizer = wx.BoxSizer(wx.HORIZONTAL)
        rhsizer.Add(self._rtxt, 1, wx.EXPAND)
        rlbl = wx.StaticText(self, ID_REPLACE_LBL, _("Replace with") + u":")
        self._sizers[ID_REPLACE_LBL] = wx.BoxSizer(wx.VERTICAL)
        self._sizers[ID_REPLACE_LBL].AddMany([((5, 5), 0),
                                              (rlbl, 0,
                                               wx.ALIGN_CENTER_VERTICAL),
                                              ((3, 3), 0),
                                              (rhsizer, 0, wx.EXPAND)])
        topvsizer.AddMany([(self._sizers[ID_REPLACE_LBL], 0, wx.EXPAND),
                           ((5, 5), 0)])

        # Look in field
        self._sizers['look'] = wx.BoxSizer(wx.VERTICAL)
        li_sz = wx.BoxSizer(wx.HORIZONTAL)
        dirbtn = wx.Button(self, ID_CHOOSE_DIR, u"...", style=wx.BU_EXACTFIT)
        dirbtn.SetToolTipString(_("Choose Folder"))
        li_sz.AddMany([(self._lookin, 1, wx.ALIGN_CENTER_VERTICAL),
                       ((5, 5), 0), (dirbtn, 0, wx.ALIGN_CENTER_VERTICAL)])
        li_lbl = wx.StaticText(self, label=_("Look in") + u":")
        self._sizers['look'].AddMany([(li_lbl, 0, wx.ALIGN_LEFT), ((3, 3), 0),
                                      (li_sz, 0, wx.EXPAND), ((5, 5), 0)])
        topvsizer.Add(self._sizers['look'], 0, wx.EXPAND)

        # Search Direction Box
        self._sizers['dir'] = wx.BoxSizer(wx.VERTICAL)
        dbox = wx.StaticBox(self, id=ID_DIR_BOX, label=_("Direction"))
        dboxsz = wx.StaticBoxSizer(dbox, wx.HORIZONTAL)
        dboxsz.AddMany([(wx.RadioButton(self, wx.ID_UP, _("Up")), 0),
                        ((20, 5), 0),
                        (wx.RadioButton(self, wx.ID_DOWN, _("Down")), 0),
                        ((5, 5), 1)])
        self._sizers['dir'].AddMany([((5, 5), 0), (dboxsz, 0, wx.EXPAND)])

        # Search Options Box
        self._sizers['opt'] = wx.BoxSizer(wx.VERTICAL)
        statbox = wx.StaticBox(self, label=_("Find Options"))
        sboxsz = wx.StaticBoxSizer(statbox, wx.VERTICAL)
        for cid, clbl in [(ID_MATCH_CASE, _("Match case")),
                          (ID_WHOLE_WORD, _("Whole word")),
                          (ID_REGEX, _("Regular expression")),
                          (ID_RECURSE, _("Search Recursively"))]:
            sboxsz.AddMany([((3, 3), 0), (wx.CheckBox(self, cid, clbl), 0)])

        # File Filters
        self._sizers['filter'] = wx.BoxSizer(wx.VERTICAL)
        self._filters = wx.TextCtrl(self)
        tt_txt = _(
            "Wildcard shell patterns for matching files (*.txt *.html).")
        self._filters.SetToolTipString(tt_txt)

        # Disable spell checking on mac for this control
        if wx.Platform == '__WXMAC__':
            self._filters.MacCheckSpelling(False)

        f_sz = wx.BoxSizer(wx.HORIZONTAL)
        f_sz.Add(self._filters, 1, wx.EXPAND)
        self._sizers['filter'].AddMany([(self._filterlbl, 0, wx.ALIGN_LEFT),
                                        ((3, 3), 0), (f_sz, 0, wx.EXPAND),
                                        ((5, 5), 0)])
        sboxsz.AddMany([((3, 3), 0), (self._sizers['filter'], 0, wx.EXPAND)])

        self._sizers['opt'].AddMany([((5, 5), 0), (sboxsz, 0, wx.EXPAND)])

        # Buttons
        bsizer = wx.BoxSizer(wx.HORIZONTAL)
        self._sizers['fspacer'] = bsizer.Add((100, 1), 1)
        self._sizers['frspacer'] = bsizer.Add((50, 1), 1)
        for bid, blbl in [(wx.ID_FIND, _("Find")),
                          (wx.ID_REPLACE, _("Replace")),
                          (ID_COUNT, _("Count")), (ID_FIND_ALL, _("Find All")),
                          (ID_REPLACE_ALL, _("Replace All"))]:
            self._sizers[bid] = wx.BoxSizer(wx.HORIZONTAL)
            self._sizers[bid].Add((3, 3), 0)
            self._sizers[bid].Add(wx.Button(self, bid, blbl), 0,
                                  wx.ALIGN_RIGHT)
            bsizer.Add(self._sizers[bid], 0)
        self.FindWindowById(wx.ID_FIND).SetDefault()

        # Final Layout
        vsizer.AddMany([((5, 5), 0), (topvsizer, 0, wx.EXPAND),
                        (self._sizers['dir'], 0, wx.EXPAND),
                        (self._sizers['opt'], 0, wx.EXPAND), ((10, 10), 0),
                        (bsizer, 0), ((10, 10), 0)])
        hsizer.AddMany([((10, 10), 0), (vsizer, 0, wx.EXPAND), ((10, 10), 0)])
        self.SetSizer(hsizer)
        self.SetAutoLayout(True)
Exemple #9
0
    def __init__(self, parent, title):
        super().__init__(parent, title=title, size=(600, 450))
        self.sb = self.CreateStatusBar()
        self.sb.SetStatusText("Текст в статусной строке")

        panel = wx.Panel(self)
        vbox = wx.BoxSizer(wx.VERTICAL)

        st = wx.StaticText(panel, label="Адрес: ")
        vbox.Add(st, flag=wx.ALL, border=10)

        inp = wx.TextCtrl(panel, value="г. Москва")
        vbox.Add(inp,
                 flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                 border=10)

        vbox.Add(wx.StaticLine(panel),
                 flag=wx.EXPAND | wx.LEFT | wx.RIGHT,
                 border=10)

        rtb = wx.ToggleButton(panel, id=B_RED, label='red', pos=(20, 25))
        gtb = wx.ToggleButton(panel, id=B_GREEN, label='green', pos=(20, 60))
        btb = wx.ToggleButton(panel, id=B_BLUE, label='blue', pos=(20, 100))

        self.col = wx.Colour(0, 0, 0)
        self.pn = wx.Panel(panel)
        self.pn.SetBackgroundColour(self.col.GetAsString())

        vb1 = wx.GridBagSizer(10, 10)
        vb1.Add(rtb, (0, 0))
        vb1.Add(gtb, (1, 0))
        vb1.Add(btb, (2, 0))
        vb1.Add(self.pn, (0, 1), (3, 1), flag=wx.EXPAND)
        vb1.AddGrowableCol(1)

        vbox.Add(vb1, flag=wx.EXPAND | wx.ALL, border=10)

        vbox.Add(wx.StaticLine(panel),
                 flag=wx.EXPAND | wx.LEFT | wx.RIGHT,
                 border=10)

        rtb.Bind(wx.EVT_TOGGLEBUTTON, self.onToggle)
        gtb.Bind(wx.EVT_TOGGLEBUTTON, self.onToggle)
        btb.Bind(wx.EVT_TOGGLEBUTTON, self.onToggle)

        pn2 = wx.Panel(panel)
        wx.StaticBox(pn2, label="Ваш пол:", size=(150, 50))

        rd1 = wx.RadioButton(pn2, label="Муж", pos=(10, 20), style=wx.RB_GROUP)
        rd2 = wx.RadioButton(pn2, label="Жен", pos=(100, 20))

        vb2 = wx.BoxSizer(wx.HORIZONTAL)
        vb2.Add(pn2)

        agree = wx.CheckBox(panel, label="Согласен на обработку")
        agree.SetValue(True)

        vb2.Add(agree, flag=wx.LEFT | wx.TOP, border=20)

        links = ["Телефон", "E-mail", "Skype"]
        cb = wx.ComboBox(panel,
                         pos=(50, 30),
                         choices=links,
                         style=wx.CB_READONLY)
        cb.SetSelection(0)

        vb2.Add(cb, flag=wx.LEFT | wx.TOP, border=15)

        sc = wx.SpinCtrl(panel, value='0', min=-100, max=100)

        vb2.Add(sc, flag=wx.LEFT | wx.TOP, border=15)

        vbox.Add(vb2, flag=wx.EXPAND | wx.ALL, border=10)

        self.gauge = wx.Gauge(panel, range=100)

        vbox.Add(self.gauge, flag=wx.EXPAND | wx.ALL, border=10)

        bStart = wx.Button(panel, label="Старт")
        bStop = wx.Button(panel, label="Стоп")

        hb3 = wx.BoxSizer()
        hb3.AddMany([(bStart, 0, wx.LEFT | wx.RIGHT, 10),
                     (bStop, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM, 10)])
        vbox.Add(hb3, flag=wx.ALIGN_CENTRE)

        vbox.Add(wx.StaticLine(panel),
                 flag=wx.EXPAND | wx.LEFT | wx.RIGHT,
                 border=10)

        sld = wx.Slider(panel,
                        value=200,
                        minValue=150,
                        maxValue=500,
                        style=wx.SL_HORIZONTAL)

        vbox.Add(sld, flag=wx.EXPAND | wx.ALL, border=10)

        panel.SetSizer(vbox)

        bStart.Bind(wx.EVT_BUTTON, self.onStart)
        bStop.Bind(wx.EVT_BUTTON, self.onStop)

        sld.Bind(wx.EVT_SCROLL, self.OnSliderScroll)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
        self.count = 0
        self.gauge.SetValue(self.count)
    def PopulateLeftPanel(self):

        pnl = wx.Panel(self.leftpanel)
        mainsizer = wx.BoxSizer(wx.VERTICAL)

        staticboxstyles = wx.StaticBox(pnl, -1, "UltimateListCtrl Styles")
        stylesizer = wx.StaticBoxSizer(staticboxstyles, wx.VERTICAL)
        staticboxthemes = wx.StaticBox(pnl, -1,
                                       "UltimateListCtrl Themes/Gradients")
        themessizer = wx.StaticBoxSizer(staticboxthemes, wx.VERTICAL)

        self.ulcstyles = []
        sorted_styles = []

        for style in _ulcStyles:
            sorted_styles.append((style, eval("ULC." + style)))

        sorted_styles.sort(key=operator.itemgetter(1))

        count = 0
        for styleName, styleVal in sorted_styles:

            if styleName in [
                    "ULC_VIRTUAL", "ULC_TILE", "ULC_LIST", "ULC_ICON",
                    "ULC_SMALL_ICON", "ULC_AUTOARRANGE"
            ]:
                continue

            if "SORT" in styleName or "ALIGN" in styleName or "VIEWS" in styleName:
                continue

            if count == 0:
                tags = wx.ALL
            else:
                tags = wx.LEFT | wx.RIGHT | wx.BOTTOM

            check = wx.CheckBox(pnl, -1, styleName)
            stylesizer.Add(check, 0, tags, 3)

            if self.ulc.list.HasAGWFlag(styleVal):
                check.SetValue(1)
            else:
                check.SetValue(0)

            if styleName in ["ULC_HAS_VARIABLE_ROW_HEIGHT", "ULC_REPORT"]:
                check.SetValue(1)
                check.Enable(False)

            check.Bind(wx.EVT_CHECKBOX, self.OnCheckStyle)
            self.ulcstyles.append(check)
            count += 1

        sizera = wx.BoxSizer(wx.HORIZONTAL)
        self.checknormal = wx.CheckBox(pnl, -1, "Standard Colours")
        self.checknormal.Bind(wx.EVT_CHECKBOX, self.OnCheckNormal)
        sizera.Add(self.checknormal, 0, wx.ALL, 3)

        sizerb = wx.BoxSizer(wx.VERTICAL)
        self.checkgradient = wx.CheckBox(pnl, -1, "Gradient Theme")
        self.checkgradient.Bind(wx.EVT_CHECKBOX, self.OnCheckGradient)
        sizerb1 = wx.BoxSizer(wx.HORIZONTAL)
        sizerb1.Add((10, 0))
        self.radiohorizontal = wx.RadioButton(pnl,
                                              -1,
                                              "Horizontal",
                                              style=wx.RB_GROUP)
        self.radiohorizontal.Bind(wx.EVT_RADIOBUTTON, self.OnHorizontal)
        sizerb1.Add(self.radiohorizontal, 0, wx.TOP | wx.BOTTOM, 3)
        sizerb2 = wx.BoxSizer(wx.HORIZONTAL)
        sizerb2.Add((10, 0))
        self.radiovertical = wx.RadioButton(pnl, -1, "Vertical")
        self.radiovertical.Bind(wx.EVT_RADIOBUTTON, self.OnVertical)
        sizerb2.Add(self.radiovertical, 0, wx.BOTTOM, 3)
        sizerb3 = wx.BoxSizer(wx.HORIZONTAL)
        self.firstcolour = csel.ColourSelect(
            pnl, -1, "First Colour", self.ulc.list.GetFirstGradientColour())
        self.secondcolour = csel.ColourSelect(
            pnl, -1, "Second Colour", self.ulc.list.GetSecondGradientColour())
        self.firstcolour.Bind(csel.EVT_COLOURSELECT, self.OnFirstColour)
        self.secondcolour.Bind(csel.EVT_COLOURSELECT, self.OnSecondColour)
        sizerb3.Add(self.firstcolour, 0, wx.TOP | wx.BOTTOM, 3)
        sizerb3.Add(self.secondcolour, 0, wx.LEFT | wx.TOP | wx.BOTTOM, 3)
        sizerb.Add(self.checkgradient, 0, wx.ALL, 3)
        sizerb.Add(sizerb1, 0)
        sizerb.Add(sizerb2, 0)
        sizerb.Add(sizerb3, 0, wx.ALIGN_CENTER)

        self.checkvista = wx.CheckBox(pnl, -1, "Windows Vista Theme")
        self.checkvista.Bind(wx.EVT_CHECKBOX, self.OnVista)

        themessizer.Add(sizera, 0, wx.EXPAND)
        themessizer.Add(sizerb, 0, wx.EXPAND)
        themessizer.Add((0, 5))
        themessizer.Add(self.checkvista, 0, wx.EXPAND | wx.ALL, 3)

        mainsizer.Add(stylesizer, 0, wx.EXPAND | wx.ALL, 5)
        mainsizer.Add(themessizer, 0, wx.EXPAND | wx.ALL, 5)

        pnl.SetSizer(mainsizer)
        pnl.Fit()

        swsizer = wx.BoxSizer(wx.VERTICAL)
        swsizer.Add(pnl, 0, wx.EXPAND)
        self.leftpanel.SetSizer(swsizer)
        swsizer.Layout()
        swsizer.Fit(self.leftpanel)

        self.checknormal.SetValue(1)
        self.radiohorizontal.Enable(False)
        self.radiovertical.Enable(False)
        self.firstcolour.Enable(False)
        self.secondcolour.Enable(False)

        return mainsizer.CalcMin().width + wx.SystemSettings.GetMetric(
            wx.SYS_VSCROLL_X)
Exemple #11
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.Size(1065, 300),
                 style=wx.TAB_TRAVERSAL,
                 name=wx.EmptyString):
        wx.Panel.__init__(self,
                          parent,
                          id=id,
                          pos=pos,
                          size=size,
                          style=style,
                          name=name)

        bSizer14 = wx.BoxSizer(wx.VERTICAL)

        self.m_splitter5 = wx.SplitterWindow(self, wx.ID_ANY,
                                             wx.DefaultPosition,
                                             wx.DefaultSize, wx.SP_3D)
        self.m_splitter5.Bind(wx.EVT_IDLE, self.m_splitter5OnIdle)

        self.m_panel8 = wx.Panel(self.m_splitter5, wx.ID_ANY,
                                 wx.DefaultPosition, wx.DefaultSize,
                                 wx.TAB_TRAVERSAL)
        gbSizer1 = wx.GridBagSizer(4, 0)
        gbSizer1.SetFlexibleDirection(wx.VERTICAL)
        gbSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        self.m_staticText8 = wx.StaticText(self.m_panel8, wx.ID_ANY,
                                           u"MyLabel", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.m_staticText8.Wrap(-1)

        gbSizer1.Add(self.m_staticText8, wx.GBPosition(0, 0), wx.GBSpan(1, 1),
                     wx.ALL, 5)

        self.m_dirPicker5 = wx.DirPickerCtrl(
            self.m_panel8, wx.ID_ANY, wx.EmptyString, u"Select a folder",
            wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE)
        gbSizer1.Add(self.m_dirPicker5, wx.GBPosition(0, 1), wx.GBSpan(1, 3),
                     wx.EXPAND, 5)

        self.m_dirPicker6 = wx.DirPickerCtrl(
            self.m_panel8, wx.ID_ANY, wx.EmptyString, u"Select a folder",
            wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE)
        gbSizer1.Add(self.m_dirPicker6, wx.GBPosition(1, 1), wx.GBSpan(1, 3),
                     wx.EXPAND, 5)

        self.m_staticText9 = wx.StaticText(self.m_panel8, wx.ID_ANY,
                                           u"MyLabel", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.m_staticText9.Wrap(-1)

        gbSizer1.Add(self.m_staticText9, wx.GBPosition(1, 0), wx.GBSpan(1, 1),
                     wx.ALL, 5)

        self.m_panel8.SetSizer(gbSizer1)
        self.m_panel8.Layout()
        gbSizer1.Fit(self.m_panel8)
        self.m_panel9 = wx.Panel(self.m_splitter5, wx.ID_ANY,
                                 wx.DefaultPosition, wx.DefaultSize,
                                 wx.TAB_TRAVERSAL)
        gSizer3 = wx.GridSizer(0, 1, 0, 0)

        self.m_treeCtrl1 = wx.TreeCtrl(self.m_panel9, wx.ID_ANY,
                                       wx.DefaultPosition, wx.DefaultSize,
                                       wx.TR_DEFAULT_STYLE)
        gSizer3.Add(self.m_treeCtrl1, 1, wx.ALL | wx.EXPAND, 5)

        self.m_panel9.SetSizer(gSizer3)
        self.m_panel9.Layout()
        gSizer3.Fit(self.m_panel9)
        self.m_splitter5.SplitVertically(self.m_panel8, self.m_panel9, 0)
        bSizer14.Add(self.m_splitter5, 0, wx.EXPAND, 5)

        self.m_radioBtn9 = wx.RadioButton(self, wx.ID_ANY, u"RadioBtn",
                                          wx.DefaultPosition, wx.DefaultSize,
                                          0)
        bSizer14.Add(self.m_radioBtn9, 0, wx.ALL, 5)

        self.m_radioBtn10 = wx.RadioButton(self, wx.ID_ANY, u"RadioBtn",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        bSizer14.Add(self.m_radioBtn10, 0, wx.ALL, 5)

        self.m_radioBtn11 = wx.RadioButton(self, wx.ID_ANY, u"RadioBtn",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        bSizer14.Add(self.m_radioBtn11, 0, wx.ALL, 5)

        self.SetSizer(bSizer14)
        self.Layout()
#!/usr/bin/env python

#-Imports---------------------------------------------------------------------

#--wxPython Imports.
import wx

if __name__ == '__main__':
    app = wx.App()
    frame = wx.Frame(None, wx.ID_ANY, "Minimal RadioButton Demo")

    radio1 = wx.RadioButton(frame,
                            -1,
                            " Radio1 ",
                            pos=(20, 20),
                            style=wx.RB_GROUP)
    radio2 = wx.RadioButton(frame, -1, " Radio2 ", pos=(20, 40))
    radio3 = wx.RadioButton(frame, -1, " Radio3 ", pos=(20, 60))

    frame.CreateStatusBar().SetStatusText('wxPython %s' % wx.version())
    frame.Show()
    app.MainLoop()
Exemple #13
0
    def __init__(self, parent):
        self.counter = 1
        self.stop_metronome_variable = True
        self.stop_song_variable = False

        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=u"BpmFinder",
                          pos=wx.DefaultPosition,
                          size=wx.Size(997, 400),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)

        frame_sizer = wx.BoxSizer(wx.VERTICAL)

        self.panel = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition,
                              wx.DefaultSize, wx.TAB_TRAVERSAL)
        self.panel.SetForegroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))
        self.panel.SetBackgroundColour(wx.Colour(0, 0, 234))

        grid_sizer = wx.GridSizer(0, 2, 0, 0)

        box_sizer1 = wx.BoxSizer(wx.VERTICAL)

        self.step_1 = wx.StaticText(self.panel, wx.ID_ANY,
                                    u"Step 1 - Enter the name of the song:",
                                    wx.DefaultPosition, wx.DefaultSize, 0)
        self.step_1.Wrap(-1)
        self.step_1.SetFont(wx.Font(12, 74, 90, 90, False, ARIAL))

        box_sizer1.Add(self.step_1, 0, wx.ALL, 5)

        self.song_name = wx.TextCtrl(self.panel, wx.ID_ANY, wx.EmptyString,
                                     wx.DefaultPosition, wx.Size(400, -1), 0)
        # Limits the maximum capacity of the text control to 100 characters.
        self.song_name.SetMaxLength(100)
        box_sizer1.Add(self.song_name, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                       5)

        self.step_2 = wx.StaticText(self.panel, wx.ID_ANY,
                                    u"Step 2 - Click on the relevant button",
                                    wx.DefaultPosition, wx.DefaultSize, 0)
        self.step_2.Wrap(-1)
        self.step_2.SetFont(wx.Font(12, 74, 90, 90, False, ARIAL))

        box_sizer1.Add(self.step_2, 0, wx.ALL, 5)

        self.fast = wx.RadioButton(self.panel, wx.ID_ANY, u"Fast (150+ bpm)",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        self.fast.SetFont(wx.Font(20, 74, 90, 90, False, ARIAL))

        box_sizer1.Add(self.fast, 0, wx.ALL, 5)

        self.standard = wx.RadioButton(self.panel, wx.ID_ANY,
                                       u"Standard (70 - 150 bpm)",
                                       wx.DefaultPosition, wx.DefaultSize, 0)
        self.standard.SetFont(wx.Font(20, 74, 90, 90, False, ARIAL))

        box_sizer1.Add(self.standard, 0, wx.ALL, 5)

        self.slow = wx.RadioButton(self.panel, wx.ID_ANY, u"Slow (1 - 70 bpm)",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        self.slow.SetFont(wx.Font(20, 74, 90, 90, False, ARIAL))

        box_sizer1.Add(self.slow, 0, wx.ALL, 5)

        self.step_3 = wx.StaticText(self.panel, wx.ID_ANY,
                                    u"Step 3 - press ENTER",
                                    wx.DefaultPosition, wx.DefaultSize, 0)
        self.step_3.Wrap(-1)
        self.step_3.SetFont(wx.Font(12, 74, 90, 90, False, ARIAL))

        box_sizer1.Add(self.step_3, 0, wx.ALL, 5)

        self.enter = wx.Button(self.panel, wx.ID_ANY, u"ENTER",
                               wx.DefaultPosition, wx.Size(100, 50), 0)
        box_sizer1.Add(self.enter, 0, wx.ALL, 5)

        grid_sizer.Add(box_sizer1, 1, wx.EXPAND, 5)

        box_sizer2 = wx.BoxSizer(wx.VERTICAL)

        self.answer = wx.StaticText(self.panel, wx.ID_ANY,
                                    u"This song's BPM is:", wx.DefaultPosition,
                                    wx.DefaultSize, 0)
        self.answer.Wrap(-1)
        self.answer.SetFont(wx.Font(12, 74, 90, 90, False, ARIAL))

        box_sizer2.Add(self.answer, 0, wx.ALL, 5)

        self.answer_bpm = wx.TextCtrl(self.panel, wx.ID_ANY, wx.EmptyString,
                                      wx.DefaultPosition, wx.DefaultSize, 0)
        self.answer_bpm.SetMaxLength(100)
        box_sizer2.Add(self.answer_bpm, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                       5)

        self.play_the_song = wx.Button(self.panel, wx.ID_ANY,
                                       u"Click to play the song",
                                       wx.DefaultPosition, wx.DefaultSize, 0)
        box_sizer2.Add(self.play_the_song, 0,
                       wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)

        self.metronome_introduce = wx.StaticText(self.panel, wx.ID_ANY,
                                                 u"Metronome",
                                                 wx.DefaultPosition,
                                                 wx.DefaultSize, 0)
        self.metronome_introduce.Wrap(-1)
        self.metronome_introduce.SetFont(wx.Font(18, 74, 90, 90, False, ARIAL))

        box_sizer2.Add(self.metronome_introduce, 0,
                       wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)

        self.metronome_instruction = wx.StaticText(self.panel, wx.ID_ANY,
                                                   u"Write the bpm:",
                                                   wx.DefaultPosition,
                                                   wx.DefaultSize, 0)
        self.metronome_instruction.Wrap(-1)
        self.metronome_instruction.SetFont(
            wx.Font(12, 74, 90, 90, False, ARIAL))

        box_sizer2.Add(self.metronome_instruction, 0,
                       wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)

        self.metronome_text = wx.TextCtrl(self.panel, wx.ID_ANY,
                                          wx.EmptyString, wx.DefaultPosition,
                                          wx.DefaultSize, 0)
        self.metronome_text.SetMaxLength(100)
        box_sizer2.Add(self.metronome_text, 0,
                       wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)

        self.start = wx.Button(self.panel, wx.ID_ANY, u"START",
                               wx.DefaultPosition, wx.DefaultSize, 0)
        box_sizer2.Add(self.start, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)

        grid_sizer.Add(box_sizer2, 1, wx.EXPAND, 5)

        self.panel.SetSizer(grid_sizer)
        self.panel.Layout()
        grid_sizer.Fit(self.panel)
        frame_sizer.Add(self.panel, 1, wx.EXPAND | wx.ALL, 0)

        self.SetSizer(frame_sizer)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.enter.Bind(wx.EVT_BUTTON, self.calculate_bpm)
        self.play_the_song.Bind(wx.EVT_BUTTON, self.play_song)
        self.start.Bind(wx.EVT_BUTTON, self.start_metronome)
Exemple #14
0
    def __init__(self, parent, IDcompte_payeur=None, IDreglement=None):
        wx.Panel.__init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL)
        self.parent = parent
        self.IDcompte_payeur = IDcompte_payeur
        self.IDreglement = IDreglement
        self.montant_reglement = FloatToDecimal(0.0)
        self.total_ventilation = FloatToDecimal(0.0)
        self.validation = True

        if "linux" in sys.platform:
            defaultFont = self.GetFont()
            defaultFont.SetPointSize(8)
            self.SetFont(defaultFont)

        # Regroupement
        self.label_regroupement = wx.StaticText(self, -1,
                                                _(u"Regrouper par :"))
        self.radio_periode = wx.RadioButton(self,
                                            -1,
                                            _(u"Mois"),
                                            style=wx.RB_GROUP)
        self.radio_facture = wx.RadioButton(self, -1, _(u"Facture"))
        self.radio_individu = wx.RadioButton(self, -1, _(u"Individu"))
        self.radio_date = wx.RadioButton(self, -1, _(u"Date"))

        # Commandes rapides
        self.label_hyperliens_1 = wx.StaticText(self, -1, _(u"Ventiler "))
        self.hyper_automatique = Hyperlien(
            self,
            label=_(u"automatiquement"),
            infobulle=_(
                u"Cliquez ici pour ventiler automatiquement le crédit restant"
            ),
            URL="automatique")
        self.label_hyperliens_2 = wx.StaticText(self, -1, u" | ")
        self.hyper_tout = Hyperlien(
            self,
            label=_(u"tout"),
            infobulle=_(u"Cliquez ici pour tout ventiler"),
            URL="tout")
        self.label_hyperliens_3 = wx.StaticText(self, -1, u" | ")
        self.hyper_rien = Hyperlien(
            self,
            label=_(u"rien"),
            infobulle=_(u"Cliquez ici pour ne rien ventiler"),
            URL="rien")

        # Liste de la ventilation
        self.ctrl_ventilation = CTRL_Ventilation(self, IDcompte_payeur,
                                                 IDreglement)

        # Etat de la ventilation
        self.imgOk = wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ok4.png"),
                               wx.BITMAP_TYPE_PNG)
        self.imgErreur = wx.Bitmap(
            Chemins.GetStaticPath("Images/16x16/Interdit2.png"),
            wx.BITMAP_TYPE_PNG)
        self.imgAddition = wx.Bitmap(
            Chemins.GetStaticPath("Images/16x16/Addition.png"),
            wx.BITMAP_TYPE_PNG)
        self.ctrl_image = wx.StaticBitmap(self, -1, self.imgAddition)

        self.ctrl_info = wx.StaticText(
            self, -1, _(u"Vous pouvez encore ventiler 30.90 ¤"))
        self.ctrl_info.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD))

        self.__do_layout()

        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioRegroupement,
                  self.radio_periode)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioRegroupement,
                  self.radio_facture)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioRegroupement,
                  self.radio_individu)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioRegroupement,
                  self.radio_date)

        # Init
        self.ctrl_ventilation.InitGrid()
Exemple #15
0
    def __init__(make):
        wx.Frame.__init__(make,
                          None,
                          title='What\'s up buddy!!! ',
                          pos=(200, 100),
                          size=(WIDTH, HEIGHT))
        make.backgrnd = wx.Panel(make)
        font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT)
        font.SetPointSize(11)

        make.submission = wx.Button(make.backgrnd, label='Submit')
        make.submission.Bind(wx.EVT_BUTTON, make.submitEvent)
        make.input = wx.TextCtrl(make.backgrnd, style=wx.TE_PROCESS_ENTER)
        make.input.Bind(wx.EVT_TEXT_ENTER, make.submitEvent)
        make.submitArea = wx.TextCtrl(make.backgrnd,
                                      style=wx.TE_READONLY | wx.TE_MULTILINE)
        make.horizontal = wx.BoxSizer(wx.HORIZONTAL)
        make.horizontal.Add(make.input, proportion=1, flag=wx.RIGHT, border=5)
        make.horizontal.Add(make.submission,
                            proportion=0,
                            flag=wx.RIGHT,
                            border=5)

        make.cb = wx.CheckBox(make.backgrnd, label='Change Background Color')
        make.cb.SetValue(False)
        make.cb.Bind(wx.EVT_CHECKBOX, make.OnCheck)

        lang = [
            'C++', 'C', 'Java', 'Objective C', 'Visual Basics', 'C#', 'Python',
            'Perl', 'Ruby'
        ]
        make.lb = wx.ComboBox(make.backgrnd,
                              choices=lang,
                              style=wx.CB_READONLY)
        make.lb.Bind(wx.EVT_COMBOBOX, make.OnSelect)

        make.st3 = wx.StaticText(make.backgrnd,
                                 label='In which continent is Turkey?')
        make.rb1 = wx.RadioButton(make.backgrnd,
                                  label='Europe',
                                  style=wx.RB_GROUP)
        make.rb2 = wx.RadioButton(make.backgrnd, label='Asia')
        make.rb1.Bind(wx.EVT_RADIOBUTTON, make.Onright)
        make.rb2.Bind(wx.EVT_RADIOBUTTON, make.Onwrong)
        make.st4 = wx.StaticText(make.backgrnd, label='')

        make.st1 = wx.StaticText(make.backgrnd,
                                 label='Which language do you prefer?')
        make.st2 = wx.StaticText(make.backgrnd, label='')
        make.st1.SetFont(font)

        make.h2 = wx.BoxSizer(wx.HORIZONTAL)
        make.h2.Add(make.st1, flag=wx.RIGHT, border=5)
        make.h2.Add(make.lb, proportion=1, flag=wx.RIGHT, border=30)

        make.vertical = wx.BoxSizer(wx.VERTICAL)
        make.vertical.Add(make.horizontal,
                          proportion=0,
                          flag=wx.EXPAND | wx.BOTTOM | wx.TOP,
                          border=10)
        make.vertical.Add(make.submitArea,
                          proportion=1,
                          flag=wx.EXPAND | wx.BOTTOM,
                          border=5)
        make.vertical.Add(make.cb,
                          proportion=1,
                          flag=wx.EXPAND | wx.LEFT,
                          border=100)
        make.vertical.Add(make.h2, proportion=0, flag=wx.EXPAND)
        make.vertical.Add(make.st2, flag=wx.LEFT, border=100)
        make.vertical.Add(make.st3, flag=wx.EXPAND | wx.TOP, border=20)
        make.vertical.Add(make.rb1, flag=wx.EXPAND)
        make.vertical.Add(make.rb2, flag=wx.EXPAND)
        make.vertical.Add(make.st4, flag=wx.EXPAND | wx.BOTTOM, border=20)

        make.backgrnd.SetSizer(make.vertical)
        make.Show()
Exemple #16
0
    def __init__(self, parent, log):

        wx.Frame.__init__(self, parent)

        self.SetIcon(images.Mondrian.GetIcon())
        self.SetTitle("ScrolledThumbnail wxPython Demo ;-)")

        self.statusbar = self.CreateStatusBar(2)
        self.statusbar.SetStatusWidths([-2, -1])
        # statusbar fields
        statusbar_fields = [("ScrolledThumbnail Demo, Michael Eager @ 23 Oct 2020"),
                            ("Welcome To wxPython!")]

        for i in range(len(statusbar_fields)):
            self.statusbar.SetStatusText(statusbar_fields[i], i)

        self.SetMenuBar(self.CreateMenuBar())

        splitter = wx.SplitterWindow(self, -1, style=wx.CLIP_CHILDREN |
                                     wx.SP_3D | wx.WANTS_CHARS | wx.SP_LIVE_UPDATE)
        self.panel = wx.Panel(splitter, -1)

        sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.scroll = ScrolledThumbnail(splitter, -1, size=(400,300))

        self.log = log

        self.thumbsizer_staticbox = wx.StaticBox(self.panel, -1, "Thumb Style")
        self.customsizer_staticbox = wx.StaticBox(self.panel, -1, "Thumb Customization")
        self.optionsizer_staticbox = wx.StaticBox(self.panel, -1, "More Options")
        self.dirsizer_staticbox = wx.StaticBox(self.panel, -1, "Directory Selection")
        self.dirbutton = wx.Button(self.panel, -1, "Change Directory")
        self.radiostyle1 = wx.RadioButton(self.panel, -1, "THUMB_OUTLINE_NONE", style=wx.RB_GROUP)
        self.radiostyle2 = wx.RadioButton(self.panel, -1, "THUMB_OUTLINE_FULL")
        self.radiostyle3 = wx.RadioButton(self.panel, -1, "THUMB_OUTLINE_RECT")
        self.radiostyle4 = wx.RadioButton(self.panel, -1, "THUMB_OUTLINE_IMAGE")
        self.highlight = wx.CheckBox(self.panel, -1, "Highlight on pointing")
        self.showfiles = wx.CheckBox(self.panel, -1, "Show file names")
        self.enabledragging = wx.CheckBox(self.panel, -1, "Enable drag and drop")
        self.setpopup = wx.CheckBox(self.panel, -1, "Set popup menu on thumbs")
        self.setgpopup = wx.CheckBox(self.panel, -1, "Set global popup menu")
        self.enabletooltip = wx.CheckBox(self.panel, -1, "Enable thumb tooltips")
        self.textzoom = wx.TextCtrl(self.panel, -1, "1.4")
        self.zoombutton = wx.Button(self.panel, -1, "Set zoom factor")
        self.textthumbwidth = wx.TextCtrl(self.panel, -1, "96")
        self.textthumbheight = wx.TextCtrl(self.panel, -1, "80")
        self.thumbsizebutton = wx.Button(self.panel, -1, "Set thumbnail size (WxH)")
        self.fontbutton = wx.Button(self.panel, -1, "Set caption font")
        self.colourbutton = wx.Button(self.panel, -1, "Set selection colour")

        self.radios = [self.radiostyle1, self.radiostyle2, self.radiostyle3,
                       self.radiostyle4]
        self.thumbstyles = ["THUMB_OUTLINE_NONE", "THUMB_OUTLINE_FULL", "THUMB_OUTLINE_RECT",
                            "THUMB_OUTLINE_IMAGE"]

        self.SetProperties()
        self.DoLayout()

        self.panel.SetSizer(sizer)
        sizer.Layout()

        self.Bind(wx.EVT_RADIOBUTTON, self.OnChangeOutline, self.radiostyle1)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnChangeOutline, self.radiostyle2)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnChangeOutline, self.radiostyle3)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnChangeOutline, self.radiostyle4)
        self.Bind(wx.EVT_CHECKBOX, self.OnHighlight, self.highlight)
        self.Bind(wx.EVT_CHECKBOX, self.OnShowFiles, self.showfiles)
        self.Bind(wx.EVT_CHECKBOX, self.OnEnableDragging, self.enabledragging)
        self.Bind(wx.EVT_CHECKBOX, self.OnSetPopup, self.setpopup)
        self.Bind(wx.EVT_CHECKBOX, self.OnSetGlobalPopup, self.setgpopup)
        self.Bind(wx.EVT_CHECKBOX, self.OnEnableToolTips, self.enabletooltip)
        self.Bind(wx.EVT_BUTTON, self.OnSetZoom, self.zoombutton)
        self.Bind(wx.EVT_BUTTON, self.OnSetThumbSize, self.thumbsizebutton)
        self.Bind(wx.EVT_BUTTON, self.OnSetFont, self.fontbutton)
        self.Bind(wx.EVT_BUTTON, self.OnSetColour, self.colourbutton)
        self.Bind(wx.EVT_BUTTON, self.OnSetDirectory, self.dirbutton)

        self.scroll.Bind(EVT_THUMBNAILS_SEL_CHANGED, self.OnSelChanged)
        self.scroll.Bind(EVT_THUMBNAILS_POINTED, self.OnPointed)
        self.scroll.Bind(EVT_THUMBNAILS_DCLICK, self.OnDClick)

        splitter.SplitVertically(self.scroll, self.panel, 400)

        splitter.SetMinimumPaneSize(140)
        self.SetMinSize((1000, 1000))
        self.CenterOnScreen()
Exemple #17
0
    def initOptions(self):
        optionsSizer = wx.BoxSizer(wx.HORIZONTAL)

        collectControlBox = widgets.ControlBox(self,
                                               label='Collect Data',
                                               orient=wx.HORIZONTAL)
        self.collectButton = wx.Button(self, label='Start')
        self.Bind(wx.EVT_BUTTON, self.toggleCollect, self.collectButton)
        collectControlBox.Add(self.collectButton,
                              proportion=1,
                              flag=wx.ALL,
                              border=8)
        optionsSizer.Add(collectControlBox,
                         proportion=0,
                         flag=wx.ALL | wx.EXPAND,
                         border=8)

        trainControlBox = widgets.ControlBox(self,
                                             label='Retrain',
                                             orient=wx.HORIZONTAL)
        self.trainButton = wx.Button(self, label='Update')
        self.Bind(wx.EVT_BUTTON, self.updateFilt, self.trainButton)
        trainControlBox.Add(self.trainButton,
                            proportion=1,
                            flag=wx.ALL,
                            border=8)
        optionsSizer.Add(trainControlBox,
                         proportion=0,
                         flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
                         border=8)

        viewControlBox = widgets.ControlBox(self,
                                            label='View',
                                            orient=wx.HORIZONTAL)
        self.rawViewRbtn = wx.RadioButton(self, label='Raw', style=wx.RB_GROUP)
        self.rawViewRbtn.SetValue(True)
        self.Bind(wx.EVT_RADIOBUTTON, self.setRawView, self.rawViewRbtn)
        self.filteredViewRbtn = wx.RadioButton(self, label='Filtered')
        self.Bind(wx.EVT_RADIOBUTTON, self.setFilteredView,
                  self.filteredViewRbtn)

        viewControlBox.Add(self.rawViewRbtn,
                           proportion=1,
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                           border=8)
        viewControlBox.Add(self.filteredViewRbtn,
                           proportion=1,
                           flag=wx.TOP | wx.RIGHT | wx.BOTTOM
                           | wx.ALIGN_CENTER_VERTICAL,
                           border=8)

        optionsSizer.Add(viewControlBox,
                         proportion=0,
                         flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
                         border=8)

        if self.flt.filteredTrain is None:
            self.trainButton.Disable()
            self.rawViewRbtn.Disable()
            self.filteredViewRbtn.Disable()

        compControlBox = widgets.ControlBox(self,
                                            label='Components',
                                            orient=wx.HORIZONTAL)
        self.compTextCtrl = wx.TextCtrl(parent=self, style=wx.TE_PROCESS_ENTER)
        self.Bind(wx.EVT_TEXT_ENTER, self.setComp, self.compTextCtrl)
        self.compTextCtrl.Bind(wx.EVT_KILL_FOCUS, self.setComp,
                               self.compTextCtrl)
        compControlBox.Add(self.compTextCtrl,
                           proportion=1,
                           flag=wx.ALL | wx.EXPAND,
                           border=10)

        self.removeCheckBox = wx.CheckBox(self, label='Remove')
        self.removeCheckBox.SetValue(self.flt.remove)
        self.Bind(wx.EVT_CHECKBOX, self.setRemove, self.removeCheckBox)
        compControlBox.Add(self.removeCheckBox,
                           proportion=1,
                           flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
                           border=8)

        self.transformCheckBox = wx.CheckBox(self, label='Transform')
        self.transformCheckBox.SetValue(self.flt.transform)
        self.Bind(wx.EVT_CHECKBOX, self.setTransform, self.transformCheckBox)
        compControlBox.Add(self.transformCheckBox,
                           proportion=1,
                           flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
                           border=8)

        lagsControlBox = widgets.ControlBox(self,
                                            label='Lags',
                                            orient=wx.HORIZONTAL)
        self.lagsSpinCtrl = wx.SpinCtrl(self,
                                        value=str(self.flt.lags),
                                        min=0,
                                        max=20)
        self.Bind(wx.EVT_SPINCTRL, self.setLags, self.lagsSpinCtrl)
        lagsControlBox.Add(self.lagsSpinCtrl,
                           proportion=1,
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                           border=8)
        optionsSizer.Add(lagsControlBox,
                         proportion=0,
                         flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
                         border=8)

        optionsSizer.Add(compControlBox,
                         proportion=1,
                         flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
                         border=8)

        self.sizer.Add(optionsSizer, proportion=0)  #, flag=wx.EXPAND)
Exemple #18
0
    def __init__(self, parent, id=wx.ID_ANY, title="Settings Panel", pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.FRAME_NO_TASKBAR
                 | wx.FRAME_FLOAT_ON_PARENT | wx.CLIP_CHILDREN):

        wx.MiniFrame.__init__(self, parent, id, title, pos, size, style)

        self.targetTitleBar = parent.titleBar
        self.parent = parent
        self.panel = wx.Panel(self, -1)

        self.coloursizer_staticbox = wx.StaticBox(self.panel, -1, "Colour Options")
        self.bottomsizer_staticbox = wx.StaticBox(self.panel, -1, "Size Options")
        self.stylesizer_staticbox = wx.StaticBox(self.panel, -1, "ButtonPanel Styles")
        self.defaultstyle = wx.RadioButton(self.panel, -1, "Default Style", style=wx.RB_GROUP)
        self.gradientstyle = wx.RadioButton(self.panel, -1, "Gradient Style")
        self.verticalgradient = wx.RadioButton(self.panel, -1, "Vertical Gradient", style=wx.RB_GROUP)
        self.horizontalgradient = wx.RadioButton(self.panel, -1, "Horizontal Gradient")

        b = self.CreateColourBitmap(wx.BLACK)

        self.bakbrush = wx.BitmapButton(self.panel, ID_BackgroundColour, b, size=wx.Size(50,25))
        self.gradientfrom = wx.BitmapButton(self.panel, ID_GradientFrom, b, size=wx.Size(50,25))
        self.gradientto = wx.BitmapButton(self.panel, ID_GradientTo, b, size=wx.Size(50,25))
        self.bordercolour = wx.BitmapButton(self.panel, ID_BorderColour, b, size=wx.Size(50,25))
        self.captioncolour = wx.BitmapButton(self.panel, ID_CaptionColour, b, size=wx.Size(50,25))
        self.textbuttoncolour = wx.BitmapButton(self.panel, ID_ButtonTextColour, b, size=wx.Size(50,25))
        self.selectionbrush = wx.BitmapButton(self.panel, ID_SelectionBrush, b, size=wx.Size(50,25))
        self.selectionpen = wx.BitmapButton(self.panel, ID_SelectionPen, b, size=wx.Size(50,25))
        self.separatorcolour = wx.BitmapButton(self.panel, ID_SeparatorColour, b, size=wx.Size(50,25))

        self.separatorspin = wx.SpinCtrl(self.panel, -1, "7", min=3, max=20,
                                         style=wx.SP_ARROW_KEYS)
        self.marginspin = wx.SpinCtrl(self.panel, -1, "6", min=3, max=20,
                                      style=wx.SP_ARROW_KEYS)
        self.paddingspin = wx.SpinCtrl(self.panel, -1, "6", min=3, max=20,
                                       style=wx.SP_ARROW_KEYS)
        self.borderspin = wx.SpinCtrl(self.panel, -1, "3", min=3, max=7,
                                      style=wx.SP_ARROW_KEYS)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_RADIOBUTTON, self.OnDefaultStyle, self.defaultstyle)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnGradientStyle, self.gradientstyle)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnVerticalGradient, self.verticalgradient)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnHorizontalGradient, self.horizontalgradient)
        self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_BackgroundColour)
        self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_GradientFrom)
        self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_GradientTo)
        self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_BorderColour)
        self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_CaptionColour)
        self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_ButtonTextColour)
        self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_SelectionBrush)
        self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_SelectionPen)
        self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_SeparatorColour)

        self.Bind(wx.EVT_SPINCTRL, self.OnSeparator, self.separatorspin)
        self.Bind(wx.EVT_SPINCTRL, self.OnMargins, self.marginspin)
        self.Bind(wx.EVT_SPINCTRL, self.OnPadding, self.paddingspin)
        self.Bind(wx.EVT_SPINCTRL, self.OnBorder, self.borderspin)

        self.Bind(wx.EVT_CLOSE, self.OnClose)
Exemple #19
0
    def __init__(self, parent, id, repo, targetCommit):
        wx.Dialog.__init__(self, parent, id)

        self.repo = repo
        self.targetCommit = targetCommit

        # Basic layout
        self.SetTitle('Switch to version...')
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.sizer)

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(sizer, 1, wx.ALL, 5)

        choiceTopPadding = 4 if sys.platform == 'darwin' else 0

        # Detect capabilities
        self.targetBranches = [
            branch for (branch, sha1) in self.repo.branches.iteritems()
            if sha1 == targetCommit.sha1
        ]
        self.targetBranches.sort()

        self.allBranches = [
            branch for (branch, sha1) in self.repo.branches.iteritems()
        ]

        if self.targetBranches:
            self.switchModes = [
                SWMODE_EXISTING_BRANCH, SWMODE_NEW_BRANCH,
                SWMODE_DETACHED_HEAD, SWMODE_MOVE_BRANCH
            ]
            branchChoices = self.targetBranches
        elif self.allBranches:
            self.switchModes = [
                SWMODE_NEW_BRANCH, SWMODE_DETACHED_HEAD, SWMODE_MOVE_BRANCH
            ]
            branchChoices = self.allBranches
        else:
            self.switchModes = [SWMODE_NEW_BRANCH, SWMODE_DETACHED_HEAD]
            branchChoices = []

        self.hasUncommittedChanges = (len(self.repo.get_unified_status()) > 0)

        self.hasSubmodules = (len(self.repo.submodules) > 0)

        # Default values
        self.switchMode = self.switchModes[0]
        self.workdirMode = WORKDIR_CHECKOUT
        self.uncommittedMode = UNCOMMITTED_SAFE_MODE
        self.submoduleSwitch = False
        self.submoduleMode = SUBMODULE_MOVE_BRANCH
        self.newBranchName = ''
        self.submoduleBranchName = ''
        if self.switchMode == SWMODE_EXISTING_BRANCH:
            self.targetBranch = self.targetBranches[0]
        else:
            self.targetBranch = ''
        self.error = None
        self.submoduleWarnings = {}

        # -------------------- Switch mode ---------------------
        # Switch mode
        self.swmodeSizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.swmodeSizer, 0, wx.EXPAND | wx.ALL, 5)

        self.swmodeSizer.Add(wx.StaticText(self, -1, 'Switch mode:'), 0,
                             wx.ALIGN_CENTRE_VERTICAL | wx.RIGHT, 5)
        self.swmodeChoices = wx.Choice(self, -1, choices=self.switchModes)
        self.swmodeSizer.Add(self.swmodeChoices, 0,
                             wx.ALIGN_CENTRE_VERTICAL | wx.TOP | wx.RIGHT,
                             choiceTopPadding)
        self.swmodeChoices.Select(0)
        self.Bind(wx.EVT_CHOICE, self.OnSwitchModeChosen, self.swmodeChoices)

        # Branch selector
        self.branchChoices = wx.Choice(self, -1, choices=branchChoices)
        self.swmodeSizer.Add(self.branchChoices, 1,
                             wx.ALIGN_CENTRE_VERTICAL | wx.TOP | wx.RIGHT,
                             choiceTopPadding)
        if branchChoices:
            self.branchChoices.Select(0)
        self.branchChoices.Bind(wx.EVT_CHOICE, self.OnBranchChosen)
        self.branchChoices.Show(self.switchModes[0] != SWMODE_NEW_BRANCH)

        # New branch text box
        self.newBranchTxt = wx.TextCtrl(self, -1)
        self.newBranchTxt.Bind(wx.EVT_TEXT, self.Validate)
        self.swmodeSizer.Add(self.newBranchTxt, 1,
                             wx.ALIGN_CENTRE_VERTICAL | wx.LEFT | wx.RIGHT, 5)
        self.newBranchTxt.Show(self.switchModes[0] == SWMODE_NEW_BRANCH)

        # ------------------ Working directory ------------------
        # Static box
        self.workdirBox = wx.StaticBox(self, -1, 'Working directory:')
        self.workdirSizer = wx.StaticBoxSizer(self.workdirBox, wx.VERTICAL)
        sizer.Add(self.workdirSizer, 0, wx.EXPAND | wx.ALL, 5)

        # Radio buttons
        btn = wx.RadioButton(self,
                             -1,
                             'Switch file contents to new version',
                             style=wx.RB_GROUP)
        btn.SetValue(True)
        btn.Bind(wx.EVT_RADIOBUTTON,
                 lambda e: self.OnWorkdirMode(WORKDIR_CHECKOUT))
        self.workdirSizer.Add(btn, 0, wx.ALL, 5)

        btn = wx.RadioButton(self, -1, 'Keep files unchanged')
        btn.Bind(wx.EVT_RADIOBUTTON,
                 lambda e: self.OnWorkdirMode(WORKDIR_KEEP))
        self.workdirSizer.Add(btn, 0, wx.ALL, 5)

        # ------------------ Uncommitted changes -----------------
        if self.hasUncommittedChanges:
            self.uncommittedBox = wx.StaticBox(self, -1,
                                               'Uncommitted changes:')
            self.uncommittedSizer = wx.StaticBoxSizer(self.uncommittedBox,
                                                      wx.VERTICAL)
            sizer.Add(self.uncommittedSizer, 0, wx.EXPAND | wx.ALL, 5)

            # Radio buttons
            self.uncommittedButtons = []

            btn = wx.RadioButton(
                self,
                -1,
                'Switch only if these files need not to be modified',
                style=wx.RB_GROUP)
            btn.SetValue(True)
            btn.Bind(wx.EVT_RADIOBUTTON,
                     lambda e: self.OnUncommittedMode(UNCOMMITTED_SAFE_MODE))
            self.uncommittedButtons.append(btn)
            self.uncommittedSizer.Add(btn, 0, wx.ALL, 5)

            btn = wx.RadioButton(self, -1,
                                 'Merge uncommitted changes into new version')
            btn.Bind(wx.EVT_RADIOBUTTON,
                     lambda e: self.OnUncommittedMode(UNCOMMITTED_MERGE))
            self.uncommittedButtons.append(btn)
            self.uncommittedSizer.Add(btn, 0, wx.ALL, 5)

            btn = wx.RadioButton(self, -1, 'Discard uncommitted changes')
            btn.Bind(wx.EVT_RADIOBUTTON,
                     lambda e: self.OnUncommittedMode(UNCOMMITTED_DISCARD))
            self.uncommittedButtons.append(btn)
            self.uncommittedSizer.Add(btn, 0, wx.ALL, 5)

            btn = wx.Button(self, -1, 'Review uncommitted changes')
            btn.Bind(wx.EVT_BUTTON, self.OnReviewUncommittedChanges)
            self.uncommittedSizer.Add(btn, 0, wx.ALL, 5)

        # ----------------------- Submodules ----------------------
        if self.hasSubmodules:
            self.submoduleBox = wx.StaticBox(self, -1, 'Submodules:')
            self.submoduleSizer = wx.StaticBoxSizer(self.submoduleBox,
                                                    wx.VERTICAL)
            sizer.Add(self.submoduleSizer, 0, wx.EXPAND | wx.ALL, 5)

            # Submodule checkbox
            self.submoduleChk = wx.CheckBox(
                self, -1, 'Switch submodules to referenced version')
            self.submoduleChk.SetValue(False)
            self.submoduleChk.Bind(wx.EVT_CHECKBOX, self.OnSubmoduleSwitch)
            self.submoduleSizer.Add(self.submoduleChk, 0, wx.ALL, 5)

            # Radio buttons
            self.submoduleModeButtons = []

            btn = wx.RadioButton(
                self,
                -1,
                'Move currently selected branches (only if no commits will be lost)',
                style=wx.RB_GROUP)
            btn.SetValue(1)
            btn.Enable(False)
            btn.Bind(wx.EVT_RADIOBUTTON,
                     lambda e: self.OnSubmoduleMode(SUBMODULE_MOVE_BRANCH))
            self.submoduleSizer.Add(btn, 0, wx.ALL, 5)
            self.submoduleModeButtons.append(btn)

            btn = wx.RadioButton(self, -1, 'Switch to detached HEAD')
            btn.Bind(wx.EVT_RADIOBUTTON,
                     lambda e: self.OnSubmoduleMode(SUBMODULE_DETACHED_HEAD))
            btn.Enable(False)
            self.submoduleSizer.Add(btn, 0, wx.ALL, 5)
            self.submoduleModeButtons.append(btn)

            s = wx.BoxSizer(wx.HORIZONTAL)
            self.submoduleSizer.Add(s, 0, wx.ALL, 5)

            btn = wx.RadioButton(self, -1, 'Switch to new branch:')
            btn.Bind(wx.EVT_RADIOBUTTON,
                     lambda e: self.OnSubmoduleMode(SUBMODULE_NEW_BRANCH))
            btn.Enable(False)
            s.Add(btn, 0)
            self.submoduleModeButtons.append(btn)

            # New branch text field
            self.submoduleBranchTxt = wx.TextCtrl(self, -1)
            self.submoduleBranchTxt.Bind(wx.EVT_TEXT, self.Validate)
            s.Add(self.submoduleBranchTxt, 0, wx.LEFT, 7)
            self.submoduleBranchTxt.Enable(False)

        # Status message
        self.statusSizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.statusSizer, 0, wx.EXPAND | wx.TOP, 15)

        self.statusMsg = wx.StaticText(self, -1, '')
        self.statusSizer.Add(self.statusMsg, 1, wx.LEFT, 5)

        self.statusButton = wx.Button(self, -1, 'Details')
        self.statusButton.Bind(wx.EVT_BUTTON, self.OnDetailsButton)
        self.statusSizer.Add(self.statusButton, 0, wx.LEFT | wx.RIGHT, 5)

        # Finish buttons
        s = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(s, 0, wx.TOP | wx.BOTTOM | wx.ALIGN_RIGHT, 15)

        self.okButton = wx.Button(self, -1, 'OK')
        self.okButton.Bind(wx.EVT_BUTTON, self.OnOkClicked)
        s.Add(self.okButton, 0, wx.LEFT | wx.RIGHT, 5)

        self.cancelButton = wx.Button(self, -1, 'Cancel')
        self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancelClicked)
        s.Add(self.cancelButton, 0, wx.LEFT | wx.RIGHT, 5)

        self.Validate()

        # Resize window
        self.Fit()
        self.Layout()
        w, h = self.GetSize()
        self.SetSize((max(450, w), h))
Exemple #20
0
    def __init__(self, parent, bankController, autoPopulate=True):
        wx.Panel.__init__(self, parent, name="AccountListCtrl")
        self.bankController = bankController
        self.Model = bankController.Model

        # Initialize some attributes to their default values.
        self.editCtrl = self.hiddenIndex = None
        self.currentIndex = None
        self.radioButtons, self.totalTexts, self.accountObjects, self.mintStatuses = [], [], [], []

        # Create the staticboxsizer which is the home for everything.
        # This *MUST* be created first to ensure proper z-ordering (as per docs).
        self.staticBox = wx.StaticBox(self, label=_("Accounts"))

        # Create a single panel to be the "child" of the static box sizer,
        # to work around a wxPython regression that prevents tooltips. lp: xxxxxx
        self.childPanel = wx.Panel(self)
        self.childSizer = childSizer = wx.BoxSizer(wx.VERTICAL)

        ## Create and set up the buttons.
        # The ADD account button.
        BMP = self.addBMP = wx.ArtProvider.GetBitmap('wxART_add')
        self.addButton = addButton = bankcontrols.FlashableButton(
            self.childPanel, bitmap=BMP)
        addButton.SetToolTipString(_("Add a new account"))
        # The REMOVE account button.
        BMP = wx.ArtProvider.GetBitmap('wxART_delete')
        self.removeButton = removeButton = wx.BitmapButton(self.childPanel,
                                                           bitmap=BMP)
        removeButton.SetToolTipString(_("Remove the selected account"))
        removeButton.Enabled = False
        # The EDIT account button.
        BMP = wx.ArtProvider.GetBitmap('wxART_textfield_rename')
        self.editButton = editButton = wx.BitmapButton(self.childPanel,
                                                       bitmap=BMP)
        editButton.SetToolTipString(_("Rename the selected account"))
        editButton.Enabled = False
        # The CONFIGURE account button.
        BMP = wx.ArtProvider.GetBitmap('wxART_cog')
        self.configureButton = configureButton = wx.BitmapButton(
            self.childPanel, bitmap=BMP)
        configureButton.SetToolTipString(_("Configure the selected account"))
        configureButton.Enabled = False

        # Layout the buttons.
        buttonSizer = wx.BoxSizer()
        buttonSizer.Add(addButton)
        buttonSizer.AddSpacer(6)
        buttonSizer.Add(editButton)
        buttonSizer.AddSpacer(6)
        buttonSizer.Add(configureButton)
        buttonSizer.AddSpacer(6)
        buttonSizer.Add(removeButton)

        # Set up the "Total" sizer.
        self.totalText = wx.StaticText(self.childPanel,
                                       label=self.Model.float2str(0))
        self.totalTexts.append(self.totalText)
        miniSizer = wx.BoxSizer()
        self.allAccountsRadio = wx.RadioButton(self.childPanel,
                                               label=_("All accounts"))
        miniSizer.Add(self.allAccountsRadio, 1, wx.ALIGN_CENTER)
        miniSizer.Add(self.totalText, 0, wx.ALIGN_CENTER | wx.LEFT, 10)
        miniSizer.AddSpacer(3)

        #self.staticBoxSizer = SmoothStaticBoxSizer(self.staticBox, wx.VERTICAL)
        self.staticBoxSizer = wx.StaticBoxSizer(self.staticBox, wx.VERTICAL)
        #self.staticBoxSizer.SetSmooth(False)
        childSizer.Add(buttonSizer, 0, wx.BOTTOM, 9)
        # Add just a tiny bit of padding between the accounts and the total item.
        childSizer.AddSpacer(3)
        childSizer.Add(miniSizer, 0, wx.EXPAND)
        self.childPanel.Sizer = childSizer
        self.staticBoxSizer.Add(self.childPanel, 1, wx.EXPAND)

        # Set up the button bindings.
        addButton.Bind(wx.EVT_BUTTON, self.onAddButton)
        removeButton.Bind(wx.EVT_BUTTON, self.onRemoveButton)
        editButton.Bind(wx.EVT_BUTTON, self.onRenameButton)
        configureButton.Bind(wx.EVT_BUTTON, self.onConfigureButton)
        # Set up the link binding.
        self.Bind(wx.EVT_RADIOBUTTON, self.onAccountClick)

        # Subscribe to messages we are concerned about.
        Publisher.subscribe(self.onAccountBalanceChanged,
                            "ormobject.updated.Account.Balance")
        Publisher.subscribe(self.onAccountRenamed,
                            "ormobject.updated.Account.Name")
        Publisher.subscribe(self.onTransactionDateChanged,
                            "ormobject.updated.Transaction.Date")
        Publisher.subscribe(self.onAccountMintIdChanged,
                            "ormobject.updated.Account.MintId")
        Publisher.subscribe(self.onAccountRemoved, "account.removed")
        Publisher.subscribe(self.onAccountAdded, "account.created")
        Publisher.subscribe(self.onCurrencyChanged, "currency_changed")
        Publisher.subscribe(self.onShowZeroToggled,
                            "controller.showzero_toggled")
        Publisher.subscribe(self.onShowCurrencyNickToggled,
                            "controller.show_currency_nick_toggled")
        Publisher.subscribe(self.onAccountChanged, "user.account changed")
        Publisher.subscribe(self.onSelectNextAccount, "user.next account")
        Publisher.subscribe(self.onSelectPreviousAccount,
                            "user.previous account")
        Publisher.subscribe(self.onToggleMintIntegration, "user.mint.toggled")
        Publisher.subscribe(self.onMintDataUpdated, "mint.updated")

        # Populate ourselves initially unless explicitly told not to.
        if autoPopulate:
            for account in self.Model.Accounts:
                self._PutAccount(account)

        self.Sizer = self.staticBoxSizer
        # Set the minimum size to the amount it needs to display the edit box.
        self.Freeze()
        self.showEditCtrl(focus=False)
        minWidth = max((self.staticBoxSizer.CalcMin()[0], 250))
        self.onHideEditCtrl()
        self.Thaw()
        self.staticBoxSizer.SetMinSize((minWidth, -1))

        # Initially load the visibility of zero-balance accounts!
        # Don't refresh the selection or we'll send an account changed message which will overwrite the LastAccountId before it gets used!
        self.refreshVisibility(refreshSelection=False)

        self.staticBoxSizer.Layout()
        #self.staticBoxSizer.SetSmooth(True)

        if not self.GetCount():
            self.addButton.StartFlashing()
Exemple #21
0
 def get_control(self, parent, locals=None):
     self.control = wx.RadioButton(parent, -1, self.radio_button)
     return self
    def __init__(self, *args, **kwds):
        # begin wxGlade: All_Widgets_Frame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((800, 417))
        self.SetTitle(_("All Widgets"))
        _icon = wx.NullIcon
        _icon.CopyFromBitmap(
            wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (32, 32)))
        self.SetIcon(_icon)

        # Menu Bar
        self.All_Widgets_menubar = wx.MenuBar()
        global mn_IDUnix
        mn_IDUnix = wx.NewId()
        global mn_IDWindows
        mn_IDWindows = wx.NewId()
        wxglade_tmp_menu = wx.Menu()
        wxglade_tmp_menu.Append(wx.ID_OPEN, _("&Open"),
                                _("Open an existing document"))
        wxglade_tmp_menu.Append(wx.ID_CLOSE, _("&Close file"),
                                _("Close current document"))
        wxglade_tmp_menu.AppendSeparator()
        wxglade_tmp_menu.Append(wx.ID_EXIT, _("E&xit"), _("Finish program"))
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&File"))
        wxglade_tmp_menu = wx.Menu()
        self.All_Widgets_menubar.mn_Unix = wxglade_tmp_menu.Append(
            mn_IDUnix, _("Unix"), _("Use Unix line endings"), wx.ITEM_RADIO)
        self.Bind(wx.EVT_MENU, self.onSelectUnix, id=mn_IDUnix)
        self.All_Widgets_menubar.mn_Windows = wxglade_tmp_menu.Append(
            mn_IDWindows, _("Windows"), _("Use Windows line endings"),
            wx.ITEM_RADIO)
        self.Bind(wx.EVT_MENU, self.onSelectWindows, id=mn_IDWindows)
        wxglade_tmp_menu.AppendSeparator()
        self.All_Widgets_menubar.mn_RemoveTabs = wxglade_tmp_menu.Append(
            wx.ID_ANY, _("Remove Tabs"), _("Remove all leading tabs"),
            wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU, self.onRemoveTabs,
                  self.All_Widgets_menubar.mn_RemoveTabs)
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Edit"))
        wxglade_tmp_menu = wx.Menu()
        wxglade_tmp_menu.Append(wx.ID_HELP, _("Manual"),
                                _("Show the application manual"))
        self.Bind(wx.EVT_MENU, self.onShowManual, id=wx.ID_HELP)
        wxglade_tmp_menu.AppendSeparator()
        wxglade_tmp_menu.Append(wx.ID_ABOUT, _("About"),
                                _("Show the About dialog"))
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Help"))
        self.SetMenuBar(self.All_Widgets_menubar)
        # Menu Bar end

        self.All_Widgets_statusbar = self.CreateStatusBar(
            1, wx.STB_ELLIPSIZE_MIDDLE | wx.STB_SHOW_TIPS | wx.STB_SIZEGRIP)
        self.All_Widgets_statusbar.SetStatusWidths([-1])
        # statusbar fields
        All_Widgets_statusbar_fields = [_("All Widgets statusbar")]
        for i in range(len(All_Widgets_statusbar_fields)):
            self.All_Widgets_statusbar.SetStatusText(
                All_Widgets_statusbar_fields[i], i)

        # Tool Bar
        self.All_Widgets_toolbar = wx.ToolBar(self, -1)
        self.All_Widgets_toolbar.AddTool(
            wx.ID_UP, _("UpDown"),
            wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)),
            wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)),
            wx.ITEM_CHECK, _("Up or Down"), _("Up or Down"))
        self.All_Widgets_toolbar.AddTool(wx.ID_OPEN, _("Open"),
                                         wx.Bitmap(32, 32), wx.NullBitmap,
                                         wx.ITEM_NORMAL, _("Open a new file"),
                                         _("Open a new file"))
        self.SetToolBar(self.All_Widgets_toolbar)
        self.All_Widgets_toolbar.Realize()
        # Tool Bar end

        sizer_1 = wx.FlexGridSizer(3, 1, 0, 0)

        self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=wx.NB_BOTTOM)
        sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0)

        self.notebook_1_wxBitmapButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxBitmapButton,
                                _("wxBitmapButton"))

        sizer_13 = wx.FlexGridSizer(2, 2, 0, 0)

        self.bitmap_button_icon1 = wx.BitmapButton(
            self.notebook_1_wxBitmapButton, wx.ID_ANY,
            wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY))
        self.bitmap_button_icon1.SetSize(
            self.bitmap_button_icon1.GetBestSize())
        self.bitmap_button_icon1.SetDefault()
        sizer_13.Add(self.bitmap_button_icon1, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_button_empty1 = wx.BitmapButton(
            self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap(10, 10))
        self.bitmap_button_empty1.SetSize(
            self.bitmap_button_empty1.GetBestSize())
        self.bitmap_button_empty1.SetDefault()
        sizer_13.Add(self.bitmap_button_empty1, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_button_icon2 = wx.BitmapButton(
            self.notebook_1_wxBitmapButton,
            wx.ID_ANY,
            wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY),
            style=wx.BORDER_NONE | wx.BU_BOTTOM)
        self.bitmap_button_icon2.SetBitmapDisabled(wx.Bitmap(32, 32))
        self.bitmap_button_icon2.SetSize(
            self.bitmap_button_icon2.GetBestSize())
        self.bitmap_button_icon2.SetDefault()
        sizer_13.Add(self.bitmap_button_icon2, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_button_art = wx.BitmapButton(
            self.notebook_1_wxBitmapButton,
            wx.ID_ANY,
            wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)),
            style=wx.BORDER_NONE | wx.BU_BOTTOM)
        self.bitmap_button_art.SetSize(self.bitmap_button_art.GetBestSize())
        self.bitmap_button_art.SetDefault()
        sizer_13.Add(self.bitmap_button_art, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxButton, _("wxButton"))

        sizer_28 = wx.BoxSizer(wx.HORIZONTAL)

        self.button_3 = wx.Button(self.notebook_1_wxButton, wx.ID_BOLD, "")
        sizer_28.Add(self.button_3, 0, wx.ALL, 5)

        self.notebook_1_wxCalendarCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxCalendarCtrl,
                                _("wxCalendarCtrl"))

        sizer_12 = wx.BoxSizer(wx.HORIZONTAL)

        self.calendar_ctrl_1 = wx.adv.CalendarCtrl(
            self.notebook_1_wxCalendarCtrl,
            wx.ID_ANY,
            style=wx.adv.CAL_MONDAY_FIRST
            | wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION
            | wx.adv.CAL_SHOW_SURROUNDING_WEEKS | wx.adv.CAL_SHOW_WEEK_NUMBERS)
        sizer_12.Add(self.calendar_ctrl_1, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxGenericCalendarCtrl = wx.Panel(
            self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxGenericCalendarCtrl,
                                _("wxGenericCalendarCtrl"))

        sizer_27 = wx.BoxSizer(wx.HORIZONTAL)

        self.generic_calendar_ctrl_1 = wx.adv.GenericCalendarCtrl(
            self.notebook_1_wxGenericCalendarCtrl,
            wx.ID_ANY,
            style=wx.adv.CAL_MONDAY_FIRST)
        sizer_27.Add(self.generic_calendar_ctrl_1, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxCheckBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxCheckBox, _("wxCheckBox"))

        sizer_21 = wx.GridSizer(2, 3, 0, 0)

        self.checkbox_1 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY,
                                      _("one (unchecked)"))
        sizer_21.Add(self.checkbox_1, 0, wx.EXPAND, 0)

        self.checkbox_2 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY,
                                      _("two (checked)"))
        self.checkbox_2.SetValue(1)
        sizer_21.Add(self.checkbox_2, 0, wx.EXPAND, 0)

        self.checkbox_3 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("three"),
                                      style=wx.CHK_2STATE)
        sizer_21.Add(self.checkbox_3, 0, wx.EXPAND, 0)

        self.checkbox_4 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("four (unchecked)"),
                                      style=wx.CHK_3STATE)
        self.checkbox_4.Set3StateValue(wx.CHK_UNCHECKED)
        sizer_21.Add(self.checkbox_4, 0, wx.EXPAND, 0)

        self.checkbox_5 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("five (checked)"),
                                      style=wx.CHK_3STATE
                                      | wx.CHK_ALLOW_3RD_STATE_FOR_USER)
        self.checkbox_5.Set3StateValue(wx.CHK_CHECKED)
        sizer_21.Add(self.checkbox_5, 0, wx.EXPAND, 0)

        self.checkbox_6 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("six (undetermined)"),
                                      style=wx.CHK_3STATE
                                      | wx.CHK_ALLOW_3RD_STATE_FOR_USER)
        self.checkbox_6.Set3StateValue(wx.CHK_UNDETERMINED)
        sizer_21.Add(self.checkbox_6, 0, wx.EXPAND, 0)

        self.notebook_1_wxCheckListBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxCheckListBox,
                                _("wxCheckListBox"))

        sizer_26 = wx.BoxSizer(wx.HORIZONTAL)

        self.check_list_box_1 = wx.CheckListBox(
            self.notebook_1_wxCheckListBox,
            wx.ID_ANY,
            choices=[_("one"), _("two"),
                     _("three"), _("four")])
        self.check_list_box_1.SetSelection(2)
        sizer_26.Add(self.check_list_box_1, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxChoice = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxChoice, _("wxChoice"))

        sizer_5 = wx.BoxSizer(wx.HORIZONTAL)

        self.choice_empty = wx.Choice(self.notebook_1_wxChoice,
                                      wx.ID_ANY,
                                      choices=[])
        sizer_5.Add(self.choice_empty, 1, wx.ALL, 5)

        self.choice_filled = wx.Choice(
            self.notebook_1_wxChoice,
            wx.ID_ANY,
            choices=[_("Item 1"), _("Item 2 (pre-selected)")])
        self.choice_filled.SetSelection(1)
        sizer_5.Add(self.choice_filled, 1, wx.ALL, 5)

        self.notebook_1_wxComboBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxComboBox, _("wxComboBox"))

        sizer_6 = wx.BoxSizer(wx.VERTICAL)

        sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_6.Add(sizer_7, 1, wx.EXPAND, 0)

        self.combo_box_empty = wx.ComboBox(self.notebook_1_wxComboBox,
                                           wx.ID_ANY,
                                           choices=[],
                                           style=0)
        sizer_7.Add(self.combo_box_empty, 1, wx.ALL, 5)

        self.combo_box_filled = wx.ComboBox(
            self.notebook_1_wxComboBox,
            wx.ID_ANY,
            choices=[_("Item 1 (pre-selected)"),
                     _("Item 2")],
            style=0)
        self.combo_box_filled.SetSelection(0)
        sizer_7.Add(self.combo_box_filled, 1, wx.ALL, 5)

        self.notebook_1_wxDatePickerCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxDatePickerCtrl,
                                _("wxDatePickerCtrl"))

        sizer_17 = wx.BoxSizer(wx.HORIZONTAL)

        self.datepicker_ctrl_1 = wx.adv.DatePickerCtrl(
            self.notebook_1_wxDatePickerCtrl,
            wx.ID_ANY,
            style=wx.adv.DP_SHOWCENTURY)
        sizer_17.Add(self.datepicker_ctrl_1, 1,
                     wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        self.notebook_1_wxGauge = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxGauge, _("wxGauge"))

        sizer_15 = wx.BoxSizer(wx.HORIZONTAL)

        self.gauge_1 = wx.Gauge(self.notebook_1_wxGauge, wx.ID_ANY, 20)
        sizer_15.Add(self.gauge_1, 1, wx.ALL, 5)

        self.notebook_1_wxGrid = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxGrid, _("wxGrid"))

        sizer_19 = wx.BoxSizer(wx.HORIZONTAL)

        self.grid_1 = wx.grid.Grid(self.notebook_1_wxGrid,
                                   wx.ID_ANY,
                                   size=(1, 1))
        self.grid_1.CreateGrid(10, 3)
        self.grid_1.SetSelectionMode(wx.grid.Grid.SelectColumns)
        self.grid_1.SetColLabelValue(1, _("B\nB"))
        sizer_19.Add(self.grid_1, 1, wx.EXPAND, 0)

        self.notebook_1_wxHyperlinkCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxHyperlinkCtrl,
                                _("wxHyperlinkCtrl"))

        sizer_20 = wx.BoxSizer(wx.HORIZONTAL)

        self.hyperlink_1 = wx.adv.HyperlinkCtrl(
            self.notebook_1_wxHyperlinkCtrl, wx.ID_ANY, _("Homepage wxGlade"),
            _("http://wxglade.sf.net"))
        sizer_20.Add(self.hyperlink_1, 0, wx.ALL, 5)

        self.notebook_1_wxListBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxListBox, _("wxListBox"))

        sizer_4 = wx.BoxSizer(wx.VERTICAL)

        self.list_box_empty = wx.ListBox(self.notebook_1_wxListBox,
                                         wx.ID_ANY,
                                         choices=[],
                                         style=0)
        sizer_4.Add(self.list_box_empty, 1, wx.ALL | wx.EXPAND, 5)

        self.list_box_filled = wx.ListBox(
            self.notebook_1_wxListBox,
            wx.ID_ANY,
            choices=[_("Item 1"), _("Item 2 (pre-selected)")],
            style=wx.LB_MULTIPLE | wx.LB_SORT)
        self.list_box_filled.SetSelection(1)
        sizer_4.Add(self.list_box_filled, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxListCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxListCtrl, _("wxListCtrl"))

        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)

        self.list_ctrl_1 = wx.ListCtrl(self.notebook_1_wxListCtrl,
                                       wx.ID_ANY,
                                       style=wx.BORDER_SUNKEN | wx.LC_REPORT)
        sizer_3.Add(self.list_ctrl_1, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxPropertyGridManager = wx.Panel(
            self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxPropertyGridManager,
                                _("wxPropertyGridManager"))

        sizer_34 = wx.BoxSizer(wx.HORIZONTAL)

        self.property_grid_2 = wx.propgrid.PropertyGridManager(
            self.notebook_1_wxPropertyGridManager,
            wx.ID_ANY,
            style=wx.propgrid.PG_ALPHABETIC_MODE)
        sizer_34.Add(self.property_grid_2, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxRadioBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxRadioBox, _("wxRadioBox"))

        grid_sizer_1 = wx.GridSizer(2, 2, 0, 0)

        self.radio_box_empty1 = wx.RadioBox(self.notebook_1_wxRadioBox,
                                            wx.ID_ANY,
                                            _("radio_box_empty1"),
                                            choices=[""],
                                            majorDimension=1,
                                            style=wx.RA_SPECIFY_ROWS)
        grid_sizer_1.Add(self.radio_box_empty1, 1, wx.ALL | wx.EXPAND, 5)

        self.radio_box_filled1 = wx.RadioBox(self.notebook_1_wxRadioBox,
                                             wx.ID_ANY,
                                             _("radio_box_filled1"),
                                             choices=[
                                                 _("choice 1"),
                                                 _("choice 2 (pre-selected)"),
                                                 _("choice 3")
                                             ],
                                             majorDimension=0,
                                             style=wx.RA_SPECIFY_ROWS)
        self.radio_box_filled1.SetSelection(1)
        grid_sizer_1.Add(self.radio_box_filled1, 1, wx.ALL | wx.EXPAND, 5)

        self.radio_box_empty2 = wx.RadioBox(self.notebook_1_wxRadioBox,
                                            wx.ID_ANY,
                                            _("radio_box_empty2"),
                                            choices=[""],
                                            majorDimension=1,
                                            style=wx.RA_SPECIFY_COLS)
        grid_sizer_1.Add(self.radio_box_empty2, 1, wx.ALL | wx.EXPAND, 5)

        self.radio_box_filled2 = wx.RadioBox(
            self.notebook_1_wxRadioBox,
            wx.ID_ANY,
            _("radio_box_filled2"),
            choices=[_("choice 1"),
                     _("choice 2 (pre-selected)")],
            majorDimension=0,
            style=wx.RA_SPECIFY_COLS)
        self.radio_box_filled2.SetSelection(1)
        grid_sizer_1.Add(self.radio_box_filled2, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxRadioButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxRadioButton,
                                _("wxRadioButton"))

        sizer_8 = wx.StaticBoxSizer(
            wx.StaticBox(self.notebook_1_wxRadioButton, wx.ID_ANY,
                         _("My RadioButton Group")), wx.HORIZONTAL)

        grid_sizer_2 = wx.FlexGridSizer(3, 2, 0, 0)
        sizer_8.Add(grid_sizer_2, 1, wx.EXPAND, 0)

        self.radio_btn_1 = wx.RadioButton(self.notebook_1_wxRadioButton,
                                          wx.ID_ANY,
                                          _("Alice"),
                                          style=wx.RB_GROUP)
        grid_sizer_2.Add(self.radio_btn_1, 1, wx.ALL | wx.EXPAND, 5)

        self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_wxRadioButton,
                                       wx.ID_ANY, "")
        grid_sizer_2.Add(self.text_ctrl_1, 1, wx.ALL | wx.EXPAND, 5)

        self.radio_btn_2 = wx.RadioButton(self.notebook_1_wxRadioButton,
                                          wx.ID_ANY, _("Bob"))
        grid_sizer_2.Add(self.radio_btn_2, 1, wx.ALL | wx.EXPAND, 5)

        self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_wxRadioButton,
                                       wx.ID_ANY, "")
        grid_sizer_2.Add(self.text_ctrl_2, 1, wx.ALL | wx.EXPAND, 5)

        self.radio_btn_3 = wx.RadioButton(self.notebook_1_wxRadioButton,
                                          wx.ID_ANY, _("Malroy"))
        grid_sizer_2.Add(self.radio_btn_3, 1, wx.ALL | wx.EXPAND, 5)

        self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_wxRadioButton,
                                       wx.ID_ANY, "")
        grid_sizer_2.Add(self.text_ctrl_3, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxSlider = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxSlider, _("wxSlider"))

        sizer_22 = wx.BoxSizer(wx.HORIZONTAL)

        self.slider_1 = wx.Slider(self.notebook_1_wxSlider,
                                  wx.ID_ANY,
                                  5,
                                  0,
                                  10,
                                  style=0)
        sizer_22.Add(self.slider_1, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxSpinButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxSpinButton,
                                _("wxSpinButton (with wxTextCtrl)"))

        sizer_16 = wx.BoxSizer(wx.HORIZONTAL)

        self.tc_spin_button = wx.TextCtrl(self.notebook_1_wxSpinButton,
                                          wx.ID_ANY,
                                          _("1"),
                                          style=wx.TE_RIGHT)
        sizer_16.Add(self.tc_spin_button, 1, wx.ALL, 5)

        self.spin_button = wx.SpinButton(self.notebook_1_wxSpinButton,
                                         wx.ID_ANY)
        sizer_16.Add(self.spin_button, 1, wx.ALL, 5)

        self.notebook_1_wxSpinCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxSpinCtrl, _("wxSpinCtrl"))

        sizer_14 = wx.BoxSizer(wx.HORIZONTAL)

        self.spin_ctrl_1 = wx.SpinCtrl(self.notebook_1_wxSpinCtrl,
                                       wx.ID_ANY,
                                       "4",
                                       min=0,
                                       max=100,
                                       style=wx.ALIGN_RIGHT | wx.SP_ARROW_KEYS)
        sizer_14.Add(self.spin_ctrl_1, 1, wx.ALL, 5)

        self.notebook_1_wxSplitterWindow_horizontal = wx.ScrolledWindow(
            self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.notebook_1_wxSplitterWindow_horizontal.SetScrollRate(10, 10)
        self.notebook_1.AddPage(self.notebook_1_wxSplitterWindow_horizontal,
                                _("wxSplitterWindow (horizontally)"))

        sizer_29 = wx.BoxSizer(wx.HORIZONTAL)

        self.splitter_1 = wx.SplitterWindow(
            self.notebook_1_wxSplitterWindow_horizontal, wx.ID_ANY, style=0)
        self.splitter_1.SetMinimumPaneSize(20)
        sizer_29.Add(self.splitter_1, 1, wx.ALL | wx.EXPAND, 5)

        self.splitter_1_pane_1 = wx.Panel(self.splitter_1, wx.ID_ANY)

        sizer_30 = wx.BoxSizer(wx.HORIZONTAL)

        self.label_top_pane = wx.StaticText(self.splitter_1_pane_1, wx.ID_ANY,
                                            _("top pane"))
        sizer_30.Add(self.label_top_pane, 1, wx.ALL | wx.EXPAND, 5)

        self.splitter_1_pane_2 = wx.Panel(self.splitter_1, wx.ID_ANY)

        sizer_31 = wx.BoxSizer(wx.HORIZONTAL)

        self.label_buttom_pane = wx.StaticText(self.splitter_1_pane_2,
                                               wx.ID_ANY, _("bottom pane"))
        sizer_31.Add(self.label_buttom_pane, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxSplitterWindow_vertical = wx.ScrolledWindow(
            self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.notebook_1_wxSplitterWindow_vertical.SetScrollRate(10, 10)
        self.notebook_1.AddPage(self.notebook_1_wxSplitterWindow_vertical,
                                _("wxSplitterWindow (vertically)"))

        sizer_25 = wx.BoxSizer(wx.HORIZONTAL)

        self.splitter_2 = wx.SplitterWindow(
            self.notebook_1_wxSplitterWindow_vertical, wx.ID_ANY, style=0)
        self.splitter_2.SetMinimumPaneSize(20)
        sizer_25.Add(self.splitter_2, 1, wx.ALL | wx.EXPAND, 5)

        self.splitter_2_pane_1 = wx.Panel(self.splitter_2, wx.ID_ANY)

        sizer_32 = wx.BoxSizer(wx.VERTICAL)

        self.label_left_pane = wx.StaticText(self.splitter_2_pane_1, wx.ID_ANY,
                                             _("left pane"))
        sizer_32.Add(self.label_left_pane, 1, wx.ALL | wx.EXPAND, 5)

        self.splitter_2_pane_2 = wx.Panel(self.splitter_2, wx.ID_ANY)

        sizer_33 = wx.BoxSizer(wx.VERTICAL)

        self.label_right_pane = wx.StaticText(self.splitter_2_pane_2,
                                              wx.ID_ANY, _("right pane"))
        sizer_33.Add(self.label_right_pane, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxStaticBitmap = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxStaticBitmap,
                                _("wxStaticBitmap"))

        sizer_11 = wx.BoxSizer(wx.VERTICAL)

        self.bitmap_empty = wx.StaticBitmap(self.notebook_1_wxStaticBitmap,
                                            wx.ID_ANY, wx.Bitmap(32, 32))
        sizer_11.Add(self.bitmap_empty, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_file = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY,
            wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY))
        sizer_11.Add(self.bitmap_file, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_nofile = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY,
            wx.Bitmap("non-existing.bmp", wx.BITMAP_TYPE_ANY))
        sizer_11.Add(self.bitmap_nofile, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_art = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY,
            wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_OTHER, (32, 32)))
        sizer_11.Add(self.bitmap_art, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_null = wx.StaticBitmap(self.notebook_1_wxStaticBitmap,
                                           wx.ID_ANY, wx.NullBitmap)
        sizer_11.Add(self.bitmap_null, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_null_sized = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap(50, 50))
        self.bitmap_null_sized.SetMinSize((50, 50))
        sizer_11.Add(self.bitmap_null_sized, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxStaticLine = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxStaticLine,
                                _("wxStaticLine"))

        sizer_9 = wx.BoxSizer(wx.VERTICAL)

        sizer_10 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_9.Add(sizer_10, 1, wx.EXPAND, 0)

        self.static_line_2 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY,
                                           style=wx.LI_VERTICAL)
        sizer_10.Add(self.static_line_2, 1, wx.ALL | wx.EXPAND, 5)

        self.static_line_3 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY,
                                           style=wx.LI_VERTICAL)
        sizer_10.Add(self.static_line_3, 1, wx.ALL | wx.EXPAND, 5)

        self.static_line_4 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY)
        sizer_9.Add(self.static_line_4, 1, wx.ALL | wx.EXPAND, 5)

        self.static_line_5 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY)
        sizer_9.Add(self.static_line_5, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxStaticText = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxStaticText,
                                _("wxStaticText"))

        grid_sizer_3 = wx.FlexGridSizer(1, 3, 0, 0)

        self.label_1 = wx.StaticText(self.notebook_1_wxStaticText,
                                     wx.ID_ANY,
                                     _("red text (RGB)"),
                                     style=wx.ALIGN_CENTER_HORIZONTAL)
        self.label_1.SetForegroundColour(wx.Colour(255, 0, 0))
        grid_sizer_3.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 5)

        self.label_4 = wx.StaticText(self.notebook_1_wxStaticText,
                                     wx.ID_ANY,
                                     _("black on red (RGB)"),
                                     style=wx.ALIGN_CENTER_HORIZONTAL)
        self.label_4.SetBackgroundColour(wx.Colour(255, 0, 0))
        self.label_4.SetToolTip(
            _("Background colour won't show, check documentation for more details"
              ))
        grid_sizer_3.Add(self.label_4, 1, wx.ALL | wx.EXPAND, 5)

        self.label_5 = wx.StaticText(self.notebook_1_wxStaticText,
                                     wx.ID_ANY,
                                     _("green on pink (RGB)"),
                                     style=wx.ALIGN_CENTER_HORIZONTAL)
        self.label_5.SetBackgroundColour(wx.Colour(255, 0, 255))
        self.label_5.SetForegroundColour(wx.Colour(0, 255, 0))
        self.label_5.SetToolTip(
            _("Background colour won't show, check documentation for more details"
              ))
        grid_sizer_3.Add(self.label_5, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_Spacer = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_Spacer, _("Spacer"))

        grid_sizer_4 = wx.FlexGridSizer(1, 3, 0, 0)

        self.label_3 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY,
                                     _("Two labels with a"))
        grid_sizer_4.Add(self.label_3, 1, wx.ALL | wx.EXPAND, 5)

        grid_sizer_4.Add((60, 20), 1, wx.ALL | wx.EXPAND, 5)

        self.label_2 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY,
                                     _("spacer between"))
        grid_sizer_4.Add(self.label_2, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxTextCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxTextCtrl, _("wxTextCtrl"))

        sizer_18 = wx.BoxSizer(wx.HORIZONTAL)

        self.text_ctrl = wx.TextCtrl(self.notebook_1_wxTextCtrl,
                                     wx.ID_ANY,
                                     _("This\nis\na\nmultiline\nwxTextCtrl"),
                                     style=wx.TE_CHARWRAP | wx.TE_MULTILINE
                                     | wx.TE_WORDWRAP)
        sizer_18.Add(self.text_ctrl, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxToggleButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxToggleButton,
                                _("wxToggleButton"))

        sizer_23 = wx.BoxSizer(wx.HORIZONTAL)

        self.button_2 = wx.ToggleButton(self.notebook_1_wxToggleButton,
                                        wx.ID_ANY, _("Toggle Button 1"))
        sizer_23.Add(self.button_2, 1, wx.ALL, 5)

        self.button_4 = wx.ToggleButton(self.notebook_1_wxToggleButton,
                                        wx.ID_ANY,
                                        _("Toggle Button 2"),
                                        style=wx.BU_BOTTOM | wx.BU_EXACTFIT)
        sizer_23.Add(self.button_4, 1, wx.ALL, 5)

        self.notebook_1_wxTreeCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxTreeCtrl, _("wxTreeCtrl"))

        sizer_24 = wx.BoxSizer(wx.HORIZONTAL)

        self.tree_ctrl_1 = wx.TreeCtrl(self.notebook_1_wxTreeCtrl,
                                       wx.ID_ANY,
                                       style=0)
        sizer_24.Add(self.tree_ctrl_1, 1, wx.ALL | wx.EXPAND, 5)

        self.static_line_1 = wx.StaticLine(self, wx.ID_ANY)
        sizer_1.Add(self.static_line_1, 0, wx.ALL | wx.EXPAND, 5)

        sizer_2 = wx.FlexGridSizer(1, 2, 0, 0)
        sizer_1.Add(sizer_2, 0, wx.ALIGN_RIGHT, 0)

        self.button_5 = wx.Button(self, wx.ID_CLOSE, "")
        sizer_2.Add(self.button_5, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.button_1 = wx.Button(self, wx.ID_OK, "", style=wx.BU_TOP)
        sizer_2.Add(self.button_1, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.notebook_1_wxTreeCtrl.SetSizer(sizer_24)

        self.notebook_1_wxToggleButton.SetSizer(sizer_23)

        self.notebook_1_wxTextCtrl.SetSizer(sizer_18)

        self.notebook_1_Spacer.SetSizer(grid_sizer_4)

        self.notebook_1_wxStaticText.SetSizer(grid_sizer_3)

        self.notebook_1_wxStaticLine.SetSizer(sizer_9)

        self.notebook_1_wxStaticBitmap.SetSizer(sizer_11)

        self.splitter_2_pane_2.SetSizer(sizer_33)

        self.splitter_2_pane_1.SetSizer(sizer_32)

        self.splitter_2.SplitVertically(self.splitter_2_pane_1,
                                        self.splitter_2_pane_2)

        self.notebook_1_wxSplitterWindow_vertical.SetSizer(sizer_25)

        self.splitter_1_pane_2.SetSizer(sizer_31)

        self.splitter_1_pane_1.SetSizer(sizer_30)

        self.splitter_1.SplitHorizontally(self.splitter_1_pane_1,
                                          self.splitter_1_pane_2)

        self.notebook_1_wxSplitterWindow_horizontal.SetSizer(sizer_29)

        self.notebook_1_wxSpinCtrl.SetSizer(sizer_14)

        self.notebook_1_wxSpinButton.SetSizer(sizer_16)

        self.notebook_1_wxSlider.SetSizer(sizer_22)

        self.notebook_1_wxRadioButton.SetSizer(sizer_8)

        self.notebook_1_wxRadioBox.SetSizer(grid_sizer_1)

        self.notebook_1_wxPropertyGridManager.SetSizer(sizer_34)

        self.notebook_1_wxListCtrl.SetSizer(sizer_3)

        self.notebook_1_wxListBox.SetSizer(sizer_4)

        self.notebook_1_wxHyperlinkCtrl.SetSizer(sizer_20)

        self.notebook_1_wxGrid.SetSizer(sizer_19)

        self.notebook_1_wxGauge.SetSizer(sizer_15)

        self.notebook_1_wxDatePickerCtrl.SetSizer(sizer_17)

        self.notebook_1_wxComboBox.SetSizer(sizer_6)

        self.notebook_1_wxChoice.SetSizer(sizer_5)

        self.notebook_1_wxCheckListBox.SetSizer(sizer_26)

        self.notebook_1_wxCheckBox.SetSizer(sizer_21)

        self.notebook_1_wxGenericCalendarCtrl.SetSizer(sizer_27)

        self.notebook_1_wxCalendarCtrl.SetSizer(sizer_12)

        self.notebook_1_wxButton.SetSizer(sizer_28)

        sizer_13.AddGrowableRow(0)
        sizer_13.AddGrowableRow(1)
        sizer_13.AddGrowableCol(0)
        sizer_13.AddGrowableCol(1)
        self.notebook_1_wxBitmapButton.SetSizer(sizer_13)

        sizer_1.AddGrowableRow(0)
        sizer_1.AddGrowableCol(0)
        self.SetSizer(sizer_1)
        sizer_1.SetSizeHints(self)

        self.Layout()
        self.Centre()

        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnNotebookPageChanged,
                  self.notebook_1)
        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnNotebookPageChanging,
                  self.notebook_1)
        self.Bind(wx.EVT_NAVIGATION_KEY, self.OnBitmapButtonPanelNavigationKey)
        self.Bind(wx.EVT_BUTTON, self.onStartConverting, self.button_1)
Exemple #23
0
    def __init__(self, filename, *args, **kwargs):
        super(CSVImportOptionsPage, self).__init__(*args, **kwargs)

        self.delimiter = wx.Choice(self, wx.ID_ANY)
        self.delimiter.Append(_('Comma'))
        self.delimiter.Append(_('Tab'))
        self.delimiter.Append(_('Space'))
        self.delimiter.Append(_('Colon'))
        self.delimiter.Append(_('Semicolon'))
        self.delimiter.Append(_('Pipe'))
        self.delimiter.SetSelection(0)

        self.date = wx.Choice(self)
        self.date.Append(_('DD/MM (day first)'))
        self.date.Append(_('MM/DD (month first)'))
        self.date.SetSelection(0)

        self.quoteChar = wx.Choice(self, wx.ID_ANY)
        self.quoteChar.Append(_('Simple quote'))
        self.quoteChar.Append(_('Double quote'))
        self.quoteChar.SetSelection(1)

        self.quotePanel = wx.Panel(self, wx.ID_ANY)
        self.doubleQuote = wx.RadioButton(self.quotePanel, wx.ID_ANY,
                                          _('Double it'))
        self.doubleQuote.SetValue(True)
        self.escapeQuote = wx.RadioButton(self.quotePanel, wx.ID_ANY,
                                          _('Escape with'))
        self.escapeChar = wx.TextCtrl(self.quotePanel,
                                      wx.ID_ANY,
                                      '\\',
                                      size=(50, -1))
        self.escapeChar.Enable(False)
        self.escapeChar.SetMaxLength(1)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.Add(self.doubleQuote, 1, wx.ALL, 3)
        hsizer.Add(self.escapeQuote, 1, wx.ALL, 3)
        hsizer.Add(self.escapeChar, 1, wx.ALL, 3)
        self.quotePanel.SetSizer(hsizer)

        self.importSelectedRowsOnly = wx.CheckBox(
            self, wx.ID_ANY, _('Import only the selected rows'))
        self.importSelectedRowsOnly.SetValue(False)

        self.hasHeaders = wx.CheckBox(self, wx.ID_ANY,
                                      _('First line describes fields'))
        self.hasHeaders.SetValue(True)

        self.grid = gridlib.Grid(self)
        self.grid.SetRowLabelSize(0)
        self.grid.SetColLabelSize(0)
        self.grid.CreateGrid(0, 0)
        self.grid.EnableEditing(False)
        self.grid.SetSelectionMode(self.grid.wxGridSelectRows)

        vsizer = wx.BoxSizer(wx.VERTICAL)
        gridSizer = wx.FlexGridSizer(0, 2)

        gridSizer.Add(wx.StaticText(self, wx.ID_ANY, _('Delimiter')), 0,
                      wx.ALIGN_CENTRE_VERTICAL | wx.ALL, 3)
        gridSizer.Add(self.delimiter, 0, wx.ALL, 3)

        gridSizer.Add(wx.StaticText(self, wx.ID_ANY, _('Date format')), 0,
                      wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3)
        gridSizer.Add(self.date, 0, wx.ALL, 3)

        gridSizer.Add(wx.StaticText(self, wx.ID_ANY, _('Quote character')), 0,
                      wx.ALIGN_CENTRE_VERTICAL | wx.ALL, 3)
        gridSizer.Add(self.quoteChar, 0, wx.ALL, 3)

        gridSizer.Add(wx.StaticText(self, wx.ID_ANY, _('Escape quote')), 0,
                      wx.ALIGN_CENTRE_VERTICAL | wx.ALL, 3)
        gridSizer.Add(self.quotePanel, 0, wx.ALL, 3)

        gridSizer.Add(self.importSelectedRowsOnly, 0, wx.ALL, 3)
        gridSizer.Add((0, 0))

        gridSizer.Add(self.hasHeaders, 0, wx.ALL, 3)
        gridSizer.Add((0, 0))

        gridSizer.AddGrowableCol(1)
        vsizer.Add(gridSizer, 0, wx.EXPAND | wx.ALL, 3)

        vsizer.Add(self.grid, 1, wx.EXPAND | wx.ALL, 3)

        self.SetSizer(vsizer)

        self.headers = None

        self.filename = filename
        self.encoding = chardet.detect(file(filename, 'rb').read())['encoding']
        self.OnOptionChanged(None)

        wx.EVT_CHOICE(self.delimiter, wx.ID_ANY, self.OnOptionChanged)
        wx.EVT_CHOICE(self.quoteChar, wx.ID_ANY, self.OnOptionChanged)
        wx.EVT_CHECKBOX(self.importSelectedRowsOnly, wx.ID_ANY,
                        self.OnOptionChanged)
        wx.EVT_CHECKBOX(self.hasHeaders, wx.ID_ANY, self.OnOptionChanged)
        wx.EVT_RADIOBUTTON(self.doubleQuote, wx.ID_ANY, self.OnOptionChanged)
        wx.EVT_RADIOBUTTON(self.escapeQuote, wx.ID_ANY, self.OnOptionChanged)
        wx.EVT_TEXT(self.escapeChar, wx.ID_ANY, self.OnOptionChanged)
Exemple #24
0
    def __init__(self, *args, **kwargs):
        """ Constructor
		"""

        Wizard.__init__(self, *args, **kwargs)

        # properties of model
        self.type = "Atomic"
        self.label = ""
        self.inputs = 1
        self.outputs = 1
        self.python_path = ""
        self.model_path = ""
        self.specific_behavior = ""

        # special properties for Port
        self.id = None

        # canvas parent
        parent = self.GetParent()

        # Create a page 1
        page1 = wizard_page(self, _('Type of Model'))
        bt1 = wx.RadioButton(page1,
                             wx.ID_ANY,
                             _('Atomic model'),
                             style=wx.RB_GROUP)
        bt2 = wx.RadioButton(page1, wx.ID_ANY, _('Coupled model'))
        bt1.SetToolTipString(
            _("DEVS classic atomic model. It is used to define the behavior (or a part of behavior) of the system"
              ))
        bt2.SetToolTipString(
            _("DEVS classic coupled model. It is used to define the structure (or a part of structure) of the system"
              ))
        page1.add_stuff(
            wx.StaticText(page1, wx.ID_ANY, _('Choose the type of model:')))
        page1.add_stuff(bt1)
        page1.add_stuff(bt2)

        ### if left click on the DetachedFrame, port instance can be created
        if isinstance(parent.GetTopLevelParent(), Container.DetachedFrame):
            bt3 = wx.RadioButton(page1, wx.ID_ANY, _('Input Port'))
            bt4 = wx.RadioButton(page1, wx.ID_ANY, _('Output Port'))
            bt3.SetToolTipString(
                _("DEVS classic input model. It is used to link models"))
            bt4.SetToolTipString(
                _("DEVS classic output model. It is used to link models"))
            page1.add_stuff(bt3)
            page1.add_stuff(bt4)

            def onBt3Click(evt):
                """ input port radio button has been pressed. We redefine its action
				"""

                self.type = "IPort"
                page1.SetNext(page6)
                page6.SetNext(page5)
                page5.SetNext(None)
                page5.SetPrev(page1)
                page6.SetPrev(page1)

            def onBt4Click(evt):
                """ input port radio button has been pressed. We redefine its action
				"""

                self.type = "OPort"
                page1.SetNext(page7)
                page7.SetNext(page5)
                page5.SetNext(None)
                page5.SetPrev(page1)
                page7.SetPrev(page1)

            bt3.Bind(wx.EVT_RADIOBUTTON, onBt3Click)
            bt4.Bind(wx.EVT_RADIOBUTTON, onBt4Click)

        def python_path_call_back(evt):
            fn = evt.GetEventObject().GetValue()
            cls = Components.GetClass(fn)
            if inspect.isclass(cls):
                ### import are here because the simulator (PyDEVS or PyPDEVS) require it
                from DomainInterface.DomainBehavior import DomainBehavior
                from DomainInterface.DomainStructure import DomainStructure
                if not (issubclass(cls, DomainBehavior)
                        or issubclass(cls, DomainStructure)):
                    dlg = wx.MessageDialog(
                        parent,
                        _('The python file must contain a class that inherit of DomainBehavior or DomainStructure master class.\n Please choose a correct python file.'
                          ), _('Wizard Manager'), wx.ID_OK | wx.ICON_ERROR)
                    dlg.ShowModal()
            else:
                dlg = wx.MessageDialog(
                    parent,
                    _('The python file not includes a class definition.\n Please choose a correct python file.'
                      ), _('Wizard Manager'), wx.ID_OK | wx.ICON_ERROR)
                dlg.ShowModal()

        def plugin_path_call_back(evt):
            fn = evt.GetEventObject().GetValue()
            if os.path.basename(fn) != 'plugins.py':
                dlg = wx.MessageDialog(
                    parent,
                    _('The name of plugin python file must be plugins.py.\n Please choose a correct plugin python file.'
                      ), _('Wizard Manager'), wx.ID_OK | wx.ICON_ERROR)
                dlg.ShowModal()

        # Create a page 2
        page2 = wizard_page(self, _('Atomic Model (AMD)'))
        sb1 = wx.StaticBoxSizer(wx.StaticBox(page2, wx.ID_ANY,
                                             _('Properties')),
                                orient=wx.VERTICAL)
        vb1 = wx.BoxSizer(wx.VERTICAL)
        vbox2 = wx.GridSizer(6, 2, 3, 3)
        bt5 = wx.CheckBox(page2, wx.ID_ANY, _('Default python file'))
        bt5.SetValue(True)
        bt5.SetToolTipString(_("Choose python file from specific directory"))
        bt51 = wx.CheckBox(page2, wx.ID_ANY, _('No plugin file'))
        bt51.SetToolTipString(_("Choose plugin file from specific directory"))
        bt51.SetValue(True)
        cb0 = wx.ComboBox(page2,
                          wx.ID_ANY,
                          _('Default'),
                          choices=[
                              _('Default'),
                              _('Generator'),
                              _('Viewer'),
                              _('Collector')
                          ],
                          style=wx.CB_READONLY)
        # filebrowse properties
        fb1 = filebrowse.FileBrowseButton(page2,
                                          wx.ID_ANY,
                                          startDirectory=DOMAIN_PATH,
                                          labelText="",
                                          fileMask='*.py',
                                          toolTip=bt5.GetToolTip().GetTip(),
                                          changeCallback=python_path_call_back)
        fb12 = filebrowse.FileBrowseButton(
            page2,
            wx.ID_ANY,
            startDirectory=DOMAIN_PATH,
            labelText="",
            fileMask='plugins.py',
            toolTip=bt51.GetToolTip().GetTip(),
            changeCallback=plugin_path_call_back)
        fb1.Enable(False)
        fb12.Enable(False)
        vbox2.AddMany([
            (wx.StaticText(page2, wx.ID_ANY, _('Label')), 0,
             wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (wx.TextCtrl(page2,
                         wx.ID_ANY,
                         value=_("Atomic_Name"),
                         validator=TextObjectValidator()), 0,
             wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (wx.StaticText(page2, wx.ID_ANY, _('Specific Behavior')), 0,
             wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (cb0, 0, wx.EXPAND),
            (wx.StaticText(page2, wx.ID_ANY, _('Inputs')), 0,
             wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (wx.SpinCtrl(page2,
                         wx.ID_ANY,
                         '1',
                         min=MIN_NB_PORT,
                         max=MAX_NB_PORT), 0, wx.EXPAND),
            (wx.StaticText(page2, wx.ID_ANY, _('Outputs')), 0,
             wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (wx.SpinCtrl(page2,
                         wx.ID_ANY,
                         '1',
                         min=MIN_NB_PORT,
                         max=MAX_NB_PORT), 0, wx.EXPAND), (bt5, 0),
            (fb1, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (bt51, 0),
            (fb12, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
        ])
        vb1.Add(vbox2, 0, wx.EXPAND)
        sb1.Add(vb1, 0, wx.EXPAND)

        page2.add_stuff(sb1)

        # Create a page 3
        page3 = wizard_page(self, _('Coupled Model (CMD)'))
        sb2 = wx.StaticBoxSizer(wx.StaticBox(page3, wx.ID_ANY,
                                             _('Properties')),
                                orient=wx.VERTICAL)
        vb2 = wx.BoxSizer(wx.VERTICAL)
        vbox3 = wx.GridSizer(6, 2, 3, 3)
        bt6 = wx.CheckBox(page3, wx.ID_ANY, _('Default python file'))
        bt6.SetToolTipString(bt5.GetToolTip().GetTip())
        bt6.SetValue(True)
        bt61 = wx.CheckBox(page3, wx.ID_ANY, _('No plugin file'))
        bt61.SetToolTipString(bt51.GetToolTip().GetTip())
        bt61.SetValue(True)
        # filebrowse properties
        fb4 = filebrowse.FileBrowseButton(page3,
                                          wx.ID_ANY,
                                          startDirectory=DOMAIN_PATH,
                                          labelText="",
                                          fileMask='*.py',
                                          toolTip=bt6.GetToolTip().GetTip(),
                                          changeCallback=plugin_path_call_back)
        fb41 = filebrowse.FileBrowseButton(
            page3,
            wx.ID_ANY,
            startDirectory=DOMAIN_PATH,
            labelText="",
            fileMask='plugins.py',
            toolTip=bt61.GetToolTip().GetTip(),
            changeCallback=plugin_path_call_back)
        fb4.Enable(False)
        fb41.Enable(False)
        vbox3.AddMany([
            (wx.StaticText(page3, wx.ID_ANY, _('Label')), 0,
             wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (wx.TextCtrl(page3,
                         wx.ID_ANY,
                         value=_("Coupled_Name"),
                         validator=TextObjectValidator()), 0,
             wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (wx.StaticText(page3, wx.ID_ANY, _('Inputs')), 0,
             wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (wx.SpinCtrl(page3,
                         wx.ID_ANY,
                         '1',
                         min=MIN_NB_PORT,
                         max=MAX_NB_PORT), 0, wx.EXPAND),
            (wx.StaticText(page3, wx.ID_ANY, _('Outputs')), 0,
             wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (wx.SpinCtrl(page3,
                         wx.ID_ANY,
                         '1',
                         min=MIN_NB_PORT,
                         max=MAX_NB_PORT), 0, wx.EXPAND), (bt6, 0),
            (fb4, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
            (bt61, 0),
            (fb41, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
        ])
        #page3.add_stuff(vbox3)
        vb2.Add(vbox3, 0, wx.EXPAND)
        sb2.Add(vb2, 0, wx.EXPAND)
        page3.add_stuff(sb2)

        # Create a page 4_1
        page4_1 = wizard_page(self, _('Finish'))
        # save filebrowse
        init = os.path.join(DOMAIN_PATH,
                            "%s.amd" % vbox2.GetItem(1).GetWindow().GetValue())
        fb2 = filebrowse.FileBrowseButton(
            page4_1,
            wx.ID_ANY,
            initialValue=init,
            fileMode=wx.SAVE,
            #startDirectory = DOMAIN_PATH,
            labelText=_("Save as"),
            fileMask='*.amd')

        page4_1.add_stuff(fb2)

        # Create a page 4_2
        page4_2 = wizard_page(self, _('Finish'))
        init = os.path.join(DOMAIN_PATH,
                            "%s.cmd" % vbox3.GetItem(1).GetWindow().GetValue())
        # save filebrowse
        fb3 = filebrowse.FileBrowseButton(
            page4_2,
            wx.ID_ANY,
            initialValue=init,
            fileMode=wx.SAVE,
            #startDirectory = DOMAIN_PATH,
            labelText=_("Save as"),
            fileMask='*.cmd')
        page4_2.add_stuff(fb3)

        # Create a page 5
        page5 = wizard_page(self, _('Finish'))
        page5.add_stuff(
            wx.StaticText(page5, wx.ID_ANY, _('Port model has been created.')))

        ### if left click on the DetachedFrame, port instance can be created
        if isinstance(parent.GetTopLevelParent(), Container.DetachedFrame):
            # Create a page 6
            page6 = wizard_page(self, _('Input Port'))
            sb3 = wx.StaticBoxSizer(wx.StaticBox(page6, wx.ID_ANY,
                                                 _('Properties')),
                                    orient=wx.VERTICAL)
            vb3 = wx.BoxSizer(wx.VERTICAL)
            #page6.add_stuff(wx.StaticBox(page6, -1, _('Properties')))
            cb_id1 = wx.CheckBox(page6, wx.ID_ANY, _('Automatic Id'))
            spin_id1 = wx.SpinCtrl(page6,
                                   wx.ID_ANY,
                                   str(parent.diagram.GetiPortCount()),
                                   min=MIN_NB_PORT,
                                   max=MAX_NB_PORT)
            cb_id1.SetValue(True)
            spin_id1.Enable(False)
            vbox6 = wx.GridSizer(2, 2, 3, 3)
            vbox6.AddMany([
                (wx.StaticText(page6, wx.ID_ANY, _('Label')), 0,
                 wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
                (wx.TextCtrl(page6, wx.ID_ANY, value=_("IPort ")), 0,
                 wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
                (cb_id1, 0), (spin_id1, 0, wx.EXPAND)
            ])
            vb3.Add(vbox6, 0, wx.EXPAND)
            sb3.Add(vb3, 0, wx.EXPAND)

            page6.add_stuff(sb3)
            #page6.add_stuff(vbox6)

            # Create a page 7
            page7 = wizard_page(self, _('Output Port'))
            #page7.add_stuff(wx.StaticBox(page7, -1, _('Properties')))
            sb4 = wx.StaticBoxSizer(wx.StaticBox(page7, wx.ID_ANY,
                                                 _('Properties')),
                                    orient=wx.VERTICAL)
            vb4 = wx.BoxSizer(wx.VERTICAL)
            cb_id2 = wx.CheckBox(page7, wx.ID_ANY, _('Automatic Id'))
            spin_id2 = wx.SpinCtrl(page7,
                                   wx.ID_ANY,
                                   str(parent.diagram.GetoPortCount()),
                                   min=MIN_NB_PORT,
                                   max=MAX_NB_PORT)
            cb_id2.SetValue(True)
            spin_id2.Enable(False)
            vbox7 = wx.GridSizer(2, 2, 3, 3)
            vbox7.AddMany([
                (wx.StaticText(page7, wx.ID_ANY, _('Label')), 0,
                 wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
                (wx.TextCtrl(page7, wx.ID_ANY, value=_("OPort ")), 0,
                 wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL),
                (cb_id2, 0), (spin_id2, 0, wx.EXPAND)
            ])
            vb4.Add(vbox7, 0, wx.EXPAND)
            sb4.Add(vb4, 0, wx.EXPAND)

            page7.add_stuff(sb4)

        def onBt1Click(evt):
            """ Atomic radio button has been pressed. We redefine its action
			"""

            self.type = "Atomic"
            page1.SetNext(page2)
            page2.SetPrev(page1)
            page2.SetNext(page4_1)
            page4_1.SetPrev(page2)

        def onBt2Click(evt):
            """ Coupled radio button has been pressed. We redefine its action
			"""

            self.type = "Coupled"
            page1.SetNext(page3)
            page3.SetPrev(page1)
            page3.SetNext(page4_2)
            page4_2.SetPrev(page3)

        # event handler for check button
        def onBt5Check(evt):
            """ Python file selector is cheked.
			"""

            if evt.GetEventObject().GetValue():
                fb1.Enable(False)
            else:
                fb1.Enable(True)

        # event handler for check button
        def onBt51Check(evt):
            """ Python file selector is cheked.
			"""
            if evt.GetEventObject().GetValue():
                fb12.Enable(False)
            else:
                fb12.Enable(True)

        def onBt6Check(evt):
            """ Python file selector is cheked.
			"""

            if evt.GetEventObject().GetValue():
                fb4.Enable(False)
            else:
                fb4.Enable(True)

        # event handler for check button
        def onBt61Check(evt):
            """ Python file selector is cheked.
			"""
            if evt.GetEventObject().GetValue():
                fb41.Enable(False)
            else:
                fb41.Enable(True)

        def onCbId1(evt):
            if evt.GetEventObject().GetValue():
                spin_id1.Enable(False)
            else:
                spin_id1.Enable(True)

        def onCbId2(evt):
            if evt.GetEventObject().GetValue():
                spin_id2.Enable(False)
            else:
                spin_id2.Enable(True)

        def OnSpecificBehavior(evt):
            """ Give the control on the number of input and output form specific behavior choice
			"""

            ### specific behavoir choice
            val = evt.GetEventObject().GetValue()

            ### if generator, 0 input and x output (1 is the default)
            if val == _('Generator'):

                ### no input and
                vbox2.GetItem(5).GetWindow().SetValue(0)
                ### update output
                if vbox2.GetItem(7).GetWindow().GetValue() == 0:
                    vbox2.GetItem(7).GetWindow().SetValue(1)

                ### Deasable the choice
                vbox2.GetItem(4).GetWindow().Enable(False)
                vbox2.GetItem(5).GetWindow().Enable(False)
                ### Enable the output choice
                vbox2.GetItem(6).GetWindow().Enable(True)
                vbox2.GetItem(7).GetWindow().Enable(True)

            ### if collector, 0 output and x input (1 is the default)
            elif val in (_('Collector'), _('Viewer')):
                ### no output
                vbox2.GetItem(7).GetWindow().SetValue(0)

                ### update input
                if vbox2.GetItem(5).GetWindow().GetValue() == 0:
                    vbox2.GetItem(5).GetWindow().SetValue(1)

                ### Deasable the choice
                vbox2.GetItem(7).GetWindow().Enable(False)
                vbox2.GetItem(6).GetWindow().Enable(False)
                ### Enable the output choice
                vbox2.GetItem(5).GetWindow().Enable(True)
                vbox2.GetItem(4).GetWindow().Enable(True)

            ### if Default, 1 output and input
            else:
                vbox2.GetItem(5).GetWindow().Enable(True)
                vbox2.GetItem(4).GetWindow().Enable(True)
                vbox2.GetItem(6).GetWindow().Enable(True)
                vbox2.GetItem(7).GetWindow().Enable(True)
                vbox2.GetItem(5).GetWindow().SetValue(1)
                vbox2.GetItem(7).GetWindow().SetValue(1)

        def OnInputAMDLabel(evt):
            fb2.SetValue(os.path.join(DOMAIN_PATH, "%s.amd" % evt.GetString()))

        def OnInputCMDLabel(evt):
            fb3.SetValue(os.path.join(DOMAIN_PATH, "%s.cmd" % evt.GetString()))

        # Binding
        bt1.Bind(wx.EVT_RADIOBUTTON, onBt1Click)
        bt2.Bind(wx.EVT_RADIOBUTTON, onBt2Click)
        bt5.Bind(wx.EVT_CHECKBOX, onBt5Check)
        bt51.Bind(wx.EVT_CHECKBOX, onBt51Check)
        bt6.Bind(wx.EVT_CHECKBOX, onBt6Check)
        bt61.Bind(wx.EVT_CHECKBOX, onBt61Check)
        ### if left click on the DetachedFrame, port instance can be created
        if isinstance(parent.GetTopLevelParent(), Container.DetachedFrame):
            cb_id1.Bind(wx.EVT_CHECKBOX, onCbId1)
            cb_id2.Bind(wx.EVT_CHECKBOX, onCbId2)
        cb0.Bind(wx.EVT_COMBOBOX, OnSpecificBehavior)
        amd_input_label = vbox2.GetItem(1).GetWindow()
        amd_input_label.Bind(wx.EVT_TEXT, OnInputAMDLabel)
        cmd_input_label = vbox3.GetItem(1).GetWindow()
        cmd_input_label.Bind(wx.EVT_TEXT, OnInputCMDLabel)

        # Add some more pages
        self.add_page(page1)
        self.add_page(page2)
        self.add_page(page3)
        self.add_page(page4_1)
        self.add_page(page4_2)
        self.add_page(page5)

        ### if left click on the DetachedFrame, port instance can be created
        if isinstance(parent.GetTopLevelParent(), Container.DetachedFrame):
            self.add_page(page6)
            self.add_page(page7)

        # define next and prev
        page1.SetNext(page2)
        page2.SetNext(page4_1)
        page2.SetPrev(page1)
        page3.SetPrev(page1)
        page3.SetNext(page4_2)
        page4_1.SetPrev(page2)
        page4_2.SetPrev(page3)
        page4_1.SetNext(None)
        page4_2.SetNext(None)
Exemple #25
0
    def __init__(self, *args, **kwds):

        from Gnumed.wxpython.gmMeasurementWidgets import cMeasurementsByDayPnl
        from Gnumed.wxpython.gmMeasurementWidgets import cMeasurementsGrid
        from Gnumed.wxpython.gmMeasurementWidgets import cTestPanelPRW

        # begin wxGlade: wxgMeasurementsPnl.__init__
        kwds["style"] = wx.NO_BORDER | wx.TAB_TRAVERSAL
        wx.Panel.__init__(self, *args, **kwds)
        self._PRW_panel = cTestPanelPRW(self,
                                        wx.ID_ANY,
                                        "",
                                        style=wx.NO_BORDER)
        self._TCTRL_panel_comment = wx.TextCtrl(self,
                                                wx.ID_ANY,
                                                "",
                                                style=wx.NO_BORDER)
        self._BTN_manage_panels = wx.Button(self,
                                            wx.ID_ANY,
                                            _("Manage panels"),
                                            style=wx.BU_EXACTFIT)
        self._BTN_display_mode = wx.Button(self,
                                           wx.ID_ANY,
                                           _("All: by day"),
                                           style=wx.BU_EXACTFIT)
        self._PNL_results_battery_grid = wx.Panel(self,
                                                  wx.ID_ANY,
                                                  style=wx.NO_BORDER)
        self._GRID_results_battery = cMeasurementsGrid(
            self._PNL_results_battery_grid, wx.ID_ANY, size=(100, 100))
        self._PNL_results_all_grid = wx.Panel(self,
                                              wx.ID_ANY,
                                              style=wx.NO_BORDER)
        self._GRID_results_all = cMeasurementsGrid(self._PNL_results_all_grid,
                                                   wx.ID_ANY,
                                                   size=(100, 100))
        self._PNL_results_all_listed = cMeasurementsByDayPnl(
            self, wx.ID_ANY, style=wx.NO_BORDER | wx.TAB_TRAVERSAL)
        self._BTN_manage_types = wx.Button(self,
                                           wx.ID_ANY,
                                           _("Manage types"),
                                           style=wx.BU_EXACTFIT)
        self._BTN_add = wx.Button(self, wx.ID_ADD, "")
        self._BTN_list = wx.Button(self, wx.ID_ANY, _("&List"))
        self._BTN_select = wx.Button(self,
                                     wx.ID_ANY,
                                     _("&Select:"),
                                     style=wx.BU_EXACTFIT)
        self._RBTN_my_unsigned = wx.RadioButton(self, wx.ID_ANY,
                                                _("your unsigned (&Y)"))
        self._RBTN_all_unsigned = wx.RadioButton(self, wx.ID_ANY,
                                                 _("all unsigned (&A)"))
        self._BTN_review = wx.Button(self,
                                     wx.ID_ANY,
                                     _("&Actions ... "),
                                     style=wx.BU_EXACTFIT)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self._on_manage_panels_button_pressed,
                  self._BTN_manage_panels)
        self.Bind(wx.EVT_BUTTON, self._on_display_mode_button_pressed,
                  self._BTN_display_mode)
        self.Bind(wx.EVT_BUTTON, self._on_manage_types_button_pressed,
                  self._BTN_manage_types)
        self.Bind(wx.EVT_BUTTON, self._on_add_button_pressed, self._BTN_add)
        self.Bind(wx.EVT_BUTTON, self._on_list_button_pressed, self._BTN_list)
        self.Bind(wx.EVT_BUTTON, self._on_select_button_pressed,
                  self._BTN_select)
        self.Bind(wx.EVT_BUTTON, self._on_review_button_pressed,
                  self._BTN_review)
Exemple #26
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 title='Shipping Calculator',
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize):

        super(Calc, self).__init__(parent, id, title, pos, size=(600, 600))

        self.panel = wx.Panel(self)

        self.txt_input0 = wx.TextCtrl(self.panel,
                                      pos=(100, 20),
                                      size=(220, 22))

        self.txt_input1 = wx.TextCtrl(self.panel,
                                      pos=(100, 60),
                                      size=(330, 22))

        self.txt_input2 = wx.TextCtrl(self.panel,
                                      pos=(100, 100),
                                      size=(280, 22))

        self.lbl0 = wx.StaticText(self.panel, label="Name", pos=(330, 24))

        self.lbl1 = wx.StaticText(self.panel, label="Address", pos=(440, 66))

        self.lbl2 = wx.StaticText(self.panel,
                                  label="City, State, Zip Code",
                                  pos=(390, 100))

        self.lbl3 = wx.StaticText(self.panel, label="Weight", pos=(40, 150))

        self.lbl4 = wx.StaticText(self.panel, label="Speed", pos=(200, 150))

        self.lbl5 = wx.StaticText(self.panel, label="Options", pos=(345, 150))

        self.Radio0 = wx.RadioButton(self.panel,
                                     label="0 - 1.9 lbs. $5",
                                     style=wx.RB_GROUP,
                                     pos=(40, 180))

        self.Radio1 = wx.RadioButton(self.panel,
                                     label="2 - 4.9 lbs. $8",
                                     pos=(40, 200))

        self.Radio2 = wx.RadioButton(self.panel,
                                     label="5 - 10 lbs. $12.25",
                                     pos=(40, 220))

        self.Radio3 = wx.RadioButton(self.panel,
                                     label="overland $2.75",
                                     style=wx.RB_GROUP,
                                     pos=(200, 180))

        self.Radio4 = wx.RadioButton(self.panel,
                                     label="3-day air $6.15",
                                     pos=(200, 200))

        self.Radio5 = wx.RadioButton(self.panel,
                                     label="2-day air $10.80",
                                     pos=(200, 220))

        self.Radio6 = wx.RadioButton(self.panel,
                                     label="overnight $15.25",
                                     pos=(200, 240))

        self.cb0 = wx.CheckBox(self.panel,
                               label="Extra padding. $5",
                               pos=(350, 180))

        self.cb1 = wx.CheckBox(self.panel,
                               label="Gift wrapping. $8",
                               pos=(350, 200))

        self.btn_enter = wx.Button(self.panel,
                                   label="Calculate Total",
                                   pos=(160, 320))

        self.btn_clear = wx.Button(self.panel,
                                   label="Clear Form",
                                   pos=(300, 320))

        self.lbl5 = wx.StaticText(self.panel,
                                  label="Shipping Summary",
                                  pos=(220, 380))

        self.btn_enter.Bind(wx.EVT_BUTTON, self.calcTotal)

        self.btn_clear.Bind(wx.EVT_BUTTON, self.clearForm)

        self.Line0 = wx.StaticText(
            self.panel,
            id=-1,
            pos=(220, 430),
            label="",
        )

        self.Line1 = wx.StaticText(self.panel, id=-1, pos=(220, 450), label="")

        self.Line2 = wx.StaticText(self.panel, id=-1, pos=(220, 470), label="")

        self.Line3 = wx.StaticText(self.panel, id=-1, pos=(220, 490), label="")
Exemple #27
0
    def view(self):
        """
        Build the UI for project configuration dialog.
        Here we have three types of project configurations.
        1. Custom Project: Users can give their own table and column names and generate data for thoss custom table
        2. From Database: Users can populate the metadata(tables and its columns) from database directly.
        3. Existing Project: Users can edit the previously saved project(it may either Custom or From Database)
        Default selection: Custom Project
        :return: None
        """
        sb = wx.StaticBox(self, label="Select The Project Type")
        sb.SetFont(
            wx.Font(wx.DEFAULT, wx.DEFAULT, style=wx.NORMAL, weight=wx.BOLD))
        sbox_select_project_type = wx.StaticBoxSizer(sb, wx.VERTICAL)
        sbox_select_project_type.SetSizeHints(self)

        rbtn_custom_project = wx.RadioButton(self, label="Custom Project")
        sbox_select_project_type.Add(
            rbtn_custom_project, 0,
            wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 10)
        rbtn_from_database = wx.RadioButton(self, label="From Database")
        sbox_select_project_type.Add(
            rbtn_from_database, 0,
            wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 10)
        rbtn_existing_project = wx.RadioButton(self, label="Existing Project")
        sbox_select_project_type.Add(
            rbtn_existing_project, 0,
            wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 10)

        hbox_btns = wx.BoxSizer(wx.HORIZONTAL)
        btn_ok = wx.Button(self, wx.ID_ANY, "OK", wx.DefaultPosition,
                           wx.DefaultSize, 10)

        btn_cancel = wx.Button(self, wx.ID_ANY, "Cancel", wx.DefaultPosition,
                               wx.DefaultSize, 10)
        self.Bind(wx.EVT_BUTTON, self.evnt_cancel, btn_cancel)

        hbox_btns.Add(btn_ok, 1, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 7)
        hbox_btns.Add(btn_cancel, 1, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 7)
        hbox_btns.Fit(self)
        hbox_btns.AddStretchSpacer(0)

        existing_project = self.existing_project_ui()
        from_database = self.from_database_ui()

        # Add elements to Main Sizer
        self.sizer.Add(sbox_select_project_type, 0,
                       wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 10)
        self.sizer.Add(existing_project, 0,
                       wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 10)
        self.sizer.Add(from_database, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER,
                       10)
        self.sizer.Add(hbox_btns, 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM, 0)

        # Bind the events to project type options
        self.Bind(
            wx.EVT_RADIOBUTTON, lambda event: self.evnt_change_project_type_ui(
                event=event,
                show_ui=existing_project,
                hide_ui=from_database,
                dialog_height=0.31), rbtn_existing_project)
        self.Bind(
            wx.EVT_RADIOBUTTON, lambda event: self.evnt_change_project_type_ui(
                event=event,
                show_ui=from_database,
                hide_ui=existing_project,
                dialog_height=0.5), rbtn_from_database)
        self.Bind(
            wx.EVT_RADIOBUTTON, lambda event: self.evnt_custom_project(
                event=event, hide_ui=[existing_project, from_database]),
            rbtn_custom_project)

        self.lbl_auth.Hide()
        self.choice_auth.Hide()
        self.sizer.Fit(self)
        self.SetSizer(self.sizer)
        self.Center(True)
        self.SetAutoLayout(1)
Exemple #28
0
 def __init__(self, parent):
     wx.Frame.__init__(self, parent, title=_("Find"), 
           size=wx.Size(400, 250), style=wx.CAPTION|
                                         wx.CLOSE_BOX|
                                         wx.CLIP_CHILDREN|
                                         wx.RESIZE_BORDER|
                                         wx.STAY_ON_TOP)
     
     panel = wx.Panel(self, style=wx.TAB_TRAVERSAL)
     
     main_sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=2, vgap=5)
     main_sizer.AddGrowableCol(0)
     main_sizer.AddGrowableRow(0)
     
     controls_sizer = wx.BoxSizer(wx.VERTICAL)
     main_sizer.AddSizer(controls_sizer, border=20, 
           flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
     
     patterns_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=1, vgap=5)
     patterns_sizer.AddGrowableCol(1)
     controls_sizer.AddSizer(patterns_sizer, border=5, flag=wx.GROW|wx.BOTTOM)
     
     find_label = wx.StaticText(panel, label=_("Find:"))
     patterns_sizer.AddWindow(find_label, flag=wx.ALIGN_CENTER_VERTICAL)
     
     self.FindPattern = wx.TextCtrl(panel)
     self.Bind(wx.EVT_TEXT, self.OnFindPatternChanged, self.FindPattern)
     patterns_sizer.AddWindow(self.FindPattern, flag=wx.GROW)
     
     params_sizer = wx.BoxSizer(wx.HORIZONTAL)
     controls_sizer.AddSizer(params_sizer, border=5, flag=wx.GROW|wx.BOTTOM)
     
     direction_staticbox = wx.StaticBox(panel, label=_("Direction"))
     direction_staticboxsizer = wx.StaticBoxSizer(
           direction_staticbox, wx.VERTICAL)
     params_sizer.AddSizer(direction_staticboxsizer, 1, border=5, 
           flag=wx.GROW|wx.RIGHT)
     
     self.Forward = wx.RadioButton(panel, label=_("Forward"), 
           style=wx.RB_GROUP)
     direction_staticboxsizer.AddWindow(self.Forward, border=5, 
           flag=wx.ALL|wx.GROW)
     
     self.Backward = wx.RadioButton(panel, label=_("Backward"))
     direction_staticboxsizer.AddWindow(self.Backward, border=5, 
           flag=wx.ALL|wx.GROW)
     
     options_staticbox = wx.StaticBox(panel, label=_("Options"))
     options_staticboxsizer = wx.StaticBoxSizer(
           options_staticbox, wx.VERTICAL)
     params_sizer.AddSizer(options_staticboxsizer, 1, flag=wx.GROW)
     
     self.CaseSensitive = wx.CheckBox(panel, label=_("Case sensitive"))
     self.CaseSensitive.SetValue(True)
     options_staticboxsizer.AddWindow(self.CaseSensitive, border=5, 
           flag=wx.ALL|wx.GROW)
     
     self.WrapSearch = wx.CheckBox(panel, label=_("Wrap search"))
     self.WrapSearch.SetValue(True)
     options_staticboxsizer.AddWindow(self.WrapSearch, border=5, 
           flag=wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.GROW)
     
     self.RegularExpressions = wx.CheckBox(panel, label=_("Regular expressions"))
     options_staticboxsizer.AddWindow(self.RegularExpressions, border=5, 
           flag=wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.GROW)
     
     buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
     main_sizer.AddSizer(buttons_sizer, border=20, 
           flag=wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_RIGHT)
     
     self.FindButton = wx.Button(panel, label=_("Find"))
     self.Bind(wx.EVT_BUTTON, self.OnFindButton, self.FindButton)
     buttons_sizer.AddWindow(self.FindButton, border=5, flag=wx.RIGHT)
     
     self.CloseButton = wx.Button(panel, label=("Close"))
     self.Bind(wx.EVT_BUTTON, self.OnCloseButton, self.CloseButton)
     buttons_sizer.AddWindow(self.CloseButton)
     
     panel.SetSizer(main_sizer)
     
     self.ParentWindow = parent
     
     self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
 
     self.RefreshButtonsState()
	def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Asset Scanner - ITMS", pos = wx.DefaultPosition, size = wx.Size( 500,255 ), style = wx.DEFAULT_FRAME_STYLE|wx.MAXIMIZE|wx.TAB_TRAVERSAL )
		
		self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
		
		fgSizer1 = wx.FlexGridSizer( 4, 2, 0, 0 )
		fgSizer1.AddGrowableCol( 1 )
		fgSizer1.AddGrowableRow( 3 )
		fgSizer1.SetFlexibleDirection( wx.BOTH )
		fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
		
		self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Computer Name or IP", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText1.Wrap( -1 )
		fgSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 )
		
		self.txtassetname = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		fgSizer1.Add( self.txtassetname, 0, wx.ALL|wx.EXPAND, 5 )
		
		self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText5.Wrap( -1 )
		fgSizer1.Add( self.m_staticText5, 0, wx.ALL, 5 )
		
		fgSizer4 = wx.FlexGridSizer( 0, 2, 0, 0 )
		fgSizer4.SetFlexibleDirection( wx.BOTH )
		fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
		
		self.rd_hardware = wx.RadioButton( self, wx.ID_ANY, u"Hardware", wx.DefaultPosition, wx.DefaultSize, 0 )
		fgSizer4.Add( self.rd_hardware, 0, wx.ALL, 5 )
		
		self.rd_software = wx.RadioButton( self, wx.ID_ANY, u"Software", wx.DefaultPosition, wx.DefaultSize, 0 )
		fgSizer4.Add( self.rd_software, 0, wx.ALL, 5 )
		
		
		fgSizer1.Add( fgSizer4, 1, wx.EXPAND, 5 )
		
		self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText2.Wrap( -1 )
		fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
		
		fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
		fgSizer2.SetFlexibleDirection( wx.BOTH )
		fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
		
		self.btnscan = wx.Button( self, wx.ID_ANY, u"Scan", wx.DefaultPosition, wx.DefaultSize, 0 )
		fgSizer2.Add( self.btnscan, 0, wx.ALL, 5 )
		
		self.btnclose = wx.Button( self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0 )
		fgSizer2.Add( self.btnclose, 0, wx.ALL, 5 )
		
		
		fgSizer1.Add( fgSizer2, 1, wx.EXPAND, 5 )
		
		self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Result", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText3.Wrap( -1 )
		fgSizer1.Add( self.m_staticText3, 0, wx.ALL, 5 )
		
		self.txtresult = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE|wx.TE_READONLY )
		fgSizer1.Add( self.txtresult, 0, wx.ALL|wx.EXPAND, 5 )
		
		
		self.SetSizer( fgSizer1 )
		self.Layout()
		
		self.Centre( wx.BOTH )
		
		# Connect Events
		self.btnscan.Bind( wx.EVT_BUTTON, self.btnscan_click )
		self.btnclose.Bind( wx.EVT_BUTTON, self.btnclose_click )
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Panel.__init__(self,
                          id=wxID_PNLMETHOD,
                          name=u'pnlMethod',
                          parent=prnt,
                          pos=wx.Point(135, 307),
                          size=wx.Size(439, 357),
                          style=wx.TAB_TRAVERSAL)
        self.SetClientSize(wx.Size(423, 319))

        self.rbGenerate = wx.RadioButton(
            id=wxID_PNLMETHODSRBGENERATE,
            label=u'Automatically generate a Method ',
            name=u'rbGenerate',
            parent=self,
            pos=wx.Point(16, 8),
            size=wx.Size(392, 16),
            style=0)
        self.rbGenerate.SetValue(True)
        self.rbGenerate.Bind(wx.EVT_RADIOBUTTON,
                             self.OnRbGenerateRadiobutton,
                             id=wxID_PNLMETHODSRBGENERATE)

        self.rbSelect = wx.RadioButton(id=wxID_PNLMETHODSRBSELECT,
                                       label=u'Select an existing Method',
                                       name=u'rbSelect',
                                       parent=self,
                                       pos=wx.Point(16, 32),
                                       size=wx.Size(392, 13),
                                       style=0)
        self.rbSelect.SetValue(False)
        self.rbSelect.Bind(wx.EVT_RADIOBUTTON,
                           self.OnRbSelectRadiobutton,
                           id=wxID_PNLMETHODSRBSELECT)

        self.rbCreateNew = wx.RadioButton(id=wxID_PNLMETHODSRBCREATENEW,
                                          label=u'Create a new Method ',
                                          name=u'rbCreateNew',
                                          parent=self,
                                          pos=wx.Point(16, 208),
                                          size=wx.Size(392, 13),
                                          style=0)
        self.rbCreateNew.SetValue(False)
        self.rbCreateNew.Bind(wx.EVT_RADIOBUTTON,
                              self.OnRbCreateNewRadiobutton,
                              id=wxID_PNLMETHODSRBCREATENEW)

        self.txtMethodDescrip = wx.richtext.RichTextCtrl(
            id=wxID_PNLMETHODSRICHTEXTCTRL1,
            parent=self,
            pos=wx.Point(16, 224),
            size=wx.Size(392, 84),
            style=wx.richtext.RE_MULTILINE,
            value=u'Method Description')
        self.txtMethodDescrip.Enable(False)
        self.txtMethodDescrip.Bind(wx.EVT_SET_FOCUS,
                                   self.OnTxtMethodDescripSetFocus)
        self.txtMethodDescrip.Bind(wx.EVT_KILL_FOCUS,
                                   self.OnTxtMethodDescripKillFocus)

        self.lstMethods = wx.ListCtrl(id=wxID_PNLMETHODSLISTCTRL1,
                                      name='lstMethods',
                                      parent=self,
                                      pos=wx.Point(16, 48),
                                      size=wx.Size(392, 152),
                                      style=wx.LC_REPORT | wx.LC_SINGLE_SEL)

        self.lstMethods.InsertColumn(0, 'Description')
        self.lstMethods.InsertColumn(1, 'Link')
        self.lstMethods.InsertColumn(2, 'id')
        self.lstMethods.SetColumnWidth(0, 200)
        self.lstMethods.SetColumnWidth(1, 153)
        self.lstMethods.SetColumnWidth(2, 0)
        self.lstMethods.Enable(False)