Exemplo n.º 1
0
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Dialog.__init__(self,
                           id=wxID_DLGDDPROGRESS,
                           name='dlgDDProgress',
                           parent=prnt,
                           pos=wx.Point(846, 324),
                           size=wx.Size(451, 295),
                           style=0,
                           title='DD Status...')
        self.SetClientSize(wx.Size(443, 264))
        self.SetAutoLayout(True)
        self.SetBackgroundColour(wx.Colour(125, 152, 221))
        self.SetCursor(wx.STANDARD_CURSOR)
        self.SetMinSize(wx.Size(-1, -1))
        self.Center(wx.BOTH)

        self.panScanStatus = wx.Panel(id=wxID_DLGDDPROGRESSPANSCANSTATUS,
                                      name=u'panScanStatus',
                                      parent=self,
                                      pos=wx.Point(16, 16),
                                      size=wx.Size(416, 200),
                                      style=wx.TAB_TRAVERSAL)
        self.panScanStatus.SetBackgroundColour(wx.Colour(225, 236, 255))

        self.lblEstimatedTime = wx.StaticText(
            id=wxID_DLGDDPROGRESSLBLESTIMATEDTIME,
            label='    ',
            name='lblEstimatedTime',
            parent=self.panScanStatus,
            pos=wx.Point(96, 176),
            size=wx.Size(12, 13),
            style=0)

        self.staticText2 = wx.StaticText(id=wxID_DLGDDPROGRESSSTATICTEXT2,
                                         label='Estimated Time:',
                                         name='staticText2',
                                         parent=self.panScanStatus,
                                         pos=wx.Point(8, 176),
                                         size=wx.Size(76, 13),
                                         style=wx.ALIGN_RIGHT)

        self.staticText3 = wx.StaticText(id=wxID_DLGDDPROGRESSSTATICTEXT3,
                                         label=u'Elapsed Time:',
                                         name='staticText3',
                                         parent=self.panScanStatus,
                                         pos=wx.Point(16, 152),
                                         size=wx.Size(66, 13),
                                         style=wx.ALIGN_RIGHT)

        self.lblElapsedTime = wx.StaticText(
            id=wxID_DLGDDPROGRESSLBLELAPSEDTIME,
            label='    ',
            name=u'lblElapsedTime',
            parent=self.panScanStatus,
            pos=wx.Point(96, 152),
            size=wx.Size(12, 13),
            style=0)

        self.lblScanStatus = wx.StaticText(id=wxID_DLGDDPROGRESSLBLSCANSTATUS,
                                           label='Creating image...',
                                           name=u'lblScanStatus',
                                           parent=self.panScanStatus,
                                           pos=wx.Point(136, 8),
                                           size=wx.Size(109, 16),
                                           style=0)
        self.lblScanStatus.SetFont(
            wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False,
                    u'MS Shell Dlg 2'))
        self.lblScanStatus.SetForegroundColour(wx.Colour(255, 0, 0))
        self.lblScanStatus.Show(True)

        self.btnOK = wx.Button(id=wxID_DLGDDPROGRESSBTNOK,
                               label=u'&OK',
                               name=u'btnOK',
                               parent=self,
                               pos=wx.Point(192, 224),
                               size=wx.Size(88, 24),
                               style=0)
        self.btnOK.Show(False)
        self.btnOK.Bind(wx.EVT_BUTTON,
                        self.OnBtnOKButton,
                        id=wxID_DLGDDPROGRESSBTNOK)

        self.btnCancel = wx.Button(id=wxID_DLGDDPROGRESSBTNCANCEL,
                                   label=u'&Cancel',
                                   name=u'btnCancel',
                                   parent=self,
                                   pos=wx.Point(192, 224),
                                   size=wx.Size(88, 24),
                                   style=0)
        self.btnCancel.Bind(wx.EVT_BUTTON,
                            self.OnBtnCancelButton,
                            id=wxID_DLGDDPROGRESSBTNCANCEL)

        self.gaugeDDProgress = wx.Gauge(id=wxID_DLGDDPROGRESSGAUGEDDPROGRESS,
                                        name='gaugeDDProgress',
                                        parent=self.panScanStatus,
                                        pos=wx.Point(8, 48),
                                        range=100,
                                        size=wx.Size(400, 16),
                                        style=wx.GA_HORIZONTAL)
        self.gaugeDDProgress.SetToolTipString('DD Progress')

        self.lblRate = wx.StaticText(id=wxID_DLGDDPROGRESSLBLRATE,
                                     label='',
                                     name='lblRate',
                                     parent=self.panScanStatus,
                                     pos=wx.Point(8, 96),
                                     size=wx.Size(400, 21),
                                     style=wx.ST_NO_AUTORESIZE
                                     | wx.ALIGN_CENTRE)

        self.gaugePulse = wx.Gauge(id=wxID_DLGDDPROGRESSGAUGEPULSE,
                                   name='gaugePulse',
                                   parent=self.panScanStatus,
                                   pos=wx.Point(8, 72),
                                   range=1000,
                                   size=wx.Size(400, 16),
                                   style=wx.GA_HORIZONTAL)
Exemplo n.º 2
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))
        
        # 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)
        
        # Tool Bar
        self.All_Widgets_toolbar = wx.ToolBar(self, -1)
        self.SetToolBar(self.All_Widgets_toolbar)
        self.All_Widgets_toolbar.AddTool(wx.ID_UP, _("UpDown"), wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, _("Up or Down"), _("Up or Down"))
        self.All_Widgets_toolbar.AddTool(wx.ID_OPEN, _("Open"), wx.Bitmap(32, 32), wx.NullBitmap, wx.ITEM_NORMAL, _("Open a new file"), _("Open a new file"))
        # 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.Bitmap(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.adv.CalendarCtrl(self.notebook_1_wxCalendarCtrl, wx.ID_ANY, style=wx.adv.CAL_MONDAY_FIRST | wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION | wx.adv.CAL_SHOW_SURROUNDING_WEEKS | wx.adv.CAL_SHOW_WEEK_NUMBERS)
        self.notebook_1_wxGenericCalendarCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.generic_calendar_ctrl_1 = wx.adv.GenericCalendarCtrl(self.notebook_1_wxGenericCalendarCtrl, wx.ID_ANY, style=wx.adv.CAL_MONDAY_FIRST)
        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=0)
        self.combo_box_filled = wx.ComboBox(self.notebook_1_wxComboBox, wx.ID_ANY, choices=[_("Item 1 (pre-selected)"), _("Item 2")], style=0)
        self.notebook_1_wxDatePickerCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.datepicker_ctrl_1 = wx.adv.DatePickerCtrl(self.notebook_1_wxDatePickerCtrl, wx.ID_ANY, style=wx.adv.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.adv.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=[], style=0)
        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_wxPropertyGridManager = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.property_grid_2 = wx.propgrid.PropertyGridManager(self.notebook_1_wxPropertyGridManager, wx.ID_ANY, style=wx.propgrid.PG_ALPHABETIC_MODE)
        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, style=0)
        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 )
        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, style=0)
        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, style=0)
        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.Bitmap(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.bitmap_null = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.NullBitmap)
        self.bitmap_null_sized = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap(50, 50))
        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, style=0)
        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_NAVIGATION_KEY, self.OnBitmapButtonPanelNavigationKey)
        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)
	def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Azur Lane Paintng Extract", pos = wx.DefaultPosition, size = wx.Size( 1024,576 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

		self.SetSizeHints( wx.Size( 512,288 ), wx.DefaultSize )
		self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) )

		bSizer1 = wx.BoxSizer( wx.VERTICAL )

		bSizer6 = wx.BoxSizer( wx.HORIZONTAL )

		self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		self.m_panel1.SetMinSize( wx.Size( 325,-1 ) )
		self.m_panel1.SetMaxSize( wx.Size( 325,-1 ) )

		bSizer3 = wx.BoxSizer( wx.VERTICAL )

		bSizer8 = wx.BoxSizer( wx.HORIZONTAL )

		m_choice_filterChoices = [ u"全部", u"仅原始立绘", u"仅皮肤立绘", u"仅改造立绘", u"仅婚纱立绘", u"仅幼女化立绘" ]
		self.m_choice_filter = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice_filterChoices, 0 )
		self.m_choice_filter.SetSelection( 0 )
		bSizer8.Add( self.m_choice_filter, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )

		self.m_staticline5 = wx.StaticLine( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL )
		bSizer8.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )

		self.m_searchCtrl1 = wx.SearchCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTER )
		self.m_searchCtrl1.ShowSearchButton( False )
		self.m_searchCtrl1.ShowCancelButton( True )
		bSizer8.Add( self.m_searchCtrl1, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )


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

		self.m_treeCtrl_info = wx.TreeCtrl( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_DEFAULT_STYLE|wx.TR_FULL_ROW_HIGHLIGHT|wx.TR_HAS_BUTTONS|wx.TR_HAS_VARIABLE_ROW_HEIGHT|wx.TR_HIDE_ROOT|wx.TR_ROW_LINES|wx.TR_SINGLE|wx.TR_TWIST_BUTTONS )
		bSizer3.Add( self.m_treeCtrl_info, 1, wx.ALL|wx.EXPAND, 5 )

		bSizer4 = wx.BoxSizer( wx.VERTICAL )

		bSizer5 = wx.BoxSizer( wx.HORIZONTAL )

		self.m_button_work = wx.Button( self.m_panel1, wx.ID_ANY, u"导出", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer5.Add( self.m_button_work, 0, wx.ALL, 5 )

		self.m_staticline2 = wx.StaticLine( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL )
		bSizer5.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )

		self.m_button_change = wx.Button( self.m_panel1, wx.ID_ANY, u"选择对应文件", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer5.Add( self.m_button_change, 0, wx.ALL, 5 )

		self.m_staticline4 = wx.StaticLine( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL )
		bSizer5.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )

		self.m_button_setting = wx.Button( self.m_panel1, wx.ID_ANY, u"设置", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer5.Add( self.m_button_setting, 0, wx.ALL, 5 )


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

		self.m_gauge_state = wx.Gauge( self.m_panel1, wx.ID_ANY, 100, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL )
		self.m_gauge_state.SetValue( 0 )
		bSizer4.Add( self.m_gauge_state, 0, wx.ALL|wx.EXPAND, 5 )


		bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 )


		self.m_panel1.SetSizer( bSizer3 )
		self.m_panel1.Layout()
		bSizer3.Fit( self.m_panel1 )
		bSizer6.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )

		self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL )
		bSizer6.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )

		self.m_scrolledWindow2 = wx.ScrolledWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.VSCROLL )
		self.m_scrolledWindow2.SetScrollRate( 5, 5 )
		bSizer12 = wx.BoxSizer( wx.VERTICAL )

		self.m_bitmap_show = wx.StaticBitmap( self.m_scrolledWindow2, wx.ID_ANY, wx.ArtProvider.GetBitmap( wx.ART_MISSING_IMAGE, wx.ART_OTHER ), wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer12.Add( self.m_bitmap_show, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5 )


		self.m_scrolledWindow2.SetSizer( bSizer12 )
		self.m_scrolledWindow2.Layout()
		bSizer12.Fit( self.m_scrolledWindow2 )
		bSizer6.Add( self.m_scrolledWindow2, 1, wx.EXPAND |wx.ALL, 5 )


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

		self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
		bSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )

		self.m_staticText_info = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText_info.Wrap( -1 )

		bSizer1.Add( self.m_staticText_info, 0, wx.ALL|wx.EXPAND, 5 )


		self.SetSizer( bSizer1 )
		self.Layout()
		self.m_statusBar1 = self.CreateStatusBar( 1, wx.STB_SIZEGRIP, wx.ID_ANY )

		self.Centre( wx.BOTH )

		# Connect Events
		self.Bind( wx.EVT_CLOSE, self.exit )
		self.Bind( wx.EVT_MOVE_END, self.resize )
		self.m_choice_filter.Bind( wx.EVT_CHOICE, self.filter_work )
		self.m_searchCtrl1.Bind( wx.EVT_TEXT, self.search )
		self.m_searchCtrl1.Bind( wx.EVT_TEXT_ENTER, self.search )
		self.m_treeCtrl_info.Bind( wx.EVT_TREE_SEL_CHANGED, self.on_info_select )
		self.m_button_work.Bind( wx.EVT_BUTTON, self.work )
		self.m_button_change.Bind( wx.EVT_BUTTON, self.choice_file )
		self.m_button_setting.Bind( wx.EVT_BUTTON, self.setting )
Exemplo n.º 4
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                           | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX)
        self.parent = parent
        self.dictAction = None

        # Bandeau
        titre = _(u"Traitement par lot")
        intro = _(
            u"Vous pouvez ici saisir, modifier ou supprimer des consommations pour un ensemble d'individus. Sélectionnez une activité ainsi que les paramètres de l'action à appliquer. Cochez les individus souhaités puis cliquez sur le bouton Commencer pour lancer le traitement."
        )
        self.SetTitle(titre)
        self.ctrl_bandeau = CTRL_Bandeau.Bandeau(
            self,
            titre=titre,
            texte=intro,
            hauteurHtml=30,
            nomImage="Images/32x32/Calendrier_modifier.png")

        # Paramètres
        self.box_parametres_staticbox = wx.StaticBox(self, -1,
                                                     _(u"Paramètres"))
        self.label_activite = wx.StaticText(self, -1, u"Activité :")
        self.ctrl_activite = CTRL_Activite(self)
        self.label_action = wx.StaticText(self, -1, u"Action :")
        self.ctrl_action = wx.TextCtrl(self, -1, u"")
        self.ctrl_action.Enable(False)
        self.bouton_action = wx.Button(self, -1,
                                       _(u"Sélectionner une action"))

        # Individus
        self.box_individus_staticbox = wx.StaticBox(
            self, -1, _(u"Sélection des individus"))
        self.listviewAvecFooter = OL_Saisie_lot_conso_global.ListviewAvecFooter(
            self, kwargs={})
        self.ctrl_individus = self.listviewAvecFooter.GetListview()
        self.ctrl_recherche = OL_Saisie_lot_conso_global.CTRL_Outils(
            self, listview=self.ctrl_individus, afficherCocher=True)

        # Grille des action
        self.box_grille_staticbox = wx.StaticBox(self, -1, _(u"Journal"))
        self.ctrl_log = wx.TextCtrl(self,
                                    -1,
                                    style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.ctrl_log.SetMinSize((-1, 60))
        self.ctrl_gauge = wx.Gauge(self, -1, style=wx.GA_SMOOTH)
        self.ctrl_grille = DLG_Badgeage_grille.CTRL(self)
        self.ctrl_grille.Show(False)

        # Boutons
        self.bouton_aide = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png")
        self.bouton_ok = CTRL_Bouton_image.CTRL(
            self,
            texte=_(u"Commencer"),
            cheminImage="Images/32x32/Valider.png")
        self.bouton_fermer = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Fermer"), cheminImage="Images/32x32/Annuler.png")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_CHOICE, self.OnChoixActivite, self.ctrl_activite)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAction, self.bouton_action)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_fermer)
        self.Bind(wx.EVT_CLOSE, self.OnBoutonAnnuler)

        self.OnChoixActivite(None)
        self.ctrl_individus.MAJ()
        wx.CallLater(0, self.Layout)
Exemplo n.º 5
0
	def __init__(self, parent, printerConnection):
		super(printWindowBasic, self).__init__(parent, -1, style=wx.CLOSE_BOX|wx.CLIP_CHILDREN|wx.CAPTION|wx.SYSTEM_MENU|wx.FRAME_TOOL_WINDOW|wx.FRAME_FLOAT_ON_PARENT, title=_("Printing on %s") % (printerConnection.getName()))
		self._printerConnection = printerConnection
		self._lastUpdateTime = 0
		self._isPrinting = False

		self.SetSizer(wx.BoxSizer())
		self.panel = wx.Panel(self)
		self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND)
		self.sizer = wx.GridBagSizer(2, 2)
		self.panel.SetSizer(self.sizer)

		self.powerWarningText = wx.StaticText(parent=self.panel,
			id=-1,
			label=_("Your computer is running on battery power.\nConnect your computer to AC power or your print might not finish."),
			style=wx.ALIGN_CENTER)
		self.powerWarningText.SetBackgroundColour('red')
		self.powerWarningText.SetForegroundColour('white')
		if power:
			self.powerManagement = power.PowerManagement()
		else:
			self.powerManagement = None
		self.powerWarningTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnPowerWarningChange, self.powerWarningTimer)
		self.OnPowerWarningChange(None)
		self.powerWarningTimer.Start(10000)

		self.statsText = wx.StaticText(self.panel, -1, _("InfoLine from printer connection\nInfoLine from dialog\nExtra line\nMore lines for layout\nMore lines for layout\nMore lines for layout"))

		self.connectButton = wx.Button(self.panel, -1, _("Connect"))
		#self.loadButton = wx.Button(self.panel, -1, 'Load')
		self.printButton = wx.Button(self.panel, -1, _("Print"))
		self.pauseButton = wx.Button(self.panel, -1, _("Pause"))
		self.cancelButton = wx.Button(self.panel, -1, _("Cancel print"))
		self.errorLogButton = wx.Button(self.panel, -1, _("Error log"))
		self.progress = wx.Gauge(self.panel, -1, range=1000)

		self.pauseTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnPauseTimer, self.pauseTimer)

		self.sizer.Add(self.powerWarningText, pos=(0, 0), span=(1, 5), flag=wx.EXPAND|wx.BOTTOM, border=5)
		self.sizer.Add(self.statsText, pos=(1, 0), span=(1, 5), flag=wx.LEFT, border=5)
		self.sizer.Add(self.connectButton, pos=(2, 0))
		#self.sizer.Add(self.loadButton, pos=(2,1))
		self.sizer.Add(self.printButton, pos=(2, 1))
		self.sizer.Add(self.pauseButton, pos=(2, 2))
		self.sizer.Add(self.cancelButton, pos=(2, 3))
		self.sizer.Add(self.errorLogButton, pos=(2, 4))
		self.sizer.Add(self.progress, pos=(3, 0), span=(1, 5), flag=wx.EXPAND)

		self.Bind(wx.EVT_CLOSE, self.OnClose)
		self.connectButton.Bind(wx.EVT_BUTTON, self.OnConnect)
		#self.loadButton.Bind(wx.EVT_BUTTON, self.OnLoad)
		self.printButton.Bind(wx.EVT_BUTTON, self.OnPrint)
		self.pauseButton.Bind(wx.EVT_BUTTON, self.OnPause)
		self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
		self.errorLogButton.Bind(wx.EVT_BUTTON, self.OnErrorLog)

		self.Layout()
		self.Fit()
		self.Centre()

		self.progress.SetMinSize(self.progress.GetSize())
		self.statsText.SetLabel('\n\n\n\n\n\n')
		self._updateButtonStates()

		self._printerConnection.addCallback(self._doPrinterConnectionUpdate)

		if self._printerConnection.hasActiveConnection() and not self._printerConnection.isActiveConnectionOpen():
			self._printerConnection.openActiveConnection()
