예제 #1
0
    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, id=self.All_Widgets_menubar.mn_RemoveTabs.GetId())
        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.AddLabelTool(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.AddLabelTool(wx.ID_OPEN, _("Open"), wx.EmptyBitmap(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.EmptyBitmap(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.EmptyBitmap(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.calendar.CalendarCtrl(self.notebook_1_wxCalendarCtrl, wx.ID_ANY, style=wx.calendar.CAL_MONDAY_FIRST | wx.calendar.CAL_SEQUENTIAL_MONTH_SELECTION | wx.calendar.CAL_SHOW_SURROUNDING_WEEKS | wx.calendar.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.calendar.GenericCalendarCtrl(self.notebook_1_wxGenericCalendarCtrl, wx.ID_ANY, style=wx.calendar.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.DatePickerCtrl(self.notebook_1_wxDatePickerCtrl, wx.ID_ANY, style=wx.DP_SHOWCENTURY)
        sizer_17.Add(self.datepicker_ctrl_1, 1, wx.ALIGN_CENTER | 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.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.EmptyBitmap(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.EmptyBitmap(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)
        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)
        self.label_4.SetBackgroundColour(wx.Colour(255, 0, 0))
        self.label_4.SetToolTip(wx.ToolTip(_("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)
        self.label_5.SetBackgroundColour(wx.Colour(255, 0, 255))
        self.label_5.SetForegroundColour(wx.Colour(0, 255, 0))
        self.label_5.SetToolTip(wx.ToolTip(_("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)
예제 #2
0
 def __init__ (self):
     wx.Frame.__init__(self,None,-1,'ап╠М©Р',size=(200,200))
     panel=wx.Panel(self,-1)
     langList=['Python','Java','ASP.NET']
     self.checkListBox=wx.CheckListBox(panel,-1,(10,10),(80,100),langList,wx.LB_SORT)
예제 #3
0
파일: Viewer.py 프로젝트: Neojume/TwoClubs
    def __init__( self, *args, **kwds):
        kwds['style'] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)

        self.all_info = None
        self.nt_threshold = 0
        self.club_contents = []

        # Dictionary containing the different clubs to display
        self.display_clubs = dict()
        for t in CLUB_TYPES:
            self.display_clubs[t] = []

        # Menu Bar
        self.menubar = wx.MenuBar()
        self.file = wx.Menu()
        self.open = wx.MenuItem(self.file, wx.ID_OPEN, '&Open\tCtrl-O', 'Open a .result file', wx.ITEM_NORMAL)
        self.file.AppendItem(self.open)
        self.quit = wx.MenuItem(self.file, wx.ID_EXIT, 'Quit', 'Exit the program', wx.ITEM_NORMAL)
        self.file.AppendItem(self.quit)

        self.edit = wx.Menu()
        self.select_none = wx.MenuItem( self.edit, wx.NewId(), 'Deselect &Nodes\tCtrl-Shift-A', 'Deselect all nodes', wx.ITEM_NORMAL)
        self.change_threshold = wx.MenuItem(self.edit, wx.NewId(), 'Change &Threshold', 'Change the nontrivial-threshold', wx.ITEM_NORMAL)
        self.edit.AppendItem(self.select_none)
        self.edit.AppendItem(self.change_threshold)

        self.tools = wx.Menu()
        self.coverage = wx.MenuItem(self.tools, wx.NewId(), 'Coverage table', 'Create the coverage table for the different types', wx.ITEM_NORMAL)
        self.largest_clubs = wx.MenuItem(self.tools, wx.NewId(), 'Largest Clubs', 'Show largest clubs and maximum degrees', wx.ITEM_NORMAL)
        self.number_clubs = wx.MenuItem(self.tools, wx.NewId(), 'Number of Club types', 'Show the number of different club types', wx.ITEM_NORMAL)
        self.nodes_info = wx.MenuItem(self.tools, wx.NewId(), 'Selected nodes info', 'Show info about the 2-clubs of the selected nodes', wx.ITEM_NORMAL)
        self.tools.AppendItem(self.coverage)
        self.tools.AppendItem(self.largest_clubs)
        self.tools.AppendItem(self.number_clubs)
        self.tools.AppendItem(self.nodes_info)

        self.view = wx.Menu()
        self.view_nontrivials = wx.MenuItem(self.edit, wx.NewId(), 'View trivials', 'Show the nontrivial 2-Clubs in the list', wx.ITEM_CHECK)
        self.view.AppendItem(self.view_nontrivials)
        self.view_nontrivials.Check()

        self.help = wx.Menu()
        self.about = wx.MenuItem(self.help, wx.NewId(), 'About', 'About this version of the Viewer', wx.ITEM_NORMAL)
        self.help.AppendItem(self.about)

        self.menubar.Append(self.file, '&File')
        self.menubar.Append(self.edit, '&Edit')
        self.menubar.Append(self.tools, '&Tools')
        self.menubar.Append(self.view, '&View')
        self.menubar.Append(self.help, '&Help')
        self.SetMenuBar(self.menubar)
        # Menu Bar end

        self.statusbar = self.CreateStatusBar(1, 0)

        self.window_all = wx.SplitterWindow(self, -1, style = wx.SP_3D | wx.SP_BORDER)

        self.notebook_BN = wx.Notebook(self.window_all, -1, style = 0)
        self.panel_boroughs = wx.Panel(self.notebook_BN, -1 )
        self.panel_nodes = wx.Panel(self.notebook_BN, -1)

        self.clb_nodes = wx.CheckListBox(self.panel_nodes, -1, choices = [])
        self.selected_nodes = set([])
        self.lb_boroughs = wx.ListBox(self.panel_boroughs, -1, choices = [])
        self.sizer_n_staticbox = wx.StaticBox(self.panel_nodes, -1, 'Nodes')
        self.sizer_b_staticbox = wx.StaticBox(self.panel_boroughs, -1, 'Boroughs')

        self.nodes_search = wx.SearchCtrl(self.panel_nodes, -1)

        self.window_all_pane_2 = wx.Panel(self.window_all, -1)

        self.nb_clubs = wx.Notebook(self.window_all_pane_2, -1, style = 0)
        self.window_club_display = wx.SplitterWindow(self.nb_clubs, -1, style = wx.SP_3D | wx.SP_BORDER)
        self.nb_club_info = wx.Notebook(self.window_club_display, -1, style = 0)
        self.panel_vis = wx.Panel(self.nb_club_info, -1)
        self.tc_club_info = wx.TextCtrl(self.nb_club_info, -1, '', style = wx.TE_MULTILINE)
        self.panel_club_display = wx.Panel(self.window_club_display, -1)
        self.lc_clubs = ClubListCtrlPanel(self.panel_club_display)

        # Dictionary containing selection boxes
        self.display_cbs = dict()
        for t in CLUB_TYPES:
            self.display_cbs[t] = wx.CheckBox(self.panel_club_display, -1, t)

        self.panel_diff = DiffPanel(self.nb_club_info)

        #self.fig = Figure((5.0, 4.0), dpi=100)
        self.fig = plt.figure(figsize=(5.0,4.0), dpi=100)
        self.canvas = FigCanvas(self.panel_vis, -1, self.fig)

        self.axes = self.fig.add_subplot(111)
        self.axes.clear()

        self.toolbar = NavigationToolbar(self.canvas)

        self.__set_properties()
        self.__do_layout()
예제 #4
0
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          "FastMonkey",
                          pos=(480, 25),
                          size=(420, 750),
                          style=wx.MINIMIZE_BOX | wx.CLOSE_BOX,
                          name='frame_main')
        panel = wx.Panel(self, -1)

        x_pos = 10
        x_pos1 = 120
        x_pos2 = 300
        y_pos = 12
        y_delta = 40
        execute_mode = [
            "默认", "忽略程序崩溃", "忽略程序无响应", "忽略安全异常", "出错中断程序", "本地代码导致的崩溃"
        ]

        log_mode = ["简单", "普通", "详细"]
        execution_mode_default = execute_mode[0]

        menu_bar = wx.MenuBar()
        m_file = wx.Menu()
        m_file.Append(wx.MenuItem(m_file, 1, '&SaveLog'))
        m_file.Append(wx.MenuItem(m_file, 2, '&StopLog'))
        m_file.Append(wx.MenuItem(m_file, 3, '&Quit'))
        m_help = wx.Menu()
        menu_bar.Append(m_file, "&File")
        menu_bar.Append(m_help, '&Help')
        self.SetMenuBar(menu_bar)
        self.Bind(wx.EVT_MENU, self.save_logcat, id=1)
        self.Bind(wx.EVT_MENU, self.build_fatal_log, id=2)
        self.Bind(wx.EVT_MENU, self.on_quit, id=3)

        wx.StaticText(panel, -1, "种子数:", pos=(x_pos, y_pos))
        self.seedCtrl = wx.TextCtrl(panel, -1, "", pos=(x_pos1, y_pos))
        self.seedCtrl.Bind(wx.EVT_KILL_FOCUS, self.valid_seed)
        self.seedCtrl.SetFocus()

        self.checkBox = wx.CheckBox(panel, -1, "疲劳控制", pos=(x_pos2, y_pos))
        self.Bind(wx.EVT_CHECKBOX, self.check_box, self.checkBox)

        wx.StaticText(panel, -1, "执行次数:", pos=(x_pos, y_pos + y_delta))
        self.executeNumCtrl = wx.TextCtrl(panel,
                                          -1,
                                          "",
                                          pos=(x_pos1, y_pos + y_delta))
        self.executeNumCtrl.Bind(wx.EVT_KILL_FOCUS, self.valid_num)

        wx.StaticText(panel, -1, "延时:", pos=(x_pos, y_pos + 2 * y_delta))
        self.delayNumCtrl = wx.TextCtrl(panel,
                                        -1,
                                        "",
                                        pos=(x_pos1, y_pos + 2 * y_delta))
        self.delayNumCtrl.Bind(wx.EVT_KILL_FOCUS, self.valid_delay)

        wx.StaticText(panel, -1, "执行方式:", pos=(x_pos, y_pos + 3 * y_delta))
        self.executeModeCtrl = wx.ComboBox(panel,
                                           -1,
                                           "", (x_pos1, y_pos + 3 * y_delta),
                                           choices=execute_mode,
                                           style=wx.CB_READONLY)

        self.getButton = wx.Button(panel,
                                   -1,
                                   "获取设备",
                                   pos=(x_pos, y_pos + 4 * y_delta))
        self.Bind(wx.EVT_BUTTON, self.get_connect_devices, self.getButton)

        list_box = self.get_devices()
        list_size = list_box.__len__()
        if list_size > 2:
            list_size = 2
        self.listBox = wx.ListBox(panel, -1, (x_pos1, y_pos + 4 * y_delta),
                                  (280, 21 * list_size), list_box,
                                  wx.LB_SINGLE)
        if list_size > 0:
            self.listBox.SetSelection(0)

        self.checkListBox = wx.CheckListBox(panel, -1,
                                            (x_pos, y_pos + 5.2 * y_delta),
                                            (400, 350), [])

        y_pos_layout = y_pos + 15 * y_delta
        wx.StaticText(panel,
                      -1,
                      "日志输出等级:",
                      pos=(x_pos, y_pos_layout - y_delta))
        self.logModeCtrl = wx.ComboBox(panel,
                                       -1,
                                       "", (x_pos1, y_pos_layout - y_delta),
                                       choices=log_mode,
                                       style=wx.CB_READONLY)

        self.readButton = wx.Button(panel,
                                    -1,
                                    "读取程序包",
                                    pos=(x_pos, y_pos_layout))
        self.Bind(wx.EVT_BUTTON, self.get_package_list, self.readButton)

        self.selectButton = wx.Button(panel,
                                      -1,
                                      "全部选择",
                                      pos=(x_pos + 120, y_pos_layout))
        self.Bind(wx.EVT_BUTTON, self.on_select_all, self.selectButton)

        self.unSelectButton = wx.Button(panel,
                                        -1,
                                        "全部取消",
                                        pos=(x_pos + 120 * 2, y_pos_layout))
        self.Bind(wx.EVT_BUTTON, self.on_unselect, self.unSelectButton)

        self.defaultButton = wx.Button(panel,
                                       -1,
                                       "默认参数",
                                       pos=(x_pos, y_pos_layout + y_delta))
        self.Bind(wx.EVT_BUTTON, self.on_reset, self.defaultButton)

        self.quickButton = wx.Button(panel,
                                     -1,
                                     "一键Monkey",
                                     pos=(x_pos + 120, y_pos_layout + y_delta))
        self.Bind(wx.EVT_BUTTON, self.start_monkey, self.quickButton)

        self.doButton = wx.Button(panel,
                                  -1,
                                  "开始Monkey",
                                  pos=(x_pos + 120 * 2,
                                       y_pos_layout + y_delta))
        self.Bind(wx.EVT_BUTTON, self.begin_monkey, self.doButton)

        self.captureButton = wx.Button(panel,
                                       -1,
                                       "截图",
                                       pos=(x_pos, y_pos_layout + 2 * y_delta))
        self.Bind(wx.EVT_BUTTON, self.capture_screen, self.captureButton)

        self.stopButton = wx.Button(panel,
                                    -1,
                                    "停止Monkey",
                                    pos=(x_pos + 120,
                                         y_pos_layout + 2 * y_delta))
        self.Bind(wx.EVT_BUTTON, self.stop_monkey, self.stopButton)
        self.stopButton.SetDefault()
예제 #5
0
파일: gui2.py 프로젝트: jacksonyoudi/opencv
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=u"GUI",
                          pos=wx.DefaultPosition,
                          size=wx.Size(767, 495),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

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

        bSizer1 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText1 = wx.StaticText(self, wx.ID_ANY, u"友弟",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText1.Wrap(-1)
        self.m_staticText1.SetFont(wx.Font(15, 75, 90, 90, False, "黑体"))
        self.m_staticText1.SetForegroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNTEXT))

        bSizer1.Add(self.m_staticText1, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                    5)

        gbSizer1 = wx.GridBagSizer(0, 0)
        gbSizer1.SetFlexibleDirection(wx.BOTH)
        gbSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        self.m_treeCtrl1 = wx.TreeCtrl(self, wx.ID_ANY, wx.DefaultPosition,
                                       wx.DefaultSize, wx.TR_DEFAULT_STYLE)
        gbSizer1.Add(self.m_treeCtrl1, wx.GBPosition(0, 0), wx.GBSpan(1, 1),
                     wx.ALL, 5)

        self.m_grid2 = wx.grid.Grid(self, wx.ID_ANY, wx.DefaultPosition,
                                    wx.DefaultSize, 0)

        # Grid
        self.m_grid2.CreateGrid(5, 5)
        self.m_grid2.EnableEditing(True)
        self.m_grid2.EnableGridLines(True)
        self.m_grid2.EnableDragGridSize(False)
        self.m_grid2.SetMargins(0, 0)

        # Columns
        self.m_grid2.EnableDragColMove(False)
        self.m_grid2.EnableDragColSize(True)
        self.m_grid2.SetColLabelSize(30)
        self.m_grid2.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        # Rows
        self.m_grid2.EnableDragRowSize(True)
        self.m_grid2.SetRowLabelSize(80)
        self.m_grid2.SetRowLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        # Label Appearance

        # Cell Defaults
        self.m_grid2.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)
        gbSizer1.Add(self.m_grid2, wx.GBPosition(0, 1), wx.GBSpan(1, 1),
                     wx.ALL, 5)

        m_checkList1Choices = []
        self.m_checkList1 = wx.CheckListBox(self, wx.ID_ANY,
                                            wx.DefaultPosition, wx.DefaultSize,
                                            m_checkList1Choices, 0)
        gbSizer1.Add(self.m_checkList1, wx.GBPosition(0, 2), wx.GBSpan(1, 1),
                     wx.ALL, 5)

        self.m_dataViewCtrl1 = wx.dataview.DataViewCtrl(
            self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0)
        gbSizer1.Add(self.m_dataViewCtrl1, wx.GBPosition(0, 3),
                     wx.GBSpan(1, 1), wx.ALL, 5)

        self.m_dataViewListCtrl1 = wx.dataview.DataViewListCtrl(
            self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0)
        gbSizer1.Add(self.m_dataViewListCtrl1, wx.GBPosition(0, 4),
                     wx.GBSpan(1, 1), wx.ALL, 5)

        self.m_button1 = wx.Button(self, wx.ID_ANY, u"MyButton",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        gbSizer1.Add(self.m_button1, wx.GBPosition(0, 5), wx.GBSpan(1, 1),
                     wx.ALL, 5)

        self.m_button2 = wx.Button(self, wx.ID_ANY, u"MyButton",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        gbSizer1.Add(self.m_button2, wx.GBPosition(0, 6), wx.GBSpan(1, 1),
                     wx.ALL, 5)

        bSizer1.Add(gbSizer1, 1, wx.EXPAND, 5)

        self.m_button3 = wx.Button(self, wx.ID_ANY, u"MyButton",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_button3, 0, wx.ALL, 5)

        self.m_bpButton1 = wx.BitmapButton(self, wx.ID_ANY, wx.NullBitmap,
                                           wx.DefaultPosition, wx.DefaultSize,
                                           wx.BU_AUTODRAW)
        bSizer1.Add(self.m_bpButton1, 0, wx.ALL, 5)

        self.m_bitmap1 = wx.StaticBitmap(self, wx.ID_ANY, wx.NullBitmap,
                                         wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_bitmap1, 0, wx.ALL, 5)

        self.m_animCtrl1 = wx.animate.AnimationCtrl(
            self, wx.ID_ANY, wx.animate.NullAnimation, wx.DefaultPosition,
            wx.DefaultSize, wx.animate.AC_DEFAULT_STYLE)
        bSizer1.Add(self.m_animCtrl1, 0, wx.ALL, 5)

        m_listBox1Choices = []
        self.m_listBox1 = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition,
                                     wx.DefaultSize, m_listBox1Choices, 0)
        bSizer1.Add(self.m_listBox1, 0, wx.ALL, 5)

        self.SetSizer(bSizer1)
        self.Layout()
        self.m_menubar1 = wx.MenuBar(0)
        self.m_menu1 = wx.Menu()
        self.m_menu11 = wx.Menu()
        self.m_menuItem2 = wx.MenuItem(self.m_menu11, wx.ID_ANY, u"project",
                                       wx.EmptyString, wx.ITEM_NORMAL)
        self.m_menu11.AppendItem(self.m_menuItem2)

        self.m_menuItem3 = wx.MenuItem(self.m_menu11, wx.ID_ANY, u"file",
                                       wx.EmptyString, wx.ITEM_NORMAL)
        self.m_menu11.AppendItem(self.m_menuItem3)

        self.m_menu1.AppendSubMenu(self.m_menu11, u"new File")

        self.m_menu21 = wx.Menu()
        self.m_menu1.AppendSubMenu(self.m_menu21, u"open")

        self.m_menu31 = wx.Menu()
        self.m_menu1.AppendSubMenu(self.m_menu31, u"save")

        self.m_menu41 = wx.Menu()
        self.m_menu1.AppendSubMenu(self.m_menu41, u"Exit")

        self.m_menuItem1 = wx.MenuItem(self.m_menu1, wx.ID_ANY, u"Import",
                                       wx.EmptyString, wx.ITEM_NORMAL)
        self.m_menu1.AppendItem(self.m_menuItem1)

        self.m_menubar1.Append(self.m_menu1, u"File")

        self.m_menu2 = wx.Menu()
        self.m_menu51 = wx.Menu()
        self.m_menu2.AppendSubMenu(self.m_menu51, u"undo")

        self.m_menu6 = wx.Menu()
        self.m_menu2.AppendSubMenu(self.m_menu6, u"redo")

        self.m_menubar1.Append(self.m_menu2, u"Edit")

        self.m_menu3 = wx.Menu()
        self.m_menubar1.Append(self.m_menu3, u"View")

        self.m_menu4 = wx.Menu()
        self.m_menubar1.Append(self.m_menu4, u"Tools")

        self.m_menu5 = wx.Menu()
        self.m_menubar1.Append(self.m_menu5, u"Help")

        self.SetMenuBar(self.m_menubar1)

        self.Centre(wx.BOTH)
    def __init__(self, parent,gui_size,cfg):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent)

        # variable initilization
        self.method = "automatic"
        self.config = cfg
        # design the panel
        self.sizer = wx.GridBagSizer(5, 5)

        text = wx.StaticText(self, label="DeepLabCut - Step 4. Create training dataset")
        self.sizer.Add(text, pos=(0, 0), flag=wx.TOP|wx.LEFT|wx.BOTTOM,border=15)
        # Add logo of DLC
        icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(logo))
        self.sizer.Add(icon, pos=(0, 4), flag=wx.TOP|wx.RIGHT|wx.ALIGN_RIGHT,border=5)

        line1 = wx.StaticLine(self)
        self.sizer.Add(line1, pos=(1, 0), span=(1, 5),flag=wx.EXPAND|wx.BOTTOM, border=10)

        self.cfg_text = wx.StaticText(self, label="Select the config file")
        self.sizer.Add(self.cfg_text, pos=(2, 0), flag=wx.TOP|wx.LEFT, border=5)

        if sys.platform=='darwin':
            self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="*.yaml")
        else:
            self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml")
        # self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml")
        self.sizer.Add(self.sel_config, pos=(2, 1),span=(1,3),flag=wx.TOP|wx.EXPAND, border=5)
        self.sel_config.SetPath(self.config)
        self.sel_config.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_config)

        sb = wx.StaticBox(self, label="Optional Attributes")
        boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)

        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox3 = wx.BoxSizer(wx.HORIZONTAL)

        net_text = wx.StaticBox(self, label="Select the network")
        netboxsizer = wx.StaticBoxSizer(net_text, wx.VERTICAL)
        self.net_choice = wx.ComboBox(self, style=wx.CB_READONLY)
        options = ['resnet_50', 'resnet_101','resnet_152','mobilenet_v2_1.0','mobilenet_v2_0.75','mobilenet_v2_0.5','mobilenet_v2_0.35']
        self.net_choice.Set(options)
        self.net_choice.SetValue('resnet_50')
        netboxsizer.Add(self.net_choice,20, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        aug_text = wx.StaticBox(self, label="Select the augmentation method")
        augboxsizer = wx.StaticBoxSizer(aug_text, wx.VERTICAL)
        self.aug_choice = wx.ComboBox(self, style=wx.CB_READONLY)
        options = ['default', 'tensorpack','imgaug']
        self.aug_choice.Set(options)
        self.aug_choice.SetValue('default')
        augboxsizer.Add(self.aug_choice,20, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        shuffle_text = wx.StaticBox(self, label="Or set a specific shuffle indx (1 network only)")
        shuffle_text_boxsizer = wx.StaticBoxSizer(shuffle_text, wx.VERTICAL)
        self.shuffle = wx.SpinCtrl(self, value='1',min=1,max=100)
        shuffle_text_boxsizer.Add(self.shuffle,1, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        trainingindex_box = wx.StaticBox(self, label="Specify the trainingset index")
        trainingindex_boxsizer = wx.StaticBoxSizer(trainingindex_box, wx.VERTICAL)
        self.trainingindex = wx.SpinCtrl(self, value='0',min=0,max=100)
        trainingindex_boxsizer.Add(self.trainingindex,0, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)


        self.userfeedback = wx.RadioBox(self, label='Need user feedback?', choices=['Yes', 'No'],majorDimension=1, style=wx.RA_SPECIFY_COLS)
        self.userfeedback.SetSelection(1)

        self.hbox1.Add(netboxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox1.Add(augboxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)

        self.hbox2.Add(shuffle_text_boxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox2.Add(trainingindex_boxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox2.Add(self.userfeedback,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)


        self.model_comparison_choice = wx.RadioBox(self, label='Want to compare models?', choices=['Yes', 'No'],majorDimension=1, style=wx.RA_SPECIFY_COLS)
        self.model_comparison_choice.Bind(wx.EVT_RADIOBOX,self.chooseOption)
        self.model_comparison_choice.SetSelection(1)

        self.shuffles_text = wx.StaticBox(self, label="Specify the number of shuffles")
        self.shuffles_text_boxsizer = wx.StaticBoxSizer(self.shuffles_text, wx.VERTICAL)
        self.shuffles = wx.SpinCtrl(self, value='1',min=1,max=100)
        self.shuffles_text_boxsizer.Add(self.shuffles,1, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        networks = ['resnet_50', 'resnet_101', 'resnet_152', 'mobilenet_v2_1.0','mobilenet_v2_0.75', 'mobilenet_v2_0.5', 'mobilenet_v2_0.35']
        augmentation_methods = ['default','tensorpack','imgaug']
        self.network_box = wx.StaticBox(self, label="Select the networks")
        self.network_boxsizer = wx.StaticBoxSizer(self.network_box, wx.VERTICAL)
        self.networks_to_compare = wx.CheckListBox(self, choices=networks, style=0,name = "Select the networks")
        self.networks_to_compare.Bind(wx.EVT_CHECKLISTBOX,self.get_network_names)
        self.network_boxsizer.Add(self.networks_to_compare,1, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        self.augmentation_box = wx.StaticBox(self, label="Select the augmentation methods")
        self.augmentation_boxsizer = wx.StaticBoxSizer(self.augmentation_box, wx.VERTICAL)
        self.augmentation_to_compare = wx.CheckListBox(self, choices=augmentation_methods, style=0,name = "Select the augmentation methods")
        self.augmentation_to_compare.Bind(wx.EVT_CHECKLISTBOX,self.get_augmentation_method_names)
        self.augmentation_boxsizer.Add(self.augmentation_to_compare,1, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        self.hbox3.Add(self.model_comparison_choice,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox3.Add(self.shuffles_text_boxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox3.Add(self.network_boxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox3.Add(self.augmentation_boxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)

        self.shuffles_text.Hide()
        self.shuffles.Hide()
        self.network_box.Hide()
        self.networks_to_compare.Hide()
        self.augmentation_box.Hide()
        self.augmentation_to_compare.Hide()

        boxsizer.Add(self.hbox1,0, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)
        boxsizer.Add(self.hbox2,0, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)
        boxsizer.Add(self.hbox3,0, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        self.sizer.Add(boxsizer, pos=(3, 0), span=(1, 5),flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT , border=10)

        self.help_button = wx.Button(self, label='Help')
        self.sizer.Add(self.help_button, pos=(4, 0), flag=wx.LEFT, border=10)
        self.help_button.Bind(wx.EVT_BUTTON, self.help_function)

        self.ok = wx.Button(self, label="Ok")
        self.sizer.Add(self.ok, pos=(4, 4))
        self.ok.Bind(wx.EVT_BUTTON, self.create_training_dataset)

        self.reset = wx.Button(self, label="Reset")
        self.sizer.Add(self.reset, pos=(4, 1), span=(1, 1),flag=wx.BOTTOM|wx.RIGHT, border=10)
        self.reset.Bind(wx.EVT_BUTTON, self.reset_create_training_dataset)

        self.sizer.AddGrowableCol(2)

        self.SetSizer(self.sizer)
        self.sizer.Fit(self)
        self.Layout()
예제 #7
0
    def setParameters(self, plotData):

        self.labels['label'] = wx.StaticText(self.panel_configure, -1,
                                             "Label: ")
        self.data['label'] = wx.TextCtrl(self.panel_configure, -1, "")

        self.labels['figure'] = wx.StaticText(self.panel_configure, -1,
                                              "Choose Figure: ")
        self.data['figure'] = wx.Choice(self.panel_configure,
                                        choices=plotData['figure'])
        self.data['figure'].SetStringSelection(str(plotData['figure'][0]))

        self.labels['cycle'] = wx.StaticText(self.panel_configure, -1,
                                             "Choose Cycle: ")
        self.data['cycle'] = wx.CheckListBox(self.panel_configure,
                                             choices=plotData['cycle'],
                                             size=(70, 80))
        self.data['cycle'].Check(len(plotData['cycle']) - 1, True)

        self.data['element'] = wx.RadioBox(
            self.panel_configure,
            -1,
            "",
            choices=["Globals", "Cylinders", "Tubes", "Tanks", "Junctions"],
            majorDimension=0,
            style=wx.RA_SPECIFY_ROWS)

        self.labels['element_number'] = wx.StaticText(self.panel_configure, -1,
                                                      "Choose Element: ")
        self.data['element_number'] = wx.Choice(self.panel_configure,
                                                -1,
                                                choices=[])
        self.labels['element_nnod'] = wx.StaticText(self.panel_configure, -1,
                                                    "Choose Node: ")
        self.data['element_nnod'] = wx.Choice(self.panel_configure,
                                              -1,
                                              choices=[])
        self.labels['element_ndof'] = wx.StaticText(self.panel_configure, -1,
                                                    "Choose Variable: ")
        self.data['element_ndof'] = wx.Choice(self.panel_configure,
                                              -1,
                                              choices=[])

        self.labels['units'] = wx.StaticText(self.panel_configure, -1,
                                             "Choose Units: ")
        self.data['units'] = wx.Choice(self.panel_configure, -1, choices=[])

        self.labels['global_variable'] = wx.StaticText(
            self.panel_configure, -1, "Choose Global Variable: ")
        self.data['global_variable'] = wx.Choice(
            self.panel_configure, -1, choices=plotData['Globals']['labels'])

        #self.labels['global_variable_type'] = wx.StaticText(self.panel_configure, -1, "Choose Type: ")
        #self.data['global_variable_type'] = wx.Choice(self.panel_configure, -1, choices=plotData['Globals']['type_labels'])

        self.infoData = plotData
        self.Bind(wx.EVT_RADIOBOX, self.onChangeElement, self.data['element'])
        self.Bind(wx.EVT_CHOICE, self.onChangeElementNumber,
                  self.data['element_number'])
        self.Bind(wx.EVT_CHOICE, self.onChangeElementNode,
                  self.data['element_nnod'])
        self.Bind(wx.EVT_CHOICE, self.onChangeElementNdof,
                  self.data['element_ndof'])
        self.Bind(wx.EVT_CHOICE, self.onChangeGlobalVariable,
                  self.data['global_variable'])

        self.__set_properties()
        self.__do_layout()
예제 #8
0
    def __init__(self, parent, infoDict, export=True):
        self.export = export
        if export:
            title = _('Export filter customizations')
        else:
            title = _('Import filter customizations')
        wx.Dialog.__init__(self,
                           parent,
                           wx.ID_ANY,
                           title,
                           size=(500, 300),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        self.calltipDict = infoDict[0]
        self.presetDict = infoDict[1]
        self.docpathDict = infoDict[2]
        self.functiontypeDict = infoDict[3]

        # Create the list control using the dictionary
        decList = [(s.lower(), s) for s in self.calltipDict.keys()]
        decList.sort()
        self.names = [s[1] for s in decList]
        self.checkListBox = wx.CheckListBox(self,
                                            wx.ID_ANY,
                                            choices=self.names)

        # Create extra control buttons
        def OnButtonSelectAll(event):
            for index in xrange(len(self.names)):
                self.checkListBox.Check(index, True)

        def OnButtonClearAll(event):
            for index in xrange(len(self.names)):
                self.checkListBox.Check(index, False)

        buttonSelectAll = wx.Button(self, wx.ID_ANY, _('Select all'))
        self.Bind(wx.EVT_BUTTON, OnButtonSelectAll, buttonSelectAll)
        buttonClearAll = wx.Button(self, wx.ID_ANY, _('Clear all'))
        self.Bind(wx.EVT_BUTTON, OnButtonClearAll, buttonClearAll)

        if export:
            staticText = wx.StaticText(self, wx.ID_ANY,
                                       _('Select filters to export:'))
            extraItem = (-1, 20)
        else:
            staticText = wx.StaticText(
                self, wx.ID_ANY, _('Select filters to import from the file:'))
            # Import dialog, check all names by default
            for index in xrange(len(self.names)):
                self.checkListBox.Check(index)
            # Extra controls to provide options for import information
            #~ self.checkBoxCalltip = wx.CheckBox(self, wx.ID_ANY, _('Calltips'))
            #~ self.checkBoxPreset = wx.CheckBox(self, wx.ID_ANY, _('Presets'))
            #~ self.checkBoxDocpath = wx.CheckBox(self, wx.ID_ANY, _('Docpaths'))
            #~ self.checkBoxType = wx.CheckBox(self, wx.ID_ANY, _('Filter types'))
            #~ staticBox = wx.StaticBox(self, wx.ID_ANY, _('Import from filters:'))
            #~ staticBoxSizer = wx.StaticBoxSizer(staticBox, wx.HORIZONTAL)
            #~ for item in (self.checkBoxCalltip, self.checkBoxPreset, self.checkBoxDocpath, self.checkBoxType):
            #~ item.SetValue(True)
            #~ staticBoxSizer.Add(item, 0, wx.ALL, 5)
            self.checkBoxOverwriteAll = wx.CheckBox(self, wx.ID_ANY,
                                                    _('Overwrite all data'))
            self.checkBoxOverwriteAll.SetValue(True)
            extraItem = wx.BoxSizer(wx.VERTICAL)
            #~ extraItem.Add(staticBoxSizer, 0, wx.BOTTOM, 10)
            extraItem.Add(self.checkBoxOverwriteAll, 0, wx.LEFT | wx.BOTTOM, 5)

        # Standard buttons
        okay = wx.Button(self, wx.ID_OK, _('OK'))
        self.Bind(wx.EVT_BUTTON, self.OnButtonOK, okay)
        cancel = wx.Button(self, wx.ID_CANCEL, _('Cancel'))
        btns = wx.StdDialogButtonSizer()
        btns.AddButton(okay)
        btns.AddButton(cancel)
        btns.Realize()

        # Size the elements
        buttonSizer = wx.BoxSizer(wx.VERTICAL)
        buttonSizer.Add(buttonSelectAll, 0, wx.ALL, 5)
        buttonSizer.Add(buttonClearAll, 0, wx.ALL, 5)
        listSizer = wx.BoxSizer(wx.HORIZONTAL)
        listSizer.Add(self.checkListBox, 1, wx.EXPAND | wx.ALL, 5)
        listSizer.Add(buttonSizer, 0, wx.ALL, 5)
        dlgSizer = wx.BoxSizer(wx.VERTICAL)
        dlgSizer.Add((-1, 5))
        dlgSizer.Add(staticText, 0, wx.ALL, 5)
        dlgSizer.Add(listSizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
        dlgSizer.Add(extraItem, 0, wx.ALL, 5)
        dlgSizer.Add(btns, 0, wx.EXPAND | wx.ALL, 5)
        self.SetSizer(dlgSizer)
        dlgSizer.SetSizeHints(self)
        # Misc
        okay.SetDefault()
예제 #9
0
    def __init__(self):
        ID_OPEN = 100
        wx.Frame.__init__(self, None, -1, "Hello World", size=(710, 800))
        self.scroll = wx.ScrolledWindow(self, -1, size=(1000, 750))
        self.scroll.SetScrollbars(1, 1, 400, 800)
        panel = wx.lib.scrolledpanel.ScrolledPanel(self.scroll,
                                                   -1,
                                                   size=(1000, 800))
        panel.SetupScrolling()

        # ---------------------create a menu bar -----------------------
        menuBar = wx.MenuBar()

        menuFile = wx.Menu()

        menuFile.Append(ID_OPEN, '&Change the input file', 'open a file')

        menuBar.Append(menuFile, '&Tools')

        self.SetMenuBar(menuBar)
        # ----------------------------------------------------------------------
        wx.EVT_MENU(self, ID_OPEN, self.OnOpen)

        # First create the controls header
        topLbl = wx.StaticText(panel, -1, "Generate text file")
        topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
        # state list
        list_name = []
        r = final_function.listdir("/home/mphyg002/Desktop/test_python/input2",
                                   list_name)
        filelist_stat = final_function.spilts(r)
        self.statelistbox = wx.CheckListBox(panel, -1, (200, 20), (250, 120),
                                            filelist_stat)
        # tran list
        tran_list = []
        rs = final_function.listdir2(
            "/home/mphyg002/Desktop/test_python/input2", tran_list)
        filelist = final_function.spilts(rs)
        self.tranlistbox = wx.CheckListBox(panel, -1, (200, 20), (250, 120),
                                           filelist, wx.LB_SINGLE)
        # temp staff
        saveBtn = wx.Button(panel, -1, "Display Text")
        cancelBtn = wx.Button(panel, -1, "Generate input file")
        clearBtn = wx.Button(panel, -1, "Clear")

        self.label_temp = wx.StaticText(panel, -1, 'Temperature:  ')
        self.Text_temp = wx.TextCtrl(panel,
                                     -1,
                                     size=(100, 28),
                                     style=wx.TE_MULTILINE)
        self.Bind(wx.EVT_BUTTON, self.GetValue, saveBtn)
        self.Bind(wx.EVT_BUTTON, self.Clear, clearBtn)
        self.Bind(wx.EVT_BUTTON, self.define_root, cancelBtn)
        # range staff
        self.label_range = wx.StaticText(panel, -1, 'Range')
        self.Text_range = wx.TextCtrl(panel,
                                      -1,
                                      size=(50, 28),
                                      style=wx.TE_MULTILINE)
        self.label_range_1 = wx.StaticText(panel, -1, ' to ')
        self.Text_range_1 = wx.TextCtrl(panel,
                                        -1,
                                        size=(50, 28),
                                        style=wx.TE_MULTILINE)
        # cooling staff
        self.label_tempmex = wx.StaticText(panel,
                                           -1,
                                           'tempmex:',
                                           pos=(210, 135))
        self.label_cqooling = wx.StaticText(panel,
                                            -1,
                                            'ntemps:',
                                            pos=(340, 135))
        self.Text_cooling_1 = wx.TextCtrl(panel,
                                          -1,
                                          size=(80, 28),
                                          pos=(280, 130),
                                          style=wx.TE_MULTILINE)
        self.Text_cooling_2 = wx.TextCtrl(panel,
                                          -1,
                                          size=(80, 28),
                                          pos=(400, 130),
                                          style=wx.TE_MULTILINE)
        #type of spectra staffb
        self.spectra = wx.RadioBox(
            panel, -1, "Type of spectra", (100, 100), wx.DefaultSize, [
                "No spectra                  ", "lifetime                    ",
                "emission                    ", "absorption                  "
            ], 4, wx.RA_SPECIFY_COLS)
        self.ProfileType = wx.RadioBox(
            panel, -1, "Profile Type", (100, 100), wx.DefaultSize, [
                "No profile type            ", "Gaus0           ",
                "Guassian          ", "Sticks            ",
                "Rect                ", "Lorentzian             ",
                "Dopp10             ", "Voigt             ",
                "Voi-Quad          ", "Voi-fast          ", "Voi-norm        "
            ], 5, wx.RA_SPECIFY_COLS)
        # Species
        self.label_species1 = wx.StaticText(panel, -1, 'N:  ')
        self.label_species2 = wx.StaticText(panel, -1, 'Gamma:  ')
        self.label_species3 = wx.StaticText(panel, -1, 'Delta: ')
        self.label_species4 = wx.StaticText(panel, -1, 'TO: ')
        self.label_species5 = wx.StaticText(panel, -1, 'PO: ')
        self.label_species6 = wx.StaticText(panel, -1, 'Ratio: ')
        self.label_species7 = wx.StaticText(panel, -1, 'File: ')
        self.Text_species1 = wx.TextCtrl(panel,
                                         -1,
                                         size=(50, 28),
                                         style=wx.TE_MULTILINE)
        self.Text_species2 = wx.TextCtrl(panel,
                                         -1,
                                         size=(50, 28),
                                         style=wx.TE_MULTILINE)
        self.Text_species3 = wx.TextCtrl(panel,
                                         -1,
                                         size=(50, 28),
                                         style=wx.TE_MULTILINE)
        self.Text_species4 = wx.TextCtrl(panel,
                                         -1,
                                         size=(50, 28),
                                         style=wx.TE_MULTILINE)
        self.Text_species5 = wx.TextCtrl(panel,
                                         -1,
                                         size=(50, 28),
                                         style=wx.TE_MULTILINE)
        self.Text_species6 = wx.TextCtrl(panel,
                                         -1,
                                         size=(50, 28),
                                         style=wx.TE_MULTILINE)
        self.Text_species7 = wx.TextCtrl(panel,
                                         -1,
                                         size=(50, 28),
                                         style=wx.TE_MULTILINE)
        # All information
        self.Text_All = wx.TextCtrl(panel,
                                    -1,
                                    size=(500, 200),
                                    style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.label_Name = wx.StaticText(panel, -1, "Name of input file:  ")
        self.Text_Name = wx.TextCtrl(panel,
                                     -1,
                                     size=(100, 28),
                                     style=wx.TE_MULTILINE)
        # Main Sizer
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(topLbl, 0, wx.ALL, 5)
        mainSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND | wx.TOP | wx.BOTTOM,
                      5)
        #row one sizer
        row1boxsizer = wx.BoxSizer(wx.HORIZONTAL)
        #temp sizer
        tempbox = wx.StaticBox(panel, -1, "temp")
        tempsizer = wx.StaticBoxSizer(tempbox, wx.HORIZONTAL)
        tempsizer.Add((40, 40), 0, wx.ALL, 2)
        tempsizer.Add(self.label_temp, 0, wx.ALL, 2)
        tempsizer.Add(self.Text_temp, 0, wx.ALL, 2)
        tempsizer.Add((40, 40), 0, wx.ALL, 2)
        # range sizer
        rangebox = wx.StaticBox(panel, -1, "range")
        rangesizer = wx.StaticBoxSizer(rangebox, wx.HORIZONTAL)
        rangesizer.Add((40, 40), 0, wx.ALL, 2)
        rangesizer.Add(self.label_range, 0, wx.ALL, 2)
        rangesizer.Add(self.Text_range, 0, wx.ALL, 2)
        rangesizer.Add(self.label_range_1, 0, wx.ALL, 2)
        rangesizer.Add(self.Text_range_1, 0, wx.ALL, 2)
        rangesizer.Add((40, 40), 0, wx.ALL, 2)
        # add range and temp to row one sizer
        row1boxsizer.Add((40, 40), 0, wx.ALL, 2)
        row1boxsizer.Add(tempsizer)
        row1boxsizer.Add((40, 40), 0, wx.ALL, 2)
        row1boxsizer.Add(rangesizer)
        row1boxsizer.Add((40, 40), 0, wx.ALL, 2)
        mainSizer.Add(row1boxsizer, 0, wx.EXPAND | wx.BOTTOM, 10)
        # row tow has one static box sizer
        row2boxsizer = wx.BoxSizer(wx.HORIZONTAL)
        coolingbox = wx.StaticBox(panel, -1, "cooling")
        coolingsizer = wx.StaticBoxSizer(coolingbox, wx.HORIZONTAL)
        coolingsizer.Add((125, 40), 0, wx.ALL, 2)
        coolingsizer.Add(self.label_tempmex, 0, wx.ALL, 2)
        coolingsizer.Add(self.Text_cooling_1, 0, wx.ALL, 2)
        coolingsizer.Add((50, 40), 0, wx.ALL, 2)
        coolingsizer.Add(self.label_cqooling, 0, wx.ALL, 2)
        coolingsizer.Add(self.Text_cooling_2, 0, wx.ALL, 2)
        coolingsizer.Add((125, 40), 0, wx.ALL, 2)
        row2boxsizer.Add((40, 40), 0, wx.ALL, 2)
        row2boxsizer.Add(coolingsizer)
        row2boxsizer.Add((40, 40), 0, wx.ALL, 2)

        # type of spectra
        row3boxsizer = wx.BoxSizer(wx.HORIZONTAL)
        row3boxsizer.Add((40, 40), 0, wx.ALL, 2)
        row3boxsizer.Add(self.spectra, 0, wx.ALL, 2)
        mainSizer.Add(row3boxsizer, 0, wx.EXPAND | wx.BOTTOM, 10)
        # Profile type
        row5boxsizer = wx.BoxSizer(wx.HORIZONTAL)
        row5boxsizer.Add((40, 40), 0, wx.ALL, 2)
        row5boxsizer.Add(self.ProfileType, 0, wx.ALL, 2)
        mainSizer.Add(row5boxsizer, 0, wx.EXPAND | wx.BOTTOM, 10)
        # species
        row4boxsizer = wx.BoxSizer(wx.HORIZONTAL)
        speciesbox = wx.StaticBox(panel, -1, "Species")
        speciessizer = wx.StaticBoxSizer(speciesbox, wx.VERTICAL)
        species1sizer = wx.BoxSizer(wx.HORIZONTAL)
        species2sizer = wx.BoxSizer(wx.HORIZONTAL)
        species1sizer.Add((45, 40), 0, wx.ALL, 2)
        species1sizer.Add(self.label_species1)
        species1sizer.Add(self.Text_species1)
        species1sizer.Add((45, 40), 0, wx.ALL, 2)
        species1sizer.Add(self.label_species2)
        species1sizer.Add(self.Text_species2)
        species1sizer.Add((45, 40), 0, wx.ALL, 2)

        species1sizer.Add(self.label_species3)
        species1sizer.Add(self.Text_species3)
        species1sizer.Add((45, 40), 0, wx.ALL, 2)
        species1sizer.Add(self.label_species4)
        species1sizer.Add(self.Text_species4)
        species1sizer.Add((45, 40), 0, wx.ALL, 2)

        species2sizer.Add((75, 40), 0, wx.ALL, 2)
        species2sizer.Add(self.label_species5)
        species2sizer.Add(self.Text_species5)
        species2sizer.Add((75, 40), 0, wx.ALL, 2)
        species2sizer.Add(self.label_species6)
        species2sizer.Add(self.Text_species6)
        species2sizer.Add((75, 40), 0, wx.ALL, 2)

        species2sizer.Add(self.label_species7)
        species2sizer.Add(self.Text_species7)
        species2sizer.Add((75, 40), 0, wx.ALL, 2)

        speciessizer.Add(species1sizer, 0, wx.ALL, 2)
        speciessizer.Add(species2sizer, 0, wx.ALL, 2)
        row4boxsizer.Add((40, 40), 0, wx.ALL, 2)
        row4boxsizer.Add(speciessizer, 0, wx.ALL, 2)
        row4boxsizer.Add((40, 40), 0, wx.ALL, 2)

        #state list section
        statebox = wx.StaticBox(panel, -1, "State Section")
        statesizer = wx.StaticBoxSizer(statebox, wx.HORIZONTAL)
        statesizer.Add((20, 20), 0, wx.ALL, 2)
        statesizer.Add(self.statelistbox, 0, wx.ALL, 2)
        statesizer.Add((20, 20), 0, wx.ALL, 2)

        tranbox = wx.StaticBox(panel, -1, "Tran Section")
        transizer = wx.StaticBoxSizer(tranbox, wx.HORIZONTAL)
        transizer.Add((20, 20), 0, wx.ALL, 2)
        transizer.Add(self.tranlistbox, 0, wx.ALL, 2)
        transizer.Add((20, 20), 0, wx.ALL, 2)
        row6boxsizer = wx.BoxSizer(wx.HORIZONTAL)
        row6boxsizer.Add((40, 40), 0, wx.ALL, 2)
        row6boxsizer.Add(statesizer, 0, wx.ALL, 2)
        row6boxsizer.Add(transizer, 0, wx.ALL, 2)

        mainSizer.Add(row6boxsizer, 0, wx.EXPAND | wx.BOTTOM, 10)
        mainSizer.Add(row4boxsizer, 0, wx.EXPAND | wx.BOTTOM, 10)
        mainSizer.Add(row2boxsizer, 0, wx.EXPAND | wx.BOTTOM, 10)
        #button sizer
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        btnSizer.Add((100, 40), 0, wx.ALL, 2)
        btnSizer.Add(saveBtn)
        btnSizer.Add((100, 20), 0, wx.ALL, 2)
        btnSizer.Add((100, 20), 0, wx.ALL, 2)
        btnSizer.Add(clearBtn)
        mainSizer.Add(btnSizer, 0, wx.EXPAND | wx.BOTTOM, 10)

        #All text file
        Alltextbox = wx.StaticBox(panel, -1, "Final Text")
        textsizer = wx.StaticBoxSizer(Alltextbox, wx.HORIZONTAL)
        textsizer.Add((45, 240), 0, wx.ALL, 2)
        textsizer.Add(self.Text_All, 0, wx.CENTER)
        textsizer.Add((45, 20), 0, wx.ALL, 2)
        row7sizer = wx.BoxSizer(wx.HORIZONTAL)
        row7sizer.Add((45, 30), 0, wx.ALL, 2)
        row7sizer.Add(textsizer)
        row7sizer.Add((45, 30), 0, wx.ALL, 2)
        mainSizer.Add(row7sizer, 0, wx.EXPAND | wx.BOTTOM, 10)

        Namesizer = wx.BoxSizer(wx.HORIZONTAL)
        Namesizer.Add((70, 60), 0, wx.ALL, 2)
        Namesizer.Add(self.label_Name, 0, wx.CENTER)
        Namesizer.Add(self.Text_Name, 0, wx.CENTER)
        Namesizer.Add((45, 60), 0, wx.ALL, 2)
        Namesizer.Add(cancelBtn, 0, wx.CENTER)

        mainSizer.Add(Namesizer)

        panel.SetSizer(mainSizer)
예제 #10
0
    def __init__(self, parent, gui_size, cfg):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent)

        # variable initialization
        self.method = "automatic"
        self.config = cfg
        self.cfg = auxiliaryfunctions.read_config(self.config)
        # design the panel
        self.sizer = wx.GridBagSizer(5, 5)

        text = wx.StaticText(self, label="DeepLabCut - Step 4. Create training dataset")
        self.sizer.Add(text, pos=(0, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=15)
        # Add logo of DLC
        icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(LOGO_PATH))
        self.sizer.Add(
            icon, pos=(0, 4), flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT, border=5
        )

        line1 = wx.StaticLine(self)
        self.sizer.Add(
            line1, pos=(1, 0), span=(1, 5), flag=wx.EXPAND | wx.BOTTOM, border=10
        )

        self.cfg_text = wx.StaticText(self, label="Select the config file")
        self.sizer.Add(self.cfg_text, pos=(2, 0), flag=wx.TOP | wx.LEFT, border=5)

        if sys.platform == "darwin":
            self.sel_config = wx.FilePickerCtrl(
                self,
                path="",
                style=wx.FLP_USE_TEXTCTRL,
                message="Choose the config.yaml file",
                wildcard="*.yaml",
            )
        else:
            self.sel_config = wx.FilePickerCtrl(
                self,
                path="",
                style=wx.FLP_USE_TEXTCTRL,
                message="Choose the config.yaml file",
                wildcard="config.yaml",
            )
        # self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml")
        self.sizer.Add(
            self.sel_config, pos=(2, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND, border=5
        )
        self.sel_config.SetPath(self.config)
        self.sel_config.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_config)

        sb = wx.StaticBox(self, label="Optional Attributes")
        boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)

        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox3 = wx.BoxSizer(wx.HORIZONTAL)

        config_file = auxiliaryfunctions.read_config(self.config)

        net_text = wx.StaticBox(self, label="Select the network")
        netboxsizer = wx.StaticBoxSizer(net_text, wx.VERTICAL)
        self.net_choice = wx.ComboBox(self, style=wx.CB_READONLY)
        options = [
            "dlcrnet_ms5",
            "resnet_50",
            "resnet_101",
            "mobilenet_v2_1.0",
            "efficientnet-b0",
        ]
        self.net_choice.Set(options)
        
        if self.cfg.get("multianimalproject", False):
            self.net_choice.SetValue("dlcrnet_ms5")
        else:
            self.net_choice.SetValue("resnet_50")

        netboxsizer.Add(self.net_choice, 20, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)

        aug_text = wx.StaticBox(self, label="Select the augmentation method")
        augboxsizer = wx.StaticBoxSizer(aug_text, wx.VERTICAL)
        self.aug_choice = wx.ComboBox(self, style=wx.CB_READONLY)
        options = ["default", "tensorpack", "imgaug"]
        self.aug_choice.Set(options)
        self.aug_choice.SetValue("imgaug")
        augboxsizer.Add(self.aug_choice, 20, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)

        self.hbox1.Add(netboxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        self.hbox1.Add(augboxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

        shuffle_text = wx.StaticBox(
            self, label="Set a specific shuffle index (1 network only)"
        )
        shuffle_text_boxsizer = wx.StaticBoxSizer(shuffle_text, wx.VERTICAL)
        self.shuffle = wx.SpinCtrl(self, value="1", min=1, max=100)
        shuffle_text_boxsizer.Add(self.shuffle, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)

        #trainingindex_box = wx.StaticBox(self, label="Specify the trainingset index")
        #trainingindex_boxsizer = wx.StaticBoxSizer(trainingindex_box, wx.VERTICAL)
        #self.trainingindex = wx.SpinCtrl(self, value="0", min=0, max=100)
        #trainingindex_boxsizer.Add(
        #    self.trainingindex, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10
        #)

        self.userfeedback = wx.RadioBox(
            self,
            label="User feedback (to confirm overwrite train/test split)?",
            choices=["Yes", "No"],
            majorDimension=1,
            style=wx.RA_SPECIFY_COLS,
        )
        self.userfeedback.SetSelection(1)

        self.hbox2.Add(shuffle_text_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        #self.hbox2.Add(trainingindex_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

        self.hbox2.Add(self.userfeedback, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

        if config_file.get("multianimalproject", False):

            self.model_comparison_choice = "No"
        else:
            self.model_comparison_choice = wx.RadioBox(
                self,
                label="Want to compare models?",
                choices=["Yes", "No"],
                majorDimension=1,
                style=wx.RA_SPECIFY_COLS,
            )
            self.model_comparison_choice.Bind(wx.EVT_RADIOBOX, self.chooseOption)
            self.model_comparison_choice.SetSelection(1)

            self.shuffles_text = wx.StaticBox(
                self, label="Specify the number of shuffles"
            )
            self.shuffles_text_boxsizer = wx.StaticBoxSizer(
                self.shuffles_text, wx.VERTICAL
            )
            self.shuffles = wx.SpinCtrl(self, value="1", min=1, max=100)
            self.shuffles_text_boxsizer.Add(
                self.shuffles, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10
            )

            networks = [
                "resnet_50",
                "resnet_101",
                "resnet_152",
                "mobilenet_v2_1.0",
                "mobilenet_v2_0.75",
                "mobilenet_v2_0.5",
                "mobilenet_v2_0.35",
                "efficientnet-b0",
                "efficientnet-b3",
                "efficientnet-b6",
            ]
            augmentation_methods = ["default", "tensorpack", "imgaug"]
            self.network_box = wx.StaticBox(self, label="Select the networks")
            self.network_boxsizer = wx.StaticBoxSizer(self.network_box, wx.VERTICAL)
            self.networks_to_compare = wx.CheckListBox(
                self, choices=networks, style=0, name="Select the networks"
            )
            self.networks_to_compare.Bind(wx.EVT_CHECKLISTBOX, self.get_network_names)
            self.network_boxsizer.Add(
                self.networks_to_compare, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10
            )

            self.augmentation_box = wx.StaticBox(
                self, label="Select the augmentation methods"
            )
            self.augmentation_boxsizer = wx.StaticBoxSizer(
                self.augmentation_box, wx.VERTICAL
            )
            self.augmentation_to_compare = wx.CheckListBox(
                self,
                choices=augmentation_methods,
                style=0,
                name="Select the augmentation methods",
            )
            self.augmentation_to_compare.Bind(
                wx.EVT_CHECKLISTBOX, self.get_augmentation_method_names
            )
            self.augmentation_boxsizer.Add(
                self.augmentation_to_compare, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10
            )

            self.hbox3.Add(
                self.model_comparison_choice, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5
            )
            self.hbox3.Add(
                self.shuffles_text_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5
            )
            self.hbox3.Add(self.network_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
            self.hbox3.Add(
                self.augmentation_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5
            )

            self.shuffles_text.Hide()
            self.shuffles.Hide()
            self.network_box.Hide()
            self.networks_to_compare.Hide()
            self.augmentation_box.Hide()
            self.augmentation_to_compare.Hide()

        boxsizer.Add(self.hbox1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
        boxsizer.Add(self.hbox2, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
        boxsizer.Add(self.hbox3, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)

        self.sizer.Add(
            boxsizer,
            pos=(3, 0),
            span=(1, 5),
            flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT,
            border=10,
        )

        self.help_button = wx.Button(self, label="Help")
        self.sizer.Add(self.help_button, pos=(4, 0), flag=wx.LEFT, border=10)
        self.help_button.Bind(wx.EVT_BUTTON, self.help_function)

        self.ok = wx.Button(self, label="Ok")
        self.sizer.Add(self.ok, pos=(4, 4))
        self.ok.Bind(wx.EVT_BUTTON, self.create_training_dataset)

        self.reset = wx.Button(self, label="Reset")
        self.sizer.Add(
            self.reset, pos=(4, 1), span=(1, 1), flag=wx.BOTTOM | wx.RIGHT, border=10
        )
        self.reset.Bind(wx.EVT_BUTTON, self.reset_create_training_dataset)

        self.sizer.AddGrowableCol(2)

        self.SetSizer(self.sizer)
        self.sizer.Fit(self)
        self.Layout()
예제 #11
0
 def Create(self, parent, id, evtHandler):
     self._tc = wx.CheckListBox(parent, id, choices=self.choices)
     self._tc.SetChecked(self.startValue)
     self.SetControl(self._tc)
     if evtHandler:
         self._tc.PushEventHandler(evtHandler)
예제 #12
0
    def __init__(self, parent, login='', password='', writeback = (lambda x: None)):
        """Instantiate the MascotSearch class. This creates a window for submitting to Mascot via Multiplierz.

        The basic workflow of this editor is:
        1. Select file(s)
        2. Customize settings via the GUI
        3. Submit to Mascot server
        4. Wait (or do other things) while the search runs
        """
        wx.Frame.__init__(self, None, -1, "Mascot MS/MS Ions Search", style=wx.DEFAULT_FRAME_STYLE ^ (wx.RESIZE_BORDER | wx.MAXIMIZE_BOX))
        self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)
        pane = wx.Panel(self, -1, style = wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN)

        for i in range(parent.nb.GetPageCount()):
            if parent.nb.GetPageText(i) == "Download Mascot":
                self.mascot_tab = parent.nb.GetPage(i)
                break
        else:
            logger_message(40, "Couldn't find Mascot downloader")
            self.mascot_tab = None

        self.login = login
        self.password = password
        self.writeback = writeback
        ms = MascotSearcher(settings.mascot_server)
        if settings.mascot_security:
            err = ms.login(self.login, self.password)
            if err:
                logger_message(40, "Error logging in to server: %s" % err)
                self.Close()
                return

        fields = ms.get_fields(settings.mascot_version)
        #fields = ms.get_fields_better()
        ms.close()

        menu_bar = wx.MenuBar()

        file_menu = wx.Menu()
        load_par = wx.MenuItem(file_menu, -1, "&Open PAR File\tCtrl+O")
        file_menu.AppendItem(load_par)
        self.Bind(wx.EVT_MENU, self.OnLoadPar, load_par)

        save_par = wx.MenuItem(file_menu, -1, "&Save Parameters\tCtrl+S")
        file_menu.AppendItem(save_par)
        self.Bind(wx.EVT_MENU, self.OnSavePar, save_par)

        menu_bar.Append(file_menu, "&File")

        output_menu = wx.Menu()
        self.open_tabs = wx.MenuItem(output_menu, -1, "&Open Results in Browser", kind=wx.ITEM_CHECK)
        output_menu.AppendItem(self.open_tabs)

        self.getIDs = wx.MenuItem(output_menu, -1, "&Send IDs to Mascot Downloader", kind=wx.ITEM_CHECK)
        output_menu.AppendItem(self.getIDs)
	
        if settings.mascot_server.find('www.matrixscience.com') != -1 or self.mascot_tab is None:
            self.getIDs.Enable(False)
            self.open_tabs.Check() # set default to open a browser
        else:
            self.getIDs.Check() # for non-public server, default to report-downloader

        menu_bar.Append(output_menu, "&Output")

        self.SetMenuBar(menu_bar)

        gbs = wx.GridBagSizer(10, 5)

        # parameter hash stores the values
        self.parameters = {'USERNAME':'',
                           'USEREMAIL':'',
                           'COM':'',
                           'DB':'',
                           'TAXONOMY':'',
                           'CLE':'',
                           'PFA':'',
                           'MODS':'',
                           'IT_MODS':'',
                           'TOL':'',
                           'TOLU':'',
                           'PEP_ISOTOPE_ERROR':'',
                           'ITOL':'',
                           'ITOLU':'',
                           'CHARGE':'',
                           'MASS':'',
                           'FILE':'',
                           'FORMAT':'',
                           'PRECURSOR':'',
                           'INSTRUMENT':'',
                           'REPORT':''
                           }

        if settings.mascot_version == '2.1':
            self.parameters.update( { 'SEG':'', 'ICAT':'', 'OVERVIEW':'' } )
        elif settings.mascot_version >= '2.2':
            self.parameters.update( { 'QUANTITATION':'', 'ERRORTOLERANT':'', 'DECOY':'', } )

        # labels
        labels = (zip(range(6) + range(7,11) + [0,4,5,7,10,11],
                      [0 for i in range(10)] + [5 for i in range(6)],
                      ['Name',
                       'Search title',
                       'Database',
                       'Taxonomy',
                       'Enzyme',
                       'Fixed\nModifications',
                       u'Peptipe tol. \xb1',
                       'Peptide Charge',
                       'Data File',
                       'Instrument',
                       'Email',
                       'Missed\nCleavages',
                       'Variable\nModifications',
                       u'MS/MS tol. \xb1',
                       'Precursor',
                       'Report Top']))

        if settings.mascot_version == '2.1':
            labels += (6, 0, 'Protein Mass'),
            gbs.Add( wx.StaticText(pane, -1, 'kDa'), (6,3), flag=wx.EXPAND )
        elif settings.mascot_version >= '2.2':
            labels += (6, 0, 'Quantitation'),
            # one fancytext label (for superscript)
            gbs.Add( FT.StaticFancyText(pane, -1, '# <sup>13</sup>C', style=wx.ALIGN_RIGHT),
                     (7,3), flag=wx.EXPAND )

        else:
            wx.MessageBox("This version of Mascot may not be supported correctly.")

        # ----- add labels -----
        for x,y,lbl in labels:
            gbs.Add( wx.StaticText(pane, -1, lbl, style=wx.ALIGN_RIGHT), (x,y), flag=wx.EXPAND )

        gbs.Add( wx.StaticText(pane, -1, 'm/z'), (10,8), flag=wx.EXPAND )

        # ----- add controls -----

        # name
        gbs.Add( wx.TextCtrl(pane, -1, "Your name here", name="USERNAME"), (0,1), (1,4), flag=wx.EXPAND )
        # email
        gbs.Add( wx.TextCtrl(pane, -1, "", name="USEREMAIL"), (0,6), (1,4), flag=wx.EXPAND )

        # title
        gbs.Add( wx.TextCtrl(pane, -1, "", name="COM"), (1,1), (1,7), flag=wx.EXPAND )

        # database
        if settings.mascot_version < '2.3':
            gbs.Add( wx.Choice(pane, -1, choices=fields['DB'], name="DB"), (2,1), (1,4), flag=wx.EXPAND )
        else:
            dbSelector = wx.CheckListBox(pane, -1, choices=fields['DB'], size=(228,81), name="DB")
            gbs.Add(dbSelector, (2,1), (1,4), flag=wx.EXPAND )
            self.Bind(wx.EVT_CHECKLISTBOX, self.onDatabaseSelect, dbSelector)

        # taxonomy
        gbs.Add( wx.Choice(pane, -1, choices=fields['TAXONOMY'], name="TAXONOMY"), (3,1), (1,8) )

        # enzyme
        gbs.Add( wx.Choice(pane, -1, choices=fields['CLE'], name="CLE"), (4,1), (1,4), flag=wx.EXPAND )
        # missed cleavages
        pfa_min = min(int(s) for s in fields['PFA'])
        pfa_max = max(int(s) for s in fields['PFA'])
        gbs.Add( wx.SpinCtrl(pane, -1, min=pfa_min, max=pfa_max, initial=int(fields['PFA'][0]), size=(40,21),
                             style=wx.SP_WRAP|wx.SP_ARROW_KEYS, name="PFA"), (4,6) )

        # fixed and variable modifications
        mods = wx.CheckListBox(pane, -1, choices=fields['MODS'], size=(228,81), name="MODS")
        gbs.Add( mods, (5,1), (1,4), flag=wx.EXPAND )
        mods.Bind(wx.EVT_CHECKLISTBOX, self.OnModSelect)

        it_mods = wx.CheckListBox(pane, -1, choices=fields['IT_MODS'], size=(228,81), name="IT_MODS")
        gbs.Add( it_mods, (5,6), (1,4), flag=wx.EXPAND )
        it_mods.Bind(wx.EVT_CHECKLISTBOX, self.OnModSelect)

        if settings.mascot_version == '2.1':
            gbs.Add( wx.TextCtrl(pane, -1, "", name="SEG", validator=ProtMassVal()), (6,1), (1,2), flag=wx.EXPAND )
            gbs.Add( wx.CheckBox(pane, -1, "ICAT", style=wx.ALIGN_RIGHT, name="ICAT"), (6,6), (1,2) )
        elif settings.mascot_version >= '2.2':
            # quantitation
            gbs.Add( wx.Choice(pane, -1, choices=fields['QUANTITATION'], name="QUANTITATION"), (6,1), (1,4), flag=wx.EXPAND )

        # peptide tolerance
        gbs.Add( wx.TextCtrl(pane, -1, "1.2", size=(40,21), validator=TolValidator(), name="TOL"), (7,1) )
        # pep tol units
        gbs.Add( wx.Choice(pane, -1, choices=fields['TOLU'], name="TOLU"), (7,2) )

        if settings.mascot_version >= '2.2':
            # isotope error (# 13C)
            pie_min = min(int(s) for s in fields['PEP_ISOTOPE_ERROR'])
            pie_max = max(int(s) for s in fields['PEP_ISOTOPE_ERROR'])
            gbs.Add( wx.SpinCtrl(pane, -1, min=pie_min, max=pie_max, initial=int(fields.selected['PEP_ISOTOPE_ERROR']),
                                 size=(40,21), style=wx.SP_WRAP|wx.SP_ARROW_KEYS, name="PEP_ISOTOPE_ERROR"), (7,4) )

        # MS/MS tolerance
        gbs.Add( wx.TextCtrl(pane, -1, "0.6", size=(40,21), validator=TolValidator(), name="ITOL"), (7,6) )
        # MS/MS tol units
        gbs.Add( wx.Choice(pane, -1, choices=fields['ITOLU'], name="ITOLU"), (7,7) )

        # peptide charge
        gbs.Add( wx.Choice(pane, -1, choices=fields['CHARGE'], name="CHARGE"), (8,1), (1,4) )

        # monoisotopic/average radiobox
        gbs.Add( wx.RadioBox( pane, -1, choices=['Monoisotopic','Average'], style=wx.ALIGN_RIGHT, name="MASS"), (8,6), (2,4) )

        # file control
        self.fname = wx.TextCtrl(pane, -1, "", style=wx.TE_READONLY)
        self.fname.BackgroundColour = wx.NamedColour("LIGHT GREY")
        gbs.Add( self.fname, (9,1), (1,4), flag=wx.EXPAND )
        self.fname.Bind(wx.EVT_LEFT_UP, self.OnChooseFile)

        fbutton = wx.Button(pane, -1, "Browse...")
        gbs.Add( fbutton, (9,5) )
        fbutton.Bind(wx.EVT_BUTTON, self.OnChooseFile)

        # instrument
        gbs.Add( wx.Choice(pane, -1, choices=fields['INSTRUMENT'], name="INSTRUMENT"), (10,1), (1,4), flag=wx.EXPAND )

        # precursor
        gbs.Add( wx.TextCtrl(pane, -1, "", size=(60,21), name="PRECURSOR", validator=PreValidator()),
                 (10,6), (1,2), flag=wx.EXPAND )

        if settings.mascot_version == '2.1':
            gbs.Add( wx.CheckBox(pane, -1, "Overview", style=wx.ALIGN_RIGHT, name="OVERVIEW"), (11,1), (1,2) )
        elif settings.mascot_version >= '2.2':
            # decoy/error tolerant checkboxes
            gbs.Add( wx.CheckBox(pane, -1, "Decoy", style=wx.ALIGN_RIGHT, name="DECOY"), (11,1), (1,2) )
            gbs.Add( wx.CheckBox(pane, -1, "Error Tolerant",
                                 style=wx.ALIGN_RIGHT, name="ERRORTOLERANT", validator=ErrorTolVal()), (11,3), (1,2) )

        # report top hits
        gbs.Add( wx.Choice(pane, -1, choices=fields['REPORT'], name="REPORT"), (11, 6), (1,2) )

        # Submit button
        submit = wx.Button(pane, -1, "Submit")
        gbs.Add( submit, (12,0), (1,10), flag=wx.EXPAND )
        submit.Bind(wx.EVT_BUTTON, self.OnSubmit)

        box = wx.BoxSizer()
        box.Add(gbs, 0, wx.ALL, 10)

        for child in pane.GetChildren():
            if isinstance(child,wx.Choice):
                if child.GetName() in fields.selected:
                    child.SetSelection(child.FindString(fields.selected[child.GetName()]))
                else:
                    child.SetSelection(0)

        pane.SetSizerAndFit(box)
        self.SetClientSize(pane.GetSize())
예제 #13
0
    def __init__(self, cityname, city_name_pinyin, lng, lat):
        super().__init__(None, -1, title='控制窗口 ' + cityname, size=(950, 500))
        self.lines_data = {}  # 线路数据
        self.lines_list = []  # 全部线路  用于初始化checklist内选项
        self.stations_list = {}  # 全部站点
        self.routine = []
        self.extent, self.translation_extent = 0.2, 0.02
        self.cityname, self.city_name_pinyin, self.lng, self.lat = cityname, city_name_pinyin, lng, lat
        self.prepare_city_metro_data()
        self.shp0 = shpreader.Reader('city_border.shp')

        self.panel = wx.Panel(self, size=(700, 500))
        # self.city_name_text = wx.StaticText(self.panel, label=cityname+'市',style=wx.ALIGN_CENTER)
        # self.city_name_text.SetFont(wx.Font(36, wx.DECORATIVE, wx.NORMAL, wx.NORMAL))
        self.button_zoom_up = wx.Button(self.panel, -1, '放大')
        self.button_zoom_up.Bind(wx.EVT_BUTTON, self.zoom_up)
        self.button_zoom_down = wx.Button(self.panel, -1, '缩小')
        self.button_zoom_down.Bind(wx.EVT_BUTTON, self.zoom_down)
        self.button_translation_up = wx.Button(self.panel, -1, '↑')
        self.button_translation_up.Bind(wx.EVT_BUTTON, self.translation_up)
        self.button_translation_down = wx.Button(self.panel, -1, '↓')
        self.button_translation_down.Bind(wx.EVT_BUTTON, self.translation_down)
        self.button_translation_left = wx.Button(self.panel, -1, '←')
        self.button_translation_left.Bind(wx.EVT_BUTTON, self.translation_left)
        self.button_translation_right = wx.Button(self.panel, -1, '→')
        self.button_translation_right.Bind(wx.EVT_BUTTON,
                                           self.translation_right)

        self.checklistbox_lines = wx.CheckListBox(self.panel,
                                                  choices=self.lines_list)
        self.checklistbox_lines.SetCheckedItems(
            range(0, self.checklistbox_lines.GetCount()))
        self.checklistbox_lines.Bind(wx.EVT_CHECKLISTBOX, self.set_lines)
        self.button_check_all_lines = wx.Button(self.panel, -1, '选中全部线路')
        self.button_check_all_lines.Bind(wx.EVT_BUTTON, self.check_all_lines)
        self.button_clear_checked_lines = wx.Button(self.panel, -1, '清空选中线路')
        self.button_clear_checked_lines.Bind(wx.EVT_BUTTON,
                                             self.clear_checked_lines)
        self.grid_check_lines = wx.GridSizer(cols=1, rows=2, vgap=2, hgap=2)
        self.grid_check_lines.AddMany([
            (self.button_check_all_lines, 0, wx.EXPAND),
            (self.button_clear_checked_lines, 0, wx.EXPAND)
        ])
        self.box_check_line = wx.BoxSizer()
        self.box_check_line.Add(self.checklistbox_lines,
                                proportion=1,
                                flag=wx.EXPAND | wx.ALL,
                                border=3)
        self.box_check_line.Add(self.grid_check_lines,
                                proportion=1,
                                flag=wx.EXPAND | wx.ALL,
                                border=3)

        self.start_station_text = wx.StaticText(self.panel, label='出发地:')
        self.input_start_station = wx.TextCtrl(self.panel)
        self.destination_station_text = wx.StaticText(self.panel, label='目的地:')
        self.input_destination_station = wx.TextCtrl(self.panel)
        self.route_text = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE)
        self.box_start_station = wx.BoxSizer()
        self.box_start_station.Add(self.start_station_text,
                                   proportion=1,
                                   flag=wx.EXPAND | wx.ALL,
                                   border=3)
        self.box_start_station.Add(self.input_start_station,
                                   proportion=2,
                                   flag=wx.EXPAND | wx.ALL,
                                   border=3)
        self.box_destination_station = wx.BoxSizer()
        self.box_destination_station.Add(self.destination_station_text,
                                         proportion=1,
                                         flag=wx.EXPAND | wx.ALL,
                                         border=3)
        self.box_destination_station.Add(self.input_destination_station,
                                         proportion=2,
                                         flag=wx.EXPAND | wx.ALL,
                                         border=3)

        self.button_search_route = wx.Button(self.panel, -1, '确定')
        self.button_search_route.Bind(wx.EVT_BUTTON, self.search_station)
        self.gridsizer_station = wx.GridSizer(cols=1, rows=3, vgap=10, hgap=5)
        self.gridsizer_station.AddMany([
            (self.box_start_station, 0, wx.EXPAND),
            (self.box_destination_station, 0, wx.EXPAND),
            (self.button_search_route, 0, wx.EXPAND)
        ])

        self.figure = plt.figure()
        self.ax = plt.axes(projection=ccrs.PlateCarree())
        # self.ax.coastlines()
        self.ax.set_extent([
            self.lng - self.extent, self.lng + self.extent,
            self.lat - self.extent, self.lat + self.extent
        ])
        self.canvas = FigureCanvasWxAgg(self.panel, -1, self.figure)
        # self.toolbar = NavigationToolbar2WxAgg(self.canvas)

        self.box_h = wx.BoxSizer()
        self.gridsizer_v = wx.GridSizer(cols=1, rows=4, vgap=10, hgap=5)

        self.controller_gridsizer = wx.GridSizer(cols=3,
                                                 rows=2,
                                                 vgap=10,
                                                 hgap=5)
        self.controller_gridsizer.AddMany([
            (self.button_zoom_up, 0, wx.EXPAND),
            (self.button_translation_up, 0, wx.EXPAND),
            (self.button_zoom_down, 0, wx.EXPAND),
            (self.button_translation_left, 0, wx.EXPAND),
            (self.button_translation_down, 0, wx.EXPAND),
            (self.button_translation_right, 0, wx.EXPAND)
        ])

        self.gridsizer_v.AddMany([(self.box_check_line, 0, wx.EXPAND),
                                  (self.gridsizer_station, 0, wx.EXPAND),
                                  (self.route_text, 0, wx.EXPAND),
                                  (self.controller_gridsizer, 0, wx.EXPAND)])
        # self.gridsizer_v.AddMany([(self.box_check_line, 0, wx.EXPAND), (self.gridsizer_station, 0, wx.EXPAND),(self.route_text, 0, wx.EXPAND),(self.controller_gridsizer, 0, wx.EXPAND), (self.toolbar, 0, wx.EXPAND)])

        self.box_h.Add(self.canvas,
                       proportion=3,
                       flag=wx.EXPAND | wx.ALL,
                       border=3)
        self.box_h.Add(self.gridsizer_v,
                       proportion=1,
                       flag=wx.EXPAND | wx.ALL,
                       border=3)
        self.panel.SetSizer(self.box_h)
        self.draw_lines()
    def InitUI(self):
        panel = wx.Panel(self)

        font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT)
        titleFont = font
        font.SetPointSize(9)
        titleFont.SetPointSize(12)

        #间隙
        hvGap = 5

        #主布局、水平
        mainHBox = wx.BoxSizer(wx.HORIZONTAL)

        #左侧布局、垂直
        leftVBox = wx.BoxSizer(wx.VERTICAL)

        #案例标题
        st1 = wx.StaticText(panel, label=u'测试案例')
        st1.SetFont(titleFont)
        leftVBox.Add(st1, flag=wx.LEFT | wx.RIGHT | wx.TOP, border=hvGap)

        #案例列表
        self.checkListBox = wx.CheckListBox(
            panel, choices=[u'测试案例1', u'测试案例2', u'测试案例3'])
        self.Bind(wx.EVT_CHECKLISTBOX, self.onCheckListBoxSelect,
                  self.checkListBox)
        leftVBox.Add(self.checkListBox,
                     proportion=1,
                     flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                     border=hvGap)
        leftVBox.Add((-1, 10))

        #全选
        self.selectAllCheckBox = wx.CheckBox(panel,
                                             label=u'全选',
                                             style=wx.CHK_3STATE)
        self.selectAllCheckBox.SetFont(font)
        self.Bind(wx.EVT_CHECKBOX, self.onCheckBoxSelectAll,
                  self.selectAllCheckBox)
        leftVBox.Add(self.selectAllCheckBox,
                     flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                     border=hvGap)

        leftVBox.Add((-1, 10))

        mainHBox.Add(leftVBox,
                     proportion=1,
                     flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                     border=hvGap)

        #右侧布局、垂直
        rightVBbox = wx.BoxSizer(wx.VERTICAL)
        '''hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        st1 = wx.StaticText(panel,label=u'测试文件')
        st1.SetFont(font)
        
        hbox1.Add(st1,flag=wx.RIGHT,border=8)
        tc = wx.TextCtrl(panel)
        hbox1.Add(tc,proportion=1)
        self.selectFileBtn = wx.Button(panel, label=u'选择文件', size=(70, 30))
        #self.Bind(wx.EVT_BUTTON, self.OnClickSelectFile, self.selectFileBtn)  #未实现
        hbox1.Add(self.selectFileBtn, flag=wx.LEFT|wx.RIGHT, border=hvGap)
        rightVBbox.Add(hbox1,flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP,border=hvGap)
        
        rightVBbox.Add((-1,hvGap))'''

        #日志标题
        st2 = wx.StaticText(panel, label=u'日志')
        st2.SetFont(titleFont)
        rightVBbox.Add(st2, flag=wx.LEFT | wx.RIGHT | wx.TOP, border=hvGap)

        hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        self.logTextCtrl = wx.TextCtrl(panel,
                                       style=wx.TE_MULTILINE | wx.TE_READONLY)
        hbox3.Add(self.logTextCtrl, proportion=1, flag=wx.EXPAND)
        rightVBbox.Add(hbox3,
                       proportion=1,
                       flag=wx.LEFT | wx.RIGHT | wx.EXPAND | wx.TOP,
                       border=hvGap)

        rightVBbox.Add((-1, 10))

        hbox5 = wx.BoxSizer(wx.HORIZONTAL)

        #串口选择
        self.ComChoice = wx.Choice(panel,
                                   choices=[u'串口1', u'串口2', u'串口3', u'串口4'],
                                   size=(100, 30))
        #self.Bind(wx.EVT_BUTTON, self.onClickedRefreshBtn, self.refreshBtn)
        hbox5.Add(self.ComChoice, flag=wx.LEFT | wx.BOTTOM, border=5)

        #刷新串口按钮
        self.refreshBtn = wx.Button(panel, label=u'刷新串口', size=(70, 30))
        self.Bind(wx.EVT_BUTTON, self.onClickedRefreshBtn, self.refreshBtn)
        hbox5.Add(self.refreshBtn, flag=wx.LEFT | wx.BOTTOM, border=5)

        #开始测试按钮
        self.startBtn = wx.Button(panel, label=u'开始', size=(60, 30))
        self.Bind(wx.EVT_BUTTON, self.onClickedStartBtn, self.startBtn)
        hbox5.Add(self.startBtn, flag=wx.LEFT | wx.BOTTOM, border=5)

        #停止测试按钮
        self.stopBtn = wx.Button(panel, label=u'停止', size=(60, 30))
        self.Bind(wx.EVT_BUTTON, self.onClickedStopBtn, self.stopBtn)
        hbox5.Add(self.stopBtn, flag=wx.LEFT | wx.BOTTOM, border=5)
        rightVBbox.Add(hbox5, flag=wx.ALIGN_RIGHT | wx.RIGHT, border=hvGap)

        mainHBox.Add(rightVBbox,
                     proportion=1,
                     flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                     border=hvGap)

        panel.SetSizer(mainHBox)

        #默认全选
        self.selectAllCheckBox.Set3StateValue(wx.CHK_CHECKED)
        self.selectListAll(True)
        self.checkListBox.SetSelection(1)  #选中某行
예제 #15
0
    def addList(self, descr, parent, sizer, items, doBtns, isFirst, pad = 0):
        sizer.Add(wx.StaticText(parent, -1, descr), 0, wx.TOP, pad)

        if doBtns:
            hsizer = wx.BoxSizer(wx.HORIZONTAL)

            if isFirst:
                funcs = [ self.OnSet1, self.OnClear1, self.OnToggle1 ]
            else:
                funcs = [ self.OnSet2, self.OnClear2, self.OnToggle2 ]

            tmp = wx.Button(parent, -1, "Set")
            hsizer.Add(tmp)
            wx.EVT_BUTTON(self, tmp.GetId(), funcs[0])

            tmp = wx.Button(parent, -1, "Clear")
            hsizer.Add(tmp, 0, wx.LEFT, 10)
            wx.EVT_BUTTON(self, tmp.GetId(), funcs[1])

            tmp = wx.Button(parent, -1, "Toggle")
            hsizer.Add(tmp, 0, wx.LEFT, 10)
            wx.EVT_BUTTON(self, tmp.GetId(), funcs[2])

            sizer.Add(hsizer, 0, wx.TOP | wx.BOTTOM, 5)

        tmp = wx.CheckListBox(parent, -1)

        longest = -1
        for i in range(len(items)):
            it = items[i]

            tmp.Append(it.text)
            tmp.Check(i, it.selected)

            if isFirst:
                if longest != -1:
                    if len(it.text) > len(items[longest].text):
                        longest = i
                else:
                    longest = 0

        w = -1
        if isFirst:
            h = len(items)
            if longest != -1:
                w = util.getTextExtent(tmp.GetFont(),
                                       "[x] " + items[longest].text)[0] + 15
        else:
            h = min(10, len(items))

        # don't know of a way to get the vertical spacing of items in a
        # wx.CheckListBox, so estimate it at font height + 5 pixels, which
        # is close enough on everything I've tested.
        h *= util.getFontHeight(tmp.GetFont()) + 5
        h += 5
        h = max(25, h)

        util.setWH(tmp, w, h)
        sizer.Add(tmp, 0, wx.EXPAND)

        return tmp
예제 #16
0
    def CreateMenusPage(self):
        """ Creates the :class:`~wx.lib.agw.labelbook.LabelBook` pages with :class:`~wx.lib.agw.flatmenu.FlatMenu` information. """

        menus = wx.Panel(self._book, wx.ID_ANY, wx.DefaultPosition,
                         wx.Size(300, 300))
        sz = wx.BoxSizer(wx.VERTICAL)
        menus.SetSizer(sz)

        choices = []

        mb = self.GetParent()

        if not self.created:
            self.order = []

        # Add all the menu items that are currently visible to the list
        for i in range(len(mb._items)):

            dummy, lableOnly = ArtManager.Get().GetAccelIndex(
                mb._items[i].GetTitle())
            choices.append(lableOnly)

            # Add the menu to the visible menus map
            self._visibleMenus.update({lableOnly: mb._items[i].GetMenu()})
            if not self.created:
                self.order.append(lableOnly)

        # Add all hidden menus to the menu bar

        for key in list(self._hiddenMenus.keys()):
            choices.append(key)

        if self.created:
            visible = OrderedDict()
            hidden = OrderedDict()
            for items in self.order:
                if items in self._visibleMenus:
                    visible[items] = self._visibleMenus[items]
                elif items in self._hiddenMenus:
                    hidden[items] = self._hiddenMenus[items]

            self._visibleMenus = visible
            self._hiddenMenus = hidden

        self._menuListId = wx.NewId()
        self._checkListMenus = wx.CheckListBox(menus,
                                               self._menuListId,
                                               pos=wx.DefaultPosition,
                                               size=wx.Size(250, 250),
                                               choices=self.order,
                                               style=wx.BORDER_SIMPLE)
        self._checkListMenus.Bind(wx.EVT_CHECKLISTBOX, self.OnMenuChecked)

        # check all visible items
        for indx, item in enumerate(self.order):
            if item in self._visibleMenus:
                self._checkListMenus.Check(indx)

        # Add title panel
        title = FMTitlePanel(menus, _("Select Menu To Add/Remove:"))
        sz.Add(title, 0, wx.EXPAND | wx.ALL, 2)
        sz.Add(self._checkListMenus, 1,
               wx.EXPAND | wx.TOP | wx.RIGHT | wx.LEFT, 2)

        self.created = True

        return menus
예제 #17
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.Size(-1, -1),
                 style=wx.TAB_TRAVERSAL,
                 name=wx.EmptyString):
        wx.Panel.__init__(self,
                          parent,
                          id=id,
                          pos=pos,
                          size=size,
                          style=style,
                          name=name)

        bSizer42 = wx.BoxSizer(wx.VERTICAL)

        sbSizer7 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Netlist or xml file"), wx.VERTICAL)

        self.netlistFilePicker = wx.FilePickerCtrl(
            sbSizer7.GetStaticBox(), wx.ID_ANY, wx.EmptyString,
            u"Select a file",
            u"Netlist and xml files (*.net; *.xml)|*.net;*.xml",
            wx.DefaultPosition, wx.DefaultSize,
            wx.FLP_DEFAULT_STYLE | wx.FLP_FILE_MUST_EXIST | wx.FLP_OPEN
            | wx.FLP_SMALL | wx.FLP_USE_TEXTCTRL | wx.BORDER_SIMPLE)
        sbSizer7.Add(self.netlistFilePicker, 0,
                     wx.EXPAND | wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer42.Add(sbSizer7, 0, wx.ALL | wx.EXPAND, 5)

        extraFieldsSizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Extra fields"), wx.VERTICAL)

        bSizer4 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer6 = wx.BoxSizer(wx.VERTICAL)

        extraFieldsListChoices = []
        self.extraFieldsList = wx.CheckListBox(extraFieldsSizer.GetStaticBox(),
                                               wx.ID_ANY, wx.DefaultPosition,
                                               wx.DefaultSize,
                                               extraFieldsListChoices,
                                               0 | wx.BORDER_SIMPLE)
        bSizer6.Add(self.extraFieldsList, 1, wx.ALL | wx.EXPAND, 5)

        bSizer4.Add(bSizer6, 1, wx.EXPAND, 5)

        bSizer5 = wx.BoxSizer(wx.VERTICAL)

        self.m_button1 = wx.Button(extraFieldsSizer.GetStaticBox(),
                                   wx.ID_ANY, u"Up", wx.DefaultPosition,
                                   wx.Size(30, 30), 0 | wx.BORDER_DEFAULT)
        bSizer5.Add(self.m_button1, 0, wx.ALL, 5)

        self.m_button2 = wx.Button(extraFieldsSizer.GetStaticBox(),
                                   wx.ID_ANY, u"Dn", wx.DefaultPosition,
                                   wx.Size(30, 30), 0 | wx.BORDER_DEFAULT)
        bSizer5.Add(self.m_button2, 0, wx.ALL, 5)

        bSizer4.Add(bSizer5, 0, 0, 5)

        extraFieldsSizer.Add(bSizer4, 1, wx.EXPAND, 5)

        self.normalizeCaseCheckbox = wx.CheckBox(
            extraFieldsSizer.GetStaticBox(), wx.ID_ANY,
            u"Normalize field name case", wx.DefaultPosition, wx.DefaultSize,
            0)
        extraFieldsSizer.Add(self.normalizeCaseCheckbox, 0, wx.ALL | wx.EXPAND,
                             5)

        bSizer42.Add(extraFieldsSizer, 2, wx.ALL | wx.EXPAND, 5)

        sbSizer32 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Board variant"), wx.VERTICAL)

        self.m_staticText5 = wx.StaticText(sbSizer32.GetStaticBox(), wx.ID_ANY,
                                           u"Board variant field name",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText5.Wrap(-1)

        sbSizer32.Add(self.m_staticText5, 0, wx.ALL, 5)

        boardVariantFieldBoxChoices = []
        self.boardVariantFieldBox = wx.ComboBox(
            sbSizer32.GetStaticBox(), wx.ID_ANY, wx.EmptyString,
            wx.DefaultPosition, wx.DefaultSize, boardVariantFieldBoxChoices,
            wx.CB_READONLY | wx.CB_SORT | wx.BORDER_SIMPLE)
        sbSizer32.Add(self.boardVariantFieldBox, 0, wx.ALL | wx.EXPAND, 5)

        bSizer17 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer18 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText6 = wx.StaticText(sbSizer32.GetStaticBox(), wx.ID_ANY,
                                           u"Whitelist", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.m_staticText6.Wrap(-1)

        bSizer18.Add(self.m_staticText6, 0, wx.ALL, 5)

        boardVariantWhitelistChoices = []
        self.boardVariantWhitelist = wx.CheckListBox(
            sbSizer32.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition,
            wx.DefaultSize, boardVariantWhitelistChoices, 0 | wx.BORDER_SIMPLE)
        bSizer18.Add(self.boardVariantWhitelist, 1, wx.ALL | wx.EXPAND, 5)

        bSizer17.Add(bSizer18, 1, wx.EXPAND, 5)

        bSizer19 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText7 = wx.StaticText(sbSizer32.GetStaticBox(), wx.ID_ANY,
                                           u"Blacklist", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.m_staticText7.Wrap(-1)

        bSizer19.Add(self.m_staticText7, 0, wx.ALL, 5)

        boardVariantBlacklistChoices = []
        self.boardVariantBlacklist = wx.CheckListBox(
            sbSizer32.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition,
            wx.DefaultSize, boardVariantBlacklistChoices, 0 | wx.BORDER_SIMPLE)
        bSizer19.Add(self.boardVariantBlacklist, 1, wx.ALL | wx.EXPAND, 5)

        bSizer17.Add(bSizer19, 1, wx.EXPAND, 5)

        sbSizer32.Add(bSizer17, 1, wx.EXPAND, 5)

        bSizer42.Add(sbSizer32, 3, wx.ALL | wx.EXPAND, 5)

        sbSizer8 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"DNP field name"), wx.VERTICAL)

        self.m_staticText4 = wx.StaticText(
            sbSizer8.GetStaticBox(), wx.ID_ANY,
            u"Components with this field not empty will be ignored",
            wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText4.Wrap(-1)

        sbSizer8.Add(self.m_staticText4, 0, wx.ALL, 5)

        dnpFieldBoxChoices = []
        self.dnpFieldBox = wx.ComboBox(
            sbSizer8.GetStaticBox(), wx.ID_ANY, u"-None-", wx.DefaultPosition,
            wx.DefaultSize, dnpFieldBoxChoices,
            wx.CB_READONLY | wx.CB_SORT | wx.BORDER_NONE)
        sbSizer8.Add(self.dnpFieldBox, 0, wx.ALL | wx.EXPAND, 5)

        bSizer42.Add(sbSizer8, 0, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(bSizer42)
        self.Layout()
        bSizer42.Fit(self)

        # Connect Events
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.netlistFilePicker.Bind(wx.EVT_FILEPICKER_CHANGED,
                                    self.OnNetlistFileChanged)
        self.m_button1.Bind(wx.EVT_BUTTON, self.OnExtraFieldsUp)
        self.m_button2.Bind(wx.EVT_BUTTON, self.OnExtraFieldsDown)
        self.normalizeCaseCheckbox.Bind(wx.EVT_CHECKBOX,
                                        self.OnNetlistFileChanged)
        self.boardVariantFieldBox.Bind(wx.EVT_COMBOBOX,
                                       self.OnBoardVariantFieldChange)
예제 #18
0
    def __init__(self, parent, gui_size, cfg):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent)
        # variable initilization
        self.filelist = []
        self.picklelist = []
        self.bodyparts = []
        self.config = cfg
        self.cfg = auxiliaryfunctions.read_config(self.config)
        self.draw = False
        # design the panel
        self.sizer = wx.GridBagSizer(5, 10)

        if self.cfg.get("multianimalproject", False):
            text = wx.StaticText(
                self,
                label="DeepLabCut - Step 7. Analyze Videos and Detect Tracklets"
            )
        else:
            text = wx.StaticText(
                self, label="DeepLabCut - Step 7. Analyze Videos ....")

        self.sizer.Add(text,
                       pos=(0, 0),
                       flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                       border=15)
        # Add logo of DLC
        icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(LOGO_PATH))
        self.sizer.Add(icon,
                       pos=(0, 8),
                       flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT,
                       border=5)

        line1 = wx.StaticLine(self)
        self.sizer.Add(line1,
                       pos=(1, 0),
                       span=(1, 8),
                       flag=wx.EXPAND | wx.BOTTOM,
                       border=10)

        self.cfg_text = wx.StaticText(self, label="Select the config file")
        self.sizer.Add(self.cfg_text,
                       pos=(2, 0),
                       flag=wx.TOP | wx.LEFT,
                       border=10)

        if sys.platform == "darwin":
            self.sel_config = wx.FilePickerCtrl(
                self,
                path="",
                style=wx.FLP_USE_TEXTCTRL,
                message="Choose the config.yaml file",
                wildcard="*.yaml",
            )
        else:
            self.sel_config = wx.FilePickerCtrl(
                self,
                path="",
                style=wx.FLP_USE_TEXTCTRL,
                message="Choose the config.yaml file",
                wildcard="config.yaml",
            )

        self.sizer.Add(self.sel_config,
                       pos=(2, 1),
                       span=(1, 3),
                       flag=wx.TOP | wx.EXPAND,
                       border=5)
        self.sel_config.SetPath(self.config)
        self.sel_config.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_config)

        self.vids = wx.StaticText(self, label="Choose the videos")
        self.sizer.Add(self.vids, pos=(3, 0), flag=wx.TOP | wx.LEFT, border=10)

        self.sel_vids = wx.Button(self, label="Select videos to analyze")
        self.sizer.Add(self.sel_vids,
                       pos=(3, 1),
                       flag=wx.TOP | wx.EXPAND,
                       border=5)
        self.sel_vids.Bind(wx.EVT_BUTTON, self.select_videos)

        sb = wx.StaticBox(self, label="Attributes")
        boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)

        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox4 = wx.BoxSizer(wx.HORIZONTAL)

        videotype_text = wx.StaticBox(self, label="Specify the videotype")
        videotype_text_boxsizer = wx.StaticBoxSizer(videotype_text,
                                                    wx.VERTICAL)
        videotypes = [".avi", ".mp4", ".mov"]
        self.videotype = wx.ComboBox(self,
                                     choices=videotypes,
                                     style=wx.CB_READONLY)
        self.videotype.SetValue(".avi")
        videotype_text_boxsizer.Add(self.videotype, 1,
                                    wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

        shuffle_text = wx.StaticBox(self, label="Specify the shuffle")
        shuffle_boxsizer = wx.StaticBoxSizer(shuffle_text, wx.VERTICAL)
        self.shuffle = wx.SpinCtrl(self, value="1", min=0, max=100)
        shuffle_boxsizer.Add(self.shuffle, 1, wx.EXPAND | wx.TOP | wx.BOTTOM,
                             5)

        trainingset = wx.StaticBox(self, label="Specify the trainingset index")
        trainingset_boxsizer = wx.StaticBoxSizer(trainingset, wx.VERTICAL)
        self.trainingset = wx.SpinCtrl(self, value="0", min=0, max=100)
        trainingset_boxsizer.Add(self.trainingset, 1,
                                 wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

        # if self.cfg.get("multianimalproject", False):
        # pass
        # else:
        # removing this as several downstream maDLC steps don't support dest_folder at this time:
        # destfolder_text = wx.StaticBox(self, label="Specify destination folder")
        # destfolderboxsizer = wx.StaticBoxSizer(destfolder_text, wx.VERTICAL)
        # self.change_workingdir = wx.CheckBox(
        #    self, label="optional destination folder"
        # )
        # self.hbox2.Add(self.change_workingdir)
        # self.change_workingdir.Bind(wx.EVT_CHECKBOX, self.activate_change_wd)
        # self.sel_wd = wx.Button(self, label="Browse")
        # self.sel_wd.Enable(False)
        # self.sel_wd.Bind(wx.EVT_BUTTON, self.select_destfolder)
        # self.hbox2.Add(self.sel_wd, 0, wx.ALL, -1)

        self.hbox1.Add(videotype_text_boxsizer, 5,
                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        self.hbox1.Add(shuffle_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        self.hbox1.Add(trainingset_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM,
                       5)

        if self.cfg.get("multianimalproject", False):

            self.robust = wx.RadioBox(
                self,
                label="Use ffprobe to read video metadata (slow but robust)",
                choices=["Yes", "No"],
                majorDimension=1,
                style=wx.RA_SPECIFY_COLS,
            )
            self.robust.SetSelection(1)
            self.hbox1.Add(self.robust, 5, 5)

            self.create_video_with_all_detections = wx.RadioBox(
                self,
                label="Create video for checking detections",
                choices=["Yes", "No"],
                majorDimension=1,
                style=wx.RA_SPECIFY_COLS,
            )
            self.create_video_with_all_detections.SetSelection(1)
            self.hbox2.Add(
                self.create_video_with_all_detections,
                5,
                wx.EXPAND | wx.TOP | wx.BOTTOM,
                5,
            )

            tracker_text = wx.StaticBox(
                self, label="Specify the Tracker Method (you can try each)")
            tracker_text_boxsizer = wx.StaticBoxSizer(tracker_text,
                                                      wx.VERTICAL)
            trackertypes = ["skeleton", "box", "ellipse"]
            self.trackertypes = wx.ComboBox(self,
                                            choices=trackertypes,
                                            style=wx.CB_READONLY)
            self.trackertypes.SetValue("ellipse")
            tracker_text_boxsizer.Add(self.trackertypes, 1,
                                      wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
            self.hbox2.Add(tracker_text_boxsizer, 5,
                           wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

            self.overwrite = wx.RadioBox(
                self,
                label=
                "Overwrite tracking files (set to yes if you edit inference parameters)",
                choices=["Yes", "No"],
                majorDimension=1,
                style=wx.RA_SPECIFY_COLS,
            )
            self.overwrite.SetSelection(1)
            self.hbox2.Add(self.overwrite, 5, 5)

        else:
            self.csv = wx.RadioBox(
                self,
                label="Want to save result(s) as csv?",
                choices=["Yes", "No"],
                majorDimension=1,
                style=wx.RA_SPECIFY_COLS,
            )
            self.csv.SetSelection(1)

            self.dynamic = wx.RadioBox(
                self,
                label="Want to dynamically crop bodyparts?",
                choices=["Yes", "No"],
                majorDimension=1,
                style=wx.RA_SPECIFY_COLS,
            )
            self.dynamic.SetSelection(1)

            self.filter = wx.RadioBox(
                self,
                label="Want to filter the predictions?",
                choices=["Yes", "No"],
                majorDimension=1,
                style=wx.RA_SPECIFY_COLS,
            )
            self.filter.SetSelection(1)

            self.trajectory = wx.RadioBox(
                self,
                label="Want to plot the trajectories?",
                choices=["Yes", "No"],
                majorDimension=1,
                style=wx.RA_SPECIFY_COLS,
            )

            self.showfigs = wx.RadioBox(
                self,
                label="Want plots to pop up?",
                choices=["Yes", "No"],
                majorDimension=1,
                style=wx.RA_SPECIFY_COLS,
            )

            self.trajectory.Bind(wx.EVT_RADIOBOX, self.chooseOption)
            self.trajectory.SetSelection(1)

            self.hbox2.Add(self.csv, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
            self.hbox2.Add(self.filter, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
            self.hbox2.Add(self.showfigs, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

            self.hbox3.Add(self.dynamic, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
            self.hbox3.Add(self.trajectory, 10, wx.EXPAND | wx.TOP | wx.BOTTOM,
                           5)

        boxsizer.Add(self.hbox1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
        boxsizer.Add(self.hbox2, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)

        config_file = auxiliaryfunctions.read_config(self.config)
        if config_file.get("multianimalproject", False):
            bodyparts = config_file["multianimalbodyparts"]
        else:
            bodyparts = config_file["bodyparts"]
        self.trajectory_to_plot = wx.CheckListBox(self,
                                                  choices=bodyparts,
                                                  style=0,
                                                  name="Select the bodyparts")
        self.trajectory_to_plot.Bind(wx.EVT_CHECKLISTBOX, self.getbp)
        self.trajectory_to_plot.SetCheckedItems(range(len(bodyparts)))
        self.trajectory_to_plot.Hide()

        self.draw_skeleton = wx.RadioBox(
            self,
            label="Include the skeleton in the video?",
            choices=["Yes", "No"],
            majorDimension=1,
            style=wx.RA_SPECIFY_COLS,
        )
        self.draw_skeleton.Bind(wx.EVT_RADIOBOX,
                                self.choose_draw_skeleton_options)
        self.draw_skeleton.SetSelection(1)
        self.draw_skeleton.Hide()

        self.trail_points_text = wx.StaticBox(
            self, label="Specify the number of trail points")
        trail_pointsboxsizer = wx.StaticBoxSizer(self.trail_points_text,
                                                 wx.VERTICAL)
        self.trail_points = wx.SpinCtrl(self, value="1")
        trail_pointsboxsizer.Add(self.trail_points, 10,
                                 wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
        self.trail_points_text.Hide()
        self.trail_points.Hide()

        self.hbox3.Add(self.trajectory_to_plot, 10,
                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        boxsizer.Add(self.hbox3, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)

        self.hbox4.Add(self.draw_skeleton, 10, wx.EXPAND | wx.TOP | wx.BOTTOM,
                       5)
        self.hbox4.Add(trail_pointsboxsizer, 10,
                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        boxsizer.Add(self.hbox4, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
        self.sizer.Add(
            boxsizer,
            pos=(5, 0),
            span=(1, 10),
            flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT,
            border=10,
        )

        self.help_button = wx.Button(self, label="Help")
        self.sizer.Add(self.help_button, pos=(7, 0), flag=wx.LEFT, border=10)
        self.help_button.Bind(wx.EVT_BUTTON, self.help_function)

        self.ok = wx.Button(self, label="Step 1: Analyze Videos")
        self.sizer.Add(self.ok,
                       pos=(7, 6),
                       flag=wx.BOTTOM | wx.RIGHT,
                       border=10)
        self.ok.Bind(wx.EVT_BUTTON, self.analyze_videos)

        if config_file.get("multianimalproject", False):
            self.ok = wx.Button(self, label="Step 2: Convert to Tracklets")
            self.sizer.Add(self.ok, pos=(7, 7), border=10)
            self.ok.Bind(wx.EVT_BUTTON, self.convert2_tracklets)

            self.inf_cfg_text = wx.Button(self,
                                          label="Edit inference_config.yaml")
            self.sizer.Add(self.inf_cfg_text, pos=(8, 7), border=10)
            self.inf_cfg_text.Bind(wx.EVT_BUTTON, self.edit_inf_config)

        self.reset = wx.Button(self, label="Reset")
        self.sizer.Add(self.reset,
                       pos=(7, 1),
                       span=(1, 1),
                       flag=wx.BOTTOM | wx.RIGHT,
                       border=10)
        self.reset.Bind(wx.EVT_BUTTON, self.reset_analyze_videos)

        self.edit_config_file = wx.Button(self, label="Edit config.yaml")
        self.sizer.Add(self.edit_config_file, pos=(8, 6))
        self.edit_config_file.Bind(wx.EVT_BUTTON, self.edit_config)

        self.sizer.AddGrowableCol(2)

        self.SetSizer(self.sizer)
        self.sizer.Fit(self)
예제 #19
0
    def __init__(self):
        wx.Dialog.__init__(self,
                           None,
                           id=wx.ID_ANY,
                           title=u"Zarządzanie Publikacjami",
                           pos=wx.DefaultPosition,
                           size=wx.Size(450, 430),
                           style=wx.DEFAULT_DIALOG_STYLE)

        self.session = cDatabase.connectDatabase()
        self.listType = []
        self.getType()

        ico = wx.Icon('icon/pub.ico', wx.BITMAP_TYPE_ICO)
        self.SetIcon(ico)

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

        bSizer1 = wx.BoxSizer(wx.VERTICAL)

        bSizer28 = wx.BoxSizer(wx.VERTICAL)

        bSizer21 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText1 = wx.StaticText(
            self, wx.ID_ANY, u"Dodawanie Publikacji", wx.DefaultPosition,
            wx.DefaultSize, wx.ALIGN_CENTRE | wx.ST_NO_AUTORESIZE)
        self.m_staticText1.Wrap(-1)
        bSizer21.Add(self.m_staticText1, 0, wx.EXPAND | wx.ALL, 5)

        bSizer28.Add(bSizer21, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 5)

        bSizer1.Add(bSizer28, 0, wx.EXPAND, 5)

        bSizer26 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer15 = wx.BoxSizer(wx.VERTICAL)

        bSizer3 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText2 = wx.StaticText(self, wx.ID_ANY, u"Tytuł:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText2.Wrap(-1)
        bSizer3.Add(self.m_staticText2, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                    5)

        self.m_textCtrl2 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                       wx.DefaultPosition, wx.Size(145, -1), 0)
        bSizer3.Add(self.m_textCtrl2, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer3, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 5)

        bSizer5 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText4 = wx.StaticText(self, wx.ID_ANY, u"Autorzy:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText4.Wrap(-1)
        bSizer5.Add(self.m_staticText4, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                    5)

        self.m_textCtrl4 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                       wx.DefaultPosition, wx.Size(145, -1), 0)
        bSizer5.Add(self.m_textCtrl4, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer5, 0, wx.EXPAND, 5)

        bSizer4 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText3 = wx.StaticText(self, wx.ID_ANY, u"Cytowania:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText3.Wrap(-1)
        bSizer4.Add(self.m_staticText3, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                    5)

        self.m_textCtrl3 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                       wx.DefaultPosition, wx.Size(145, -1), 0)
        bSizer4.Add(self.m_textCtrl3, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer4, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5)

        bSizer6 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText5 = wx.StaticText(self, wx.ID_ANY, u"Typ:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText5.Wrap(-1)
        bSizer6.Add(self.m_staticText5, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                    5)

        m_choice1Choices = self.listType
        self.m_choice1 = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition,
                                   wx.Size(145, -1), m_choice1Choices, 0)
        self.m_choice1.SetSelection(0)
        bSizer6.Add(self.m_choice1, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer6, 0, wx.EXPAND, 5)

        bSizer7 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText6 = wx.StaticText(self, wx.ID_ANY, u"Rok:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText6.Wrap(-1)
        bSizer7.Add(self.m_staticText6, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                    5)

        self.m_textCtrl5 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                       wx.DefaultPosition, wx.Size(145, -1), 0)
        bSizer7.Add(self.m_textCtrl5, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer7, 0, wx.EXPAND, 5)

        bSizer8 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText7 = wx.StaticText(self, wx.ID_ANY, u"DOI:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText7.Wrap(-1)
        bSizer8.Add(self.m_staticText7, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                    5)

        self.m_textCtrl6 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                       wx.DefaultPosition, wx.Size(145, -1), 0)
        bSizer8.Add(self.m_textCtrl6, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer8, 0, wx.EXPAND, 5)

        bSizer29 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText9 = wx.StaticText(self, wx.ID_ANY, u"Inny klucz:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText9.Wrap(-1)
        bSizer29.Add(self.m_staticText9, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                     5)

        self.m_textCtrl7 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                       wx.DefaultPosition, wx.Size(145, -1), 0)
        bSizer29.Add(self.m_textCtrl7, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer29, 0, wx.EXPAND, 5)

        bSizer9 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText8 = wx.StaticText(self, wx.ID_ANY, u"Wydawca:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText8.Wrap(-1)
        bSizer9.Add(self.m_staticText8, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                    5)

        m_choice2Choices = cDatabase.getJournalName(self.session)
        self.m_choice2 = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition,
                                   wx.Size(145, -1), m_choice2Choices, 0)
        bSizer9.Add(self.m_choice2, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer9, 0, wx.EXPAND, 5)

        bSizer17 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText10 = wx.StaticText(self, wx.ID_ANY, u"Źródło:",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText10.Wrap(-1)
        bSizer17.Add(self.m_staticText10, 1, wx.ALL, 5)

        self.m_textCtrl71 = wx.TextCtrl(self, wx.ID_ANY,
                                        wx.EmptyString, wx.DefaultPosition,
                                        wx.Size(145, -1), 0)
        bSizer17.Add(self.m_textCtrl71, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer17, 1, wx.EXPAND, 5)

        bSizer18 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText99 = wx.StaticText(self, wx.ID_ANY, u"LMCP:",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText99.Wrap(-1)
        bSizer18.Add(self.m_staticText99, 1, wx.ALL, 5)

        self.m_textCtrl99 = wx.TextCtrl(self, wx.ID_ANY,
                                        wx.EmptyString, wx.DefaultPosition,
                                        wx.Size(145, -1), 0)
        self.m_textCtrl99.SetToolTipString(
            u"Ilość punktów na liście ministerialnej")
        bSizer18.Add(self.m_textCtrl99, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer18, 1, wx.EXPAND, 5)

        bSizer19 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText98 = wx.StaticText(self, wx.ID_ANY, u"JCR:",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText98.Wrap(-1)
        bSizer19.Add(self.m_staticText98, 1, wx.ALL, 5)

        m_choice3Choices = ['True', 'False']
        self.m_choice3 = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition,
                                   wx.Size(145, -1), m_choice3Choices, 0)
        bSizer19.Add(self.m_choice3, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer15.Add(bSizer19, 1, wx.EXPAND, 5)

        bSizer26.Add(bSizer15, 1, wx.EXPAND, 5)

        bSizer23 = wx.BoxSizer(wx.VERTICAL)

        bSizer10 = wx.BoxSizer(wx.VERTICAL)

        m_checkList3Choices = cDatabase.getUserName(self.session)
        self.m_checkList3 = wx.CheckListBox(self, wx.ID_ANY,
                                            wx.DefaultPosition,
                                            wx.Size(200, 281),
                                            m_checkList3Choices, 0)
        self.m_checkList3.SetToolTipString(u"Powiąż autorów z publikacją")

        bSizer10.Add(self.m_checkList3, 0,
                     wx.EXPAND | wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer23.Add(bSizer10, 0, wx.EXPAND, 5)

        bSizer26.Add(bSizer23, 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer26, 0, wx.EXPAND, 5)

        bSizer55 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_textCtrl55 = wx.TextCtrl(self, wx.ID_ANY,
                                        wx.EmptyString, wx.DefaultPosition,
                                        wx.Size(-1, 50), wx.TE_MULTILINE)
        self.m_textCtrl55.SetToolTipString(u"Notatki do publikacji")
        bSizer55.Add(self.m_textCtrl55, 1, wx.ALL | wx.EXPAND, 5)

        bSizer1.Add(bSizer55, 0, wx.EXPAND, 5)

        bSizer11 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_button1 = wx.Button(self, wx.ID_ANY, u"Dodaj",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer11.Add(self.m_button1, 0, wx.ALL | wx.EXPAND, 5)

        self.m_button3 = wx.Button(self, wx.ID_ANY, u"Zatwierdź",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer11.Add(self.m_button3, 0, wx.ALL, 5)

        self.m_button4 = wx.Button(self, wx.ID_ANY, u"Zamknij",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer11.Add(self.m_button4, 0, wx.ALL, 5)

        self.m_staticText11 = wx.StaticText(self, wx.ID_ANY, u"",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText11.Wrap(-1)
        bSizer11.Add(self.m_staticText11, 1, wx.ALL, 5)

        self.m_staticText12 = wx.StaticText(self, wx.ID_ANY, u"",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText12.Wrap(-1)
        bSizer11.Add(self.m_staticText12, 1, wx.ALL, 5)

        bSizer1.Add(bSizer11, 0, wx.ALIGN_RIGHT, 5)

        self.SetSizer(bSizer1)
        self.Layout()

        self.Centre(wx.BOTH)

        self.m_button3.Hide()
        self.m_staticText11.Hide()
        self.m_staticText12.Hide()

        ##################################################
        ## Bind
        ###################################################

        self.m_button1.Bind(wx.EVT_BUTTON, self.addPubValue)
        self.m_button4.Bind(wx.EVT_BUTTON, self.close)
        self.m_button3.Bind(wx.EVT_BUTTON, self.editPubValue)

        ###################################################
        ## Metody
        ###################################################
        self.getType()
    def createSplitWindowView(self, title, value):
        self.SetTitle("Create Command")

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

        self.panel_1 = wx.Panel(self, wx.ID_ANY)
        sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0)

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

        self.command = wx.Panel(self.panel_1, wx.ID_ANY)
        grid_sizer_1.Add(self.command, 1, wx.ALL | wx.EXPAND, 3)

        sizer_12 = wx.StaticBoxSizer(
            wx.StaticBox(self.command, wx.ID_ANY, "Command Arguements"),
            wx.VERTICAL)

        self.panel_18 = wx.Panel(self.command, wx.ID_ANY)
        sizer_12.Add(self.panel_18, 1, wx.EXPAND, 0)

        grid_sizer_2 = wx.FlexGridSizer(4, 1, 0, 0)

        self.panel_5 = wx.Panel(self.panel_18, wx.ID_ANY)
        grid_sizer_2.Add(self.panel_5, 1, wx.ALL | wx.EXPAND, 2)

        grid_sizer_5 = wx.GridSizer(1, 2, 0, 0)

        self.panel_6 = wx.Panel(self.panel_5, wx.ID_ANY)
        grid_sizer_5.Add(self.panel_6, 1, wx.EXPAND, 0)

        sizer_6 = wx.BoxSizer(wx.VERTICAL)

        label_4 = wx.StaticText(self.panel_6, wx.ID_ANY, "Command Type")
        sizer_6.Add(label_4, 0, 0, 0)

        self.choice_1 = wx.Choice(self.panel_6,
                                  wx.ID_ANY,
                                  choices=Globals.COMMAND_TYPES)
        self.choice_1.SetSelection(-1)
        sizer_6.Add(self.choice_1, 0, wx.EXPAND, 0)

        self.panel_7 = wx.Panel(self.panel_5, wx.ID_ANY)
        grid_sizer_5.Add(self.panel_7, 1, wx.EXPAND | wx.LEFT, 2)

        sizer_7 = wx.BoxSizer(wx.VERTICAL)

        label_5 = wx.StaticText(self.panel_7, wx.ID_ANY, "Package Name")
        sizer_7.Add(label_5, 0, 0, 0)

        self.text_ctrl_2 = wx.TextCtrl(self.panel_7, wx.ID_ANY, "")
        self.text_ctrl_2.Enable(False)
        sizer_7.Add(self.text_ctrl_2, 0, wx.EXPAND, 0)

        self.panel_4 = wx.Panel(self.panel_18, wx.ID_ANY)
        grid_sizer_2.Add(self.panel_4, 1, wx.ALL | wx.EXPAND, 2)

        grid_sizer_4 = wx.GridSizer(1, 2, 0, 0)

        self.panel_8 = wx.Panel(self.panel_4, wx.ID_ANY)
        grid_sizer_4.Add(self.panel_8, 1, wx.EXPAND, 0)

        sizer_5 = wx.BoxSizer(wx.VERTICAL)

        label_3 = wx.StaticText(self.panel_8, wx.ID_ANY, "App Version Id")
        sizer_5.Add(label_3, 0, 0, 0)

        self.text_ctrl_3 = wx.TextCtrl(self.panel_8, wx.ID_ANY, "")
        self.text_ctrl_3.Enable(False)
        sizer_5.Add(self.text_ctrl_3, 0, wx.EXPAND, 0)

        self.panel_9 = wx.Panel(self.panel_4, wx.ID_ANY)
        grid_sizer_4.Add(self.panel_9, 1, wx.EXPAND | wx.LEFT, 2)

        sizer_8 = wx.BoxSizer(wx.VERTICAL)

        label_6 = wx.StaticText(self.panel_9, wx.ID_ANY, "App State")
        sizer_8.Add(label_6, 0, 0, 0)

        self.choice_2 = wx.Choice(self.panel_9,
                                  wx.ID_ANY,
                                  choices=["", "Show", "Hide", "Disable"])
        self.choice_2.Enable(False)
        self.choice_2.SetSelection(0)
        sizer_8.Add(self.choice_2, 0, wx.EXPAND, 0)

        self.panel_3 = wx.Panel(self.panel_18, wx.ID_ANY)
        grid_sizer_2.Add(self.panel_3, 1, wx.ALL | wx.EXPAND, 2)

        grid_sizer_3 = wx.GridSizer(1, 2, 0, 0)

        self.panel_10 = wx.Panel(self.panel_3, wx.ID_ANY)
        grid_sizer_3.Add(self.panel_10, 1, wx.EXPAND, 0)

        sizer_4 = wx.BoxSizer(wx.VERTICAL)

        label_2 = wx.StaticText(self.panel_10, wx.ID_ANY, "Device State")
        sizer_4.Add(label_2, 0, 0, 0)

        self.choice_3 = wx.Choice(self.panel_10,
                                  wx.ID_ANY,
                                  choices=["", "Unlocked", "Locked"])
        self.choice_3.Enable(False)
        self.choice_3.SetSelection(0)
        sizer_4.Add(self.choice_3, 0, wx.EXPAND, 0)

        self.panel_11 = wx.Panel(self.panel_3, wx.ID_ANY)
        grid_sizer_3.Add(self.panel_11, 1, wx.EXPAND | wx.LEFT, 2)

        sizer_9 = wx.BoxSizer(wx.VERTICAL)

        label_7 = wx.StaticText(self.panel_11, wx.ID_ANY, "Lock Message")
        sizer_9.Add(label_7, 0, 0, 0)

        self.text_ctrl_4 = wx.TextCtrl(self.panel_11, wx.ID_ANY, "")
        self.text_ctrl_4.Enable(False)
        sizer_9.Add(self.text_ctrl_4, 0, wx.EXPAND, 0)

        self.panel_2 = wx.Panel(self.panel_18, wx.ID_ANY)
        grid_sizer_2.Add(self.panel_2, 1, wx.ALL | wx.EXPAND, 2)

        sizer_3 = wx.FlexGridSizer(2, 1, 0, 0)

        label_1 = wx.StaticText(self.panel_2, wx.ID_ANY, "Custom Config:")
        sizer_3.Add(label_1, 0, 0, 0)

        self.text_ctrl_1 = wx.TextCtrl(self.panel_2,
                                       wx.ID_ANY,
                                       "",
                                       style=wx.TE_BESTWRAP | wx.TE_MULTILINE)
        sizer_3.Add(self.text_ctrl_1, 0, wx.EXPAND, 0)

        static_line_2 = wx.StaticLine(self.panel_1,
                                      wx.ID_ANY,
                                      style=wx.LI_VERTICAL)
        grid_sizer_1.Add(static_line_2, 0, wx.ALL | wx.EXPAND, 2)

        self.schedule = wx.Panel(self.panel_1, wx.ID_ANY)
        grid_sizer_1.Add(self.schedule, 1, wx.ALL | wx.EXPAND, 3)

        sizer_10 = wx.StaticBoxSizer(
            wx.StaticBox(self.schedule, wx.ID_ANY, "Schedule Arguements"),
            wx.VERTICAL)

        self.panel_13 = wx.Panel(self.schedule, wx.ID_ANY)
        sizer_10.Add(self.panel_13, 1, wx.EXPAND, 0)

        grid_sizer_6 = wx.FlexGridSizer(4, 1, 0, 0)

        self.panel_14 = wx.Panel(self.panel_13, wx.ID_ANY)
        grid_sizer_6.Add(self.panel_14, 1, wx.EXPAND, 0)

        sizer_11 = wx.BoxSizer(wx.VERTICAL)

        label_9 = wx.StaticText(self.panel_14, wx.ID_ANY, "Type")
        sizer_11.Add(label_9, 0, 0, 0)

        self.choice_4 = wx.Choice(
            self.panel_14,
            wx.ID_ANY,
            choices=[
                "Immediate",
                "Window",
                "Reocurring",
            ],
        )
        self.choice_4.SetSelection(0)
        sizer_11.Add(self.choice_4, 0, wx.EXPAND, 0)

        self.panel_15 = wx.Panel(self.panel_13, wx.ID_ANY)
        grid_sizer_6.Add(self.panel_15, 1, wx.EXPAND, 0)

        sizer_13 = wx.BoxSizer(wx.VERTICAL)

        label_10 = wx.StaticText(self.panel_15, wx.ID_ANY, "Time Type")
        sizer_13.Add(label_10, 0, 0, 0)

        self.choice_5 = wx.Choice(self.panel_15,
                                  wx.ID_ANY,
                                  choices=["Device", "Console"])
        self.choice_5.SetSelection(0)
        sizer_13.Add(self.choice_5, 0, wx.EXPAND, 0)

        self.panel_16 = wx.Panel(self.panel_13, wx.ID_ANY)
        grid_sizer_6.Add(self.panel_16, 1, wx.EXPAND, 0)

        grid_sizer_8 = wx.GridSizer(2, 1, 0, 0)

        self.panel_19 = wx.Panel(self.panel_16, wx.ID_ANY)
        grid_sizer_8.Add(self.panel_19, 1, wx.EXPAND, 0)

        grid_sizer_9 = wx.GridSizer(2, 1, 0, 0)

        label_11 = wx.StaticText(self.panel_19, wx.ID_ANY, "Start Datetime")
        grid_sizer_9.Add(label_11, 0, 0, 0)

        self.panel_20 = wx.Panel(self.panel_19, wx.ID_ANY)
        grid_sizer_9.Add(self.panel_20, 1, wx.EXPAND, 0)

        sizer_14 = wx.BoxSizer(wx.HORIZONTAL)

        self.datepicker_ctrl_1 = wx.adv.DatePickerCtrl(self.panel_20,
                                                       wx.ID_ANY)
        sizer_14.Add(self.datepicker_ctrl_1, 0, 0, 0)

        sizer_14.Add((20, 20), 0, wx.EXPAND, 0)

        self.timepicker_ctrl_2 = wx.adv.TimePickerCtrl(self.panel_20,
                                                       wx.ID_ANY)
        sizer_14.Add(self.timepicker_ctrl_2, 0, 0, 0)

        self.panel_21 = wx.Panel(self.panel_16, wx.ID_ANY)
        grid_sizer_8.Add(self.panel_21, 1, wx.EXPAND, 0)

        grid_sizer_10 = wx.GridSizer(2, 1, 0, 0)

        label_12 = wx.StaticText(self.panel_21, wx.ID_ANY, "End Datetime")
        grid_sizer_10.Add(label_12, 0, 0, 0)

        self.panel_22 = wx.Panel(self.panel_21, wx.ID_ANY)
        grid_sizer_10.Add(self.panel_22, 1, wx.EXPAND, 0)

        sizer_15 = wx.BoxSizer(wx.HORIZONTAL)

        self.datepicker_ctrl_3 = wx.adv.DatePickerCtrl(self.panel_22,
                                                       wx.ID_ANY)
        sizer_15.Add(self.datepicker_ctrl_3, 0, 0, 0)

        sizer_15.Add((20, 20), 0, wx.EXPAND, 0)

        self.timepicker_ctrl_4 = wx.adv.TimePickerCtrl(self.panel_22,
                                                       wx.ID_ANY)
        sizer_15.Add(self.timepicker_ctrl_4, 0, 0, 0)

        self.panel_12 = wx.Panel(self.panel_13, wx.ID_ANY)
        grid_sizer_6.Add(self.panel_12, 1, wx.EXPAND, 0)

        grid_sizer_7 = wx.FlexGridSizer(2, 1, 0, 0)

        label_8 = wx.StaticText(self.panel_12, wx.ID_ANY, "Days")
        grid_sizer_7.Add(label_8, 0, 0, 0)

        self.check_list_box_1 = wx.CheckListBox(
            self.panel_12,
            wx.ID_ANY,
            choices=[
                "Monday",
                "Tuesday",
                "Wednesday",
                "Thursday",
                "Friday",
                "Saturday",
                "Sunday",
            ],
            style=wx.LB_MULTIPLE | wx.LB_NEEDED_SB,
        )
        grid_sizer_7.Add(self.check_list_box_1, 0, wx.EXPAND, 0)

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

        sizer_2 = wx.StdDialogButtonSizer()
        sizer_1.Add(sizer_2, 0,
                    wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.ALL, 5)

        self.button_OK = wx.Button(self, wx.ID_OK, "")
        self.button_OK.SetDefault()
        sizer_2.AddButton(self.button_OK)

        self.button_CANCEL = wx.Button(self, wx.ID_CANCEL, "")
        sizer_2.AddButton(self.button_CANCEL)

        sizer_2.Realize()

        grid_sizer_7.AddGrowableRow(1)
        grid_sizer_7.AddGrowableCol(0)
        self.panel_12.SetSizer(grid_sizer_7)

        self.panel_22.SetSizer(sizer_15)

        self.panel_21.SetSizer(grid_sizer_10)

        self.panel_20.SetSizer(sizer_14)

        self.panel_19.SetSizer(grid_sizer_9)

        self.panel_16.SetSizer(grid_sizer_8)

        self.panel_15.SetSizer(sizer_13)

        self.panel_14.SetSizer(sizer_11)

        grid_sizer_6.AddGrowableRow(3)
        grid_sizer_6.AddGrowableCol(0)
        self.panel_13.SetSizer(grid_sizer_6)

        self.schedule.SetSizer(sizer_10)

        sizer_3.AddGrowableRow(1)
        sizer_3.AddGrowableCol(0)
        self.panel_2.SetSizer(sizer_3)

        self.panel_11.SetSizer(sizer_9)

        self.panel_10.SetSizer(sizer_4)

        self.panel_3.SetSizer(grid_sizer_3)

        self.panel_9.SetSizer(sizer_8)

        self.panel_8.SetSizer(sizer_5)

        self.panel_4.SetSizer(grid_sizer_4)

        self.panel_7.SetSizer(sizer_7)

        self.panel_6.SetSizer(sizer_6)

        self.panel_5.SetSizer(grid_sizer_5)

        grid_sizer_2.AddGrowableRow(3)
        grid_sizer_2.AddGrowableCol(0)
        self.panel_18.SetSizer(grid_sizer_2)

        self.command.SetSizer(sizer_12)

        grid_sizer_1.AddGrowableRow(0)
        grid_sizer_1.AddGrowableCol(0)
        grid_sizer_1.AddGrowableCol(2)
        self.panel_1.SetSizer(grid_sizer_1)

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

        self.SetAffirmativeId(self.button_OK.GetId())
        self.SetEscapeId(self.button_CANCEL.GetId())

        self.Layout()
        self.Centre()

        self.datepicker_ctrl_1.Enable(False)
        self.timepicker_ctrl_2.Enable(False)
        self.datepicker_ctrl_3.Enable(False)
        self.timepicker_ctrl_4.Enable(False)
        self.check_list_box_1.Enable(False)
        self.button_OK.Enable(False)

        self.choice_1.Bind(wx.EVT_CHOICE, self.onCommandType)
        self.choice_3.Bind(wx.EVT_CHOICE, self.onDeviceState)
        self.button_OK.Bind(wx.EVT_BUTTON, self.OnClose)
        self.button_CANCEL.Bind(wx.EVT_BUTTON, self.OnClose)

        self.choice_4.Bind(wx.EVT_CHOICE, self.onScheduleType)

        self.startDate = None
        self.endDate = None
        self.winStartTime = None
        self.winEndTime = None
예제 #21
0
    def _makeInstalledPanel(self, tabbedPanel):
        """Creates panel with for controlling installed dictionaries"""

        #
        # Boxes
        #
        panelInstalled = wx.Panel(tabbedPanel, -1)
        vboxInstalled = wx.BoxSizer(wx.VERTICAL)

        # Help message
        labelHelp = wx.StaticText(panelInstalled, -1,
           _("Checked dictionaries are available from the " \
           "menu, unchecked dictionaries \nare not available from the menu."))
        vboxInstalled.Add(labelHelp, 0, wx.ALL, 3)

        #
        # Installed list
        #
        idDictList = wx.NewId()
        self.installedList = wx.CheckListBox(panelInstalled,
                                             idDictList,
                                             style=wx.LC_REPORT
                                             | wx.LC_SINGLE_SEL
                                             | wx.SUNKEN_BORDER)
        self.Bind(wx.EVT_CHECKLISTBOX, self.onDictionaryChecked,
                  self.installedList)
        self.Bind(wx.EVT_LISTBOX, self.onInstalledSelected, self.installedList)
        vboxInstalled.Add(self.installedList, 1, wx.ALL | wx.EXPAND, 1)

        hboxButtons = wx.BoxSizer(wx.HORIZONTAL)

        #
        # "Install from file" button
        #
        idInstallFile = wx.NewId()
        self.buttonInstallFile = wx.Button(panelInstalled, idInstallFile,
                                           _("Install From File"))
        hboxButtons.Add(self.buttonInstallFile, 0, wx.ALL, 2)

        #
        # "Remove" button
        #
        idRemove = wx.NewId()
        self.buttonRemove = wx.Button(panelInstalled, idRemove, _("Remove"))
        self.buttonRemove.Disable()
        hboxButtons.Add(self.buttonRemove, 0, wx.ALL, 2)

        vboxInstalled.Add(hboxButtons, 0, wx.ALL | wx.ALIGN_RIGHT, 2)

        panelInstalled.SetSizer(vboxInstalled)
        vboxInstalled.Fit(panelInstalled)

        #
        # Make columns
        #

        dictNames = list(self.installedDictionaries.keys())
        dictNames.sort()
        self.setInstalledDicts(dictNames)

        self.Bind(wx.EVT_BUTTON, self.onRemove, self.buttonRemove)
        self.Bind(wx.EVT_BUTTON, self.onInstallFile, self.buttonInstallFile)

        return panelInstalled
예제 #22
0
    def _SetupKeyStuff(self):
        self.DataKeys = []
        self.RegExKeys = []
        self.CheckedKeys = []

        # Set up HORIZONTAL sizer to help place items
        self.midSizer = wx.BoxSizer(wx.HORIZONTAL)
        keySizer = wx.BoxSizer(wx.VERTICAL)
        #       regExKeySizer = wx.BoxSizer(wx.VERTICAL)

        # Regular Expression results
        regExKeyText = wx.StaticText(self, -1, "RegEx keys:")
        self.regExCountText = wx.StaticText(self, 01, "")
        self.lb = wx.CheckListBox(self,
                                  -1,
                                  choices=[],
                                  size=(250, 250),
                                  style=wx.LB_EXTENDED)
        self.Bind(wx.EVT_CHECKLISTBOX, self.EvtCheckListBox, self.lb)
        self.Bind(wx.EVT_LISTBOX, self.EvtListBox, self.lb)

        keySizer.Add(regExKeyText, 0, wx.LEFT | wx.RIGHT, border=5)
        keySizer.Add(self.lb, 0, wx.ALL, border=5)
        keySizer.Add(self.regExCountText,
                     0,
                     wx.TOP | wx.BOTTOM | wx.ALIGN_LEFT,
                     border=5)

        # ListBox buttons
        ClearButton = wx.Button(self, -1, "Clear", pos=(350, 405))
        AllButton = wx.Button(self, -1, "All", pos=(450, 405))
        ToggleButton = wx.Button(self, -1, "Toggle", pos=(550, 405))
        self.Bind(wx.EVT_BUTTON, self.ClearSelection, ClearButton)
        self.Bind(wx.EVT_BUTTON, self.SelectAll, AllButton)
        self.Bind(wx.EVT_BUTTON, self.ToggleSelection, ToggleButton)

        lbSizer = wx.BoxSizer(wx.HORIZONTAL)
        lbSizer.Add(ClearButton, 0, wx.LEFT | wx.RIGHT, border=5)
        lbSizer.Add(AllButton, 0, wx.LEFT | wx.RIGHT, border=5)
        lbSizer.Add(ToggleButton, 0, wx.LEFT | wx.RIGHT, border=5)
        keySizer.Add(lbSizer, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, border=5)

        # Animate
        animateSizer = wx.BoxSizer(wx.HORIZONTAL)
        AnimateButton = wx.Button(self, -1, "Animate")
        self.animateGauge = wx.Gauge(self, -1, 50)
        self.Bind(wx.EVT_BUTTON, self._AnimateEvent, AnimateButton)
        animateSizer.Add(AnimateButton, 1, wx.ALL, border=5)
        animateSizer.Add(self.animateGauge, 2, wx.ALL | wx.EXPAND, border=5)

        keySizer.Add(animateSizer, 0, wx.ALL, border=5)

        # Available keys
        dataKeyText = wx.StaticText(self, -1, "Data keys:")
        self.DataKeysCtrl = wx.TextCtrl(self,
                                        -1,
                                        '',
                                        size=(250, 200),
                                        style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.Bind(wx.EVT_TEXT, self.RegExChange, self.DataKeysCtrl)
        keySizer.Add(dataKeyText, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, border=5)
        keySizer.Add(self.DataKeysCtrl, 0, wx.ALL, border=5)
        self.midSizer.Add(keySizer, 1, wx.ALL, border=5)

        self.midSizer.Add(wx.StaticLine(self, -1, style=wx.LI_VERTICAL),
                          0,
                          wx.ALL | wx.EXPAND,
                          border=5)

        # matplotlib stuff
        self._SetupMPL()
        self.mainSizer.Add(self.midSizer, 0, wx.ALL | wx.EXPAND, border=5)
예제 #23
0
    def createControlsSizer(this):
        ctrlSizer = wx.BoxSizer(wx.VERTICAL)

        str = 'Octahedron %d'
        cellList = [str % i for i in range(8)]

        this.showSolidsGui = wx.CheckBox(this.panel,
                                         label='Show Solid Octahedra')
        this.showSolidsGui.SetValue(this.shape.showSolids)
        this.showSolidsGui.Bind(wx.EVT_CHECKBOX, this.onShowSolids)
        this.showSolidsListGui = wx.CheckListBox(this.panel, choices=cellList)
        this.showSolidsListGui.Bind(wx.EVT_CHECKLISTBOX, this.onShowSolidsList)
        for i in range(4):
            this.showSolidsListGui.Check(i)
        list = [this.showSolidsListGui.IsChecked(i) for i in range(8)]
        this.shape.setShowWhichSolids(list)
        showSolidsSizer = wx.BoxSizer(wx.HORIZONTAL)
        showSolidsSizer.Add(this.showSolidsGui, 1, wx.EXPAND)
        showSolidsSizer.Add(this.showSolidsListGui, 1, wx.EXPAND)

        this.showTranspIGui = wx.CheckBox(
            this.panel, label='Show Transparent Octahedra (I)')
        this.showTranspIGui.SetValue(this.shape.showTranspI)
        this.showTranspIGui.Bind(wx.EVT_CHECKBOX, this.onShowTranspI)
        this.showTranspIListGui = wx.CheckListBox(this.panel, choices=cellList)
        this.showTranspIListGui.Bind(wx.EVT_CHECKLISTBOX,
                                     this.onShowTranspIList)
        for i in range(7):
            this.showTranspIListGui.Check(i)
        list = [this.showTranspIListGui.IsChecked(i) for i in range(8)]
        this.shape.setShowWhichTranspI(list)
        showTranspISizer = wx.BoxSizer(wx.HORIZONTAL)
        showTranspISizer.Add(this.showTranspIGui, 1, wx.EXPAND)
        showTranspISizer.Add(this.showTranspIListGui, 1, wx.EXPAND)

        this.showTranspIIGui = wx.CheckBox(
            this.panel, label='Show Transparent Octahedra (II)')
        this.showTranspIIGui.SetValue(this.shape.showTranspII)
        this.showTranspIIGui.Bind(wx.EVT_CHECKBOX, this.onShowTranspII)
        this.showTranspIIListGui = wx.CheckListBox(this.panel,
                                                   choices=cellList)
        this.showTranspIIListGui.Bind(wx.EVT_CHECKLISTBOX,
                                      this.onShowTranspIIList)
        for i in range(8):
            this.showTranspIIListGui.Check(i)
        list = [this.showTranspIIListGui.IsChecked(i) for i in range(8)]
        this.shape.setShowWhichTranspII(list)
        showTranspIISizer = wx.BoxSizer(wx.HORIZONTAL)
        showTranspIISizer.Add(this.showTranspIIGui, 1, wx.EXPAND)
        showTranspIISizer.Add(this.showTranspIIListGui, 1, wx.EXPAND)

        this.colAltGui = wx.RadioBox(this.panel,
                                     label='Colour Alternative',
                                     style=wx.RA_HORIZONTAL,
                                     choices=['a', 'b'])
        this.panel.Bind(wx.EVT_RADIOBOX,
                        this.onColAlt,
                        id=this.colAltGui.GetId())
        #this.colAltGu.SetSelection(0)
        colAltSizer = wx.BoxSizer(wx.HORIZONTAL)
        colAltSizer.Add(this.colAltGui, 1, wx.EXPAND)

        showFacesSizer = wx.StaticBoxSizer(
            wx.StaticBox(this.panel, label='View Settings'), wx.VERTICAL)
        showFacesSizer.Add(showSolidsSizer, 1, wx.EXPAND)
        showFacesSizer.Add(showTranspISizer, 1, wx.EXPAND)
        showFacesSizer.Add(showTranspIISizer, 1, wx.EXPAND)

        ctrlSizer.Add(showFacesSizer, 20, wx.EXPAND)
        ctrlSizer.Add(colAltSizer, 2, wx.EXPAND)

        return ctrlSizer
예제 #24
0
    def __init__(self, parent, *args, **kwds):
        # begin wxGlade: Settings.__init__
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((490, 280))
        self.radio_units = wx.RadioBox(self,
                                       wx.ID_ANY,
                                       _("Units"),
                                       choices=["mm", "cm", "inch", "mils"],
                                       majorDimension=1,
                                       style=wx.RA_SPECIFY_ROWS)
        self.combo_svg_ppi = wx.ComboBox(self,
                                         wx.ID_ANY,
                                         choices=[
                                             _("96 px/in Inkscape"),
                                             _("72 px/in Illustrator"),
                                             _("90 px/in Old Inkscape"),
                                             _("Custom")
                                         ],
                                         style=wx.CB_DROPDOWN)
        # self.text_svg_ppi = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
        self.text_svg_ppi = wx.TextCtrl(self, wx.ID_ANY, "")
        self.choices = [
            (_("Print Shutdown"), "print_shutdown", False),
            (_("SVG Uniform Save"), "uniform_svg", False),
            (_("Image DPI Scaling"), 'image_dpi', True),
            (_("DXF Centering"), 'dxf_center', True),
            (_("Show Negative Guide"), "show_negative_guide", True),
            (_("Launch Spooler JobStart"), "auto_spooler", True),
            (_("MouseWheel Pan"), "mouse_wheel_pan", False),
            (_("Invert MouseWheel Pan"), 'mouse_pan_invert', False),
            (_("Invert MouseWheel Zoom"), 'mouse_zoom_invert', False),
            (_("Default Operations"), "default_operations", False),
        ]
        self.checklist_options = wx.CheckListBox(
            self, wx.ID_ANY, choices=[c[0] for c in self.choices])

        from wxMeerK40t import supported_languages
        choices = [
            language_name for language_code, language_name, language_index in
            supported_languages
        ]
        self.combo_language = wx.ComboBox(self,
                                          wx.ID_ANY,
                                          choices=choices,
                                          style=wx.CB_DROPDOWN)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_RADIOBOX, self.on_radio_units, self.radio_units)
        self.Bind(wx.EVT_COMBOBOX, self.on_combo_language, self.combo_language)
        self.Bind(wx.EVT_COMBOBOX, self.on_combo_svg_ppi, self.combo_svg_ppi)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_svg_ppi, self.text_svg_ppi)
        self.Bind(wx.EVT_TEXT, self.on_text_svg_ppi, self.text_svg_ppi)
        self.Bind(wx.EVT_CHECKLISTBOX, self.on_checklist_settings,
                  self.checklist_options)

        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)

        # OSX Window close
        if parent is not None:
            parent.accelerator_table(self)
예제 #25
0
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          "Past paper Crawler",
                          size=(510, 585))

        self.level_list = [
            "--- Select level ---", "IGCSE", "AS & A-Level", "O-Level"
        ]
        self.type_list = []
        self.subject_dict = {
        }  # A dictionary of subjects available return from Crawler. (key: subject name, value: subject url)
        self.paper_dict = {
        }  # A dictionary of papers available return from Crawler. (key: f_in name, [value]: paper ur)
        self.paired = True

        self.retry_urls = []  # List of url need to retry download
        self.directory = ""  # Record the root folder the user choose to save the f_in
        self.year, self.season, self.num, self.region, self.type = "All years", "All seasons", "All papers", "All regions", "All types"  # Record the subject, season, num, region, chosen by the user

        self.pairs_list, self.pairs_info = [], {
        }  # Store the information of question paper and corresponding mark scheme
        self.files_list, self.files_info = [], {
        }  # Store the information of each individual f_in

        self.level_choice = wx.Choice(
            self, choices=self.level_list)  # Choosing the level
        self.level_choice.SetSelection(0)
        self.level_choice.Bind(wx.EVT_CHOICE, self.level_chosen)

        self.subject_choice = wx.Choice(self)  # Choosing the subject
        self.subject_choice.Bind(wx.EVT_CHOICE, self.subject_chosen)

        self.year_choice = wx.Choice(self, size=(85, 25))  # Choosing the year
        self.year_choice.Bind(wx.EVT_CHOICE, self.year_chosen)

        self.season_choice = wx.Choice(self,
                                       size=(85, 25))  # Choosing the season
        self.season_choice.Bind(wx.EVT_CHOICE, self.season_chosen)

        self.num_choice = wx.Choice(self,
                                    size=(85, 25))  # Choosing the paper number
        self.num_choice.Bind(wx.EVT_CHOICE, self.num_chosen)

        self.region_choice = wx.Choice(self,
                                       size=(85, 25))  # Choosing the region
        self.region_choice.Bind(wx.EVT_CHOICE, self.region_chosen)

        txt_filter = wx.StaticText(self, label="Filter:")
        self.style_choice = wx.Choice(self,
                                      size=(160,
                                            25))  # Choosing the display style
        self.style_choice.Bind(wx.EVT_CHOICE, self.style_chosen)
        self.hint = wx.StaticText(
            self, label="Papers and answers before 2005 are omitting.")

        download = wx.Button(self, label="Download",
                             size=(60, 25))  # Download button
        self.Bind(wx.EVT_BUTTON, self.pre_download, download)

        self.type_choice = wx.Choice(self, size=(40, 25))
        self.type_choice.Bind(wx.EVT_CHOICE, self.type_chosen)
        self.type_choice.Hide()

        self.paper_checklist = wx.CheckListBox(
            self)  # Check list box to display papers avaliable for downloading

        select_all = wx.Button(self, label="Select All",
                               size=(60, 25))  # Select all button
        self.Bind(wx.EVT_BUTTON, self.select_all, select_all)

        # Arranging boxes

        sizer_top = wx.BoxSizer(wx.HORIZONTAL)
        sizer_filter = wx.BoxSizer(wx.HORIZONTAL)
        sizer_paper_checklist = wx.BoxSizer(wx.HORIZONTAL)
        sizer_hint = wx.BoxSizer(wx.HORIZONTAL)
        sizer_bottom = wx.BoxSizer(wx.HORIZONTAL)

        bottom_border = 10

        sizer_top.Add(self.level_choice,
                      proportion=1,
                      flag=wx.BOTTOM | wx.RIGHT,
                      border=bottom_border | 5)
        sizer_top.Add(self.subject_choice,
                      proportion=1,
                      flag=wx.ALIGN_RIGHT | wx.BOTTOM,
                      border=bottom_border)

        sizer_filter.Add(txt_filter,
                         proportion=0,
                         flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM,
                         border=bottom_border)
        sizer_filter.Add(self.year_choice,
                         proportion=1,
                         flag=wx.LEFT | wx.BOTTOM,
                         border=10 | bottom_border)
        sizer_filter.Add(self.season_choice,
                         proportion=1,
                         flag=wx.LEFT | wx.BOTTOM,
                         border=10 | bottom_border)
        sizer_filter.Add(self.num_choice,
                         proportion=1,
                         flag=wx.LEFT | wx.BOTTOM,
                         border=10 | bottom_border)
        sizer_filter.Add(self.region_choice,
                         proportion=1,
                         flag=wx.LEFT | wx.BOTTOM,
                         border=10 | bottom_border)

        sizer_paper_checklist.Add(self.paper_checklist,
                                  proportion=1,
                                  flag=wx.EXPAND | wx.BOTTOM,
                                  border=bottom_border)

        sizer_hint.Add(self.hint,
                       proportion=0,
                       flag=wx.BOTTOM,
                       border=bottom_border)

        sizer_bottom.Add(self.style_choice, proportion=1, flag=wx.ALIGN_LEFT)
        sizer_bottom.Add(self.type_choice,
                         proportion=1,
                         flag=wx.LEFT | wx.RESERVE_SPACE_EVEN_IF_HIDDEN,
                         border=5)
        sizer_bottom.Add(select_all, proportion=1, flag=wx.LEFT, border=15)
        sizer_bottom.Add(download,
                         proportion=1,
                         flag=wx.ALIGN_RIGHT | wx.LEFT,
                         border=5)

        sizer_all = wx.BoxSizer(wx.VERTICAL)
        side_border = 25

        sizer_all.Add(sizer_top,
                      proportion=0,
                      flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                      border=side_border | side_border | 1)
        sizer_all.Add(sizer_filter,
                      proportion=0,
                      flag=wx.EXPAND | wx.LEFT | wx.RIGHT,
                      border=side_border | side_border)
        sizer_all.Add(sizer_paper_checklist,
                      proportion=1,
                      flag=wx.EXPAND | wx.LEFT | wx.RIGHT,
                      border=side_border | side_border)
        sizer_all.Add(sizer_hint,
                      proportion=0,
                      flag=wx.EXPAND | wx.LEFT | wx.RIGHT,
                      border=side_border | side_border)
        sizer_all.Add(sizer_bottom,
                      proportion=0,
                      flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                      border=side_border | side_border | 1)

        self.SetSizer(sizer_all)

        # initialize menu
        menu_bar = wx.MenuBar()
        menu = wx.Menu()

        self.about = wx.MenuItem(menu, wx.ID_ABOUT, "About Past Paper Crawler")
        self.Bind(wx.EVT_MENU, self.on_about, self.about)
        menu.Append(self.about)

        preferences = wx.MenuItem(menu, wx.ID_PREFERENCES,
                                  '&Preferences...\tCtrl+,')
        self.Bind(wx.EVT_MENU, on_preferences, preferences)
        menu.Append(preferences)

        # For different system
        if platform.system() == "Darwin":
            menu_bar.Append(menu, " ")
        else:
            menu_bar.Append(menu, "File")

        self.SetMenuBar(menu_bar)
예제 #26
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: All_Widgets_Frame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)

        # Menu Bar
        self.All_Widgets_menubar = wx.MenuBar()
        wxglade_tmp_menu = wx.Menu()
        wxglade_tmp_menu.Append(wx.ID_OPEN, _("&Open"),
                                _("Open an existing document"), wx.ITEM_NORMAL)
        wxglade_tmp_menu.Append(wx.ID_CLOSE, _("&Close file"),
                                _("Close current document"), wx.ITEM_NORMAL)
        wxglade_tmp_menu.AppendSeparator()
        wxglade_tmp_menu.Append(wx.ID_EXIT, _("E&xit"), _("Finish program"),
                                wx.ITEM_NORMAL)
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&File"))
        wxglade_tmp_menu = wx.Menu()
        self.mn_Unix = wx.MenuItem(wxglade_tmp_menu, wx.ID_ANY, _("Unix"),
                                   _("Use Unix line endings"), wx.ITEM_RADIO)
        wxglade_tmp_menu.AppendItem(self.mn_Unix)
        self.mn_Windows = wx.MenuItem(wxglade_tmp_menu, wx.ID_ANY,
                                      _("Windows"),
                                      _("Use Windows line endings"),
                                      wx.ITEM_RADIO)
        wxglade_tmp_menu.AppendItem(self.mn_Windows)
        wxglade_tmp_menu.AppendSeparator()
        self.mn_RemoveTabs = wx.MenuItem(wxglade_tmp_menu, wx.ID_ANY,
                                         _("Remove Tabs"),
                                         _("Remove all leading tabs"),
                                         wx.ITEM_CHECK)
        wxglade_tmp_menu.AppendItem(self.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"),
                                wx.ITEM_NORMAL)
        wxglade_tmp_menu.AppendSeparator()
        wxglade_tmp_menu.Append(wx.ID_ABOUT, _("About"),
                                _("Show the About dialog"), wx.ITEM_NORMAL)
        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.ST_SIZEGRIP)

        # Tool Bar
        self.All_Widgets_toolbar = wx.ToolBar(self, -1)
        self.SetToolBar(self.All_Widgets_toolbar)
        self.All_Widgets_toolbar.AddLabelTool(
            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.AddLabelTool(wx.ID_OPEN, _("Open"),
                                              wx.EmptyBitmap(32, 32),
                                              wx.NullBitmap, wx.ITEM_NORMAL,
                                              _("Open a new file"),
                                              _("Open a new file"))
        # Tool Bar end
        self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=wx.NB_BOTTOM)
        self.notebook_1_wxBitmapButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.bitmap_button_icon1 = wx.BitmapButton(
            self.notebook_1_wxBitmapButton, wx.ID_ANY,
            wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY))
        self.bitmap_button_empty1 = wx.BitmapButton(
            self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.EmptyBitmap(10, 10))
        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_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.notebook_1_wxButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.button_3 = wx.Button(self.notebook_1_wxButton, wx.ID_BOLD, "")
        self.notebook_1_wxCalendarCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.calendar_ctrl_1 = wx.calendar.CalendarCtrl(
            self.notebook_1_wxCalendarCtrl,
            wx.ID_ANY,
            style=wx.calendar.CAL_MONDAY_FIRST
            | wx.calendar.CAL_SEQUENTIAL_MONTH_SELECTION
            | wx.calendar.CAL_SHOW_SURROUNDING_WEEKS)
        self.notebook_1_wxCheckBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.checkbox_1 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY,
                                      _("one (unchecked)"))
        self.checkbox_2 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY,
                                      _("two (checked)"))
        self.checkbox_3 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("three"),
                                      style=wx.CHK_2STATE)
        self.checkbox_4 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("four (unchecked)"),
                                      style=wx.CHK_3STATE)
        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_6 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("six (undetermined)"),
                                      style=wx.CHK_3STATE
                                      | wx.CHK_ALLOW_3RD_STATE_FOR_USER)
        self.notebook_1_wxCheckListBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.check_list_box_1 = wx.CheckListBox(
            self.notebook_1_wxCheckListBox,
            wx.ID_ANY,
            choices=[_("one"), _("two"),
                     _("three"), _("four")])
        self.notebook_1_wxChoice = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.choice_empty = wx.Choice(self.notebook_1_wxChoice,
                                      wx.ID_ANY,
                                      choices=[])
        self.choice_filled = wx.Choice(
            self.notebook_1_wxChoice,
            wx.ID_ANY,
            choices=[_("Item 1"), _("Item 2 (pre-selected)")])
        self.notebook_1_wxComboBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.combo_box_empty = wx.ComboBox(self.notebook_1_wxComboBox,
                                           wx.ID_ANY,
                                           choices=[],
                                           style=wx.CB_DROPDOWN)
        self.combo_box_filled = wx.ComboBox(
            self.notebook_1_wxComboBox,
            wx.ID_ANY,
            choices=[_("Item 1 (pre-selected)"),
                     _("Item 2")],
            style=wx.CB_DROPDOWN)
        self.notebook_1_wxDatePickerCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.datepicker_ctrl_1 = wx.DatePickerCtrl(
            self.notebook_1_wxDatePickerCtrl,
            wx.ID_ANY,
            style=wx.DP_SHOWCENTURY)
        self.notebook_1_wxGauge = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.gauge_1 = wx.Gauge(self.notebook_1_wxGauge, wx.ID_ANY, 20)
        self.notebook_1_wxGrid = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.grid_1 = wx.grid.Grid(self.notebook_1_wxGrid,
                                   wx.ID_ANY,
                                   size=(1, 1))
        self.notebook_1_wxHyperlinkCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.hyperlink_1 = wx.HyperlinkCtrl(self.notebook_1_wxHyperlinkCtrl,
                                            wx.ID_ANY, _("Homepage wxGlade"),
                                            _("http://wxglade.sf.net"))
        self.notebook_1_wxListBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.list_box_empty = wx.ListBox(self.notebook_1_wxListBox,
                                         wx.ID_ANY,
                                         choices=[])
        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.notebook_1_wxListCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.list_ctrl_1 = wx.ListCtrl(self.notebook_1_wxListCtrl,
                                       wx.ID_ANY,
                                       style=wx.BORDER_SUNKEN | wx.LC_REPORT)
        self.notebook_1_wxRadioBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.radio_box_empty1 = wx.RadioBox(self.notebook_1_wxRadioBox,
                                            wx.ID_ANY,
                                            _("radio_box_empty1"),
                                            choices=[""],
                                            majorDimension=1,
                                            style=wx.RA_SPECIFY_ROWS)
        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_empty2 = wx.RadioBox(self.notebook_1_wxRadioBox,
                                            wx.ID_ANY,
                                            _("radio_box_empty2"),
                                            choices=[""],
                                            majorDimension=1,
                                            style=wx.RA_SPECIFY_COLS)
        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.notebook_1_wxRadioButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.radio_btn_1 = wx.RadioButton(self.notebook_1_wxRadioButton,
                                          wx.ID_ANY,
                                          _("Alice"),
                                          style=wx.RB_GROUP)
        self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_wxRadioButton,
                                       wx.ID_ANY, "")
        self.radio_btn_2 = wx.RadioButton(self.notebook_1_wxRadioButton,
                                          wx.ID_ANY, _("Bob"))
        self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_wxRadioButton,
                                       wx.ID_ANY, "")
        self.radio_btn_3 = wx.RadioButton(self.notebook_1_wxRadioButton,
                                          wx.ID_ANY, _("Malroy"))
        self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_wxRadioButton,
                                       wx.ID_ANY, "")
        self.notebook_1_wxSlider = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.slider_1 = wx.Slider(self.notebook_1_wxSlider, wx.ID_ANY, 5, 0,
                                  10)
        self.notebook_1_wxSpinButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.tc_spin_button = wx.TextCtrl(self.notebook_1_wxSpinButton,
                                          wx.ID_ANY,
                                          _("1"),
                                          style=wx.TE_RIGHT)
        self.spin_button = wx.SpinButton(self.notebook_1_wxSpinButton,
                                         wx.ID_ANY,
                                         style=wx.SP_VERTICAL)
        self.notebook_1_wxSpinCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.spin_ctrl_1 = wx.SpinCtrl(self.notebook_1_wxSpinCtrl,
                                       wx.ID_ANY,
                                       "4",
                                       min=0,
                                       max=100,
                                       style=wx.SP_ARROW_KEYS | wx.TE_RIGHT)
        self.notebook_1_wxSplitterWindow_horizontal = wx.ScrolledWindow(
            self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.splitter_1 = wx.SplitterWindow(
            self.notebook_1_wxSplitterWindow_horizontal, wx.ID_ANY)
        self.splitter_1_pane_1 = wx.Panel(self.splitter_1, wx.ID_ANY)
        self.label_top_pane = wx.StaticText(self.splitter_1_pane_1, wx.ID_ANY,
                                            _("top pane"))
        self.splitter_1_pane_2 = wx.Panel(self.splitter_1, wx.ID_ANY)
        self.label_buttom_pane = wx.StaticText(self.splitter_1_pane_2,
                                               wx.ID_ANY, _("bottom pane"))
        self.notebook_1_wxSplitterWindow_vertical = wx.ScrolledWindow(
            self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.splitter_2 = wx.SplitterWindow(
            self.notebook_1_wxSplitterWindow_vertical, wx.ID_ANY)
        self.splitter_2_pane_1 = wx.Panel(self.splitter_2, wx.ID_ANY)
        self.label_left_pane = wx.StaticText(self.splitter_2_pane_1, wx.ID_ANY,
                                             _("left pane"))
        self.splitter_2_pane_2 = wx.Panel(self.splitter_2, wx.ID_ANY)
        self.label_right_pane = wx.StaticText(self.splitter_2_pane_2,
                                              wx.ID_ANY, _("right pane"))
        self.notebook_1_wxStaticBitmap = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.bitmap_empty = wx.StaticBitmap(self.notebook_1_wxStaticBitmap,
                                            wx.ID_ANY, wx.EmptyBitmap(32, 32))
        self.bitmap_file = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY,
            wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY))
        self.bitmap_nofile = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY,
            wx.Bitmap("non-existing.bmp", wx.BITMAP_TYPE_ANY))
        self.bitmap_art = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY,
            wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_OTHER, (32, 32)))
        self.notebook_1_wxStaticLine = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.static_line_2 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY,
                                           style=wx.LI_VERTICAL)
        self.static_line_3 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY,
                                           style=wx.LI_VERTICAL)
        self.static_line_4 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY)
        self.static_line_5 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY)
        self.notebook_1_wxStaticText = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.label_1 = wx.StaticText(self.notebook_1_wxStaticText,
                                     wx.ID_ANY,
                                     _("red text (RGB)"),
                                     style=wx.ALIGN_CENTER)
        self.label_4 = wx.StaticText(self.notebook_1_wxStaticText,
                                     wx.ID_ANY,
                                     _("black on red (RGB)"),
                                     style=wx.ALIGN_CENTER)
        self.label_5 = wx.StaticText(self.notebook_1_wxStaticText,
                                     wx.ID_ANY,
                                     _("green on pink (RGB)"),
                                     style=wx.ALIGN_CENTER)
        self.notebook_1_Spacer = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.label_3 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY,
                                     _("Two labels with a"))
        self.label_2 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY,
                                     _("spacer between"))
        self.notebook_1_wxTextCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        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)
        self.notebook_1_wxToggleButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.button_2 = wx.ToggleButton(self.notebook_1_wxToggleButton,
                                        wx.ID_ANY, _("Toggle Button 1"))
        self.button_4 = wx.ToggleButton(self.notebook_1_wxToggleButton,
                                        wx.ID_ANY,
                                        _("Toggle Button 2"),
                                        style=wx.BU_BOTTOM | wx.BU_EXACTFIT)
        self.notebook_1_wxTreeCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.tree_ctrl_1 = wx.TreeCtrl(self.notebook_1_wxTreeCtrl, wx.ID_ANY)
        self.static_line_1 = wx.StaticLine(self, wx.ID_ANY)
        self.button_5 = wx.Button(self, wx.ID_CLOSE, "")
        self.button_1 = wx.Button(self, wx.ID_OK, "", style=wx.BU_TOP)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_MENU, self.onSelectUnix, self.mn_Unix)
        self.Bind(wx.EVT_MENU, self.onSelectWindows, self.mn_Windows)
        self.Bind(wx.EVT_MENU, self.onRemoveTabs, self.mn_RemoveTabs)
        self.Bind(wx.EVT_MENU, self.onShowManual, id=wx.ID_HELP)
        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_BUTTON, self.onStartConverting, self.button_1)
예제 #27
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.Size(-1, -1),
                 style=wx.TAB_TRAVERSAL,
                 name=wx.EmptyString):
        wx.Panel.__init__(self,
                          parent,
                          id=id,
                          pos=pos,
                          size=size,
                          style=style,
                          name=name)

        bSizer42 = wx.BoxSizer(wx.VERTICAL)

        sbSizer7 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Extra data file"), wx.VERTICAL)

        self.extraDataFilePicker = wx.FilePickerCtrl(
            sbSizer7.GetStaticBox(), wx.ID_ANY, wx.EmptyString,
            u"Select a file",
            u"Netlist and xml files (*.net; *.xml)|*.net;*.xml",
            wx.DefaultPosition, wx.DefaultSize,
            wx.FLP_DEFAULT_STYLE | wx.FLP_FILE_MUST_EXIST | wx.FLP_OPEN
            | wx.FLP_SMALL | wx.FLP_USE_TEXTCTRL | wx.BORDER_SIMPLE)
        sbSizer7.Add(self.extraDataFilePicker, 0,
                     wx.EXPAND | wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer42.Add(sbSizer7, 0, wx.ALL | wx.EXPAND, 5)

        fieldsSizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Fields"), wx.VERTICAL)

        bSizer4 = wx.BoxSizer(wx.HORIZONTAL)

        self.fieldsGrid = wx.grid.Grid(fieldsSizer.GetStaticBox(), wx.ID_ANY,
                                       wx.DefaultPosition, wx.DefaultSize, 0)

        # Grid
        self.fieldsGrid.CreateGrid(2, 3)
        self.fieldsGrid.EnableEditing(True)
        self.fieldsGrid.EnableGridLines(True)
        self.fieldsGrid.EnableDragGridSize(False)
        self.fieldsGrid.SetMargins(0, 0)

        # Columns
        self.fieldsGrid.AutoSizeColumns()
        self.fieldsGrid.EnableDragColMove(False)
        self.fieldsGrid.EnableDragColSize(True)
        self.fieldsGrid.SetColLabelSize(30)
        self.fieldsGrid.SetColLabelValue(0, u"Show")
        self.fieldsGrid.SetColLabelValue(1, u"Group")
        self.fieldsGrid.SetColLabelValue(2, u"Name")
        self.fieldsGrid.SetColLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)

        # Rows
        self.fieldsGrid.EnableDragRowSize(False)
        self.fieldsGrid.SetRowLabelSize(0)
        self.fieldsGrid.SetRowLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)

        # Label Appearance

        # Cell Defaults
        self.fieldsGrid.SetDefaultCellAlignment(wx.ALIGN_CENTER, wx.ALIGN_TOP)
        bSizer4.Add(self.fieldsGrid, 1, wx.ALL | wx.EXPAND, 5)

        bSizer5 = wx.BoxSizer(wx.VERTICAL)

        self.m_btnUp = wx.BitmapButton(fieldsSizer.GetStaticBox(), wx.ID_ANY,
                                       wx.NullBitmap, wx.DefaultPosition,
                                       wx.DefaultSize, wx.BU_AUTODRAW | 0)
        self.m_btnUp.SetMinSize(wx.Size(30, 30))

        bSizer5.Add(self.m_btnUp, 0, wx.ALL, 5)

        self.m_btnDown = wx.BitmapButton(fieldsSizer.GetStaticBox(), wx.ID_ANY,
                                         wx.NullBitmap, wx.DefaultPosition,
                                         wx.DefaultSize, wx.BU_AUTODRAW | 0)
        self.m_btnDown.SetMinSize(wx.Size(30, 30))

        bSizer5.Add(self.m_btnDown, 0, wx.ALL, 5)

        bSizer4.Add(bSizer5, 0, 0, 5)

        fieldsSizer.Add(bSizer4, 1, wx.EXPAND, 5)

        self.normalizeCaseCheckbox = wx.CheckBox(fieldsSizer.GetStaticBox(),
                                                 wx.ID_ANY,
                                                 u"Normalize field name case",
                                                 wx.DefaultPosition,
                                                 wx.DefaultSize, 0)
        fieldsSizer.Add(self.normalizeCaseCheckbox, 0, wx.ALL | wx.EXPAND, 5)

        bSizer42.Add(fieldsSizer, 2, wx.ALL | wx.EXPAND, 5)

        sbSizer32 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Board variant"), wx.VERTICAL)

        self.m_staticText5 = wx.StaticText(sbSizer32.GetStaticBox(), wx.ID_ANY,
                                           u"Board variant field name",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText5.Wrap(-1)

        sbSizer32.Add(self.m_staticText5, 0, wx.ALL, 5)

        boardVariantFieldBoxChoices = []
        self.boardVariantFieldBox = wx.ComboBox(
            sbSizer32.GetStaticBox(), wx.ID_ANY, wx.EmptyString,
            wx.DefaultPosition, wx.DefaultSize, boardVariantFieldBoxChoices,
            wx.CB_READONLY | wx.CB_SORT | wx.BORDER_SIMPLE)
        sbSizer32.Add(self.boardVariantFieldBox, 0, wx.ALL | wx.EXPAND, 5)

        bSizer17 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer18 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText6 = wx.StaticText(sbSizer32.GetStaticBox(), wx.ID_ANY,
                                           u"Whitelist", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.m_staticText6.Wrap(-1)

        bSizer18.Add(self.m_staticText6, 0, wx.ALL, 5)

        boardVariantWhitelistChoices = []
        self.boardVariantWhitelist = wx.CheckListBox(
            sbSizer32.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition,
            wx.DefaultSize, boardVariantWhitelistChoices, 0 | wx.BORDER_SIMPLE)
        bSizer18.Add(self.boardVariantWhitelist, 1, wx.ALL | wx.EXPAND, 5)

        bSizer17.Add(bSizer18, 1, wx.EXPAND, 5)

        bSizer19 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText7 = wx.StaticText(sbSizer32.GetStaticBox(), wx.ID_ANY,
                                           u"Blacklist", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.m_staticText7.Wrap(-1)

        bSizer19.Add(self.m_staticText7, 0, wx.ALL, 5)

        boardVariantBlacklistChoices = []
        self.boardVariantBlacklist = wx.CheckListBox(
            sbSizer32.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition,
            wx.DefaultSize, boardVariantBlacklistChoices, 0 | wx.BORDER_SIMPLE)
        bSizer19.Add(self.boardVariantBlacklist, 1, wx.ALL | wx.EXPAND, 5)

        bSizer17.Add(bSizer19, 1, wx.EXPAND, 5)

        sbSizer32.Add(bSizer17, 1, wx.EXPAND, 5)

        bSizer42.Add(sbSizer32, 3, wx.ALL | wx.EXPAND, 5)

        sbSizer8 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"DNP field name"), wx.VERTICAL)

        self.m_staticText4 = wx.StaticText(
            sbSizer8.GetStaticBox(), wx.ID_ANY,
            u"Components with this field not empty will be ignored",
            wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText4.Wrap(-1)

        sbSizer8.Add(self.m_staticText4, 0, wx.ALL, 5)

        dnpFieldBoxChoices = []
        self.dnpFieldBox = wx.ComboBox(
            sbSizer8.GetStaticBox(), wx.ID_ANY, u"-None-", wx.DefaultPosition,
            wx.DefaultSize, dnpFieldBoxChoices,
            wx.CB_READONLY | wx.CB_SORT | wx.BORDER_NONE)
        sbSizer8.Add(self.dnpFieldBox, 0, wx.ALL | wx.EXPAND, 5)

        bSizer42.Add(sbSizer8, 0, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(bSizer42)
        self.Layout()
        bSizer42.Fit(self)

        # Connect Events
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.extraDataFilePicker.Bind(wx.EVT_FILEPICKER_CHANGED,
                                      self.OnExtraDataFileChanged)
        self.fieldsGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK,
                             self.OnGridCellClicked)
        self.m_btnUp.Bind(wx.EVT_BUTTON, self.OnFieldsUp)
        self.m_btnDown.Bind(wx.EVT_BUTTON, self.OnFieldsDown)
        self.normalizeCaseCheckbox.Bind(wx.EVT_CHECKBOX,
                                        self.OnNetlistFileChanged)
        self.boardVariantFieldBox.Bind(wx.EVT_COMBOBOX,
                                       self.OnBoardVariantFieldChange)
예제 #28
0
    def __init__(self, parent, *args, **kwds):
        # begin wxGlade: Settings.__init__
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((455, 183))
        self.radio_units = wx.RadioBox(self,
                                       wx.ID_ANY,
                                       _("Units"),
                                       choices=["mm", "cm", "inch", "mils"],
                                       majorDimension=1,
                                       style=wx.RA_SPECIFY_ROWS)
        self.combo_svg_ppi = wx.ComboBox(self,
                                         wx.ID_ANY,
                                         choices=[
                                             _("96 px/in Inkscape"),
                                             _("72 px/in Illustrator"),
                                             _("90 px/in Old Inkscape"),
                                             _("Custom")
                                         ],
                                         style=wx.CB_DROPDOWN)
        # self.text_svg_ppi = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
        self.text_svg_ppi = wx.TextCtrl(self, wx.ID_ANY, "")
        self.checklist_options = wx.CheckListBox(
            self,
            wx.ID_ANY,
            choices=[
                _("Invert Mouse Wheel Zoom"),
                _("Print Shutdown"),
                _("SVG Uniform Save"),
                _("Image DPI Scaling"),
                _("Show Negative Guide"),
                _("Launch Spooler JobStart")
            ])
        from wxMeerK40t import supported_languages
        choices = [
            language_name for language_code, language_name, language_index in
            supported_languages
        ]
        self.combo_language = wx.ComboBox(self,
                                          wx.ID_ANY,
                                          choices=choices,
                                          style=wx.CB_DROPDOWN)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_RADIOBOX, self.on_radio_units, self.radio_units)
        self.Bind(wx.EVT_COMBOBOX, self.on_combo_language, self.combo_language)
        self.Bind(wx.EVT_COMBOBOX, self.on_combo_svg_ppi, self.combo_svg_ppi)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_svg_ppi, self.text_svg_ppi)
        self.Bind(wx.EVT_TEXT, self.on_text_svg_ppi, self.text_svg_ppi)
        self.Bind(wx.EVT_CHECKLISTBOX, self.on_checklist_settings,
                  self.checklist_options)

        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
예제 #29
0
파일: spellcheck.py 프로젝트: sparkyb/pype
    def __init__(self, parent, root):
        scrolled.ScrolledPanel.__init__(self, parent, -1)
        global SCI
        SCI = self

        self.document = None
        self.root = root
        self.funcdefs = {}
        self.dcts = {}
        self.start = 0

        ws = wx.BoxSizer(wx.HORIZONTAL)

        #-------------------------- Left button/pref column --------------------------

        s = wx.BoxSizer(wx.VERTICAL)

        s2 = wx.BoxSizer(wx.HORIZONTAL)

        go = wx.Button(self, -1, "Check!")
        self.Bind(wx.EVT_BUTTON, self.OnSpellCheck, go)
        go.SetToolTipString(
            "Check spelling in the current document (or selected words)")
        s2.Add(go, 0, wx.RIGHT, 4)

        bs = go.GetDefaultSize()[1]  #somewhat unrelated

        clear = wx.Button(self, -1, "Clear")
        self.Bind(wx.EVT_BUTTON, self.OnClear, clear)
        clear.SetToolTipString("Clear the results of the previous spell check")
        s2.Add(clear, 0, wx.LEFT, 4)

        s.Add(s2, 0, wx.ALL | wx.EXPAND, 2)

        s2 = wx.BoxSizer(wx.HORIZONTAL)

        self.ignore_funcdefs = wx.CheckBox(self, -1,
                                           "Ignore Function Definitions")
        self.ignore_funcdefs.SetToolTipString(
            "If checked, will ignore all function definitions")
        s.Add(self.ignore_funcdefs, 0, wx.TOP | wx.BOTTOM, 6)

        ## ws.Add(s, 0, wx.ALL|wx.EXPAND, 2)

        #------------------------ Custom dictionaries column -------------------------

        s.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), 0,
              wx.EXPAND | wx.ALL, 4)

        ## s = wx.BoxSizer(wx.VERTICAL)

        s2 = wx.BoxSizer(wx.HORIZONTAL)

        s2.Add(wx.StaticText(self, -1, "Custom Dictionaries:"), 1,
               wx.RIGHT | wx.ALIGN_LEFT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL,
               4)

        s2.Add(wx.StaticText(self, -1, ""), 0, wx.EXPAND)

        addd = wx.Button(self, -1, "+", style=wx.BU_EXACTFIT)
        addd.SetToolTipString("Add a new custom dictionary")
        s2.Add(addd, 0, wx.RIGHT | wx.ALIGN_RIGHT, 4)
        self.Bind(wx.EVT_BUTTON, self.OnAddD, addd)

        deld = wx.Button(self, -1, "-", style=wx.BU_EXACTFIT)
        deld.SetToolTipString("Remove a custom dictionary")
        s2.Add(deld, 0, wx.ALIGN_RIGHT)
        self.Bind(wx.EVT_BUTTON, self.OnDelD, deld)

        s.Add(s2, 0, wx.ALL, 2)

        s.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), 0,
              wx.EXPAND | wx.ALL, 2)

        _ = list(self.root.config['DICTIONARIES'])
        _.sort()
        self.dictionaries = wx.CheckListBox(self, -1, choices=_)
        s.Add(self.dictionaries, 1, wx.EXPAND)

        ws.Add(s, 0, wx.ALL | wx.EXPAND, 2)

        #---------------------------- Misspellings column ----------------------------

        s = wx.BoxSizer(wx.VERTICAL)

        s2 = wx.BoxSizer(wx.HORIZONTAL)
        s2.Add(wx.StaticText(self, -1, "Possible Misspellings:"), 1,
               wx.ALIGN_LEFT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 4)

        cha = wx.Button(self, -1, "./ All", style=wx.BU_EXACTFIT)
        cha.SetToolTipString(
            "Make sure all of the 'Possible Misspellings' are checked")
        s2.Add(cha, 0, wx.RIGHT, 4)
        self.Bind(wx.EVT_BUTTON, self.OnCheckAll, cha)

        add = wx.Button(self, -1, "+./", style=wx.BU_EXACTFIT)
        add.SetToolTipString("Add the checked words to a custom dictionary")
        s2.Add(add, 0)
        self.Bind(wx.EVT_BUTTON, self.OnAdd, add)

        ignore = wx.Button(self, -1, "- ./", style=wx.BU_EXACTFIT)
        ignore.SetToolTipString(
            "Ignore the checked words while this document stays open")
        s2.Add(ignore, 0, wx.RIGHT, 4)
        self.Bind(wx.EVT_BUTTON, self.OnIgnore, ignore)

        s.Add(s2, 0, wx.ALL | wx.EXPAND, 2)
        s.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), 0,
              wx.EXPAND | wx.ALL, 2)

        self.badsp = wx.CheckListBox(self, -1, choices=[], style=wx.LB_SINGLE)
        s.Add(self.badsp, 1, wx.EXPAND)
        self.badsp.Bind(wx.EVT_LISTBOX, self.OnClick)

        ws.Add(s, 1, wx.ALL | wx.EXPAND, 2)

        #---------------------------- Corrections column -----------------------------

        s = wx.BoxSizer(wx.VERTICAL)

        s.Add(wx.StaticText(self, -1, "Possible Corrections:",
                            size=(-1, bs)), 0,
              wx.ALL | wx.ALIGN_CENTER | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL,
              2)

        s.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), 0,
              wx.EXPAND | wx.ALL, 2)

        self.replsp = FindPrefixListBox(self,
                                        -1,
                                        choices=[],
                                        style=wx.LB_SINGLE)
        s.Add(self.replsp, 1, wx.EXPAND)
        self.replsp.Bind(wx.EVT_LISTBOX, self.OnClickRepl)

        ws.Add(s, 1, wx.ALL | wx.EXPAND, 2)

        self.SetSizer(ws)
        self.SetAutoLayout(1)
        self.SetupScrolling()
        self.timer = Timer(self.unload_d)
예제 #30
0
    def __init__(self, parent, gui_size, cfg):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent)

        # variable initilization
        self.config = cfg
        self.bodyparts = []
        # design the panel
        self.sizer = wx.GridBagSizer(5, 5)

        text = wx.StaticText(self,
                             label="DeepLabCut - Step 6. Evaluate Network")
        self.sizer.Add(text,
                       pos=(0, 0),
                       flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                       border=15)
        # Add logo of DLC
        icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(logo))
        self.sizer.Add(icon,
                       pos=(0, 4),
                       flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT,
                       border=5)

        line1 = wx.StaticLine(self)
        self.sizer.Add(line1,
                       pos=(1, 0),
                       span=(1, 5),
                       flag=wx.EXPAND | wx.BOTTOM,
                       border=10)

        self.cfg_text = wx.StaticText(self, label="Select the config file")
        self.sizer.Add(self.cfg_text,
                       pos=(2, 0),
                       flag=wx.TOP | wx.LEFT,
                       border=5)

        if sys.platform == 'darwin':
            self.sel_config = wx.FilePickerCtrl(
                self,
                path="",
                style=wx.FLP_USE_TEXTCTRL,
                message="Choose the config.yaml file",
                wildcard="*.yaml")
        else:
            self.sel_config = wx.FilePickerCtrl(
                self,
                path="",
                style=wx.FLP_USE_TEXTCTRL,
                message="Choose the config.yaml file",
                wildcard="config.yaml")
        # self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml")
        self.sizer.Add(self.sel_config,
                       pos=(2, 1),
                       span=(1, 3),
                       flag=wx.TOP | wx.EXPAND,
                       border=5)
        self.sel_config.SetPath(self.config)
        self.sel_config.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_config)

        sb = wx.StaticBox(self, label="Optional Attributes")
        boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)

        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        #        self.hbox2 = wx.BoxSizer(wx.HORIZONTAL)

        shuffles_text = wx.StaticBox(self, label="Specify the shuffle")
        shuffles_text_boxsizer = wx.StaticBoxSizer(shuffles_text, wx.VERTICAL)
        self.shuffles = wx.SpinCtrl(self, value='1', min=1, max=100)
        shuffles_text_boxsizer.Add(self.shuffles, 1,
                                   wx.EXPAND | wx.TOP | wx.BOTTOM, 10)

        trainingset = wx.StaticBox(self, label="Specify the trainingset index")
        trainingset_boxsizer = wx.StaticBoxSizer(trainingset, wx.VERTICAL)
        self.trainingset = wx.SpinCtrl(self, value='0', min=0, max=100)
        trainingset_boxsizer.Add(self.trainingset, 1,
                                 wx.EXPAND | wx.TOP | wx.BOTTOM, 10)

        self.plot_choice = wx.RadioBox(self,
                                       label='Want to plot predictions?',
                                       choices=['Yes', 'No'],
                                       majorDimension=1,
                                       style=wx.RA_SPECIFY_COLS)
        self.plot_choice.SetSelection(1)

        self.bodypart_choice = wx.RadioBox(self,
                                           label='Compare all bodyparts?',
                                           choices=['Yes', 'No'],
                                           majorDimension=1,
                                           style=wx.RA_SPECIFY_COLS)
        self.bodypart_choice.Bind(wx.EVT_RADIOBOX, self.chooseOption)

        config_file = auxiliaryfunctions.read_config(self.config)
        bodyparts = config_file['bodyparts']
        self.bodyparts_to_compare = wx.CheckListBox(
            self, choices=bodyparts, style=0, name="Select the bodyparts")
        self.bodyparts_to_compare.Bind(wx.EVT_CHECKLISTBOX, self.getbp)
        self.bodyparts_to_compare.Hide()
        #        self.SetSizer(self.sizer)
        #        self.sizer.Fit(self)

        self.hbox1.Add(shuffles_text_boxsizer, 10,
                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        self.hbox1.Add(trainingset_boxsizer, 10,
                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        self.hbox1.Add(self.plot_choice, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        self.hbox1.Add(self.bodypart_choice, 10,
                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        self.hbox1.Add(self.bodyparts_to_compare, 10,
                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

        boxsizer.Add(self.hbox1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
        #        boxsizer.Add(self.hbox2,5, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        self.sizer.Add(boxsizer,
                       pos=(3, 0),
                       span=(1, 5),
                       flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT,
                       border=10)

        self.help_button = wx.Button(self, label='Help')
        self.sizer.Add(self.help_button, pos=(4, 0), flag=wx.LEFT, border=10)
        self.help_button.Bind(wx.EVT_BUTTON, self.help_function)

        self.ok = wx.Button(self, label="Ok")
        self.sizer.Add(self.ok, pos=(4, 4))
        self.ok.Bind(wx.EVT_BUTTON, self.evaluate_network)

        self.cancel = wx.Button(self, label="Reset")
        self.sizer.Add(self.cancel,
                       pos=(4, 1),
                       span=(1, 1),
                       flag=wx.BOTTOM | wx.RIGHT,
                       border=10)
        self.cancel.Bind(wx.EVT_BUTTON, self.cancel_evaluate_network)

        self.sizer.AddGrowableCol(2)

        self.SetSizer(self.sizer)
        self.sizer.Fit(self)