Exemplo n.º 6
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=wx.EmptyString,
                          pos=wx.Point(1000, 1000),
                          size=wx.Size(300, 200),
                          style=wx.FRAME_TOOL_WINDOW | wx.RESIZE_BORDER
                          | wx.STAY_ON_TOP | wx.TAB_TRAVERSAL)

        self.SetSizeHintsSz(wx.Size(-1, -1), wx.Size(-1, -1))
        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT))

        bSizer15 = wx.BoxSizer(wx.VERTICAL)

        bSizer7 = wx.BoxSizer(wx.HORIZONTAL)

        self.button = wx.BitmapButton(
            self, wx.ID_ANY,
            wx.Bitmap(u"graphics/arrouw.png", wx.BITMAP_TYPE_ANY),
            wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW)
        self.button.SetToolTipString(u"Collapse")

        bSizer7.Add(self.button, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        bSizer8 = wx.BoxSizer(wx.VERTICAL)

        self.movie_load = wx.Gauge(self, wx.ID_ANY, 100, wx.DefaultPosition,
                                   wx.Size(-1, -1),
                                   wx.GA_HORIZONTAL | wx.GA_SMOOTH)
        bSizer8.Add(
            self.movie_load, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL
            | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5)

        self.movie_head = wx.HyperlinkCtrl(self, wx.ID_ANY, u"wxFB Website",
                                           u"http://www.wxformbuilder.org",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           wx.HL_DEFAULT_STYLE)
        self.movie_head.SetFont(wx.Font(13, 70, 90, 90, True, wx.EmptyString))
        self.movie_head.SetToolTipString(u"Visit Movie Website")
        self.movie_head.SetMinSize(wx.Size(150, 25))

        bSizer8.Add(self.movie_head, 0,
                    wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5)

        bSizer7.Add(bSizer8, 1, wx.EXPAND, 5)

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

        self.movie = wx.StaticText(self, wx.ID_ANY, u"Change Text",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        self.movie.Wrap(90)
        self.movie.SetFont(wx.Font(10, 70, 90, 90, False, wx.EmptyString))
        self.movie.SetForegroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DDKSHADOW))

        bSizer15.Add(self.movie, 0,
                     wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 5)

        self.line = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition,
                                  wx.DefaultSize, wx.LI_HORIZONTAL)
        bSizer15.Add(self.line, 0, wx.EXPAND | wx.ALL, 5)

        self.sub_load = wx.Gauge(self, wx.ID_ANY, 100, wx.DefaultPosition,
                                 wx.DefaultSize,
                                 wx.GA_HORIZONTAL | wx.GA_SMOOTH)
        bSizer15.Add(self.sub_load, 0,
                     wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 5)

        bSizer9 = wx.BoxSizer(wx.HORIZONTAL)

        self.sub = wx.HyperlinkCtrl(self, wx.ID_ANY, u"wxFB Website",
                                    u"http://www.wxformbuilder.org",
                                    wx.DefaultPosition, wx.DefaultSize,
                                    wx.HL_DEFAULT_STYLE)
        self.sub.SetFont(wx.Font(10, 70, 90, 90, True, wx.EmptyString))
        self.sub.SetToolTipString(u"Visit Subtitles Website")

        bSizer9.Add(self.sub, 0, wx.ALL, 5)

        self.sub_apply = wx.BitmapButton(
            self, wx.ID_ANY, wx.Bitmap(u"graphics/play.png",
                                       wx.BITMAP_TYPE_ANY), wx.DefaultPosition,
            wx.Size(25, 25), wx.BU_AUTODRAW)
        self.sub_apply.SetToolTipString(u"Play Movie with Subtitles")

        bSizer9.Add(self.sub_apply, 0, 0, 5)

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

        self.SetSizer(bSizer15)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.Bind(wx.EVT_MOTION, self.func)
        self.button.Bind(wx.EVT_BUTTON, self.close)
        self.sub_apply.Bind(wx.EVT_BUTTON, self.sub_restart)
Exemplo n.º 7
0
    def __init__(self, parent, image_panel, terminal_panel):
        wx.Panel.__init__(self, parent=parent)
        # Panels
        self.panel = wx.Panel(self, -1, size=(580, 180))
        self.cat_panel = image_panel
        self.term_panel = terminal_panel
        self.btn_go_toggle = 1
        self.image_store = []        # holds last image_num images for review
        self.image_num = 10          # number of images to hold for review
        self.inc = 0                 # holds index number of image_store for back/fwd buttons
        self.current_pic = 0         # holds index number of current review pic for "Go" button
        self.auto = 0
        self.review = 0
        self.good_cat = 0
        self.haar_scale = 1.08
        self.haar_neig = 5

        # Buttons, sliders and gauge, setup and initialise
        self.btn_back = wx.Button(self.panel, id=-1, pos=(390, 30), size=(45, 35))
        self.btn_back.name = "back"
        self.btn_back.SetBitmap(wx.Bitmap(gui_graphics + '/back.png'))
        self.btn_back.Bind(wx.EVT_BUTTON, self.btn_review)
        self.btn_back.ToolTip = wx.ToolTip(f"Move back through {self.image_num} most recent cats")

        self.btn_go = wx.Button(self.panel, id=-1, pos=(455, 30), size=(45, 35))
        self.btn_go.SetBitmap(wx.Bitmap(gui_graphics + '/start.png'))
        self.btn_go.Bind(wx.EVT_BUTTON, self.btn_go_press)
        self.btn_go.ToolTip = wx.ToolTip("Start the spider or data dump")

        self.btn_fwd = wx.Button(self.panel, id=-1, pos=(520, 30), size=(45, 35))
        self.btn_fwd.name = "fwd"
        self.btn_fwd.SetBitmap(wx.Bitmap(gui_graphics + '/fwd.png'))
        self.btn_fwd.Bind(wx.EVT_BUTTON, self.btn_review)
        self.btn_fwd.ToolTip = wx.ToolTip(f"Move forward through {self.image_num} most recent cats")

        self.btn_clear_btdt = wx.Button(self.panel, id=-1, pos=(390, 75), size=(45, 35))
        self.btn_clear_btdt.SetBitmap(wx.Bitmap(gui_graphics + '/clear.png'))
        self.btn_clear_btdt.Bind(wx.EVT_BUTTON, self.btn_clr_btdt)
        self.btn_clear_btdt.ToolTip = wx.ToolTip("Clears the btdt list")

        self.btn_reject = wx.Button(self.panel, id=-1, pos=(455, 75), size=(45, 35))
        self.btn_reject.SetBitmap(wx.Bitmap(gui_graphics + '/dislike.png'))
        self.btn_reject.Bind(wx.EVT_BUTTON, self.btn_reject_press)
        self.btn_reject.ToolTip = wx.ToolTip("Crap cat! Go to next")

        self.btn_accept = wx.Button(self.panel, id=-1, pos=(520, 75), size=(45, 35))
        self.btn_accept.SetBitmap(wx.Bitmap(gui_graphics + '/like.png'))
        self.btn_accept.Bind(wx.EVT_BUTTON, self.btn_accept_press)
        self.btn_accept.ToolTip = wx.ToolTip("Good cat! start finding faces")

        self.btn_auto = wx.ToggleButton(self.panel, id=-1, pos=(390, 120), size=(45, 35))
        self.btn_auto.SetBitmap(wx.Bitmap(gui_graphics + '/repeat.png'))
        self.btn_auto.Bind(wx.EVT_TOGGLEBUTTON, self.btn_auto_go)
        self.btn_auto.ToolTip = wx.ToolTip("Toggles between manual and full auto operation WARNING! full auto will lock the gui until it finds a cat to skin. You can only access the toggle button as the dead cat spins.")

        self.spn_scale = floatspin.FloatSpin(
                                            self.panel,
                                            id=-1,
                                            pos=(450, 120),
                                            size=(55,25),
                                            value=1.08,
                                            min_val=1.01,
                                            max_val=1.4,
                                            increment=.01,
                                            digits=2,
                                            agwStyle=floatspin.FS_LEFT
                                            )
        self.spn_scale.Bind(wx.EVT_SPINCTRL, self.spn_scale_OnSpin)
        self.spn_scale.Bind(wx.EVT_TEXT, self.spn_scale_OnSpin)
        self.spn_scale.ToolTip = wx.ToolTip("Scale factor for Haar (default 1.08). Min-1.01; Max-1.4. Smaller number finds more faces but is slower")

        self.spn_neig = wx.SpinCtrl(
                                    self.panel,
                                    id=-1,
                                    pos=(520, 120),
                                    size=(45, 25),
                                    value='5',
                                    min=1,
                                    max=20
                                    )       #size=(55, 35),
        self.spn_neig.Bind(wx.EVT_SPINCTRL, self.spn_neig_OnSpin)
        self.spn_neig.Bind(wx.EVT_TEXT, self.spn_neig_OnSpin)
        self.spn_neig.ToolTip = wx.ToolTip("Neighbour factor for Haar (default 5). More is more accurate but slower")

        self.cat_sld = wx.Slider(
            self.panel,
            value=1,
            minValue=1,
            maxValue=200,
            pos=(15, 20),
            size=(320, -1),
            style=wx.SL_HORIZONTAL|wx.SL_LABELS
            )

        self.progress = wx.Gauge(
            self.panel,
            -1,
            100,
            pos=(20, 120),
            size=(315, -1),
            style=wx.GA_HORIZONTAL|wx.GA_SMOOTH
            )

        self.progress.SetValue(0)
        self.progress.SetRange(self.cat_sld.GetValue())
        self.progress.SetForegroundColour(wx.Colour(255, 255, 255))

        self.r = praw.Reddit('bot1')    # Initialises reddit bot to download cat images
        self.btdt = self.get_btdt()     # setting up and loading list of downloaded/rejected images

        self.term_msg(f"You have {self.Cat_count()} raw cats")
        self.term_msg(f"btdt currently has {len(self.btdt)} entries\n")
Exemplo n.º 8
0
	def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Experiment Running", pos = wx.DefaultPosition, size = wx.Size( 489,354 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

		self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )

		bSizer3 = wx.BoxSizer( wx.VERTICAL )

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

		gSizer6.SetMinSize( wx.Size( -1,30 ) )
		self.m_staticText73 = wx.StaticText( self, wx.ID_ANY, u"Current period", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText73.Wrap( -1 )
		gSizer6.Add( self.m_staticText73, 0, wx.ALL, 5 )

		self.currentperiod = wx.StaticText( self, wx.ID_ANY, u"not started", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.currentperiod.Wrap( -1 )

		gSizer6.Add( self.currentperiod, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL, 5 )

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


		bSizer3.Add( gSizer6, 1, wx.EXPAND, 5 )

		self.PeriodStatus = wx.Gauge( self, wx.ID_ANY, 100, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL )
		self.PeriodStatus.SetValue( 0 )
		self.PeriodStatus.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) )

		bSizer3.Add( self.PeriodStatus, 1, wx.ALL|wx.EXPAND, 5 )

		fgSizer2 = wx.FlexGridSizer( 0, 10, 0, 0 )
		fgSizer2.SetFlexibleDirection( wx.BOTH )
		fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

		bSizer3.Add( fgSizer2, 1, wx.EXPAND, 5 )

		fgSizer22 = wx.FlexGridSizer( 0, 10, 0, 0 )
		fgSizer22.SetFlexibleDirection( wx.BOTH )
		fgSizer22.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

		self.R2lab1 = wx.StaticText( self, wx.ID_ANY, u"pO2:", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.R2lab1.Wrap( -1 )
		fgSizer22.Add( self.R2lab1, 0, wx.ALL, 5 )

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

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

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

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

		self.m_staticText962 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText962.Wrap( -1 )
		fgSizer22.Add( self.m_staticText962, 0, wx.ALL, 5 )

		self.m_staticText972 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText972.Wrap( -1 )
		fgSizer22.Add( self.m_staticText972, 0, wx.ALL, 5 )

		self.m_staticText982 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText982.Wrap( -1 )
		fgSizer22.Add( self.m_staticText982, 0, wx.ALL, 5 )

		self.m_staticText992 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText992.Wrap( -1 )
		fgSizer22.Add( self.m_staticText992, 0, wx.ALL, 5 )


		bSizer3.Add( fgSizer22, 1, wx.EXPAND, 5 )

		gSizer10 = wx.GridSizer( 1, 4, 0, 0 )

		self.m_button132 = wx.Button( self, wx.ID_ANY, u"Stop (2x click)", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_button132.SetBackgroundColour( wx.Colour( 247, 89, 89 ) )

		gSizer10.Add( self.m_button132, 1, wx.ALL|wx.EXPAND, 5 )

		self.m_button21 = wx.Button( self, wx.ID_ANY, u"Exp. control", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_button21.Enable( False )

		gSizer10.Add( self.m_button21, 1, wx.ALL|wx.EXPAND, 5 )

		self.graphs = wx.Button( self, wx.ID_ANY, u"Graphs", wx.DefaultPosition, wx.DefaultSize, 0 )
		gSizer10.Add( self.graphs, 1, wx.ALL|wx.EXPAND, 5 )

		self.writenote = wx.Button( self, wx.ID_ANY, u"Write a note", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.writenote.SetDefault()
		gSizer10.Add( self.writenote, 1, wx.ALL|wx.EXPAND, 5 )


		bSizer3.Add( gSizer10, 1, wx.EXPAND, 5 )


		self.SetSizer( bSizer3 )
		self.Layout()

		self.Centre( wx.BOTH )

		# Connect Events
		self.m_button132.Bind( wx.EVT_LEFT_DCLICK, self.STOOOOP )
		self.graphs.Bind( wx.EVT_BUTTON, self.graphss )
		self.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)
		# self.m_button21.Bind( wx.EVT_BUTTON, self.pcrittt )
		self.writenote.Bind( wx.EVT_BUTTON, self.writenotetoexperiment )
		self.Show(True)

		# while 1:
			# time.sleep(1)
		self.UpdateGui()
Exemplo n.º 9
0
    def __init__(self, parent, ID, app):
        """Latest is optional extra. If not given it will be fetched.
        """
        self.app = app
        # get latest version info if poss
        if app.updater in [False, None]:
            # user has turned off check for updates in prefs so check now
            app.updater = updater = Updater(app=self.app)
            # don't need a warning - we'll provide one ourselves
            self.latest = updater.getLatestInfo(warnMsg=False)
        else:
            self.latest = app.updater.latest
        self.runningVersion = app.updater.runningVersion
        wx.Dialog.__init__(self,
                           parent,
                           ID,
                           title=_translate('PsychoPy Updates'),
                           size=(100, 200))

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

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

        # positioning and sizing
        self.updateStatus()
        self.Center()
        self.ShowModal()
Exemplo n.º 10
0
    def __init__(self, parent):
        wx.Panel.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          pos=wx.DefaultPosition,
                          size=wx.Size(527, 300),
                          style=wx.TAB_TRAVERSAL)

        bSizer1 = wx.BoxSizer(wx.VERTICAL)

        bSizer2 = wx.BoxSizer(wx.HORIZONTAL)

        #self.SetLayoutDirection(wx.Right)
        self.addr1 = '192.168.1.1'
        self.addr2 = '192.168.1.20'

        self.txt1 = wx.StaticText(self, wx.ID_ANY, u"بررسی شبکه",
                                  wx.DefaultPosition, wx.DefaultSize, 0)
        self.txt1.Wrap(-1)
        bSizer2.Add(self.txt1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        Choices = [
            "eth0", "eth1", "eth2", "wlan0", "wlan1", "wifi0", "ath0", "ath1",
            "ppp0"
        ]
        self.chs1 = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition,
                              wx.DefaultSize, Choices, 0)
        self.chs1.SetSelection(0)
        bSizer2.Add(self.chs1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.txt2 = wx.StaticText(self, wx.ID_ANY, u"از شماره ip",
                                  wx.DefaultPosition, wx.DefaultSize, 0)
        self.txt2.Wrap(-1)
        bSizer2.Add(self.txt2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.ip1 = wx.TextCtrl(self, wx.ID_ANY, self.addr1, wx.DefaultPosition,
                               wx.DefaultSize, 0)
        #self.ip1 = masked.IpAddrCtrl( self, -1,'192.168.  1.  1', style = wx.TE_PROCESS_TAB )
        bSizer2.Add(self.ip1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.txt3 = wx.StaticText(self, wx.ID_ANY, u"الی", wx.DefaultPosition,
                                  wx.DefaultSize, 0)
        self.txt3.Wrap(-1)
        bSizer2.Add(self.txt3, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.ip2 = wx.TextCtrl(self, wx.ID_ANY, self.addr2, wx.DefaultPosition,
                               wx.DefaultSize, 0)
        #self.ip2 = masked.IpAddrCtrl( self, -1,'192.168.  1.256', style = wx.TE_PROCESS_TAB )
        bSizer2.Add(self.ip2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

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

        bSizer3 = wx.BoxSizer(wx.HORIZONTAL)

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

        self.Listno = 7

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

        # Columns
        self.lanlist.SetColSize(0, 70)
        self.lanlist.SetColSize(1, 121)
        self.lanlist.SetColSize(2, 157)
        self.lanlist.SetColSize(3, 59)
        self.lanlist.SetColSize(4, 79)
        self.lanlist.EnableDragColMove(False)
        self.lanlist.EnableDragColSize(True)
        self.lanlist.SetColLabelSize(30)
        self.lanlist.SetColLabelValue(0, u"نام کاربر")
        self.lanlist.SetColLabelValue(1, u"آدرس شبکه ip")
        self.lanlist.SetColLabelValue(2, u"آدرس مک mac")
        self.lanlist.SetColLabelValue(3, u"وضعیت")
        self.lanlist.SetColLabelValue(4, u"زمان اتصال")
        self.lanlist.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        # Rows
        self.lanlist.EnableDragRowSize(True)
        self.lanlist.SetRowLabelSize(19)
        self.lanlist.SetRowLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        # Label Appearance

        # Cell Defaults
        self.lanlist.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)
        bSizer3.Add(self.lanlist, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

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

        bSizer10 = wx.BoxSizer(wx.VERTICAL)
        self.m_gauge1 = wx.Gauge(self, wx.ID_ANY, 100, wx.DefaultPosition,
                                 wx.DefaultSize, wx.GA_HORIZONTAL)
        self.m_gauge1.SetValue(0)
        bSizer10.Add(self.m_gauge1, 0,
                     wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 5)
        bSizer1.Add(bSizer10, 0, wx.EXPAND, 5)

        bSizer4 = wx.BoxSizer(wx.HORIZONTAL)

        self.btn1 = wx.Button(self, wx.ID_ANY, u"بررسي", wx.DefaultPosition,
                              wx.DefaultSize, 0)
        bSizer4.Add(self.btn1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.btn2 = wx.Button(self, wx.ID_ANY, u"تنظیمات", wx.DefaultPosition,
                              wx.DefaultSize, 0)
        bSizer4.Add(self.btn2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.chk1 = wx.CheckBox(self, wx.ID_ANY, u"نمایش همه",
                                wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer4.Add(self.chk1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.btn3 = wx.Button(self, wx.ID_ANY, u"انصراف", wx.DefaultPosition,
                              wx.DefaultSize, 0)
        bSizer4.Add(self.btn3, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.btn4 = wx.Button(self, wx.ID_ANY, u"تائید", wx.DefaultPosition,
                              wx.DefaultSize, 0)
        bSizer4.Add(self.btn4, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

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

        self.SetSizer(bSizer1)
        self.Layout()

        # Connect Events
        self.chs1.Bind(wx.EVT_CHOICE, self.Onlan)
        self.btn1.Bind(wx.EVT_BUTTON, self.search)
        self.btn2.Bind(wx.EVT_BUTTON, self.Option)
        self.chk1.Bind(wx.EVT_CHECKBOX, self.showall)
        self.btn3.Bind(wx.EVT_BUTTON, self.Cancel)
        self.btn4.Bind(wx.EVT_BUTTON, self.Onokey)
Exemplo n.º 11
0
    def __init__(self,
                 parent,
                 title,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_FRAME_STYLE):
        wx.MiniFrame.__init__(self, parent, -1, title, pos, size, style)
        panel = wx.Panel(self, -1)
        self.SetIcon(wx.Icon(resource_path('StickyHamsters32x32.ico')))

        self.count = 0

        # Set Up Printing Data
        self.pdata = wx.PrintData()
        self.pdata.SetPaperId(wx.PAPER_LETTER)
        self.pdata.SetOrientation(wx.PORTRAIT)
        self.margins = (wx.Point(15, 15), wx.Point(15, 15))

        sizer = wx.BoxSizer(wx.VERTICAL)

        label0 = wx.StaticText(panel, -1, 'Date Range')
        sizer.AddSpacer(10)
        sizer.Add(label0, 1, wx.CENTER)

        hsizer0 = wx.BoxSizer(wx.HORIZONTAL)
        hsizervsizer0 = wx.BoxSizer(wx.VERTICAL)
        label0 = wx.StaticText(panel, -1, 'Start')
        self.textBox0 = wx.TextCtrl(panel, -1)
        hsizervsizer0.Add(label0)
        hsizervsizer0.Add(self.textBox0)
        hsizer0.Add(hsizervsizer0)
        hsizer0.AddSpacer(20)

        hsizervsizer1 = wx.BoxSizer(wx.VERTICAL)
        label1 = wx.StaticText(panel, -1, 'End')
        self.textBox1 = wx.TextCtrl(panel, -1)
        hsizervsizer1.Add(label1)
        hsizervsizer1.Add(self.textBox1)
        hsizer0.Add(hsizervsizer1)
        sizer.Add(hsizer0, 1, wx.CENTER)
        sizer.AddSpacer(30)

        self.button = wx.Button(panel, -1, 'Generate Report')
        self.Bind(wx.EVT_BUTTON, self.pressMe_OnClick, self.button)

        hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        self.RadioButton0 = wx.RadioButton(panel, -1, 'Numerical Report')
        hsizer1.Add(self.RadioButton0)
        self.RadioButton0.SetValue(True)
        hsizer1.AddSpacer(20)

        self.RadioButton1 = wx.RadioButton(panel, -1, 'Full Report')
        hsizer1.Add(self.RadioButton1)
        sizer.Add(hsizer1, 1, wx.CENTER)

        vsizer0 = wx.BoxSizer(wx.VERTICAL)
        self.CheckBox0 = wx.CheckBox(panel, -1, 'Completed Tickets')
        vsizer0.Add(self.CheckBox0)
        vsizer0.AddSpacer(15)

        self.CheckBox1 = wx.CheckBox(panel, -1, 'Incomplete Tickets')
        vsizer0.Add(self.CheckBox1)
        vsizer0.AddSpacer(15)

        self.CheckBox2 = wx.CheckBox(panel, -1, 'Graph')
        vsizer0.Add(self.CheckBox2)
        sizer.Add(vsizer0, 1, wx.CENTER)

        sizer.AddStretchSpacer()

        self.gauge = wx.Gauge(panel, -1)
        sizer.Add(self.gauge, 0, wx.CENTER)
        sizer.AddSpacer(5)

        sizer.AddStretchSpacer()
        sizer.Add(self.button, 0, wx.CENTER)
        sizer.AddSpacer(5)

        panel.SetSizerAndFit(sizer)
Exemplo n.º 12
0
	def __init__(self, printerConnection):
		super(printWindow, self).__init__(None, -1, title=_("Printing"))
		self._printerConnection = printerConnection
		self.lastUpdateTime = 0

		self.SetSizer(wx.BoxSizer())
		self.panel = wx.Panel(self)
		self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND)
		self.sizer = wx.GridBagSizer(2, 2)
		self.panel.SetSizer(self.sizer)

		sb = wx.StaticBox(self.panel, label=_("Statistics"))
		boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)

		self.powerWarningText = wx.StaticText(parent=self.panel,
			id=-1,
			label=_("Your computer is running on battery power.\nConnect your computer to AC power or your print might not finish."),
			style=wx.ALIGN_CENTER)
		self.powerWarningText.SetBackgroundColour('red')
		self.powerWarningText.SetForegroundColour('white')
		boxsizer.AddF(self.powerWarningText, flags=wx.SizerFlags().Expand().Border(wx.BOTTOM, 10))
		self.powerManagement = power.PowerManagement()
		self.powerWarningTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnPowerWarningChange, self.powerWarningTimer)
		self.OnPowerWarningChange(None)
		self.powerWarningTimer.Start(10000)

		self.statsText = wx.StaticText(self.panel, -1, _("Filament: ####.##m #.##g\nEstimated print time: #####:##\nMachine state:\nDetecting baudrateXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"))
		boxsizer.Add(self.statsText, flag=wx.LEFT, border=5)

		self.sizer.Add(boxsizer, pos=(0, 0), span=(7, 1), flag=wx.EXPAND)

		self.connectButton = wx.Button(self.panel, -1, _("Connect"))
		#self.loadButton = wx.Button(self.panel, -1, 'Load')
		self.printButton = wx.Button(self.panel, -1, _("Print"))
		self.pauseButton = wx.Button(self.panel, -1, _("Pause"))
		self.cancelButton = wx.Button(self.panel, -1, _("Cancel print"))
		self.errorLogButton = wx.Button(self.panel, -1, _("Error log"))
		self.progress = wx.Gauge(self.panel, -1, range=1000)

		self.sizer.Add(self.connectButton, pos=(1, 1), flag=wx.EXPAND)
		#self.sizer.Add(self.loadButton, pos=(1,1), flag=wx.EXPAND)
		self.sizer.Add(self.printButton, pos=(2, 1), flag=wx.EXPAND)
		self.sizer.Add(self.pauseButton, pos=(3, 1), flag=wx.EXPAND)
		self.sizer.Add(self.cancelButton, pos=(4, 1), flag=wx.EXPAND)
		self.sizer.Add(self.errorLogButton, pos=(5, 1), flag=wx.EXPAND)
		self.sizer.Add(self.progress, pos=(7, 0), span=(1, 7), flag=wx.EXPAND)

		nb = wx.Notebook(self.panel)
		self.tabs = nb
		self.sizer.Add(nb, pos=(0, 2), span=(7, 4), flag=wx.EXPAND)

		self.temperaturePanel = wx.Panel(nb)
		sizer = wx.GridBagSizer(2, 2)
		self.temperaturePanel.SetSizer(sizer)

		self.temperatureSelect = wx.SpinCtrl(self.temperaturePanel, -1, '0', size=(21 * 3, 21), style=wx.SP_ARROW_KEYS)
		self.temperatureSelect.SetRange(0, 400)
		self.temperatureHeatUp = wx.Button(self.temperaturePanel, -1, str(int(profile.getProfileSettingFloat('print_temperature'))) + 'C')
		self.bedTemperatureLabel = wx.StaticText(self.temperaturePanel, -1, _("BedTemp:"))
		self.bedTemperatureSelect = wx.SpinCtrl(self.temperaturePanel, -1, '0', size=(21 * 3, 21), style=wx.SP_ARROW_KEYS)
		self.bedTemperatureSelect.SetRange(0, 400)
		self.bedTemperatureLabel.Show(False)
		self.bedTemperatureSelect.Show(False)

		self.temperatureGraph = TemperatureGraph(self.temperaturePanel)

		sizer.Add(wx.StaticText(self.temperaturePanel, -1, _("Temp:")), pos=(0, 0))
		sizer.Add(self.temperatureSelect, pos=(0, 1))
		sizer.Add(self.temperatureHeatUp, pos=(0, 2))
		sizer.Add(self.bedTemperatureLabel, pos=(1, 0))
		sizer.Add(self.bedTemperatureSelect, pos=(1, 1))
		sizer.Add(self.temperatureGraph, pos=(2, 0), span=(1, 3), flag=wx.EXPAND)
		sizer.AddGrowableRow(2)
		sizer.AddGrowableCol(2)

		nb.AddPage(self.temperaturePanel, 'Temp')

		self.directControlPanel = wx.Panel(nb)

		sizer = wx.GridBagSizer(2, 2)
		self.directControlPanel.SetSizer(sizer)
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y100 F6000', 'G90'], 'print-move-y100.png'), pos=(0, 3))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y10 F6000', 'G90'], 'print-move-y10.png'), pos=(1, 3))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y1 F6000', 'G90'], 'print-move-y1.png'), pos=(2, 3))

		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y-1 F6000', 'G90'], 'print-move-y-1.png'), pos=(4, 3))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y-10 F6000', 'G90'], 'print-move-y-10.png'), pos=(5, 3))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y-100 F6000', 'G90'], 'print-move-y-100.png'), pos=(6, 3))

		sizer.Add(PrintCommandButton(self, ['G91', 'G1 X-100 F6000', 'G90'], 'print-move-x-100.png'), pos=(3, 0))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 X-10 F6000', 'G90'], 'print-move-x-10.png'), pos=(3, 1))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 X-1 F6000', 'G90'], 'print-move-x-1.png'), pos=(3, 2))

		sizer.Add(PrintCommandButton(self, ['G28 X0 Y0'], 'print-move-home.png'), pos=(3, 3))

		sizer.Add(PrintCommandButton(self, ['G91', 'G1 X1 F6000', 'G90'], 'print-move-x1.png'), pos=(3, 4))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 X10 F6000', 'G90'], 'print-move-x10.png'), pos=(3, 5))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 X100 F6000', 'G90'], 'print-move-x100.png'), pos=(3, 6))

		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z10 F200', 'G90'], 'print-move-z10.png'), pos=(0, 8))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z1 F200', 'G90'], 'print-move-z1.png'), pos=(1, 8))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z0.1 F200', 'G90'], 'print-move-z0.1.png'), pos=(2, 8))

		sizer.Add(PrintCommandButton(self, ['G28 Z0'], 'print-move-home.png'), pos=(3, 8))

		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z-0.1 F200', 'G90'], 'print-move-z-0.1.png'), pos=(4, 8))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z-1 F200', 'G90'], 'print-move-z-1.png'), pos=(5, 8))
		sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z-10 F200', 'G90'], 'print-move-z-10.png'), pos=(6, 8))

		sizer.Add(PrintCommandButton(self, ['G92 E0', 'G1 E2 F120'], 'extrude.png', size=(60, 20)), pos=(1, 10), span=(1, 3), flag=wx.EXPAND)
		sizer.Add(PrintCommandButton(self, ['G92 E0', 'G1 E-2 F120'], 'retract.png', size=(60, 20)), pos=(2, 10), span=(1, 3), flag=wx.EXPAND)

		nb.AddPage(self.directControlPanel, _("Jog"))

		self.termPanel = wx.Panel(nb)
		sizer = wx.GridBagSizer(2, 2)
		self.termPanel.SetSizer(sizer)

		f = wx.Font(8, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
		self.termLog = wx.TextCtrl(self.termPanel, style=wx.TE_MULTILINE | wx.TE_DONTWRAP)
		self.termLog.SetFont(f)
		self.termLog.SetEditable(0)
		self.termInput = wx.TextCtrl(self.termPanel, style=wx.TE_PROCESS_ENTER)
		self.termInput.SetFont(f)
		self._termHistory = []
		self._termHistoryIdx = 0

		sizer.Add(self.termLog, pos=(0, 0), flag=wx.EXPAND)
		sizer.Add(self.termInput, pos=(1, 0), flag=wx.EXPAND)
		sizer.AddGrowableCol(0)
		sizer.AddGrowableRow(0)

		nb.AddPage(self.termPanel, _("Term"))

		self.sizer.AddGrowableRow(6)
		self.sizer.AddGrowableCol(3)

		self.Bind(wx.EVT_CLOSE, self.OnClose)
		self.connectButton.Bind(wx.EVT_BUTTON, self.OnConnect)
		#self.loadButton.Bind(wx.EVT_BUTTON, self.OnLoad)
		self.printButton.Bind(wx.EVT_BUTTON, self.OnPrint)
		self.pauseButton.Bind(wx.EVT_BUTTON, self.OnPause)
		self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
		self.errorLogButton.Bind(wx.EVT_BUTTON, self.OnErrorLog)

		self.Bind(wx.EVT_BUTTON, lambda e: (self.temperatureSelect.SetValue(int(profile.getProfileSettingFloat('print_temperature'))), self.machineCom.sendCommand("M104 S%d" % (int(profile.getProfileSettingFloat('print_temperature'))))), self.temperatureHeatUp)
		self.Bind(wx.EVT_SPINCTRL, self.OnTempChange, self.temperatureSelect)
		self.Bind(wx.EVT_SPINCTRL, self.OnBedTempChange, self.bedTemperatureSelect)

		self.Bind(wx.EVT_TEXT_ENTER, self.OnTermEnterLine, self.termInput)
		self.termInput.Bind(wx.EVT_CHAR, self.OnTermKey)

		self.Layout()
		self.Fit()
		self.Centre()

		self.statsText.SetMinSize(self.statsText.GetSize())
		self.statsText.SetLabel(self._printerConnection.getStatusString())

		self.UpdateButtonStates()

		if webcam.hasWebcamSupport():
			#Need to call the camera class on the GUI thread, or else it won't work. Shame as it hangs the GUI for about 2 seconds.
			wx.CallAfter(self._webcamCheck)

		self._printerConnection.addCallback(self._doPrinterConnectionUpdate)
Exemplo n.º 13
0
    def __init__(self, parent):

        wx.Panel.__init__(self, parent, -1)
        self.entered_username = ""
        self.entered_password = ""
        self.job_id = 1
        self.display_response = "data"
        self.data_entry = "data"
        self.states = []
        self.send_data = {
            'data': '',
            'headers': 'User-Agent: RESTClient-%s' % VERSION.replace(":", "")
        }

        url_label = wx.StaticText(self, -1, "URL:")
        self.url = wx.ComboBox(self, 501, DEFAULT_URL, (90, 80), (-1, -1),
                               [DEFAULT_URL], wx.CB_DROPDOWN)

        wx.CallAfter(self.url.SetInsertionPoint, 0)
        self.url.Bind(wx.EVT_CHAR, self.URLEvtChar)
        self.Bind(wx.EVT_COMBOBOX, self.HistorySelect, self.url)

        self.methodList = ['GET', 'POST', 'PUT', 'DELETE']

        self.ch = wx.Choice(self, -1, (100, 50), choices=self.methodList)
        self.ch.Select(0)

        content_label = wx.StaticText(self, -1, "Your Content")
        self.content_entry = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)

        self.content_entry.SetInsertionPoint(0)

        remote_content_label = wx.StaticText(self, -1, "Remote Content")
        response_code = wx.StaticText(self, -1, "")
        self.response_code = response_code
        t3 = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)

        t3.SetInsertionPoint(0)

        b = wx.Button(self, -1, "Load URL")
        self.Bind(wx.EVT_BUTTON, self.LoadDataEvent, b)

        self.headers_button = wx.Button(self, -1, "Show Headers")
        self.Bind(wx.EVT_BUTTON, self.ShowOtherResponse, self.headers_button)

        self.entry_headers = wx.Button(self, -1, "Change Headers")
        self.Bind(wx.EVT_BUTTON, self.ShowOtherEntry, self.entry_headers)

        self.tc = t3

        basic_auth_button = wx.Button(self, -1, "Enter Basic Auth Info")
        self.Bind(wx.EVT_BUTTON, self.EnterBasicAuthInfo, basic_auth_button)

        space = 4
        bsizer = wx.BoxSizer(wx.VERTICAL)
        bsizer.Add(self.ch, 0, wx.GROW | wx.ALL, space)
        bsizer.Add(self.entry_headers, 0, wx.GROW | wx.ALL, space)
        bsizer.Add(basic_auth_button, 0, wx.GROW | wx.ALL, space)

        self.gauge = wx.Gauge(self, -1, 50, (110, 50), (200, 25))

        sizer = wx.FlexGridSizer(cols=3, hgap=space, vgap=space)
        sizer.AddGrowableCol(1)
        sizer.AddGrowableRow(2)
        sizer.AddGrowableRow(4)
        sizer.AddMany([
            url_label,
            (self.url, 0, wx.EXPAND),
            b,
            (0, 0),
            (self.gauge, 0, wx.EXPAND),
            (0, 0),
            content_label,
            (self.content_entry, 0, wx.EXPAND),
            bsizer,
            remote_content_label,
            response_code,
            self.headers_button,
            (0, 0),
            (t3, 0, wx.EXPAND),
            (0, 0),
        ])
        border = wx.BoxSizer(wx.VERTICAL)
        border.Add(sizer, 1, wx.EXPAND | wx.ALIGN_CENTRE | wx.ALL, 25)
        self.SetSizer(border)
        self.SetAutoLayout(True)
Exemplo n.º 14
0
    def __init__(self, parent, dll, hDrvHandle, text):
        self.dll = dll
        self.hDrvHandle = hDrvHandle
        self.code = None
        self.codeFormat = UUIRTDRV_IRFMT_PRONTO
        eg.Dialog.__init__(self,
                           parent,
                           -1,
                           text.title,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        staticText = wx.StaticText(self, -1, text.helpText)

        sb = wx.StaticBox(self, -1, text.progress)
        progressSizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
        progressCtrl = wx.Gauge(self, -1, 100, size=(250, 25))
        self.progressCtrl = progressCtrl
        progressSizer.Add(progressCtrl, 0, wx.ALL | wx.EXPAND, 5)

        sb = wx.StaticBox(self, -1, text.signalQuality)
        sigQualitySizer = wx.StaticBoxSizer(sb, wx.HORIZONTAL)
        sigQualityCtrl = wx.Gauge(self,
                                  -1,
                                  100,
                                  size=(25, 100),
                                  style=wx.GA_VERTICAL | wx.GA_SMOOTH)
        self.sigQualityCtrl = sigQualityCtrl
        sigQualitySizer.Add(sigQualityCtrl, 0, wx.ALL | wx.EXPAND, 5)

        sb = wx.StaticBox(self, -1, text.frequency)
        carrierFreqSizer = wx.StaticBoxSizer(sb, wx.HORIZONTAL)
        carrierFreqCtrl = wx.StaticText(self, -1, "-", style=wx.ALIGN_CENTER)
        self.carrierFreqCtrl = carrierFreqCtrl
        carrierFreqSizer.Add(carrierFreqCtrl, 1, wx.EXPAND | wx.ALL, 5)

        forceRawCtrl = wx.CheckBox(self, -1, text.forceRaw)
        forceRawCtrl.Bind(wx.EVT_CHECKBOX, self.OnRawBox)
        self.forceRawCtrl = forceRawCtrl

        cancelButton = wx.Button(self, wx.ID_CANCEL, eg.text.General.cancel)
        cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
        cancelButton.SetDefault()

        burstButton = wx.Button(self, wx.ID_CANCEL, text.acceptBurstButton)
        burstButton.Bind(wx.EVT_BUTTON, self.OnAcceptBurst)
        burstButton.Enable(False)
        self.burstButton = burstButton

        leftSizer = wx.BoxSizer(wx.VERTICAL)
        leftSizer.Add(staticText, 0, wx.EXPAND | wx.TOP, 5)
        leftSizer.Add((5, 5), 1)
        leftSizer.Add(forceRawCtrl)

        rightSizer = wx.BoxSizer(wx.VERTICAL)
        rightSizer.Add((15, 15))
        rightSizer.Add(burstButton, 0, wx.EXPAND | wx.ALIGN_RIGHT)
        rightSizer.Add((5, 5))
        rightSizer.Add(cancelButton, 0, wx.EXPAND | wx.ALIGN_RIGHT)
        rightSizer.Add((0, 0), 1)
        rightSizer.Add(carrierFreqSizer, 0, wx.EXPAND)

        upperRowSizer = wx.BoxSizer(wx.HORIZONTAL)
        upperRowSizer.Add(leftSizer, 1, wx.EXPAND)
        upperRowSizer.Add((5, 5))
        upperRowSizer.Add(sigQualitySizer, 0, wx.EXPAND)
        upperRowSizer.Add((5, 5))
        upperRowSizer.Add(rightSizer, 0, wx.EXPAND)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(upperRowSizer, 1, wx.EXPAND | wx.ALL, 5)
        sizer.Add(progressSizer, 0, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        sizer.Fit(self)
        self.SetMinSize(self.GetSize())
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.StartLearnIR()
Exemplo n.º 15
0
    def __init__(self, parent, driftTracker, winid=-1, showPlots=True):
        # begin wxGlade: MyFrame1.__init__
        #kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Panel.__init__(self, parent, winid)
        self.dt = driftTracker
        self.plotInterval = 10
        self.showPlots = showPlots

        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.cbTrack = wx.CheckBox(self, -1, 'Track')
        hsizer.Add(self.cbTrack, 0, wx.ALL, 2)
        self.cbTrack.Bind(wx.EVT_CHECKBOX, self.OnCBTrack)
        self.cbLock = wx.CheckBox(self, -1, 'Lock')
        self.cbLock.Bind(wx.EVT_CHECKBOX, self.OnCBLock)
        hsizer.Add(self.cbLock, 0, wx.ALL, 2)
        #self.bSaveHist = wx.Button(self, -1, 'Save Hist')
        #hsizer.Add(self.bSaveHist, 0, wx.ALL, 2)
        #self.bSaveHist.Bind(wx.EVT_BUTTON, self.OnBSaveHist)
        self.cbLockActive = wx.CheckBox(self, -1, 'Lock Active')
        self.cbLockActive.Enable(False)
        hsizer.Add(self.cbLockActive, 0, wx.ALL, 2)
        sizer_1.Add(hsizer, 0, wx.EXPAND, 0)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        self.bSetPostion = wx.Button(self, -1, 'Set focus to current')
        hsizer.Add(self.bSetPostion, 0, wx.ALL, 2)
        self.bSetPostion.Bind(wx.EVT_BUTTON, self.OnBSetPostion)
        #self.bSaveCalib = wx.Button(self, -1, 'Save Cal')
        #hsizer.Add(self.bSaveCalib, 0, wx.ALL, 2)
        #self.bSaveCalib.Bind(wx.EVT_BUTTON, self.OnBSaveCalib)
        sizer_1.Add(hsizer, 0, wx.EXPAND, 0)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.Add(wx.StaticText(self, -1, "Calibration:"), 0,
                   wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.gCalib = wx.Gauge(self, -1, 11)
        hsizer.Add(self.gCalib, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        sizer_1.Add(hsizer, 0, wx.EXPAND, 0)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.Add(wx.StaticText(self, -1, "Tolerance [nm]:"), 0,
                   wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.tTolerance = wx.TextCtrl(self,
                                      -1,
                                      '%3.0f' %
                                      (1e3 * self.dt.get_focus_tolerance()),
                                      size=[30, -1])
        hsizer.Add(self.tTolerance, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.bSetTolerance = wx.Button(self, -1, 'Set', style=wx.BU_EXACTFIT)
        hsizer.Add(self.bSetTolerance, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.bSetTolerance.Bind(wx.EVT_BUTTON, self.OnBSetTolerance)
        sizer_1.Add(hsizer, 0, wx.EXPAND, 0)

        # hsizer = wx.BoxSizer(wx.HORIZONTAL)
        # hsizer.Add(wx.StaticText(self, -1, "Z-factor:"), 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        # self.tZfactor = wx.TextCtrl(self, -1, '%3.1f'% self.dt.Zfactor, size=[30,-1])
        # hsizer.Add(self.tZfactor, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        # self.bSetZfactor = wx.Button(self, -1, 'Set', style=wx.BU_EXACTFIT)
        # hsizer.Add(self.bSetZfactor, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        # self.bSetZfactor.Bind(wx.EVT_BUTTON, self.OnBSetZfactor)
        # self.bCalcZfactor = wx.Button(self, -1, 'Calculate Z-factor', style=wx.BU_EXACTFIT)
        # hsizer.Add(self.bCalcZfactor, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        # self.bCalcZfactor.Bind(wx.EVT_BUTTON, self.OnBCalculateZfactor)
        # sizer_1.Add(hsizer,0, wx.EXPAND, 0)

        # hsizer = wx.BoxSizer(wx.HORIZONTAL)
        # hsizer.Add(wx.StaticText(self, -1, "feedback delay [frames]:"), 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        # self.tMinDelay = wx.TextCtrl(self, -1, '%d' % (self.dt.minDelay), size=[30,-1])
        # hsizer.Add(self.tMinDelay, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        # self.bSetMinDelay = wx.Button(self, -1, 'Set', style=wx.BU_EXACTFIT)
        # hsizer.Add(self.bSetMinDelay, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        # self.bSetMinDelay.Bind(wx.EVT_BUTTON, self.OnBSetMinDelay)
        # sizer_1.Add(hsizer,0, wx.EXPAND, 0)
        #
        # hsizer = wx.BoxSizer(wx.HORIZONTAL)
        # hsizer.Add(wx.StaticText(self, -1, "Plot Interval [frames]:"), 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        # self.tPlotInterval = wx.TextCtrl(self, -1, '%d' % (self.plotInterval), size=[30,-1])
        # hsizer.Add(self.tPlotInterval, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        # self.bSetPlotInterval = wx.Button(self, -1, 'Set', style=wx.BU_EXACTFIT)
        # hsizer.Add(self.bSetPlotInterval, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        # self.bSetPlotInterval.Bind(wx.EVT_BUTTON, self.OnBSetPlotInterval)
        # sizer_1.Add(hsizer,0, wx.EXPAND, 0)
        #

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        self.stError = wx.StaticText(self, -1, 'Error:\n\n', size=[200, -1])
        cfont = self.stError.GetFont()
        font = wx.Font(cfont.GetPointSize(), wx.TELETYPE, wx.NORMAL, wx.NORMAL)
        self.stError.SetFont(font)
        hsizer.Add(self.stError, 0, wx.ALL, 2)
        sizer_1.Add(hsizer, 0, wx.EXPAND, 0)

        if self.showPlots:
            self.trackPlot = TrackerPlotPanel(self, self.dt, size=[300, 500])

            #hsizer.Add(self.stError, 0, wx.ALL, 2)
            sizer_1.Add(self.trackPlot, 0, wx.EXPAND, 0)

        self.SetAutoLayout(1)
        self.SetSizer(sizer_1)
        sizer_1.Fit(self)
        sizer_1.SetSizeHints(self)
        self.Layout()
Exemplo n.º 16
0
 def create_widget(self):
     self.widget = wx.Gauge(self.parent.widget,
                            self.id,
                            self.range,
                            style=self.style)
    color_select.Disable()
    start = wx.Button(panel, 200, 'スタート', size=(80, 50))
    start.Disable()
    cancel = wx.Button(panel, 201, 'キャンセル', size=(80, 50))
    turn_end = wx.Button(panel, 202, 'ターンエンド', size=(80, 50))
    layout = wx.BoxSizer(wx.HORIZONTAL)
    layout.Add(mode_select, border=10)
    layout.Add(color_select, border=10)
    layout.Add(start)
    layout.Add(cancel)
    layout.Add(turn_end)
    panel.SetSizer(layout)

    gauge = wx.Gauge(panel,
                     range=turn,
                     style=wx.GA_VERTICAL,
                     pos=(710, 120),
                     size=(70, 700))
    gauge.GetShadowWidth()

    bluepoint_text = wx.StaticText(panel,
                                   -1,
                                   '青\n取得済み得点:0 \n領域得点:0',
                                   style=wx.SIMPLE_BORDER,
                                   pos=(0, 51))
    redpoint_text = wx.StaticText(panel,
                                  -1,
                                  '赤\n取得済み得点:0 \n領域得点:0',
                                  style=wx.SIMPLE_BORDER,
                                  pos=(0, 99))
    turnunm = wx.StaticText(panel,
Exemplo n.º 18
0
    def __init__(self,
                 parent,
                 id,
                 title,
                 params,
                 prime_file,
                 out_file,
                 mp_method='python',
                 command=None):
        wx.Frame.__init__(self,
                          parent,
                          id,
                          title,
                          size=(800, 900),
                          style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX
                          | wx.RESIZE_BORDER)

        self.logtext = ''
        self.pparams = params
        self.prime_file = prime_file
        self.out_file = os.path.join(self.pparams.run_no, 'log.txt')
        self.bookmark = 0
        self.prev_pids = []
        self.aborted = False
        self.command = command
        self.mp_method = mp_method
        self.current_cycle = -1

        self.main_panel = wx.Panel(self)
        self.main_sizer = wx.BoxSizer(wx.VERTICAL)

        # Toolbar
        self.prime_toolbar = self.CreateToolBar(wx.TB_TEXT)
        abort_bmp = bitmaps.fetch_icon_bitmap('actions', 'stop')
        self.tb_btn_abort = self.prime_toolbar.AddLabelTool(wx.ID_ANY,
                                                            label='Abort',
                                                            bitmap=abort_bmp,
                                                            shortHelp='Abort')
        self.prime_toolbar.Realize()

        # Status box
        self.status_panel = wx.Panel(self.main_panel)
        self.status_sizer = wx.BoxSizer(wx.VERTICAL)
        self.status_box = wx.StaticBox(self.status_panel, label='Status')
        self.status_box_sizer = wx.StaticBoxSizer(self.status_box,
                                                  wx.HORIZONTAL)
        self.status_txt = wx.StaticText(self.status_panel, label='')
        self.status_box_sizer.Add(self.status_txt,
                                  flag=wx.ALL | wx.ALIGN_CENTER,
                                  border=10)
        self.status_sizer.Add(self.status_box_sizer,
                              flag=wx.EXPAND | wx.ALL,
                              border=3)
        self.status_panel.SetSizer(self.status_sizer)

        # Tabbed output window(s)
        self.prime_panel = wx.Panel(self.main_panel)
        self.prime_nb = wx.Notebook(self.prime_panel, style=0)
        self.log_tab = LogTab(self.prime_nb)
        self.graph_tab = RuntimeTab(self.prime_nb, params=self.pparams)
        self.prime_nb.AddPage(self.log_tab, 'Log')
        self.prime_nb.AddPage(self.graph_tab, 'Charts')
        self.prime_nb.SetSelection(1)
        self.prime_sizer = wx.BoxSizer(wx.VERTICAL)
        self.prime_sizer.Add(self.prime_nb,
                             1,
                             flag=wx.EXPAND | wx.ALL,
                             border=3)
        self.prime_panel.SetSizer(self.prime_sizer)

        self.main_sizer.Add(self.status_panel,
                            flag=wx.EXPAND | wx.ALL,
                            border=3)
        self.main_sizer.Add(self.prime_panel,
                            1,
                            flag=wx.EXPAND | wx.ALL,
                            border=3)
        self.main_panel.SetSizer(self.main_sizer)

        #Processing status bar
        self.sb = self.CreateStatusBar()
        self.sb.SetFieldsCount(2)
        self.sb.SetStatusWidths([-1, -2])

        # Output gauge in status bar
        self.gauge_prime = wx.Gauge(self.sb,
                                    -1,
                                    style=wx.GA_HORIZONTAL | wx.GA_SMOOTH)
        rect = self.sb.GetFieldRect(0)
        self.gauge_prime.SetPosition((rect.x + 2, rect.y + 2))
        self.gauge_prime.SetSize((rect.width - 4, rect.height - 4))
        self.gauge_prime.Hide()

        # Output polling timer
        self.timer = wx.Timer(self)

        # Event bindings
        self.Bind(thr.EVT_ALLDONE, self.onFinishedProcess)
        self.sb.Bind(wx.EVT_SIZE, self.onStatusBarResize)
        self.Bind(wx.EVT_TIMER, self.onTimer, id=self.timer.GetId())

        # Button bindings
        self.Bind(wx.EVT_TOOL, self.onAbort, self.tb_btn_abort)

        self.run()
Exemplo n.º 19
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,
                  self.All_Widgets_menubar.mn_RemoveTabs)
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Edit"))
        wxglade_tmp_menu = wx.Menu()
        wxglade_tmp_menu.Append(wx.ID_HELP, _("Manual"),
                                _("Show the application manual"))
        self.Bind(wx.EVT_MENU, self.onShowManual, id=wx.ID_HELP)
        wxglade_tmp_menu.AppendSeparator()
        wxglade_tmp_menu.Append(wx.ID_ABOUT, _("About"),
                                _("Show the About dialog"))
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Help"))
        self.SetMenuBar(self.All_Widgets_menubar)
        # Menu Bar end

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

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

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

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

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

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

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

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

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

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

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

        sizer_28 = wx.BoxSizer(wx.HORIZONTAL)

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

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

        sizer_12 = wx.BoxSizer(wx.HORIZONTAL)

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

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

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

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

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

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

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

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

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

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

        sizer_26 = wx.BoxSizer(wx.HORIZONTAL)

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

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

        sizer_5 = wx.BoxSizer(wx.HORIZONTAL)

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

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

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

        sizer_6 = wx.BoxSizer(wx.VERTICAL)

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

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

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

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

        sizer_17 = wx.BoxSizer(wx.HORIZONTAL)

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

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

        sizer_15 = wx.BoxSizer(wx.HORIZONTAL)

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

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

        sizer_19 = wx.BoxSizer(wx.HORIZONTAL)

        self.grid_1 = wx.grid.Grid(self.notebook_1_wxGrid,
                                   wx.ID_ANY,
                                   size=(1, 1))
        self.grid_1.CreateGrid(10, 3)
        self.grid_1.SetSelectionMode(wx.grid.Grid.SelectRows)
        sizer_19.Add(self.grid_1, 1, wx.EXPAND, 0)

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

        sizer_20 = wx.BoxSizer(wx.HORIZONTAL)

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

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

        sizer_4 = wx.BoxSizer(wx.VERTICAL)

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

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

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

        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)

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

        self.notebook_1_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)
        sizer_14.Add(self.spin_ctrl_1, 1, wx.ALL, 5)

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

        sizer_29 = wx.BoxSizer(wx.HORIZONTAL)

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

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

        sizer_30 = wx.BoxSizer(wx.HORIZONTAL)

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

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

        sizer_31 = wx.BoxSizer(wx.HORIZONTAL)

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

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

        sizer_25 = wx.BoxSizer(wx.HORIZONTAL)

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

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

        sizer_32 = wx.BoxSizer(wx.VERTICAL)

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

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

        sizer_33 = wx.BoxSizer(wx.VERTICAL)

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

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

        sizer_11 = wx.BoxSizer(wx.VERTICAL)

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

        self.bitmap_file = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY,
            wx.Bitmap("icon.png", 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.notebook_1_wxStaticLine = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxStaticLine,
                                _("wxStaticLine"))

        sizer_9 = wx.BoxSizer(wx.VERTICAL)

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

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

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

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

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

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

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

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

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

        self.label_5 = wx.StaticText(self.notebook_1_wxStaticText,
                                     wx.ID_ANY,
                                     _("green on pink (RGB)"),
                                     style=wx.ALIGN_CENTER_HORIZONTAL)
        self.label_5.SetBackgroundColour(wx.Colour(255, 0, 255))
        self.label_5.SetForegroundColour(wx.Colour(0, 255, 0))
        self.label_5.SetToolTipString(
            _("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_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_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_BUTTON, self.onStartConverting, self.button_1)
Exemplo n.º 20
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=u"西瓜视频下载",
                          pos=wx.DefaultPosition,
                          size=wx.Size(800, 315),
                          style=wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP
                          | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.Size(-1, -1), wx.DefaultSize)
        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DLIGHT))

        bSizerMain = wx.BoxSizer(wx.VERTICAL)

        bSizerRow1 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText_url = wx.StaticText(self, wx.ID_ANY, u"URL",
                                              wx.DefaultPosition,
                                              wx.Size(40, -1), wx.ALIGN_RIGHT)
        self.m_staticText_url.Wrap(-1)

        bSizerRow1.Add(self.m_staticText_url, 0,
                       wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        self.m_textCtrl_url = wx.TextCtrl(self, wx.ID_ANY,
                                          wx.EmptyString, wx.DefaultPosition,
                                          wx.Size(-1, 25), 0)
        bSizerRow1.Add(self.m_textCtrl_url, 1,
                       wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.m_button_download = wx.Button(self, wx.ID_ANY,
                                           u"下载", wx.DefaultPosition,
                                           wx.Size(80, -1), 0)

        self.m_button_download.SetBitmapPosition(wx.RIGHT)
        bSizerRow1.Add(self.m_button_download, 0,
                       wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)

        bSizerMain.Add(
            bSizerRow1, 0,
            wx.RIGHT | wx.LEFT | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)

        bSizerRow_option = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText_url111 = wx.StaticText(self, wx.ID_ANY, u"选项",
                                                 wx.DefaultPosition,
                                                 wx.Size(40,
                                                         -1), wx.ALIGN_RIGHT)
        self.m_staticText_url111.Wrap(-1)

        bSizerRow_option.Add(self.m_staticText_url111, 0,
                             wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        self.m_checkBox_option = wx.CheckBox(self, wx.ID_ANY, u"单独下载音频",
                                             wx.DefaultPosition,
                                             wx.DefaultSize, wx.ALIGN_RIGHT)
        self.m_checkBox_option.SetValue(False)
        bSizerRow_option.Add(self.m_checkBox_option, 0, wx.ALL | wx.EXPAND, 5)

        bSizerMain.Add(bSizerRow_option, 0, wx.EXPAND, 5)

        bSizerRow2 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText_url11 = wx.StaticText(self, wx.ID_ANY, u"进度",
                                                wx.DefaultPosition,
                                                wx.Size(40,
                                                        -1), wx.ALIGN_RIGHT)
        self.m_staticText_url11.Wrap(-1)

        bSizerRow2.Add(self.m_staticText_url11, 0,
                       wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        self.m_gauge = wx.Gauge(self, wx.ID_ANY, 100, wx.DefaultPosition,
                                wx.Size(-1, 25), wx.GA_HORIZONTAL)
        self.m_gauge.SetValue(0)
        bSizerRow2.Add(self.m_gauge, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        bSizerMain.Add(bSizerRow2, 0, wx.EXPAND, 5)

        bSizerRow_progress_info = wx.BoxSizer(wx.HORIZONTAL)

        bSizerRow_progress_info.Add(
            (40, 3), 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 5)

        self.m_staticText_info = wx.StaticText(self, wx.ID_ANY, u"",
                                               wx.DefaultPosition,
                                               wx.Size(40, -1), wx.ALIGN_LEFT)
        bSizerRow_progress_info.Add(self.m_staticText_info, 1,
                                    wx.ALL | wx.EXPAND, 5)

        bSizerMain.Add(bSizerRow_progress_info, 0, wx.EXPAND, 0)

        bSizerRow5 = wx.BoxSizer(wx.HORIZONTAL)

        bSizerRow5.Add((40, 3), 0,
                       wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 5)

        self.m_richText_info = wx.richtext.RichTextCtrl(
            self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
            wx.Size(-1, 200),
            0 | wx.VSCROLL | wx.HSCROLL | wx.NO_BORDER | wx.WANTS_CHARS)
        bSizerRow5.Add(self.m_richText_info, 1, wx.ALL, 5)

        bSizerMain.Add(bSizerRow5, 0, wx.EXPAND, 0)

        self.SetSizer(bSizerMain)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.m_button_download.Bind(wx.EVT_LEFT_UP, self.clickup)
        self.m_richText_info.SetEditable(False)
        self.m_textCtrl_url.SetValue(
            "https://www.ixigua.com/i6832441533485023757/?logTag=l6r5Zch4RoIqgpQmXIcxW"
        )
        # pub.subscribe(self.update_display, "update")

        self.download_title = ""
Exemplo n.º 21
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           title=GT(u'Quick Build'),
                           pos=wx.DefaultPosition,
                           size=wx.Size(400, 260))

        self.title = self.GetTitle()

        label_stage = wx.StaticText(self, label=GT(u'Staged directory tree'))
        self.input_stage = wx.TextCtrl(self)
        self.input_stage.SetToolTip(
            wx.ToolTip(GT(u'Root directory of build tree')))

        btn_browse_stage = CreateButton(self, btnid.STAGE, image=u'browse')
        btn_browse_stage.Bind(wx.EVT_BUTTON, self.OnBrowse)

        label_target = wx.StaticText(self, label=GT(u'Target file'))
        self.input_target = wx.TextCtrl(self)
        self.input_target.SetToolTip(wx.ToolTip(GT(u'Target output file')))

        btn_browse_target = CreateButton(self, btnid.TARGET, image=u'browse')
        btn_browse_target.Bind(wx.EVT_BUTTON, self.OnBrowse)

        btn_build = CreateButton(self, btnid.BUILD)
        btn_build.SetToolTip(wx.ToolTip(GT(u'Start building')))
        btn_build.Bind(wx.EVT_BUTTON, self.OnBuild)

        btn_cancel = CreateButton(self, btnid.EXIT)
        btn_cancel.SetToolTip(wx.ToolTip(GT(u'Close dialog')))
        btn_cancel.Bind(wx.EVT_BUTTON, self.OnClose)

        self.gauge = wx.Gauge(self, GAUGE_MAX)

        self.timer = DebreateTimer(self)
        self.Bind(wx.EVT_TIMER, self.OnUpdateProgress)
        self.Bind(EVT_TIMER_STOP, self.OnTimerStop)

        # *** Layout *** #

        Lstage_V1 = BoxSizer(wx.VERTICAL)
        Lstage_V1.Add(label_stage, 0, wx.ALIGN_LEFT)
        Lstage_V1.Add(self.input_stage, 1, wx.EXPAND)

        Lstage_H1 = BoxSizer(wx.HORIZONTAL)
        Lstage_H1.Add(Lstage_V1, 3, wx.ALIGN_TOP)
        Lstage_H1.Add(btn_browse_stage, 0, wx.ALIGN_TOP | wx.TOP, 7)

        Ltarget_V1 = BoxSizer(wx.VERTICAL)
        Ltarget_V1.Add(label_target, 0, wx.ALIGN_LEFT)
        Ltarget_V1.Add(self.input_target, 1, wx.EXPAND)

        Ltarget_H1 = BoxSizer(wx.HORIZONTAL)
        Ltarget_H1.Add(Ltarget_V1, 3, wx.ALIGN_TOP)
        Ltarget_H1.Add(btn_browse_target, 0, wx.ALIGN_TOP | wx.TOP, 7)

        Lbtn_H1 = BoxSizer(wx.HORIZONTAL)
        Lbtn_H1.Add(btn_build, 1, wx.ALIGN_BOTTOM | wx.RIGHT, 2)
        Lbtn_H1.Add(btn_cancel, 1, wx.ALIGN_BOTTOM | wx.LEFT, 2)

        Lguage_H1 = BoxSizer(wx.HORIZONTAL)
        Lguage_H1.Add(self.gauge, 1, lyt.PAD_LR, 5)

        Lmain_V = BoxSizer(wx.VERTICAL)
        Lmain_V.AddSpacer(1, wx.EXPAND)
        Lmain_V.Add(Lstage_H1, -1, wx.EXPAND | lyt.PAD_LR, 5)
        Lmain_V.Add(Ltarget_H1, -1, wx.EXPAND | lyt.PAD_LR, 5)
        Lmain_V.Add(Lbtn_H1, -1, wx.ALIGN_CENTER | wx.ALL, 5)
        Lmain_V.Add(Lguage_H1, -1, wx.EXPAND | wx.ALL, 5)
        Lmain_V.AddSpacer(1, wx.EXPAND)

        self.SetAutoLayout(True)
        self.SetSizer(Lmain_V)
        self.Layout()

        self.Bind(wx.EVT_CLOSE, self.OnClose)

        self.CenterOnParent()

        # For showing error dialog after build thread exits
        self.build_error = None
Exemplo n.º 22
0
    def __init__(self):
        # ------------------------------------------------------------------------------------------------------------ #
        # PDCA 信息提前读取
        PDCAIPAdress = "PDCA IP Address"
        UserName = "******"
        PassWord = "******"
        try:
            with open(pdca_file) as fd:
                for line in fd:
                    if "PDCAIP:" in line:
                        PDCAIPAdress = str(line).split('PDCAIP:')[1].replace(
                            '\n', '')
                    if "PDCAAccount:" in line:
                        UserName = str(line).split('PDCAAccount:')[1].replace(
                            '\n', '')
                    if "PDCAPassword:"******"MyApp",
                          size=(1000, 800),
                          style=wx.DEFAULT_FRAME_STYLE)
        panel = wx.Panel(self, -1)

        font = wx.Font(100, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False,
                       'Courier New')
        self.SetFont(font)

        self.button = buttons.GenButton(panel,
                                        -1,
                                        'Start',
                                        size=(180, 90),
                                        pos=(780, 30))
        self.button.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.BOLD, False))
        self.Bind(wx.EVT_BUTTON, self.OnClick, self.button)
        self.button.SetDefault()
        self.button.SetBezelWidth(5)
        self.button.SetBackgroundColour('Green')

        self.basicText1 = wx.TextCtrl(panel,
                                      -1,
                                      "Enter File Path Road or Others",
                                      size=(700, 25),
                                      pos=(50, 80),
                                      style=wx.TE_LEFT)

        self.basic2Text = wx.TextCtrl(panel,
                                      -1,
                                      "",
                                      size=(900, 450),
                                      pos=(50, 300),
                                      style=wx.TE_MULTILINE | wx.TE_READONLY
                                      | wx.TE_RICH)
        self.basic2Text.SetInsertionPoint(0)

        Label6 = wx.StaticText(panel, -1, "剩余:", pos=(50, 280))
        self.text_eight = wx.TextCtrl(panel,
                                      -1,
                                      "",
                                      size=(45, 20),
                                      pos=(83, 280),
                                      style=wx.TE_LEFT | wx.TE_READONLY)
        # ------------------------------------------------------------------------------------------------------------ #
        #  时间更新
        self.basic3Text = wx.TextCtrl(panel,
                                      -1,
                                      "",
                                      size=(155, 20),
                                      pos=(50, 30),
                                      style=wx.TE_MULTILINE | wx.TE_READONLY
                                      | wx.TE_CENTER)
        self.basic3Text.SetInsertionPoint(0)
        # ------------------------------------------------------------------------------------------------------------ #
        #  天气更新
        self.basic4Text = wx.TextCtrl(panel,
                                      -1,
                                      "",
                                      size=(520, 38),
                                      pos=(230, 20),
                                      style=wx.TE_MULTILINE | wx.TE_READONLY
                                      | wx.TE_LEFT)
        self.basic4Text.SetInsertionPoint(0)
        # ------------------------------------------------------------------------------------------------------------ #
        Label1 = wx.StaticText(panel, -1, "PDCA 信息:", pos=(750, 150))
        self.Text1 = wx.TextCtrl(panel,
                                 -1,
                                 PDCAIPAdress,
                                 size=(200, 20),
                                 pos=(750, 180))
        self.Text2 = wx.TextCtrl(panel,
                                 -1,
                                 UserName,
                                 size=(200, 20),
                                 pos=(750, 210))
        self.Text3 = wx.TextCtrl(panel,
                                 -1,
                                 PassWord,
                                 size=(200, 20),
                                 pos=(750, 240),
                                 style=wx.TE_PASSWORD)
        self.Text4 = wx.TextCtrl(panel,
                                 -1,
                                 "Log Keys",
                                 size=(100, 20),
                                 pos=(850, 150),
                                 style=wx.TE_CENTER)
        # ------------------------------------------------------------------------------------------------------------ #
        #  CM 输入框
        self.basic5Text = wx.TextCtrl(panel,
                                      -1,
                                      "CM Bundle Name",
                                      size=(200, 20),
                                      pos=(750, 270),
                                      style=wx.TE_MULTILINE | wx.TE_LEFT)
        self.basic5Text.SetInsertionPoint(0)
        # ------------------------------------------------------------------------------------------------------------ #

        self.sampleList = [
            '空选项(默认)', 'PDCA Log 下载', 'Download Log 处理', '79A Runin 时间计算',
            'Bundle Download', '等待更新', '等待更新', '等待更新', '等待更新', '文件解密', '文件加密',
            '天气播报', '检查磁盘信息', '解释说明', '未来7天天气', '清除记录'
        ]
        self.checkbox = wx.RadioBox(panel, -1, '功能选择栏(单选)', (50, 120),
                                    wx.DefaultSize, self.sampleList, 4,
                                    wx.RA_SPECIFY_COLS)
        # ------------------------------------------------------------------------------------------------------------ #
        # 进度条显示
        self.count = 0
        self.gauge = wx.Gauge(panel, -1, 50, (50, 250), (650, 25))
        self.gauge.SetBezelFace(5)
        self.gauge.SetShadowWidth(5)
        self.Bind(wx.EVT_IDLE, self.OnIdle)
        self.text_eight.SetBackgroundColour('Green')
        # ------------------------------------------------------------------------------------------------------------ #
        # 网络状态显示
        self.img1 = wx.Image(
            os.path.dirname(sys.argv[0]) + '/png/' + 'pass.png',
            wx.BITMAP_TYPE_PNG).ConvertToBitmap()  # pass
        self.img2 = wx.Image(
            os.path.dirname(sys.argv[0]) + '/png/' + 'fail.png',
            wx.BITMAP_TYPE_PNG).ConvertToBitmap()  # fail

        Label2 = wx.StaticText(panel, -1, "PDCA", pos=(685, 180))
        self.network_one = wx.BitmapButton(panel,
                                           -1,
                                           self.img2,
                                           size=(30, 30),
                                           pos=(690, 200))
        Label3 = wx.StaticText(panel, -1, "SINA", pos=(685, 130))
        self.network_two = wx.BitmapButton(panel,
                                           -1,
                                           self.img2,
                                           size=(30, 30),
                                           pos=(690, 150))

        try:
            App_version = plistlib.readPlist(
                os.path.dirname(sys.argv[0]).replace('Resources', '') +
                'Info.plist')['CFBundleVersion']
        except:
            App_version = ""
        Label4 = wx.StaticText(panel, -1, App_version, pos=(945, 753))

        Label5 = wx.StaticText(panel, -1, "Log行数:", pos=(170, 280))
        self.text_nine = wx.TextCtrl(panel,
                                     -1,
                                     "",
                                     size=(55, 20),
                                     pos=(230, 280),
                                     style=wx.TE_LEFT | wx.TE_READONLY)
        self.text_nine.SetBackgroundColour('Green')

        time_start_add()  # 打开时间线程显示当前时间并实时刷新,以及显示天气情况
        weather_start()  # 打开天气更新线程,需连接网络状态
        thread.start_new(net_work_check, ())  # 检查网络状态
        thread.start_new(read_log, ())  # 显示历史记录
        thread.start_new(check_log_row, ())  # 检查log存储行数,大于1000时显示红色
Exemplo n.º 23
0
    def __init__(self):
        """
        Set up window
        """

        # dimensions
        WIDTH = 480
        HEIGHT = 789
        SIZE = (WIDTH, HEIGHT)
        WIDTH_LABEL = 100
        MARGIN = 10

        # everything else is derived from those
        WIDTH_CONTROL = WIDTH - (MARGIN * 5) - WIDTH_LABEL
        WIDTH_TEXT = WIDTH - (MARGIN * 3) - 6

        # used for 'transparent' backgrounds
        frame_background = wx.SystemSettings.GetColour(wx.SYS_COLOUR_FRAMEBK)

        # load version so we can show it in the UI
        # important so it can be asked for when debugging
        # todo: check for new version and show dialog if available?
        with open(resource("VERSION")) as version_file:
            version = version_file.read().strip()

        # set up main frame and panel
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        wx.Frame.__init__(self,
                          None,
                          title="DMI Instagram Scraper v%s" % version,
                          style=wx.CAPTION | wx.MINIMIZE_BOX | wx.CLOSE_BOX)
        self.SetSize(SIZE)
        self.main_panel = wx.Panel(self, wx.ID_ANY)
        self.main_panel.SetMinSize((-1, -1))
        main_sizer = wx.BoxSizer(wx.VERTICAL)

        # update check
        self.checkForUpdates(version)

        # listen for events
        self.scrape_event_id = wx.NewIdRef()
        self.Connect(-1, -1, self.scrape_event_id, self.handleScraperEvent)

        # icon
        icon = wx.Icon()
        icon.CopyFromBitmap(wx.Bitmap(resource("icon.png"),
                                      wx.BITMAP_TYPE_PNG))
        self.SetIcon(icon)

        # DMI Logo
        # branding! shown at the top of the window
        # logo = wx.Image("banner.png", wx.BITMAP_TYPE_PNG)
        wx_logo = wx.StaticBitmap(self, -1, wx.Bitmap(resource("banner.png")))
        logo_wrap = wx.BoxSizer(wx.HORIZONTAL)
        logo_wrap.Add(wx_logo, flag=wx.CENTER | wx.TOP, border=10)

        # Intro text
        # The last row is added separately to make it 'clickable' (wxPython
        # doesn't have in-text hyperlinks)
        intro = self.intro_mac if sys.platform == "darwin" else self.intro_win
        wikilink = self.wikilink_mac if sys.platform == "darwin" else self.wikilink_win
        intro_wrap = wx.BoxSizer(wx.VERTICAL)
        intro_wrap.Add(
            wx.StaticText(self.main_panel,
                          wx.ID_ANY,
                          intro,
                          size=(WIDTH_TEXT, 108)))
        intro_link = wx.StaticText(self.main_panel,
                                   wx.ID_ANY,
                                   wikilink,
                                   size=(WIDTH_TEXT, -1))
        intro_link.Bind(wx.EVT_LEFT_DOWN, self.openWiki)
        intro_link.SetCursor(wx.Cursor(wx.CURSOR_HAND))
        intro_wrap.Add(intro_link)

        # Query field
        # the actual queries are entered into this text field
        self.query_input = wx.TextCtrl(self.main_panel,
                                       wx.ID_ANY,
                                       "",
                                       style=wx.TE_MULTILINE | wx.TE_RICH,
                                       size=(WIDTH_CONTROL, 90))
        text_foreground = wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)
        text_background = wx.NullColour
        self.query_input.SetDefaultStyle(
            wx.TextAttr(text_foreground, text_background))
        self.query_input.Bind(wx.EVT_LEFT_DOWN, self.initQueryField)
        self.query_input.Bind(wx.EVT_KEY_DOWN, self.initQueryField)
        self.query_input.AppendText("#blessed\n@djkhaled")
        query_wrap = wx.BoxSizer(wx.HORIZONTAL)
        query_wrap.Add(wx.StaticText(self.main_panel,
                                     wx.ID_ANY,
                                     "Query",
                                     size=(WIDTH_LABEL, -1),
                                     style=wx.ALIGN_RIGHT),
                       flag=wx.RIGHT,
                       border=MARGIN)
        query_wrap.Add(self.query_input, flag=wx.EXPAND)

        # Amount of items
        # this number of items is scraped per query
        self.amount_input = wx.TextCtrl(self.main_panel,
                                        wx.ID_ANY,
                                        "50",
                                        size=(WIDTH_CONTROL, -1))
        amount_wrap = wx.BoxSizer(wx.HORIZONTAL)
        amount_wrap.Add(wx.StaticText(self.main_panel,
                                      wx.ID_ANY,
                                      "Items per query",
                                      size=(WIDTH_LABEL, -1),
                                      style=wx.ALIGN_RIGHT),
                        flag=wx.RIGHT,
                        border=MARGIN)
        amount_wrap.Add(self.amount_input)

        # Toggle comments scrape
        # if set, comments are also scraped, but this takes much longer
        self.comments_checkbox = wx.CheckBox(self.main_panel)
        self.photos_checkbox = wx.CheckBox(self.main_panel)
        self.metadata_checkbox = wx.CheckBox(self.main_panel)
        comments_wrap = wx.BoxSizer(wx.HORIZONTAL)
        comments_wrap.Add(wx.StaticText(self.main_panel,
                                        wx.ID_ANY,
                                        "Also scrape",
                                        size=(WIDTH_LABEL, -1),
                                        style=wx.ALIGN_RIGHT),
                          flag=wx.RIGHT,
                          border=MARGIN)
        comments_wrap.Add(self.comments_checkbox)
        comments_wrap.Add(wx.StaticText(self.main_panel, wx.ID_ANY,
                                        "Comments"))
        comments_wrap.Add(self.photos_checkbox, flag=wx.LEFT, border=10)
        comments_wrap.Add(
            wx.StaticText(self.main_panel, wx.ID_ANY, "Photo files"))
        comments_wrap.Add(self.metadata_checkbox, flag=wx.LEFT, border=10)
        comments_wrap.Add(
            wx.StaticText(self.main_panel, wx.ID_ANY, "Metadata files"))

        # File name
        # the results are saved as a CSV file here
        self.file_input = wx.TextCtrl(self.main_panel,
                                      wx.ID_ANY,
                                      "instagram-scrape.csv",
                                      size=(WIDTH_CONTROL, -1))
        file_wrap = wx.BoxSizer(wx.HORIZONTAL)
        file_wrap.Add(wx.StaticText(self.main_panel,
                                    wx.ID_ANY,
                                    "File name",
                                    size=(WIDTH_LABEL, -1),
                                    style=wx.ALIGN_RIGHT),
                      flag=wx.RIGHT,
                      border=MARGIN)
        file_wrap.Add(self.file_input)

        # Target folder
        # the folder where the results file is saved
        self.folder_input = wx.DirPickerCtrl(self.main_panel,
                                             wx.ID_ANY,
                                             os.path.expanduser("~" + os.sep +
                                                                "Documents"),
                                             size=(WIDTH_CONTROL, -1))
        folder_wrap = wx.BoxSizer(wx.HORIZONTAL)
        folder_wrap.Add(wx.StaticText(self.main_panel,
                                      wx.ID_ANY,
                                      "Folder to scrape to",
                                      size=(WIDTH_LABEL, -1),
                                      style=wx.ALIGN_RIGHT),
                        flag=wx.RIGHT,
                        border=MARGIN)
        folder_wrap.Add(self.folder_input)

        # Scrape button
        # clicking makes the scrape start or stop
        self.scrape_button = wx.Button(self.main_panel, wx.ID_ANY,
                                       "Start scraping")
        self.scrape_button.Bind(wx.EVT_LEFT_DOWN, self.scrapeControl)
        scrape_button_wrap = wx.BoxSizer(wx.HORIZONTAL)
        scrape_button_wrap.AddStretchSpacer()
        scrape_button_wrap.Add(self.scrape_button, 0, wx.CENTER, 0)
        scrape_button_wrap.AddStretchSpacer()

        # Progress bar
        # We can actually use this, sort of! Since at some point we will know
        # how many posts to scrape
        self.progress_bar = wx.Gauge(self.main_panel,
                                     wx.ID_ANY,
                                     range=100,
                                     style=wx.HORIZONTAL | wx.GA_SMOOTH
                                     | wx.GA_PROGRESS,
                                     size=(WIDTH_TEXT, 15))
        self.progress_bar.Disable()
        progress_wrap = wx.BoxSizer(wx.HORIZONTAL)
        progress_wrap.Add(self.progress_bar, wx.EXPAND)

        # Logger
        # a simple text field that cannot be written in, to which new
        # lines are added
        self.logger = wx.TextCtrl(self.main_panel,
                                  wx.ID_ANY,
                                  "",
                                  style=wx.TE_MULTILINE | wx.TE_READONLY
                                  | wx.TE_RICH | wx.BORDER_NONE,
                                  size=(WIDTH_CONTROL, 90))
        self.logger.SetDefaultStyle(
            wx.TextAttr(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT),
                        frame_background))
        self.logger.SetBackgroundColour(frame_background)
        self.logger.AppendText("Waiting for input...")
        status_wrap = wx.BoxSizer(wx.HORIZONTAL)
        status_wrap.Add(wx.StaticText(self.main_panel,
                                      wx.ID_ANY,
                                      "Status",
                                      size=(WIDTH_LABEL, -1),
                                      style=wx.ALIGN_RIGHT),
                        flag=wx.RIGHT,
                        border=MARGIN)
        status_wrap.Add(self.logger)

        # this is the order in which items are added to the window
        order = (logo_wrap, intro_wrap, query_wrap, amount_wrap, comments_wrap,
                 file_wrap, folder_wrap, scrape_button_wrap, progress_wrap,
                 status_wrap)

        # organise items in window
        # some items are centered, and some items get a horizontal row below
        # them
        for item in order:
            flag = wx.ALL | wx.CENTER if item in (
                logo_wrap, scrape_button_wrap) else wx.ALL
            main_sizer.Add(item, flag=flag, border=MARGIN)

            if item in (intro_wrap, scrape_button_wrap):
                main_sizer.Add(wx.StaticLine(self.main_panel, wx.ID_ANY), 0,
                               wx.EXPAND | wx.LEFT | wx.RIGHT, MARGIN)

        # render
        self.main_panel.SetSizer(main_sizer)
        self.main_panel.Fit()
        self.Layout()
Exemplo n.º 24
0
    def create_controls(self):
        a = (self.Resolution[1] * 0.15)
        color = self.color
        ################ Sizer
        sizer_v = wx.BoxSizer(wx.VERTICAL)
        sizer_h0 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_h1 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_h2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_h3 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_h4 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_h5 = wx.BoxSizer(wx.HORIZONTAL)

        # Controls
        self.Button1 = wx.Button(self, 5, '  Browse   ')
        self.srclabel = wx.StaticText(self, label="Source Address : Infohash ")
        self.combo1 = wx.ComboBox(self,
                                  size=(500, wx.DefaultSize.y),
                                  choices=self.list3)
        self.combo1.SetEditable(False)
        self.combo1.Bind(wx.wx.EVT_COMBOBOX, self.onSelect)
        self.Button3 = wx.Button(self, 6, '    Exit   ')

        self.toolbar = wx.ToolBar(self, style=wx.TB_HORIZONTAL | wx.TB_TEXT)
        color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND)
        self.toolbar.SetBackgroundColour(color)
        self.toolbar.AddLabelTool(1, "Play/Pause",
                                  wx.Bitmap('ui/images/playpause.png'))
        self.Bind(wx.EVT_TOOL, self.start_processing, id=1)
        self.toolbar.AddLabelTool(2, "Stop", wx.Bitmap('ui/images/stop.png'))
        self.Bind(wx.EVT_TOOL, self.stop_processing, id=2)
        self.toolbar.AddLabelTool(3, "Previous",
                                  wx.Bitmap('ui/images/rewind.png'))
        self.Bind(wx.EVT_TOOL, self.previous_step, id=3)
        self.toolbar.AddLabelTool(4, "Next",
                                  wx.Bitmap('ui/images/forward.png'))
        self.Bind(wx.EVT_TOOL, self.next_step, id=4)
        self.toolbar.EnableTool(2, False)
        self.toolbar.EnableTool(3, False)
        self.toolbar.EnableTool(4, True)
        self.panel4 = wx.Panel(self, -1)
        self.panel4.SetBackgroundColour(color)

        self.panel2 = wx.Panel(self, -1)
        self.panel2.SetBackgroundColour(color)
        self.rb1 = wx.RadioButton(self.panel2,
                                  -1,
                                  'Time Interval (in millseconds) :', (10, 5),
                                  style=wx.RB_GROUP)
        self.rb2 = wx.RadioButton(self.panel2, -1,
                                  'Slow Motion  (x times)          :',
                                  (10, 40))
        self.panel3 = wx.Panel(self, -1)
        self.panel3.SetBackgroundColour(color)
        self.srclabel2 = wx.StaticText(
            self.panel3,
            pos=(30, 10),
            label="Playback position of Lookup       :        ")
        self.ProgressBar = wx.Gauge(self.panel3,
                                    -1,
                                    1,
                                    pos=(30, 40),
                                    size=(400, -1),
                                    style=wx.SL_AUTOTICKS)
        self.TextBox1 = wx.TextCtrl(self.panel2,
                                    pos=(250, 5),
                                    size=wx.Size(200, -1))
        self.TextBox1.SetValue("100")
        self.TextBox2 = wx.TextCtrl(self.panel2,
                                    pos=(250, 40),
                                    size=wx.Size(200, -1))
        self.TextBox2.SetValue("100")
        for RadioButton in [self.rb1, self.rb2]:
            self.Bind(wx.EVT_RADIOBUTTON, self.on_radio, RadioButton)

        self.lc = wx.ListCtrl(self,
                              wx.ID_ANY,
                              style=wx.LC_REPORT | wx.SUNKEN_BORDER,
                              size=(-1, a * 0.5))
        self.lc.InsertColumn(0, "No.")
        self.lc.SetColumnWidth(0, 40)
        self.lc.InsertColumn(1, "Query Time")
        self.lc.SetColumnWidth(1, 120)
        self.lc.InsertColumn(2, "Response Time")
        self.lc.SetColumnWidth(2, 120)
        self.lc.InsertColumn(3, "RTT")
        self.lc.SetColumnWidth(3, 80)
        self.lc.InsertColumn(4, "Responder")
        self.lc.SetColumnWidth(4, 160)
        self.lc.InsertColumn(5, "TID")
        self.lc.SetColumnWidth(5, 60)
        self.lc.InsertColumn(6, "Log Distance")
        self.lc.SetColumnWidth(6, 100)
        self.lc.InsertColumn(7, "Nodes Distance")
        self.lc.SetColumnWidth(7, 280)

        self.panel1 = wx.Panel(self, -1)
        font1 = wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL, False,
                        u'Comic Sans MS')
        self.panel1.SetFont(font1)
        self.panel1.SetScrollbar(wx.HORIZONTAL, 0, 1, self.hsb)
        self.panel1.SetScrollbar(wx.VERTICAL, 0, 1, self.vsb)
        self.Stbox1 = wx.StaticText(self.panel1, -1, "", (0, 0))
        font1 = wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL, False,
                        u'Comic Sans MS')
        self.Stbox1.SetFont(font1)

        self.TxtBox1 = wx.TextCtrl(self,
                                   wx.ID_ANY,
                                   value="",
                                   style=wx.TE_MULTILINE,
                                   size=(-1, -1))

        sizer_h0.Add(self.Button1, flag=wx.ALL, border=10)
        sizer_h0.Add(self.srclabel, flag=wx.ALL, border=10)
        sizer_h0.Add(self.combo1, flag=wx.ALL, border=10)
        sizer_h0.Add(self.Button3, flag=wx.ALL, border=10)
        sizer_v.Add(sizer_h0, 0)
        sizer_h1.Add(self.toolbar)
        sizer_h1.Add(self.panel4, 1, wx.ALL | wx.EXPAND, 10)
        sizer_v.Add(sizer_h1, 0, flag=wx.ALL | wx.EXPAND)
        sizer_h2.Add(self.panel2, 0, wx.ALL | wx.EXPAND)
        sizer_h2.Add(self.panel3, 2, wx.ALL | wx.EXPAND)
        sizer_v.Add(sizer_h2, 0, flag=wx.ALL | wx.EXPAND)
        sizer_h3.Add(self.lc, 1, flag=wx.ALL | wx.EXPAND)
        sizer_v.Add(sizer_h3, 1, wx.ALL | wx.EXPAND, 10)
        sizer_h4.Add(self.panel1, 2, wx.ALL | wx.EXPAND)
        sizer_v.Add(sizer_h4, 2, wx.ALL | wx.EXPAND, 10)
        sizer_h5.Add(self.TxtBox1, 1, flag=wx.ALL | wx.EXPAND)
        sizer_v.Add(sizer_h5, 1, wx.ALL | wx.EXPAND, 10)
        self.SetSizer(sizer_v)
Exemplo n.º 25
0
	def __init__(self, parent, printerConnection):
		super(printWindowAdvanced, self).__init__(parent, -1, style=wx.CLOSE_BOX|wx.CLIP_CHILDREN|wx.CAPTION|wx.SYSTEM_MENU|wx.FRAME_FLOAT_ON_PARENT|wx.MINIMIZE_BOX, title=_("Printing on %s") % (printerConnection.getName()))
		self._printerConnection = printerConnection
		self._lastUpdateTime = time.time()
		self._printDuration = 0
		self._lastDurationTime = None
		self._isPrinting = False

		self.SetSizer(wx.BoxSizer(wx.VERTICAL))
		self.toppanel = wx.Panel(self)
		self.topsizer = wx.GridBagSizer(2, 2)
		self.toppanel.SetSizer(self.topsizer)
		self.toppanel.SetBackgroundColour(wx.WHITE)
		self.topsizer.SetEmptyCellSize((125, 1))
		self.panel = wx.Panel(self)
		self.sizer = wx.GridBagSizer(2, 2)
		self.sizer.SetEmptyCellSize((125, 1))
		self.panel.SetSizer(self.sizer)
		self.panel.SetBackgroundColour(wx.WHITE)
		self.GetSizer().Add(self.toppanel, 0, flag=wx.EXPAND)
		self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND)

		self._fullscreenTemperature = None
		self._termHistory = []
		self._termHistoryIdx = 0

		self._mapImage = wx.Image(resources.getPathForImage('print-window-map.png'))
		self._colorCommandMap = {}

		# Move X
		self._addMovementCommand(0, 0, 255, self._moveX, 100)
		self._addMovementCommand(0, 0, 240, self._moveX, 10)
		self._addMovementCommand(0, 0, 220, self._moveX, 1)
		self._addMovementCommand(0, 0, 200, self._moveX, 0.1)
		self._addMovementCommand(0, 0, 180, self._moveX, -0.1)
		self._addMovementCommand(0, 0, 160, self._moveX, -1)
		self._addMovementCommand(0, 0, 140, self._moveX, -10)
		self._addMovementCommand(0, 0, 120, self._moveX, -100)

		# Move Y
		self._addMovementCommand(0, 255, 0, self._moveY, -100)
		self._addMovementCommand(0, 240, 0, self._moveY, -10)
		self._addMovementCommand(0, 220, 0, self._moveY, -1)
		self._addMovementCommand(0, 200, 0, self._moveY, -0.1)
		self._addMovementCommand(0, 180, 0, self._moveY, 0.1)
		self._addMovementCommand(0, 160, 0, self._moveY, 1)
		self._addMovementCommand(0, 140, 0, self._moveY, 10)
		self._addMovementCommand(0, 120, 0, self._moveY, 100)

		# Move Z
		self._addMovementCommand(255, 0, 0, self._moveZ, 10)
		self._addMovementCommand(220, 0, 0, self._moveZ, 1)
		self._addMovementCommand(200, 0, 0, self._moveZ, 0.1)
		self._addMovementCommand(180, 0, 0, self._moveZ, -0.1)
		self._addMovementCommand(160, 0, 0, self._moveZ, -1)
		self._addMovementCommand(140, 0, 0, self._moveZ, -10)

		# Extrude/Retract
		self._addMovementCommand(255, 80, 0, self._moveE, 10)
		self._addMovementCommand(255, 180, 0, self._moveE, -10)

		# Home
		self._addMovementCommand(255, 255, 0, self._homeXYZ, None)
		self._addMovementCommand(240, 255, 0, self._homeXYZ, "X")
		self._addMovementCommand(220, 255, 0, self._homeXYZ, "Y")
		self._addMovementCommand(200, 255, 0, self._homeXYZ, "Z")

		self.powerWarningText = wx.StaticText(parent=self.toppanel,
			id=-1,
			label=_("Your computer is running on battery power.\nConnect your computer to AC power or your print might not finish."),
			style=wx.ALIGN_CENTER)
		self.powerWarningText.SetBackgroundColour('red')
		self.powerWarningText.SetForegroundColour('white')
		if power:
			self.powerManagement = power.PowerManagement()
		else:
			self.powerManagement = None
		self.powerWarningTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnPowerWarningChange, self.powerWarningTimer)
		self.OnPowerWarningChange(None)
		self.powerWarningTimer.Start(10000)

		self.pauseTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnPauseTimer, self.pauseTimer)

		self.connectButton = wx.Button(self.toppanel, -1, _("Connect"), size=(125, 30))
		self.printButton = wx.Button(self.toppanel, -1, _("Print"), size=(125, 30))
		self.cancelButton = wx.Button(self.toppanel, -1, _("Cancel"), size=(125, 30))
		self.errorLogButton = wx.Button(self.toppanel, -1, _("Error log"), size=(125, 30))
		self.motorsOffButton = wx.Button(self.toppanel, -1, _("Motors off"), size=(125, 30))
		self.movementBitmap = wx.StaticBitmap(self.panel, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window.png'))), (0, 0))
		self.temperatureBitmap = wx.StaticBitmap(self.panel, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window-temperature.png'))), (0, 0))
		self.temperatureField = TemperatureField(self.panel, self._setHotendTemperature)
		self.temperatureBedBitmap = wx.StaticBitmap(self.panel, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window-temperature-bed.png'))), (0, 0))
		self.temperatureBedField = TemperatureField(self.panel, self._setBedTemperature)
		self.temperatureGraph = TemperatureGraph(self.panel)
		self.temperatureGraph.SetMinSize((250, 100))
		self.progress = wx.Gauge(self.panel, -1, range=1000)

		f = wx.Font(8, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
		self._termLog = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE)
		self._termLog.SetFont(f)
		self._termLog.SetEditable(0)
		self._termLog.SetMinSize((385, -1))
		self._termInput = wx.TextCtrl(self.panel, style=wx.TE_PROCESS_ENTER)
		self._termInput.SetFont(f)

		self.Bind(wx.EVT_TEXT_ENTER, self.OnTermEnterLine, self._termInput)
		self._termInput.Bind(wx.EVT_CHAR, self.OnTermKey)

		self.topsizer.Add(self.powerWarningText, pos=(0, 0), span=(1, 6), flag=wx.EXPAND|wx.BOTTOM, border=5)
		self.topsizer.Add(self.connectButton, pos=(1, 0), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.printButton, pos=(1, 1), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.cancelButton, pos=(1, 2), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.errorLogButton, pos=(1, 4), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.motorsOffButton, pos=(1, 5), flag=wx.LEFT|wx.RIGHT, border=2)
		self.sizer.Add(self.movementBitmap, pos=(0, 0), span=(2, 3))
		self.sizer.Add(self.temperatureGraph, pos=(2, 0), span=(4, 2), flag=wx.EXPAND)
		self.sizer.Add(self.temperatureBitmap, pos=(2, 2))
		self.sizer.Add(self.temperatureField, pos=(3, 2))
		self.sizer.Add(self.temperatureBedBitmap, pos=(4, 2))
		self.sizer.Add(self.temperatureBedField, pos=(5, 2))
		self.sizer.Add(self._termLog, pos=(0, 3), span=(5, 3), flag=wx.EXPAND|wx.RIGHT, border=5)
		self.sizer.Add(self._termInput, pos=(5, 3), span=(1, 3), flag=wx.EXPAND|wx.RIGHT, border=5)
		self.sizer.Add(self.progress, pos=(7, 0), span=(1, 6), flag=wx.EXPAND|wx.BOTTOM)

		self.Bind(wx.EVT_SIZE, self.OnSize)
		self.Bind(wx.EVT_CLOSE, self.OnClose)
		self.movementBitmap.Bind(wx.EVT_LEFT_DOWN, self.OnMovementClick)
		self.temperatureGraph.Bind(wx.EVT_LEFT_UP, self.OnTemperatureClick)
		self.connectButton.Bind(wx.EVT_BUTTON, self.OnConnect)
		self.printButton.Bind(wx.EVT_BUTTON, self.OnPrint)
		self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
		self.errorLogButton.Bind(wx.EVT_BUTTON, self.OnErrorLog)
		self.motorsOffButton.Bind(wx.EVT_BUTTON, self.OnMotorsOff)

		self.Layout()
		self.Fit()
		self.Refresh()
		self.progress.SetMinSize(self.progress.GetSize())
		self._updateButtonStates()

		self._printerConnection.addCallback(self._doPrinterConnectionUpdate)

		if self._printerConnection.hasActiveConnection() and \
		   not self._printerConnection.isActiveConnectionOpen():
			self._printerConnection.openActiveConnection()
Exemplo n.º 26
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: PAIMEIfilefuzz.__init__
        kwds["style"] = wx.TAB_TRAVERSAL
        wx.Panel.__init__(self, *args, **kwds)

        self.list_book = kwds["parent"]  # handle to list book.
        self.pydbg = copy.copy(
            self.list_book.top.pydbg)  # handle to top most frame.

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

        self.log_window_pane = wx.Panel(self.main_splitter, -1)
        self.main_window_pane = wx.Panel(self.main_splitter, -1)

        self.setup_sizer_staticbox = wx.StaticBox(self.main_window_pane, -1,
                                                  "Setup")
        self.setup_right_staticbox = wx.StaticBox(self.main_window_pane, -1,
                                                  "Byte Modifications")

        self.file_inspector_staticbox = wx.StaticBox(self.main_window_pane, -1,
                                                     "File Inspector")

        self.progress_sizer_staticbox = wx.StaticBox(self.main_window_pane, -1,
                                                     "Progress")
        self.statistics_sizer_staticbox = wx.StaticBox(self.main_window_pane,
                                                       -1, "Statistics")
        self.fuzz_sizer_staticbox = wx.StaticBox(self.main_window_pane, -1,
                                                 "Fuzz")

        self.program_name_label = wx.StaticText(self.main_window_pane, -1,
                                                "Program Name")
        self.program_name_control = filebrowse.FileBrowseButtonWithHistory(
            self.main_window_pane, -1, size=(500, -1), labelText="")
        self.program_name_control.SetHistory([])

        self.source_name_label = wx.StaticText(self.main_window_pane, -1,
                                               "Source File Name")
        self.source_name_control = filebrowse.FileBrowseButtonWithHistory(
            self.main_window_pane, -1, size=(500, -1), labelText="")
        self.source_name_control.SetHistory([])

        self.destination_label = wx.StaticText(self.main_window_pane, -1,
                                               "Destination Directory")
        self.destination_control = filebrowse.DirBrowseButton(
            self.main_window_pane, -1, size=(500, -1), labelText="")

        self.hex_label = wx.StaticText(self.main_window_pane, -1, "Hex Bytes")
        self.hex_control = wx.TextCtrl(self.main_window_pane, -1, "")

        self.start_label = wx.StaticText(self.main_window_pane, -1,
                                         "Range Start")
        self.start_control = wx.TextCtrl(self.main_window_pane, -1, "")
        self.start_control.SetMaxLength(7)

        self.end_label = wx.StaticText(self.main_window_pane, -1, "Range End")
        self.end_control = wx.TextCtrl(self.main_window_pane, -1, "")
        self.end_control.SetMaxLength(7)

        self.timeout_label = wx.StaticText(self.main_window_pane, -1,
                                           "Timeout (secs)")
        self.timer_control = wx.TextCtrl(self.main_window_pane, -1, "")
        self.timer_control.SetMaxLength(7)

        self.file_view_control = wx.TextCtrl(self.main_window_pane,
                                             -1,
                                             "",
                                             style=wx.TE_MULTILINE
                                             | wx.TE_READONLY | wx.TE_RICH2)

        self.file_list_box_control = wx.ListBox(self.main_window_pane,
                                                -1,
                                                choices=[],
                                                style=wx.LB_SINGLE)
        self.file_list_refresh_button = wx.Button(self.main_window_pane, -1,
                                                  "Refresh List")

        self.generate_button_control = wx.Button(self.main_window_pane, -1,
                                                 "Generate")
        self.run_button_control = wx.Button(self.main_window_pane, -1, "Run")
        self.stop_button_control = wx.Button(self.main_window_pane, -1, "Stop")

        self.stat_crashes_label = wx.StaticText(self.main_window_pane, -1,
                                                "# Crashes:")
        self.stat_crashes = wx.StaticText(self.main_window_pane,
                                          -1,
                                          "0 / 0%",
                                          style=wx.ALIGN_RIGHT)
        self.stat_num_read_label = wx.StaticText(self.main_window_pane, -1,
                                                 "# Read Violations:")
        self.stat_num_read = wx.StaticText(self.main_window_pane,
                                           -1,
                                           "0 / 0%",
                                           style=wx.ALIGN_RIGHT)
        self.stat_num_write_label = wx.StaticText(self.main_window_pane, -1,
                                                  "# Write Violations:")
        self.stat_num_write = wx.StaticText(self.main_window_pane,
                                            -1,
                                            "0 / 0%",
                                            style=wx.ALIGN_RIGHT)
        self.stat_running_time_label = wx.StaticText(self.main_window_pane, -1,
                                                     "Running Time:")
        self.stat_running_time = wx.StaticText(self.main_window_pane,
                                               -1,
                                               "00:00:00",
                                               style=wx.ALIGN_RIGHT)
        self.stat_end_eta_label = wx.StaticText(self.main_window_pane, -1,
                                                "Estimated Completion:")
        self.stat_end_eta = wx.StaticText(self.main_window_pane,
                                          -1,
                                          "00:00:00",
                                          style=wx.ALIGN_RIGHT)
        self.stat_last_violaton_label = wx.StaticText(
            self.main_window_pane, -1, "Last Violation Address:")
        self.stat_last_violation = wx.StaticText(self.main_window_pane,
                                                 -1,
                                                 "N/A",
                                                 style=wx.ALIGN_RIGHT)

        self.progress_text_label = wx.StaticText(self.main_window_pane, -1,
                                                 "File 0 / 0")
        self.progress_gauge_control = wx.Gauge(self.main_window_pane,
                                               -1,
                                               100,
                                               style=wx.GA_HORIZONTAL
                                               | wx.GA_SMOOTH)

        self.log = wx.TextCtrl(self.log_window_pane,
                               -1,
                               "",
                               style=wx.TE_MULTILINE | wx.TE_READONLY
                               | wx.TE_LINEWRAP)

        self.__set_properties()
        self.__do_layout()

        #self.Bind(wx.EVT_BUTTON, self.OnHistory, self.history_button_control)
        #self.Bind(wx.EVT_BUTTON, self.OnSave, self.save_button_control)
        #self.Bind(wx.EVT_BUTTON, self.OnLoad, self.Load)
        self.Bind(wx.EVT_LISTBOX, self.OnFileList, self.file_list_box_control)
        self.Bind(wx.EVT_BUTTON, self.OnRefresh, self.file_list_refresh_button)
        self.Bind(wx.EVT_BUTTON, self.OnGenerate, self.generate_button_control)
        self.Bind(wx.EVT_BUTTON, self.OnRun, self.run_button_control)
        self.Bind(wx.EVT_BUTTON, self.OnStop, self.stop_button_control)

        # Thread events
        self.Bind(EVT_THREAD_UPDATE, self.OnThreadUpdate)
        self.Bind(EVT_THREAD_LOG, self.OnThreadLog)
        self.Bind(EVT_THREAD_END, self.OnThreadEnd)

        self.msg("PaiMei File Fuzz")
        self.msg("Module by Cody Pierce\n")
Exemplo n.º 27
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self,
                          parent,
                          title=title,
                          size=(345, 330),
                          style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)

        # programm variables
        self.PrgName = title
        self.PrgVersion = "v1.11"
        self.PytonVersion = sys.version
        self.WxVersion = wx.__version__
        IconPath = "_ico" + os.sep + "Demofile Renamer.ico"

        # init variables
        self.ListSelection = 0
        self.CheckBoxSelection = False
        textExample = 'Example:\n "samurai-vs-ninja.dem" will be renamed to\n "samurai-vs-ninja_de_dust2.dem"'

        # Center frame
        self.Center()

        # Icon set
        # ico = wx.Icon(IconPath, wx.BITMAP_TYPE_ICO)
        # self.SetIcon(ico)

        # StatusBar creation in the bottom of the window
        self.CreateStatusBar()

        # MenuBar in the top of the window
        helpmenu = wx.Menu()

        # MenuBar colums
        menuHelp = helpmenu.Append(wx.ID_HELP, '&Help', 'Show help dialog')
        menuSeperator = helpmenu.AppendSeparator()
        menuLicense = helpmenu.Append(
            wx.ID_VIEW_DETAILS, "&License",
            "Show license dialog")  # should use wx.newid()
        menuAbout = helpmenu.Append(wx.ID_ABOUT)
        menuSeperator = helpmenu.AppendSeparator()
        menuExit = helpmenu.Append(wx.ID_EXIT)

        # MenuBar creation
        menuBar = wx.MenuBar()
        menuBar.Append(helpmenu,
                       "&Help")  # Adding the "helpmenu" to the MenuBar
        self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.

        # FramePanel creation
        panel = wx.Panel(self, -1)
        wx.StaticText(panel, -1, "Choose renaming mask:", (30, 15))

        self.ListBoxSelect = wx.ListBox(panel, -1, choices=["OLDNAME_MAPNAME", "MAPNAME_OLDNAME", \
        "YYYY_MAPNAME_OLDNAME", "YYYY_OLDNAME_MAPNAME", "YYYY-MM_MAPNAME_OLDNAME", \
        "YYYY-MM_OLDNAME_MAPNAME", "YYYY-MM-DD_MAPNAME_OLDNAME", "YYYY-MM-DD_OLDNAME_MAPNAME"], \
        size=(270,35),pos=(30,40))

        self.StaticTextExample = wx.StaticText(panel, -1, textExample,
                                               (30, 80))
        wx.StaticText(panel, -1, "Extracting mapname", (30, 150))
        self.GaugeProgress = wx.Gauge(panel,
                                      -1,
                                      range=100,
                                      pos=(30, 170),
                                      size=(270, 10))
        self.checkboxMode = wx.CheckBox(
            panel,
            -1,
            "Parsing full demofile (processing intense)",
            pos=(30, 190),
            size=(270, 15))
        self.buttonCancel = wx.Button(panel, -1, "Cancel", (30, 218), (90, 20))
        self.buttonStart = wx.Button(panel, -1, "Start", (210, 218), (90, 20))

        # Preselect default settings
        self.ListBoxSelect.SetSelection(0)

        # Set events.
        self.Bind(wx.EVT_MENU, self.OnHelp, menuHelp)
        self.Bind(wx.EVT_MENU, self.OnLicense, menuLicense)
        self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout)
        self.Bind(wx.EVT_MENU, self.OnExit, menuExit)
        self.Bind(wx.EVT_LISTBOX, self.OnListSelect, self.ListBoxSelect)
        self.Bind(wx.EVT_CHECKBOX, self.OnCheckBoxSelect, self.checkboxMode)
        self.Bind(wx.EVT_BUTTON, self.OnStart, self.buttonStart)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.buttonCancel)

        # Set events (DemoFileRenamer thread handling only)
        self.Bind(EVT_GUIENABLE, self.OnGuiEnable)
        self.Bind(EVT_GUIDISABLE, self.OnGuiDisable)
        self.Bind(EVT_GAUGESETRANGE, self.OnGaugeSetRange)
        self.Bind(EVT_GAUGEPROGRESS, self.OnGaugeProgress)
        self.Bind(EVT_FINISH, self.OnFinish)
        self.Bind(EVT_FINISHFAILED, self.OnFinishFailed)
        self.Bind(EVT_ONERROR, self.OnError)

        # Create/Show MainWindow
        self.Show(True)
Exemplo n.º 28
0
    def Build(self):
        self.wildcard = "EEPROM dump (*.bin)|*.bin"
        self.byts = None
        self.mainp = wx.Panel(self)

        self.formatbox = wx.RadioBox(self.mainp,
                                     label="Fill byte",
                                     choices=["0x00", "0xFF"])

        self.wfilel = wx.StaticText(self.mainp, label="File")
        self.fpickerbox = wx.BoxSizer(wx.HORIZONTAL)
        self.fpickerbox.Add(self.wfilel, 1)
        self.fpickerbox.Add(self.formatbox, 0)

        self.readfpicker = wx.FilePickerCtrl(
            self.mainp,
            wildcard=self.wildcard,
            style=wx.FLP_SAVE | wx.FLP_USE_TEXTCTRL | wx.FLP_SMALL)
        self.writefpicker = wx.FilePickerCtrl(
            self.mainp,
            wildcard=self.wildcard,
            style=wx.FLP_OPEN | wx.FLP_FILE_MUST_EXIST | wx.FLP_USE_TEXTCTRL
            | wx.FLP_SMALL)

        self.progressboxp = wx.Panel(self.mainp)
        self.progressbox = wx.BoxSizer(wx.VERTICAL)
        self.lastpulse = time.time()
        self.progress = wx.Gauge(self.progressboxp,
                                 style=wx.GA_HORIZONTAL | wx.GA_SMOOTH)
        self.progress.SetRange(100)
        self.progressboxp.Hide()
        self.progress_text = wx.StaticText(self.progressboxp,
                                           size=(32, -1),
                                           style=wx.ALIGN_CENTRE_HORIZONTAL)
        self.progressbox.Add(self.progress, 1, flag=wx.EXPAND)
        self.progressbox.Add(self.progress_text,
                             0,
                             flag=wx.EXPAND | wx.TOP,
                             border=10)
        self.progressboxp.SetSizer(self.progressbox)

        self.mainsizer = wx.BoxSizer(wx.VERTICAL)
        self.mainsizer.Add(self.mainp, 1, wx.EXPAND | wx.ALL, border=10)
        self.SetSizer(self.mainsizer)

        self.gobutton = wx.Button(self.mainp, label="Read")
        self.gobutton.Disable()

        self.fpickerbox = wx.BoxSizer(wx.HORIZONTAL)
        self.fpickerbox.AddSpacer(5)
        self.fpickerbox.Add(self.readfpicker, 1)
        self.fpickerbox.Add(self.writefpicker, 1)

        self.modebox = wx.RadioBox(self.mainp,
                                   label="Mode",
                                   choices=["Read", "Write", "Format"])

        self.eeprompsizer = wx.GridBagSizer()
        self.eeprompsizer.Add(self.wfilel,
                              pos=(0, 0),
                              flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL
                              | wx.LEFT,
                              border=10)
        self.eeprompsizer.Add(self.fpickerbox,
                              pos=(0, 1),
                              span=(1, 5),
                              flag=wx.EXPAND | wx.RIGHT | wx.BOTTOM,
                              border=10)
        self.eeprompsizer.Add(self.progressboxp,
                              pos=(3, 0),
                              span=(1, 6),
                              flag=wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.EXPAND
                              | wx.TOP,
                              border=20)
        self.eeprompsizer.Add(self.modebox,
                              pos=(4, 0),
                              span=(1, 2),
                              flag=wx.ALIGN_LEFT | wx.ALIGN_BOTTOM | wx.LEFT
                              | wx.TOP,
                              border=30)
        self.eeprompsizer.Add(self.gobutton,
                              pos=(5, 5),
                              flag=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM | wx.RIGHT,
                              border=10)
        self.eeprompsizer.AddGrowableRow(2, 1)
        self.eeprompsizer.AddGrowableCol(5, 1)
        self.mainp.SetSizer(self.eeprompsizer)

        self.mainsizer = wx.BoxSizer(wx.VERTICAL)
        self.mainsizer.Add(self.mainp, 1, wx.EXPAND | wx.ALL, border=10)
        self.SetSizer(self.mainsizer)

        self.readfpicker.Hide()
        self.formatbox.Hide()

        self.Fit()
        self.Layout()

        self.OnModeChange(None)

        self.readfpicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnReadPicker)
        self.writefpicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnWritePicker)
        self.modebox.Bind(wx.EVT_RADIOBOX, self.OnModeChange)
        self.gobutton.Bind(wx.EVT_BUTTON, self.OnGo)
Exemplo n.º 29
0
    def init_ui(self):
        self.Title = 'FTP Monitor'
        self.SetBackgroundColour(wx.Colour(240, 240, 240))
        icon_bundle = wx.IconBundle()
        icon_bundle.AddIconFromFile(r'../resources/cheeseburger.ico', wx.BITMAP_TYPE_ANY)
        self.SetIcons(icon_bundle)

        # Setup Toolbar
        toolbar = self.CreateToolBar()
        add_source_image = wx.Image(r'../resources/add_32.png').ConvertToBitmap()
        scan_source_image = wx.Image(r'../resources/scan_32.png').ConvertToBitmap()
        download_image = wx.Image(r'../resources/download_32.png').ConvertToBitmap()
        stop_image = wx.Image(r'../resources/stop.png').ConvertToBitmap()
        toolbar.AddTool(ADD_SOURCE_TOOL_ID, bitmap=add_source_image)
        toolbar.AddTool(SCAN_SOURCES_TOOL_ID, bitmap=scan_source_image)
        toolbar.AddTool(DOWNLOAD_TOOL_ID, bitmap=download_image)
        toolbar.AddTool(STOP_SCAN_TOOL_ID, bitmap=stop_image)
        toolbar.Realize()
        self.Bind(event=wx.EVT_TOOL, id=ADD_SOURCE_TOOL_ID, handler=self.add_source_button_callback)
        self.Bind(event=wx.EVT_TOOL, id=SCAN_SOURCES_TOOL_ID, handler=self.scan_sources_button_callback)
        self.Bind(event=wx.EVT_TOOL, id=DOWNLOAD_TOOL_ID, handler=self.download_button_callback)
        self.Bind(event=wx.EVT_TOOL, id=STOP_SCAN_TOOL_ID, handler=self.stop_scan_button_callback)

        splitter = wx.SplitterWindow(parent=self)

        sources_panel = wx.Panel(parent=splitter)
        sources_label = wx.StaticText(parent=sources_panel, label='Sources')
        self.sources_listctrl = SuperListCtrl(parent=sources_panel, columns=['IP', 'Search Path'])

        downloaders_label_hsizer = wx.BoxSizer( wx.HORIZONTAL )
        downloaders_label = wx.StaticText(parent=sources_panel, label='Downloaders')
        add_downloader_button = wx.Button( parent=sources_panel, label='+' )
        add_downloader_button.Bind( wx.EVT_BUTTON, self.add_downloader_callback )
        downloaders_label_hsizer.Add( item=downloaders_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5 )
        downloaders_label_hsizer.Add( item=add_downloader_button, flag=wx.TOP | wx.BOTTOM, border=5 )
        self.downloaders_listctrl = SuperListCtrl(parent=sources_panel, columns=['IP'], style=wx.LC_SINGLE_SEL)
        self.downloaders_listctrl.Bind( wx.EVT_LIST_ITEM_SELECTED, self.downloaders_on_select )

        sources_panel_vsizer = wx.BoxSizer(wx.VERTICAL)
        sources_panel_vsizer.Add(item=sources_label)
        sources_panel_vsizer.Add(item=self.sources_listctrl, flag=wx.EXPAND, proportion=1)
        sources_panel_vsizer.Add(item=downloaders_label_hsizer)
        sources_panel_vsizer.Add(item=self.downloaders_listctrl, flag=wx.EXPAND, proportion=1)
        sources_panel.SetSizer(sources_panel_vsizer)

        results_panel = wx.Panel(parent=splitter)
        results_label = wx.StaticText(parent=results_panel, label='Results')
        results_columns = ['Title', 'Series', 'Episode Number', 'Season', 'Rating', 'Genre', 'Duration',
                           'IMDB Rating', 'Resolution', 'Year', 'File Size', 'IP', 'Filename', 'Full Path']
        self.results_listctrl = SuperListCtrl(parent=results_panel, columns=results_columns)
        results_panel_vsizer = wx.BoxSizer(wx.VERTICAL)
        results_panel_vsizer.Add(results_label)
        results_panel_vsizer.Add(self.results_listctrl, flag=wx.EXPAND, proportion=1)
        results_panel.SetSizer(results_panel_vsizer)

        splitter.SplitVertically(sources_panel, results_panel)
        splitter.SetMinimumPaneSize(300)

        self.progress_bar = wx.Gauge(parent=self)


        splitter2 = wx.SplitterWindow(parent=self)
        log_panel = wx.Panel(parent=splitter2)
        log_label = wx.StaticText(parent=log_panel, label='Log')
        self.log_textctrl = wx.TextCtrl(parent=log_panel, style=wx.TE_READONLY | wx.TE_MULTILINE)
        log_panel_vsizer = wx.BoxSizer(wx.VERTICAL)
        log_panel_vsizer.Add( log_label )
        log_panel_vsizer.Add( self.log_textctrl, flag=wx.EXPAND, proportion=1 )
        log_panel.SetSizer( log_panel_vsizer )

        downloads_panel = wx.Panel(parent=splitter2)
        downloads_label = wx.StaticText(parent=downloads_panel, label='Downloads')
        self.downloads_listctrl = SuperListCtrl(parent=downloads_panel, columns=[ 'Status', 'Progress', 'Source', 'File', 'Rate' ])
        self.downloads_listctrl.Bind( event=wx.EVT_LIST_ITEM_RIGHT_CLICK, handler=self.download_right_click_callback )
        downloads_panel_vsizer = wx.BoxSizer(wx.VERTICAL)
        downloads_panel_vsizer.Add( downloads_label )
        downloads_panel_vsizer.Add( self.downloads_listctrl, flag=wx.EXPAND, proportion=1 )
        downloads_panel.SetSizer( downloads_panel_vsizer )

        # downloads right-click callback
        self.downloads_context_menu = wx.Menu( )
        self.downloads_context_menu.Append( CANCEL_DL_ID, 'Cancel' )
        self.downloads_context_menu.Append( REMOVE_DL_ID, 'Remove' )

        splitter2.SplitVertically( log_panel, downloads_panel )
        splitter2.SetMinimumPaneSize(300)

        main_vsizer = wx.BoxSizer(wx.VERTICAL)
        main_vsizer.Add(splitter, flag=wx.EXPAND | wx.ALL, proportion=4, border=5)
        main_vsizer.Add(self.progress_bar, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
        main_vsizer.Add(splitter2, flag=wx.EXPAND | wx.ALL, proportion=1, border=5)
        #main_vsizer.Add(self.log_textctrl, flag=wx.EXPAND | wx.ALL, proportion=1, border=5)

        self.SetSizer(main_vsizer)

        self.Show()
        self.SetSize((800, 500))
Exemplo n.º 30
0
    def __init__(self):
        super().__init__(
            None,
            title='μOTP+',
            size=(320, 240),
            style=wx.CAPTION | wx.MINIMIZE_BOX | wx.CLOSE_BOX,
        )

        path = Path(self.CONFIG_PATH).expanduser()
        path.parent.mkdir(parents=True, exist_ok=True)
        if path.exists():
            self.config_fp = open(str(path), 'r+', encoding='utf-8')
            self.config = yaml.load(self.config_fp)
        else:
            self.config_fp = open(str(path), 'w', encoding='utf-8')
            self.config = {
                'account': None,
                'timediff': 0,
            }
            self.save_config()

        if not self.config['account']:
            self.issue()

        wrapper = wx.Panel(self)
        sizer_wrapper = wx.BoxSizer(wx.VERTICAL)

        self.wg_gauge_time = wx.Gauge(wrapper,
                                      range=self.REFRESH_INTERVAL,
                                      style=wx.GA_HORIZONTAL | wx.GA_SMOOTH)
        sizer_wrapper.Add(self.wg_gauge_time, flag=wx.EXPAND)

        panel = wx.Panel(wrapper)
        box = wx.BoxSizer(wx.VERTICAL)

        self.wg_txt_token = wx.TextCtrl(panel,
                                        style=wx.TE_READONLY | wx.TE_CENTRE
                                        | wx.BORDER_NONE)
        self.wg_txt_token.SetFont(wx.Font(32, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        self.wg_txt_token.SetLabelText('INITIALIZING')
        box.Add(self.wg_txt_token, flag=wx.EXPAND)

        box.AddSpacer(60)

        box.Add(wx.StaticText(panel, label="S/N"), flag=wx.ALIGN_CENTRE)

        box.AddSpacer(5)

        self.wg_txt_serial = wx.TextCtrl(panel,
                                         style=wx.TE_READONLY | wx.TE_CENTRE
                                         | wx.BORDER_NONE)
        self.wg_txt_serial.SetLabelText(
            self.config['account']['serial_number'])
        box.Add(self.wg_txt_serial, flag=wx.ALIGN_CENTRE)

        panel.SetSizer(box)
        sizer_wrapper.Add(panel,
                          proportion=1,
                          flag=wx.ALL | wx.EXPAND,
                          border=20)
        wrapper.SetSizer(sizer_wrapper)

        self.uotp = UOTP(self.config['account']['user_hash'].decode(),
                         self.config['account']['oid'],
                         self.config['account']['seed'],
                         self.config['account']['serial_number'])
        self.uotp.sync_time()

        self.timeout = -1
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.on_update, self.timer)
        self.timer.Start(1000)

        self.on_update()

        self.Centre()
        self.Show()