def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Сканирование", pos=wx.DefaultPosition, size=wx.Size(633, 432), style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.option_notebook = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) option_notebookImageSize = wx.Size(16, 16) option_notebookIndex = 0 option_notebookImages = wx.ImageList( option_notebookImageSize.GetWidth(), option_notebookImageSize.GetHeight()) self.option_notebook.AssignImageList(option_notebookImages) self.option_panel = wx.Panel(self.option_notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.option_panel.SetFont( wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 90, False, wx.EmptyString)) bSizer4 = wx.BoxSizer(wx.VERTICAL) bSizer9 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText8 = wx.StaticText(self.option_panel, wx.ID_ANY, u"Сканнер:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText8.Wrap(-1) self.m_staticText8.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer9.Add(self.m_staticText8, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.scanner_comboBox = wx.combo.BitmapComboBox( self.option_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, "", wx.CB_READONLY) self.scanner_comboBox.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer9.Add(self.scanner_comboBox, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) bSizer4.Add(bSizer9, 0, wx.EXPAND, 5) bSizer5 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText1 = wx.StaticText(self.option_panel, wx.ID_ANY, u"Источник:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText1.Wrap(-1) self.m_staticText1.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer5.Add(self.m_staticText1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.source_comboBox = wx.combo.BitmapComboBox(self.option_panel, wx.ID_ANY, u"Combo!", wx.DefaultPosition, wx.DefaultSize, "", wx.CB_READONLY) self.source_comboBox.SetSelection(0) self.source_comboBox.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer5.Add(self.source_comboBox, 1, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5) bSizer4.Add(bSizer5, 0, wx.EXPAND, 5) bSizer17 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText14 = wx.StaticText(self.option_panel, wx.ID_ANY, u"Режим сканирования:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText14.Wrap(-1) self.m_staticText14.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer17.Add(self.m_staticText14, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.mode_comboBox = wx.combo.BitmapComboBox(self.option_panel, wx.ID_ANY, u"Combo!", wx.DefaultPosition, wx.DefaultSize, "", wx.CB_READONLY) self.mode_comboBox.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer17.Add(self.mode_comboBox, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) bSizer4.Add(bSizer17, 0, wx.EXPAND, 5) bSizer7 = wx.BoxSizer(wx.HORIZONTAL) self.multiscan_checkBox = wx.CheckBox(self.option_panel, wx.ID_ANY, u"Многостраничное сканирование", wx.DefaultPosition, wx.DefaultSize, 0) self.multiscan_checkBox.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer7.Add(self.multiscan_checkBox, 0, wx.ALL, 5) bSizer4.Add(bSizer7, 0, wx.EXPAND, 5) bSizer8 = wx.BoxSizer(wx.HORIZONTAL) self.preview_checkBox = wx.CheckBox( self.option_panel, wx.ID_ANY, u"Просмотр результата сканирования", wx.DefaultPosition, wx.DefaultSize, 0) self.preview_checkBox.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer8.Add(self.preview_checkBox, 0, wx.ALL, 5) bSizer4.Add(bSizer8, 0, wx.EXPAND, 5) self.option_panel.SetSizer(bSizer4) self.option_panel.Layout() bSizer4.Fit(self.option_panel) self.option_notebook.AddPage(self.option_panel, u"Параметры сканирования", True) self.area_panel = wx.Panel(self.option_notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer161 = wx.BoxSizer(wx.VERTICAL) bSizer61 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText61 = wx.StaticText(self.area_panel, wx.ID_ANY, u"Размер страницы:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText61.Wrap(-1) self.m_staticText61.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer61.Add(self.m_staticText61, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.pagesize_comboBox = wx.combo.BitmapComboBox( self.area_panel, wx.ID_ANY, u"Combo!", wx.DefaultPosition, wx.Size(100, -1), "", wx.CB_READONLY) self.pagesize_comboBox.SetSelection(0) self.pagesize_comboBox.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer61.Add(self.pagesize_comboBox, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) bSizer161.Add(bSizer61, 0, wx.EXPAND, 5) gbSizer1 = wx.GridBagSizer(0, 0) gbSizer1.SetFlexibleDirection(wx.BOTH) gbSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_bitmap1 = wx.StaticBitmap( self.area_panel, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_CMN_DIALOG), wx.DefaultPosition, wx.Size(128, 128), 0) gbSizer1.Add( self.m_bitmap1, wx.GBPosition(2, 2), wx.GBSpan(2, 2), wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.left_spinCtrl = wx.SpinCtrl(self.area_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0) self.left_spinCtrl.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gbSizer1.Add(self.left_spinCtrl, wx.GBPosition(3, 1), wx.GBSpan(1, 1), wx.ALL, 5) self.left_text = wx.StaticText(self.area_panel, wx.ID_ANY, u"Слева (мм):", wx.DefaultPosition, wx.DefaultSize, 0) self.left_text.Wrap(-1) self.left_text.SetFont(wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gbSizer1.Add(self.left_text, wx.GBPosition(2, 1), wx.GBSpan(1, 1), wx.ALL | wx.ALIGN_BOTTOM, 5) self.right_text = wx.StaticText(self.area_panel, wx.ID_ANY, u"Справа (мм):", wx.DefaultPosition, wx.DefaultSize, 0) self.right_text.Wrap(-1) self.right_text.SetFont(wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gbSizer1.Add(self.right_text, wx.GBPosition(2, 4), wx.GBSpan(1, 1), wx.ALL | wx.ALIGN_BOTTOM, 5) self.right_spinCtrl = wx.SpinCtrl(self.area_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0) self.right_spinCtrl.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gbSizer1.Add(self.right_spinCtrl, wx.GBPosition(3, 4), wx.GBSpan(1, 1), wx.ALL, 5) self.top_text = wx.StaticText(self.area_panel, wx.ID_ANY, u"Сверху (мм):", wx.DefaultPosition, wx.DefaultSize, 0) self.top_text.Wrap(-1) self.top_text.SetFont(wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gbSizer1.Add(self.top_text, wx.GBPosition(1, 2), wx.GBSpan(1, 1), wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.top_spinCtrl = wx.SpinCtrl(self.area_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10, 0) self.top_spinCtrl.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gbSizer1.Add(self.top_spinCtrl, wx.GBPosition(1, 3), wx.GBSpan(1, 1), wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.m_staticText5 = wx.StaticText(self.area_panel, wx.ID_ANY, u"Снизу (мм):", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText5.Wrap(-1) self.m_staticText5.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gbSizer1.Add(self.m_staticText5, wx.GBPosition(4, 2), wx.GBSpan(1, 1), wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.bottom_spinCtrl = wx.SpinCtrl(self.area_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10, 0) self.bottom_spinCtrl.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gbSizer1.Add(self.bottom_spinCtrl, wx.GBPosition(4, 3), wx.GBSpan(1, 1), wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) bSizer161.Add(gbSizer1, 1, wx.EXPAND, 5) self.area_panel.SetSizer(bSizer161) self.area_panel.Layout() bSizer161.Fit(self.area_panel) self.option_notebook.AddPage(self.area_panel, u"Область сканирования", False) self.extend_panel = wx.Panel(self.option_notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer14 = wx.BoxSizer(wx.VERTICAL) bSizer15 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText12 = wx.StaticText(self.extend_panel, wx.ID_ANY, u"Директория хранения:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText12.Wrap(-1) self.m_staticText12.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer15.Add(self.m_staticText12, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.scan_dirPicker = wx.DirPickerCtrl( self.extend_panel, wx.ID_ANY, u"/home/xhermit", u"Select a folder", wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE) self.scan_dirPicker.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer15.Add(self.scan_dirPicker, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) bSizer14.Add(bSizer15, 0, wx.EXPAND, 5) bSizer16 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText13 = wx.StaticText(self.extend_panel, wx.ID_ANY, u"Формат имени файла:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText13.Wrap(-1) self.m_staticText13.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer16.Add(self.m_staticText13, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.filename_textCtrl = wx.TextCtrl(self.extend_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.filename_textCtrl.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer16.Add(self.filename_textCtrl, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) bSizer14.Add(bSizer16, 0, wx.EXPAND, 5) bSizer6 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText6 = wx.StaticText(self.extend_panel, wx.ID_ANY, u"Формат результирующего файла:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText6.Wrap(-1) self.m_staticText6.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer6.Add(self.m_staticText6, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.fileext_comboBox = wx.combo.BitmapComboBox( self.extend_panel, wx.ID_ANY, u"Combo!", wx.DefaultPosition, wx.Size(100, -1), "", wx.CB_READONLY) self.fileext_comboBox.SetSelection(0) self.fileext_comboBox.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer6.Add(self.fileext_comboBox, 0, wx.ALL | wx.EXPAND, 5) bSizer14.Add(bSizer6, 0, wx.EXPAND, 5) bSizer19 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText15 = wx.StaticText(self.extend_panel, wx.ID_ANY, u"Глубина:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText15.Wrap(-1) self.m_staticText15.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer19.Add(self.m_staticText15, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.depth_spinCtrl = wx.SpinCtrl(self.extend_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10, 0) self.depth_spinCtrl.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer19.Add(self.depth_spinCtrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) bSizer14.Add(bSizer19, 0, wx.EXPAND, 5) bSizer20 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText16 = wx.StaticText(self.extend_panel, wx.ID_ANY, u"Инструмент сканирования:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText16.Wrap(-1) self.m_staticText16.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer20.Add(self.m_staticText16, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.extern_cmd_textCtrl = wx.TextCtrl(self.extend_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.extern_cmd_textCtrl.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer20.Add(self.extern_cmd_textCtrl, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) bSizer14.Add(bSizer20, 0, wx.EXPAND, 5) self.extend_panel.SetSizer(bSizer14) self.extend_panel.Layout() bSizer14.Fit(self.extend_panel) self.option_notebook.AddPage(self.extend_panel, u"Дополнительно", False) bSizer1.Add(self.option_notebook, 1, wx.EXPAND | wx.ALL, 5) bSizer2 = wx.BoxSizer(wx.HORIZONTAL) self.cancel_button = wx.Button(self, wx.ID_ANY, u"Отмена", wx.DefaultPosition, wx.DefaultSize, 0) self.cancel_button.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer2.Add(self.cancel_button, 0, wx.ALL, 5) self.extern_button = wx.Button(self, wx.ID_ANY, u"Инструмент сканирования ...", wx.DefaultPosition, wx.DefaultSize, 0) self.extern_button.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer2.Add(self.extern_button, 0, wx.ALL, 5) self.ok_button = wx.Button(self, wx.ID_ANY, u"Сканировать", wx.DefaultPosition, wx.DefaultSize, 0) self.ok_button.SetFont(wx.Font(14, 70, 90, 90, False, wx.EmptyString)) bSizer2.Add(self.ok_button, 0, wx.ALL | wx.EXPAND, 5) bSizer1.Add(bSizer2, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.SetSizer(bSizer1) self.Layout() self.Centre(wx.BOTH) # Connect Events self.Bind(wx.EVT_INIT_DIALOG, self.onInitDlg) self.multiscan_checkBox.Bind(wx.EVT_CHECKBOX, self.onMultiScanCheckBox) self.fileext_comboBox.Bind(wx.EVT_COMBOBOX, self.onFileTypeCombobox) self.cancel_button.Bind(wx.EVT_BUTTON, self.onCanceButtonClick) self.extern_button.Bind(wx.EVT_BUTTON, self.onExternButtonClick) self.ok_button.Bind(wx.EVT_BUTTON, self.onOkButtonClick)
def __init__(self, parent, IDcompte_payeur=None, IDreglement=None): wx.Panel.__init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL) self.parent = parent self.IDcompte_payeur = IDcompte_payeur self.IDreglement = IDreglement self.montant_reglement = FloatToDecimal(0.0) self.total_ventilation = FloatToDecimal(0.0) self.validation = True if "linux" in sys.platform: defaultFont = self.GetFont() defaultFont.SetPointSize(8) self.SetFont(defaultFont) # Regroupement self.label_regroupement = wx.StaticText(self, -1, _(u"Regrouper par :")) self.radio_periode = wx.RadioButton(self, -1, _(u"Mois"), style=wx.RB_GROUP) self.radio_facture = wx.RadioButton(self, -1, _(u"Facture")) self.radio_individu = wx.RadioButton(self, -1, _(u"Individu")) self.radio_date = wx.RadioButton(self, -1, _(u"Date")) # Commandes rapides self.label_hyperliens_1 = wx.StaticText(self, -1, _(u"Ventiler ")) self.hyper_automatique = Hyperlien( self, label=_(u"automatiquement"), infobulle=_( u"Cliquez ici pour ventiler automatiquement le crédit restant" ), URL="automatique") self.label_hyperliens_2 = wx.StaticText(self, -1, u" | ") self.hyper_tout = Hyperlien( self, label=_(u"tout"), infobulle=_(u"Cliquez ici pour tout ventiler"), URL="tout") self.label_hyperliens_3 = wx.StaticText(self, -1, u" | ") self.hyper_rien = Hyperlien( self, label=_(u"rien"), infobulle=_(u"Cliquez ici pour ne rien ventiler"), URL="rien") # Liste de la ventilation self.ctrl_ventilation = CTRL_Ventilation(self, IDcompte_payeur, IDreglement) # Etat de la ventilation self.imgOk = wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ok4.png"), wx.BITMAP_TYPE_PNG) self.imgErreur = wx.Bitmap( Chemins.GetStaticPath("Images/16x16/Interdit2.png"), wx.BITMAP_TYPE_PNG) self.imgAddition = wx.Bitmap( Chemins.GetStaticPath("Images/16x16/Addition.png"), wx.BITMAP_TYPE_PNG) self.ctrl_image = wx.StaticBitmap(self, -1, self.imgAddition) self.ctrl_info = wx.StaticText( self, -1, _(u"Vous pouvez encore ventiler 30.90 ¤")) self.ctrl_info.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD)) self.__do_layout() self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioRegroupement, self.radio_periode) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioRegroupement, self.radio_facture) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioRegroupement, self.radio_individu) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioRegroupement, self.radio_date) # Init self.ctrl_ventilation.InitGrid()
def __init__(self, parent, id=-1, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): self.frame = wx.Frame.__init__(self, parent, id, title, pos, size, style) # Initiate parent window self.SetIcon(wx.Icon("Icons/Pie.ico", wx.BITMAP_TYPE_ICO)) # Set window icon self.ribbon = RB.RibbonBar(self, -1) # Initiate Ribbon Bar self.CreateStatusBar() # Initiate Status Bar ### ------------------------------------------- Home Tab: id = 100 -------------------------------------------- ### home = RB.RibbonPage(self.ribbon, -1, "Home") # Home tab on bar filePanel = RB.RibbonPanel(home, -1, "File") # File menu fileBar = RB.RibbonButtonBar(filePanel) fileBar.AddSimpleButton(101, "New", wx.Bitmap("Icons/stock_new.png", wx.BITMAP_TYPE_PNG), "") # New document fileBar.AddSimpleButton(102, "Open", wx.Bitmap("Icons/stock_open.png", wx.BITMAP_TYPE_PNG), "") # Open file tool fileBar.AddHybridButton( 103, "Save", wx.Bitmap("Icons/stock_save.png", wx.BITMAP_TYPE_PNG)) # Save file tool fileBar.AddHybridButton(104, "Print", wx.Bitmap("Icons/stock_print.png", wx.BITMAP_TYPE_PNG), "") # Print alignmentPanel = RB.RibbonPanel(home, -1, "Alignment") # Alignment menu alignBar = RB.RibbonButtonBar(alignmentPanel) alignBar.AddSimpleButton(105, "Left", wx.Bitmap("Icons/align_left.png", wx.BITMAP_TYPE_PNG), "") # Left Align alignBar.AddSimpleButton(106, "Center", wx.Bitmap("Icons/align_center.png", wx.BITMAP_TYPE_PNG), "") # Centre Align alignBar.AddSimpleButton(107, "Right", wx.Bitmap("Icons/align_right.png", wx.BITMAP_TYPE_PNG), "") # Right Align toolsPanel = RB.RibbonPanel(home, -1, "Text") # Text menu toolsBar = RB.RibbonButtonBar(toolsPanel) toolsBar.AddSimpleButton(108, "Standard", wx.Bitmap("Icons/bullet_point.png", wx.BITMAP_TYPE_PNG), "") # Standard Bullets toolsBar.AddSimpleButton(109, "Number", wx.Bitmap("Icons/numb_point.png", wx.BITMAP_TYPE_PNG), "") # Numbered Bullets toolsBar.AddSimpleButton(110, "Bold", wx.Bitmap("Icons/stock_text_bold.png", wx.BITMAP_TYPE_PNG), "") # Bold text toolsBar.AddSimpleButton(111, "Italic", wx.Bitmap("Icons/stock_text_italic.png", wx.BITMAP_TYPE_PNG), "") # Italic text toolsBar.AddSimpleButton(112, "Underline", wx.Bitmap("Icons/stock_text_underline.png", wx.BITMAP_TYPE_PNG), "") # Underline Text toolsBar.AddSimpleButton(119, "Highlight", wx.Bitmap("Icons/highlighter_icon.png", wx.BITMAP_TYPE_PNG), "") # Highlight text lineSpace = RB.RibbonPanel(home, -1, "Spacing") # Spacing menu lineBar = RB.RibbonButtonBar(lineSpace) lineBar.AddSimpleButton(113, "Normal", wx.Bitmap("Icons/spacing_normal.png", wx.BITMAP_TYPE_PNG), "") # Single line spacing lineBar.AddSimpleButton(114, "Half", wx.Bitmap("Icons/spacing_half.png", wx.BITMAP_TYPE_PNG), "") # 1 1/2 line spacing lineBar.AddSimpleButton(115, "Double", wx.Bitmap("Icons/spacing_double.png", wx.BITMAP_TYPE_PNG), "") # Double line spacing tabPanel = RB.RibbonPanel(home, -1, "Indent") # Indent menu tabBar = RB.RibbonButtonBar(tabPanel) tabBar.AddSimpleButton(116, "Right", wx.Bitmap("Icons/arrow_right.png", wx.BITMAP_TYPE_PNG), "") # Right indent tabBar.AddSimpleButton(117, "Left", wx.Bitmap("Icons/arrow_left.png", wx.BITMAP_TYPE_PNG), "") # Left indent picPanel = RB.RibbonPanel(home, -1, "Add Pictures") # Pictures menu picBar = RB.RibbonButtonBar(picPanel) picBar.AddSimpleButton(118, "Import", wx.Bitmap("Icons/insert_image.png", wx.BITMAP_TYPE_PNG), "") # Import pics ### ------------------------------------------- Font Tab: id = 200 -------------------------------------------- ### font_tab = RB.RibbonPage(self.ribbon, -1, "Font") # Font tab created fontPanel = RB.RibbonPanel(font_tab, 400, "Font") # Font gallery self.addColours(fontPanel, 200) fontPanel2 = RB.RibbonPanel(font_tab, -1, "Fonts") # Fonts bar fonts = RB.RibbonButtonBar(fontPanel2) fonts.AddSimpleButton( 201, "Font", wx.Bitmap("Icons/edit_pic.jpg", wx.BITMAP_TYPE_JPEG), "") fonts.AddSimpleButton( 202, "Words", wx.Bitmap("Icons/suggestion_icon.png", wx.BITMAP_TYPE_PNG), "") fonts.AddSimpleButton( 203, "Check", wx.Bitmap("Icons/suggestion_icon.png", wx.BITMAP_TYPE_PNG), "") fontPanel.Realize() fontPanel2.Realize() ### ------------------------------------------- End Ribbon ---------------------------------------------------- ### self.rtc = RichTextCtrl(self, style=wx.HSCROLL | wx.NO_BORDER) # Init rich text box wx.CallAfter(self.rtc.SetFocus) # Display text box self.rtc.BeginFont( wx.Font(15, wx.SWISS, wx.NORMAL, wx.NORMAL, False, "Calibri")) box = wx.BoxSizer( wx.VERTICAL) # Resizes widgets within window when resized box.Add(self.ribbon, 0, wx.EXPAND) # Resizes ribbon appropriately box.Add(self.rtc, 1, wx.EXPAND) # Fills in remaining space with text box self.ribbon.Realize() # Displays ribbon self.SetSizer(box) # Initiate self.Show(True) self.bindEvents()
def ShowSensors(self): """ Display the sensors. """ sensors = self.getSensorsToDisplay(self.istart) # Destroy previous widgets for b in self.boxes: b.Destroy() for t in self.texts: t.Destroy() self.boxes = [] self.texts = [] # Main sizer boxSizerMain = wx.BoxSizer(wx.VERTICAL) # Grid sizer nrows, ncols = 2, 3 vgap, hgap = 50, 50 gridSizer = wx.GridSizer(nrows, ncols, vgap, hgap) # Create a box for each sensor for index, sensor in sensors: (name, value, unit) = self.port.sensor(index) box = OBDStaticBox(self, wx.ID_ANY) self.boxes.append(box) boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL) # Text for sensor value if type(value) == float: value = str("%.2f" % round(value, 3)) t1 = wx.StaticText(parent=self, label=str(value), style=wx.ALIGN_CENTER) t1.SetForegroundColour('WHITE') font1 = wx.Font(32, wx.ROMAN, wx.NORMAL, wx.NORMAL, faceName="Monaco") t1.SetFont(font1) boxSizer.Add(t1, 0, wx.ALIGN_CENTER | wx.ALL, 20) boxSizer.AddStretchSpacer() self.texts.append(t1) # Text for sensor name t2 = wx.StaticText(parent=self, label=unit + "\n" + name, style=wx.ALIGN_CENTER) t2.SetForegroundColour('WHITE') font2 = wx.Font(13, wx.ROMAN, wx.NORMAL, wx.BOLD, faceName="Monaco") t2.SetFont(font2) boxSizer.Add(t2, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.texts.append(t2) gridSizer.Add(boxSizer, 1, wx.EXPAND | wx.ALL) # Add invisible boxes if necessary nsensors = len(sensors) for i in range(6 - nsensors): box = OBDStaticBox(self) boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL) self.boxes.append(box) box.Show(False) gridSizer.Add(boxSizer, 1, wx.EXPAND | wx.ALL) # Layout boxSizerMain.Add(gridSizer, 1, wx.EXPAND | wx.ALL, 10) self.SetSizer(boxSizerMain) self.Refresh() self.Layout() # Timer for update self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.refresh, self.timer) self.timer.Start(2000)
def DoDrawing(self, dc, printing=False): dc.BeginDrawing() dc.SetPen(wx.Pen('RED')) dc.DrawRectangle(5, 5, 50, 50) dc.SetBrush(wx.LIGHT_GREY_BRUSH) dc.SetPen(wx.Pen('BLUE', 4)) dc.DrawRectangle(15, 15, 50, 50) dc.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL)) dc.SetTextForeground(wx.Colour(0xFF, 0x20, 0xFF)) te = dc.GetTextExtent("Hello World") dc.DrawText("Hello World", 60, 65) dc.SetPen(wx.Pen('VIOLET', 4)) dc.DrawLine(5, 65 + te[1], 60 + te[0], 65 + te[1]) lst = [(100, 110), (150, 110), (150, 160), (100, 160)] dc.DrawLines(lst, -60) dc.SetPen(wx.GREY_PEN) dc.DrawPolygon(lst, 75) dc.SetPen(wx.GREEN_PEN) dc.DrawSpline(lst + [(100, 100)]) dc.DrawBitmap(self.bmp, 200, 20, True) dc.SetTextForeground(wx.Colour(0, 0xFF, 0x80)) dc.DrawText("a bitmap", 200, 85) ## dc.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL)) ## dc.SetTextForeground("BLACK") ## dc.DrawText("TEST this STRING", 10, 200) ## print dc.GetFullTextExtent("TEST this STRING") font = wx.Font(20, wx.SWISS, wx.NORMAL, wx.NORMAL) dc.SetFont(font) dc.SetTextForeground(wx.BLACK) for a in range(0, 360, 45): dc.DrawRotatedText("Rotated text...", 300, 300, a) dc.SetPen(wx.TRANSPARENT_PEN) dc.SetBrush(wx.BLUE_BRUSH) dc.DrawRectangle(50, 500, 50, 50) dc.DrawRectangle(100, 500, 50, 50) dc.SetPen(wx.Pen('RED')) dc.DrawEllipticArc(200, 500, 50, 75, 0, 90) if not printing: # This has troubles when used on a print preview in wxGTK, # probably something to do with the pen styles and the scaling # it does... y = 20 for style in [ wx.DOT, wx.LONG_DASH, wx.SHORT_DASH, wx.DOT_DASH, wx.USER_DASH ]: pen = wx.Pen("DARK ORCHID", 1, style) if style == wx.USER_DASH: pen.SetCap(wx.CAP_BUTT) pen.SetDashes([1, 2]) pen.SetColour("RED") dc.SetPen(pen) dc.DrawLine(300, y, 400, y) y = y + 10 dc.SetBrush(wx.TRANSPARENT_BRUSH) dc.SetPen(wx.Pen(wx.Colour(0xFF, 0x20, 0xFF), 1, wx.SOLID)) dc.DrawRectangle(450, 50, 100, 100) old_pen = dc.GetPen() new_pen = wx.Pen("BLACK", 5) dc.SetPen(new_pen) dc.DrawRectangle(470, 70, 60, 60) dc.SetPen(old_pen) dc.DrawRectangle(490, 90, 20, 20) dc.GradientFillLinear((20, 260, 50, 50), "red", "blue") dc.GradientFillConcentric((20, 325, 50, 50), "red", "blue", (25, 25)) self.DrawSavedLines(dc) dc.EndDrawing()
def __init__(self, parent, release): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = "Pyfa Update", pos = wx.DefaultPosition, size = wx.Size( 400,300 ), style = wx.DEFAULT_DIALOG_STYLE ) self.UpdateSettings = service.settings.UpdateSettings.getInstance() self.releaseInfo = release self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) mainSizer = wx.BoxSizer( wx.VERTICAL ) headSizer = wx.BoxSizer( wx.HORIZONTAL ) self.headingText = wx.StaticText( self, wx.ID_ANY, "Pyfa Update Available!", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) self.headingText.Wrap( -1 ) self.headingText.SetFont( wx.Font( 14, 74, 90, 92, False) ) headSizer.Add( self.headingText, 1, wx.ALL, 5 ) mainSizer.Add( headSizer, 0, wx.EXPAND, 5 ) mainSizer.Add( wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ), 0, wx.EXPAND |wx.ALL, 5 ) versionSizer = wx.BoxSizer( wx.HORIZONTAL ) if(self.releaseInfo['prerelease']): self.releaseText = wx.StaticText( self, wx.ID_ANY, "Pre-release", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT ) self.releaseText.SetFont( wx.Font( 12, 74, 90, 92, False) ) self.releaseText.SetForegroundColour( wx.Colour( 230, 0, 0 ) ) else: self.releaseText = wx.StaticText( self, wx.ID_ANY, "Stable", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT ) self.releaseText.SetFont( wx.Font( 12, 74, 90, 90, False) ) self.releaseText.Wrap( -1 ) versionSizer.Add( self.releaseText, 1, wx.ALL, 5 ) self.versionText = wx.StaticText( self, wx.ID_ANY, self.releaseInfo['tag_name'], wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_LEFT ) self.versionText.Wrap( -1 ) self.versionText.SetFont( wx.Font( 12, 74, 90, 90, False) ) versionSizer.Add( self.versionText, 1, wx.ALL, 5 ) versionSizer.AddSpacer( ( 15, 5), 0, wx.EXPAND, 5 ) mainSizer.Add( versionSizer, 0, wx.EXPAND, 5 ) mainSizer.AddSpacer( ( 0, 5), 0, wx.EXPAND, 5 ) releaseDate = dateutil.parser.parse(self.releaseInfo['published_at']) notesSizer = wx.BoxSizer( wx.HORIZONTAL ) self.notesTextCtrl = wx.TextCtrl( self, wx.ID_ANY, str(releaseDate.date())+":\n\n"+self.releaseInfo['body'], wx.DefaultPosition, wx.DefaultSize, wx.TE_AUTO_URL|wx.TE_MULTILINE|wx.TE_READONLY|wx.DOUBLE_BORDER|wx.TRANSPARENT_WINDOW ) notesSizer.Add( self.notesTextCtrl, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5 ) mainSizer.Add( notesSizer, 1, wx.EXPAND, 5 ) self.supressCheckbox = wx.CheckBox( self, wx.ID_ANY, "Don't remind me again for this release", wx.DefaultPosition, wx.DefaultSize, 0 ) self.supressCheckbox.Bind(wx.EVT_CHECKBOX, self.SuppressChange) mainSizer.Add( self.supressCheckbox, 0, wx.ALL, 5 ) mainSizer.Add( wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ), 0, wx.EXPAND |wx.ALL, 5 ) actionSizer = wx.BoxSizer( wx.HORIZONTAL ) goSizer = wx.BoxSizer( wx.VERTICAL ) self.downloadButton = wx.Button( self, wx.ID_ANY, "Download", wx.DefaultPosition, wx.DefaultSize, 0 ) self.downloadButton.Bind(wx.EVT_BUTTON, self.OnDownload) goSizer.Add( self.downloadButton, 0, wx.ALL, 5 ) actionSizer.Add( goSizer, 1, wx.EXPAND, 5 ) self.closeButton = wx.Button(self, wx.ID_CLOSE) self.closeButton.Bind(wx.EVT_BUTTON, self.OnClose) actionSizer.Add( self.closeButton, 0, wx.ALL, 5 ) mainSizer.Add( actionSizer, 0, wx.EXPAND, 5 ) self.SetSizer( mainSizer ) self.Layout() # Handle use-case of suppressing a release, then a new version becoming available. # If that new version is not suppressed, the old version will remain in the preferences and # may cause confusion. If this dialog box is popping up for any reason, that mean we can # safely reset this setting self.UpdateSettings.set('version', None) self.Centre( wx.BOTH )
def __init__( self, parent ): ScrolledPanel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 100,20 ), style = wx.TAB_TRAVERSAL | wx.HSCROLL | wx.VSCROLL ) mainSizer = wx.BoxSizer( wx.VERTICAL ) self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.draggedFitID = None self.FitDNDPopupMenu = wx.Menu() self.options = ["Fleet booster", "Wing booster", "Squad booster"] for option in self.options: item = self.FitDNDPopupMenu.Append(-1, option) self.Bind(wx.EVT_MENU, self.OnPopupItemSelected, item) contentFGSizer = wx.FlexGridSizer( 5, 3, 0, 0 ) contentFGSizer.AddGrowableCol( 1 ) contentFGSizer.SetFlexibleDirection( wx.BOTH ) contentFGSizer.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.oneonePlaceholder = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.oneonePlaceholder.Wrap( -1 ) contentFGSizer.Add( self.oneonePlaceholder, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.stFits = wx.StaticText( self, wx.ID_ANY, u"Fits", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stFits.Wrap( -1 ) self.stFits.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) ) contentFGSizer.Add( self.stFits, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) self.stCharacters = wx.StaticText( self, wx.ID_ANY, u"Characters", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stCharacters.Wrap( -1 ) self.stCharacters.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) ) contentFGSizer.Add( self.stCharacters, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) contentFGSizer.Add( self.m_staticline2, 0, wx.EXPAND, 5 ) self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) contentFGSizer.Add( self.m_staticline3, 0, wx.EXPAND, 5 ) self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) contentFGSizer.Add( self.m_staticline4, 0, wx.EXPAND, 5 ) self.stFleet = wx.StaticText( self, wx.ID_ANY, u"Fleet booster:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stFleet.Wrap( -1 ) self.stFleet.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) ) contentFGSizer.Add( self.stFleet, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) self.stFleetFit = wx.StaticText( self, wx.ID_ANY, u"None", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stFleetFit.Wrap( -1 ) contentFGSizer.Add( self.stFleetFit, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) chFleetCharChoices = [] self.chFleetChar = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, chFleetCharChoices, 0 ) self.chFleetChar.SetSelection( 0 ) contentFGSizer.Add( self.chFleetChar, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5 ) self.stWing = wx.StaticText( self, wx.ID_ANY, u"Wing booster:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stWing.Wrap( -1 ) self.stWing.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) ) contentFGSizer.Add( self.stWing, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) self.stWingFit = wx.StaticText( self, wx.ID_ANY, u"None", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stWingFit.Wrap( -1 ) contentFGSizer.Add( self.stWingFit, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) chWingCharChoices = [] self.chWingChar = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, chWingCharChoices, 0 ) self.chWingChar.SetSelection( 0 ) contentFGSizer.Add( self.chWingChar, 0, wx.ALL| wx.ALIGN_CENTER_VERTICAL, 5 ) self.stSquad = wx.StaticText( self, wx.ID_ANY, u"Squad booster:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stSquad.Wrap( -1 ) self.stSquad.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) ) contentFGSizer.Add( self.stSquad, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) self.stSquadFit = wx.StaticText( self, wx.ID_ANY, u"None", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stSquadFit.Wrap( -1 ) contentFGSizer.Add( self.stSquadFit, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) chSquadCharChoices = [] self.chSquadChar = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, chSquadCharChoices, 0 ) self.chSquadChar.SetSelection( 0 ) contentFGSizer.Add( self.chSquadChar, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5 ) mainSizer.Add( contentFGSizer, 1, wx.EXPAND, 0 ) self.stBoosters = [] self.stBoosters.append(self.stFleetFit) self.stBoosters.append(self.stWingFit) self.stBoosters.append(self.stSquadFit) self.chCharacters = [] self.chCharacters.append(self.chFleetChar) self.chCharacters.append(self.chWingChar) self.chCharacters.append(self.chSquadChar) self.SetSizer( mainSizer ) self.SetAutoLayout(True) self.SetupScrolling() self.Disable() self.mainFrame.Bind(GE.CHAR_LIST_UPDATED, self.RefreshCharacterList) self.mainFrame.Bind(GE.FIT_CHANGED, self.fitSelected) self.mainFrame.Bind(gui.shipBrowser.EVT_FIT_RENAMED, self.fitRenamed) for stBooster in self.stBoosters: stBooster.Bind(wx.EVT_LEFT_DCLICK, self.RemoveBooster) stBooster.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterWindow) stBooster.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow) stBooster.SetToolTip(wx.ToolTip("Double click to remove booster")) for chCharacter in self.chCharacters: chCharacter.Bind(wx.EVT_CHOICE, self.CharChanged) self.RefreshCharacterList()
def __init__(self, parent, noTitle=False, style=wx.VSCROLL | wx.NO_BORDER, project={}): scrlpanel.ScrolledPanel.__init__(self, parent, -1, style=style) self.parent = parent self.project = project # type: PavloviaProject self.noTitle = noTitle self.localFolder = '' self.syncPanel = None if not noTitle: self.title = wx.StaticText(parent=self, id=-1, label="", style=wx.ALIGN_CENTER) font = wx.Font(18, wx.DECORATIVE, wx.NORMAL, wx.BOLD) self.title.SetFont(font) # if we've synced before we should know the local location self.localFolderCtrl = wx.StaticText(parent=self, id=wx.ID_ANY, label=_translate("Local root: ")) self.browseLocalBtn = wx.Button(parent=self, id=wx.ID_ANY, label=_translate("Browse...")) self.browseLocalBtn.Bind(wx.EVT_BUTTON, self.onBrowseLocalFolder) # remote attributes self.url = wxhl.HyperLinkCtrl( parent=self, id=-1, label="https://pavlovia.org", URL="https://pavlovia.org", ) self.description = wx.StaticText( parent=self, id=-1, label=_translate("Select a project for details")) self.tags = wx.StaticText(parent=self, id=-1, label="") self.visibility = wx.StaticText(parent=self, id=-1, label="") self.syncButton = wx.Button(self, -1, _translate("Sync...")) self.syncButton.Enable(False) self.syncButton.Bind(wx.EVT_BUTTON, self.onSyncButton) self.syncPanel = sync.SyncStatusPanel(parent=self, id=wx.ID_ANY) # layout # sizers: on the right we have detail self.sizer = wx.BoxSizer(wx.VERTICAL) # self.sizer.Add(wx.StaticText(self, -1, _translate("Project Info")), # flag=wx.ALL, # border=5) if not noTitle: self.sizer.Add(self.title, border=5, flag=wx.ALL | wx.ALIGN_CENTER) self.sizer.Add(self.url, border=5, flag=wx.ALL | wx.ALIGN_CENTER) self.sizer.Add(self.localFolderCtrl, border=5, flag=wx.ALL | wx.EXPAND), self.sizer.Add(self.browseLocalBtn, border=5, flag=wx.ALL | wx.ALIGN_LEFT) self.sizer.Add(self.tags, border=5, flag=wx.ALL | wx.EXPAND) self.sizer.Add(self.visibility, border=5, flag=wx.ALL | wx.EXPAND) self.sizer.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), flag=wx.ALL | wx.EXPAND) self.sizer.Add(self.description, border=10, flag=wx.ALL | wx.EXPAND) self.sizer.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), flag=wx.ALL | wx.EXPAND) self.sizer.Add(self.syncButton, flag=wx.ALL | wx.ALIGN_RIGHT, border=5) self.sizer.Add(self.syncPanel, border=5, proportion=1, flag=wx.ALL | wx.RIGHT | wx.EXPAND) if self.project: self.setProject(self.project) self.syncPanel.setStatus(_translate("Ready to sync")) else: self.syncPanel.setStatus( _translate("This file doesn't belong to a project yet")) self.SetAutoLayout(True) self.SetSizerAndFit(self.sizer) self.SetupScrolling() self.Bind(wx.EVT_SIZE, self.onResize)
def __init__(self, parent, id): self.debug = False pos = wx.DefaultPosition wx.Frame.__init__(self, None, -1, title='NI DAQ Utility', size=(810, 600)) panel = wx.Panel(self, -1) self.led = gizmos.LEDNumberCtrl(panel, -1, pos=(50, 200), size=(550, 120)) self.led.SetBackgroundColour("black") self.led.SetForegroundColour("red") if self.debug: print "7-segment display done" device_buttons_list = ['NI 6251M', 'NI 6025E'] self.devices_RadioBox = wx.RadioBox(panel, -1, "DAQ Card", (218, 350), wx.DefaultSize, device_buttons_list, 2, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.on_device_change, self.devices_RadioBox) if self.debug: print "DAQ card buttons done" channel_buttons_list = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15' ] self.channels_RadioBox = wx.RadioBox(panel, -1, "Channel", (400, 350), wx.DefaultSize, channel_buttons_list, 2, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.on_channel_change, self.channels_RadioBox) if self.debug: print "channel select buttons done" gain_buttons_list = [ '+/- 10V', '+/- 5V', '+/- 2V', '+/- 1V', '+/- 0.5V', '+/- 0.2V', '+/- 0.1V', '+/- 0.05V' ] self.gains_RadioBox = wx.RadioBox(panel, -1, "Channel Gain", (518, 350), wx.DefaultSize, gain_buttons_list, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.on_gain_change, self.gains_RadioBox) if self.debug: print "gain select buttons done" t1 = wx.StaticText(panel, -1, "Analog Input Voltage", pos=(180, 150)) font = wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL) t1.SetFont(font) t2 = wx.StaticText(panel, -1, "Volts", pos=(610, 250)) font = wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.NORMAL) t2.SetFont(font) t3 = wx.StaticText(panel, -1, "Data Acquisition Card Measurement Utility", pos=(22, 20)) font = wx.Font(31, wx.DEFAULT, wx.NORMAL, wx.NORMAL) t3.SetFont(font) if self.debug: print "window text done" #disable +/-.05V selection for initial 6251 card selection self.gains_RadioBox.EnableItem(7, False) self.OnTimer(None) self.timer = wx.Timer(self, -1) # update clock digits every second (1000ms) self.timer.Start(1000) self.Bind(wx.EVT_TIMER, self.OnTimer) if self.debug: print "__init__ done"
def __init__(self, parent, ID, title, exitCallback): wx.Frame.__init__(self, parent, ID, title) EXIT = 100 self.exitCallback = exitCallback # Create a menu bar # TRANSLATORS: this is a menu bar entry fileMenu = wx.Menu(_("File")) # TRANSLATORS: this is a menu bar entry fileMenu.Append(EXIT, _("Exit%(hotkey)s") % {"hotkey": "\tCTRL+Q"}, "Exit London Law") menuBar = wx.MenuBar() # TRANSLATORS: this is a menu bar entry menuBar.Append(fileMenu, _("File")) self.SetMenuBar(menuBar) # Create a status bar self.status = self.CreateStatusBar() # stick everything in a panel to enable tab traversal mainPanel = wx.Panel(self, -1) labelFont = wx.Font(self.GetFont().GetPointSize(), wx.DEFAULT, wx.NORMAL, wx.BOLD) labelFont.SetWeight(wx.BOLD) # TRANSLATORS: labels for server connection dialog connectLabel = wx.StaticText(mainPanel, -1, _("Connect to: ")) connectLabel.SetFont(labelFont) # TRANSLATORS: labels for server connection dialog self.hostEntryLabel = wx.StaticText(mainPanel, -1, _("host:"), wx.Point(0, 0)) self.hostEntry = wx.TextCtrl(mainPanel, -1, "localhost", wx.DefaultPosition, (170, wx.DefaultSize[1])) # TRANSLATORS: labels for server connection dialog self.portEntryLabel = wx.StaticText(mainPanel, -1, _("port:"), wx.Point(0, 0)) self.portEntry = wx.TextCtrl(mainPanel, -1, str(LLAW_PORT), wx.DefaultPosition, (50, wx.DefaultSize[1])) self.portEntry.SetMaxLength(5) connectSizer = wx.BoxSizer(wx.HORIZONTAL) connectSizer.Add((30, 1), 0, 0) connectSizer.Add(self.hostEntryLabel, 0, wx.ALIGN_CENTRE | wx.LEFT, 5) connectSizer.Add(self.hostEntry, 0, wx.ALIGN_CENTRE | wx.ALL, 5) connectSizer.Add((10, 1), 0, 0) connectSizer.Add(self.portEntryLabel, 0, wx.ALIGN_CENTRE) connectSizer.Add(self.portEntry, 0, wx.ALIGN_CENTRE | wx.ALL, 5) # TRANSLATORS: labels for server connection dialog userLabel = wx.StaticText(mainPanel, -1, _("User information: ")) userLabel.SetFont(labelFont) self.usernameEntryLabel = wx.StaticText(mainPanel, -1, _("username:"******"password:"******"Connect")) self.quitButton = wx.Button(mainPanel, -1, _("Quit")) buttonSizer = wx.BoxSizer(wx.HORIZONTAL) buttonSizer.Add(self.quitButton, 0, wx.ALIGN_CENTRE | wx.ALL, 5) if sys.platform.lower()[:-3] == "win": # Win32 users like their buttons in the wrong order buttonSizer.Prepend(self.connectButton, 0, wx.ALIGN_CENTRE | wx.ALL, 5) else: buttonSizer.Add(self.connectButton, 0, wx.ALIGN_CENTRE | wx.ALL, 5) buttonSizer.Prepend((10, 1), 1, wx.EXPAND) self.topSizer = wx.BoxSizer(wx.VERTICAL) self.topSizer.Add(connectLabel, 0, wx.ALIGN_LEFT | wx.LEFT | wx.TOP, 10) self.topSizer.Add(connectSizer, 0, wx.ALIGN_LEFT | wx.ALL, 5) self.topSizer.Add(userLabel, 0, wx.ALIGN_LEFT | wx.LEFT | wx.TOP, 10) self.topSizer.Add(userSizer, 0, wx.ALIGN_LEFT | wx.ALL, 5) self.topSizer.Add((10, 10), 1, wx.EXPAND) self.topSizer.Add(buttonSizer, 0, wx.EXPAND | wx.ALL, 5) mainPanel.SetSizer(self.topSizer) self.topSizer.Fit(self) mainPanel.SetAutoLayout(1) self.hostEntry.SetFocus() wx.EVT_SET_FOCUS(self.hostEntry, self.selectFocused) wx.EVT_SET_FOCUS(self.portEntry, self.selectFocused) wx.EVT_SET_FOCUS(self.usernameEntry, self.selectFocused) wx.EVT_SET_FOCUS(self.passEntry, self.selectFocused) wx.EVT_BUTTON(self, self.quitButton.GetId(), self.menuExit) wx.EVT_MENU(self, EXIT, self.menuExit)
def __init__(self, parent, item, *args): super(ItemInfo, self).__init__(parent) self.Size = wx.Size(500, 700) self.current_item = self.find_current_item(item) common_item_types = Storage.ItemStorage.get_common_item_keys() self.Bind(wx.EVT_SHOW, self.show_current_item_stats) mod_list = [] mod_list.append("None") for key, value in Storage.item_storage.mod_dict.items(): mod_list.append(key) ##============================= Шрифты ===============================## label_font = wx.Font(16, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False) sublabel_font = wx.Font(12, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False) stat_font = wx.Font(16, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False) ##================================ Верхний блок ========================== self.name_sizer = wx.BoxSizer(wx.VERTICAL) self.item_name = wx.StaticText(self, label="Name") self.item_name.SetFont(sublabel_font) self.item_type = wx.TextCtrl(self, wx.ID_ANY, item, wx.DefaultPosition) self.name_sizer.Add(self.item_name, wx.ID_ANY, wx.ALIGN_CENTER_HORIZONTAL, wx.BOTTOM) self.name_sizer.Add(self.item_type, wx.ID_ANY, wx.EXPAND) self.item_key_sizer = wx.BoxSizer(wx.VERTICAL) self.item_key_label = wx.StaticText(self, label="Item key") self.item_key_label.SetFont(sublabel_font) self.item_key_combobox = wx.ComboBox(self, value=self.current_item.key, choices=common_item_types) self.item_key_sizer.Add(self.item_key_label, wx.ID_ANY, wx.ALIGN_CENTER_HORIZONTAL, wx.BOTTOM) self.item_key_sizer.Add(self.item_key_combobox, wx.ID_ANY, wx.EXPAND) self.item_key_combobox.Bind(wx.EVT_COMBOBOX, self.update_new_item_stats) self.item_rarity_sizer = wx.BoxSizer(wx.VERTICAL) self.item_rarity_label = wx.StaticText(self, label="Item rarity") self.item_rarity_label.SetFont(sublabel_font) self.item_rarity_value = wx.ComboBox( self, value=self.current_item.rarity.key, choices=BaseStats.RARITY_LIST) self.item_rarity_sizer.Add(self.item_rarity_label, wx.ID_ANY, wx.ALIGN_CENTER_HORIZONTAL, wx.BOTTOM) self.item_rarity_sizer.Add(self.item_rarity_value, wx.ID_ANY, wx.EXPAND) self.item_rarity_value.Bind(wx.EVT_COMBOBOX, self.update_new_item_stats) self.required_stats_sizer = wx.BoxSizer(wx.HORIZONTAL) self.required_stats_sizer.Add(self.name_sizer, wx.ID_ANY, wx.EXPAND, wx.LEFT | wx.RIGHT, 20) self.required_stats_sizer.Add(self.item_key_sizer, wx.ID_ANY, wx.EXPAND, wx.LEFT | wx.RIGHT, 20) self.required_stats_sizer.Add(self.item_rarity_sizer, wx.ID_ANY, wx.EXPAND, wx.LEFT | wx.RIGHT, 20) self.top_sizer = wx.BoxSizer(wx.VERTICAL) self.top_label = wx.StaticText(self, label="Main parameters") self.top_label.SetFont(label_font) self.top_sizer.Add(self.top_label, wx.ID_ANY, wx.ALIGN_CENTER_HORIZONTAL, wx.BOTTOM, 30) self.top_sizer.Add(self.required_stats_sizer, wx.ID_ANY, wx.EXPAND, wx.BOTTOM, 30) ##==================Список модов в предмете и контролы для их смены=========== self.mod_section = wx.BoxSizer(wx.VERTICAL) self.item_mods = wx.BoxSizer(wx.HORIZONTAL) mod_list_label = wx.StaticText(self, label="Item mods") mod_list_label.SetFont(label_font) mod1_combobox = wx.ComboBox(self, value=self.current_item.mod_list[0].key, choices=mod_list) mod2_combobox = wx.ComboBox(self, value=self.current_item.mod_list[1].key, choices=mod_list) mod3_combobox = wx.ComboBox(self, value=self.current_item.mod_list[2].key, choices=mod_list) self.item_mods.Add(mod1_combobox, wx.ID_ANY, wx.EXPAND, wx.LEFT | wx.RIGHT, 50) self.item_mods.Add(mod2_combobox, wx.ID_ANY, wx.EXPAND, wx.LEFT | wx.RIGHT, 50) self.item_mods.Add(mod3_combobox, wx.ID_ANY, wx.EXPAND, wx.LEFT | wx.RIGHT, 50) mod1_combobox.Bind(wx.EVT_COMBOBOX, self.update_new_item_stats) mod2_combobox.Bind(wx.EVT_COMBOBOX, self.update_new_item_stats) mod3_combobox.Bind(wx.EVT_COMBOBOX, self.update_new_item_stats) self.mod_section.Add(mod_list_label, wx.ID_ANY, wx.ALIGN_CENTER_HORIZONTAL, wx.BOTTOM, 20) self.mod_section.Add(self.item_mods, wx.ID_ANY, wx.EXPAND) # Привязываем ивент изменения состояния комбобокса ко всем боксам self.mod_boxes = [mod1_combobox, mod2_combobox, mod3_combobox] # for m in self.mod_boxes: # m.Bind(wx.EVT_COMBOBOX, self.update_new_item_stats) # ============================== Статы предмета ============================ stat_grid_sizer = wx.GridSizer(cols=3, hgap=30, vgap=20) self.str_amount_txt = wx.StaticText(self, label="Didn't get stats") self.str_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.str_amount_txt) self.dex_amount_txt = wx.StaticText(self, label="Didn't get stats") self.dex_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.dex_amount_txt) self.end_amount_txt = wx.StaticText(self, label="Didn't get stats") self.end_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.end_amount_txt) self.tech_amount_txt = wx.StaticText(self, label="Didn't get stats") self.tech_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.tech_amount_txt) self.spd_amount_txt = wx.StaticText(self, label="Didn't get stats") self.spd_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.spd_amount_txt) self.hit_amount_txt = wx.StaticText(self, label="Didn't get stats") self.hit_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.hit_amount_txt) self.crit_amount_txt = wx.StaticText(self, label="Didn't get stats") self.crit_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.crit_amount_txt) self.dodge_amount_txt = wx.StaticText(self, label="Didn't get stats") self.dodge_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.dodge_amount_txt) self.effic_amount_txt = wx.StaticText(self, label="Didn't get stats") self.effic_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.effic_amount_txt) self.resphys_amount_txt = wx.StaticText(self, label="Didn't get stats") self.resphys_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.resphys_amount_txt) self.reschem_amount_txt = wx.StaticText(self, label="Didn't get stats") self.reschem_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.reschem_amount_txt) self.restherm_amount_txt = wx.StaticText(self, label="Didn't get stats") self.restherm_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.restherm_amount_txt) self.heal_amount_txt = wx.StaticText(self, label="Didn't get stats") self.heal_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.heal_amount_txt) self.power_amount_txt = wx.StaticText(self, label="Didn't get stats") self.power_amount_txt.SetFont(stat_font) stat_grid_sizer.Add(self.power_amount_txt) stat_label = wx.StaticText(self, label="Item stats") stat_label.SetFont(label_font) self.stat_sizer = wx.BoxSizer(wx.VERTICAL) self.stat_sizer.Add(stat_label, wx.ID_ANY, wx.ALIGN_CENTER, wx.BOTTOM, 20) self.stat_sizer.Add(stat_grid_sizer, wx.ID_ANY, wx.EXPAND, 20) ## =============================== Управление рандомными статами ========================= ## # Создаем чекбоксы для каждого стата на который может упасть рандомный стат предмета strength_check = wx.CheckBox(self, label="Strength") strength_check.SetFont(stat_font) dexterity_check = wx.CheckBox(self, label="Dexterity") dexterity_check.SetFont(stat_font) endurance_check = wx.CheckBox(self, label="Endurance") endurance_check.SetFont(stat_font) technic_check = wx.CheckBox(self, label="Technic") technic_check.SetFont(stat_font) speed_check = wx.CheckBox(self, label="Speed") speed_check.SetFont(stat_font) # Засовываем чекбоксы в грид checkbox_sizer = wx.GridSizer(cols=3, hgap=10, vgap=10) checkbox_sizer.Add(strength_check) checkbox_sizer.Add(dexterity_check) checkbox_sizer.Add(endurance_check) checkbox_sizer.Add(technic_check) checkbox_sizer.Add(speed_check) random_label = wx.StaticText(self, label="Random stat distribution") random_label.SetFont(label_font) # Добавляем все элементы блока рандомных статов в один сайзер rand_sizer = wx.BoxSizer(wx.VERTICAL) rand_sizer.Add(random_label, wx.ID_ANY, wx.ALIGN_CENTER) rand_sizer.Add(checkbox_sizer, wx.ID_ANY, wx.ALIGN_CENTER_HORIZONTAL) ## =============================== Кнопки управления ================================= test_button = wx.Button(self, label="Test") self.Bind(wx.EVT_BUTTON, self.show_current_item_stats, test_button) button_sizer = wx.BoxSizer(wx.HORIZONTAL) button_sizer.Add(test_button, wx.ID_ANY, wx.ALIGN_CENTER) ##=============================== Главный сайзер================================ self.main_sizer = wx.BoxSizer(wx.VERTICAL) self.main_sizer.Add(self.top_sizer, wx.ID_ANY, wx.EXPAND, wx.BOTTOM, 20) self.main_sizer.Add(self.mod_section, wx.ID_ANY, wx.EXPAND, wx.BOTTOM, 20) self.main_sizer.Add(self.stat_sizer, wx.ID_ANY, wx.EXPAND, wx.BOTTOM, 20) self.main_sizer.Add(rand_sizer, wx.ID_ANY, wx.EXPAND, wx.BOTTOM, 20) self.main_sizer.Add(button_sizer, wx.ID_ANY, wx.EXPAND) # self.main_sizer.SetSizeHints(self) self.SetSizer(self.main_sizer)
def TreeFont(): font = wx.Font(9, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) return font
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Проверка результата сканирования", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer21 = wx.BoxSizer(wx.VERTICAL) bSizer22 = wx.BoxSizer(wx.VERTICAL) self.m_staticText18 = wx.StaticText( self, wx.ID_ANY, u"Проверка предварительного результата сканирования", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText18.Wrap(-1) self.m_staticText18.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer22.Add(self.m_staticText18, 0, wx.ALL, 5) bSizer21.Add(bSizer22, 1, wx.EXPAND, 5) bSizer23 = wx.BoxSizer(wx.HORIZONTAL) self.preview_button = wx.Button(self, wx.ID_ANY, u"Предварительный просмотр ...", wx.DefaultPosition, wx.DefaultSize, 0) self.preview_button.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer23.Add(self.preview_button, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.rescan_button = wx.Button(self, wx.ID_ANY, u"Пересканировать", wx.DefaultPosition, wx.DefaultSize, 0) self.rescan_button.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer23.Add(self.rescan_button, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.cancel_button = wx.Button(self, wx.ID_ANY, u"Отмена", wx.DefaultPosition, wx.DefaultSize, 0) self.cancel_button.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer23.Add(self.cancel_button, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.next_button = wx.Button(self, wx.ID_ANY, u"Далее >>", wx.DefaultPosition, wx.DefaultSize, 0) self.next_button.SetDefault() self.next_button.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer23.Add(self.next_button, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) bSizer21.Add(bSizer23, 0, wx.ALIGN_RIGHT, 5) self.SetSizer(bSizer21) self.Layout() bSizer21.Fit(self) self.Centre(wx.BOTH) # Connect Events self.preview_button.Bind(wx.EVT_BUTTON, self.onPreviewButtonClick) self.rescan_button.Bind(wx.EVT_BUTTON, self.onReScanButtonClick) self.cancel_button.Bind(wx.EVT_BUTTON, self.onCancelButtonClick) self.next_button.Bind(wx.EVT_BUTTON, self.onNextButtonClick)
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Загрузка листов в лоток", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer17 = wx.BoxSizer(wx.VERTICAL) bSizer18 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText14 = wx.StaticText(self, wx.ID_ANY, u"Подготовьте", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText14.Wrap(-1) self.m_staticText14.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer18.Add(self.m_staticText14, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.sheets_spinCtrl = wx.SpinCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 0) self.sheets_spinCtrl.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer18.Add(self.sheets_spinCtrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.m_staticText15 = wx.StaticText(self, wx.ID_ANY, u"листов", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText15.Wrap(-1) self.m_staticText15.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer18.Add(self.m_staticText15, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) bSizer17.Add(bSizer18, 1, wx.EXPAND, 5) bSizer19 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText16 = wx.StaticText(self, wx.ID_ANY, u"для сканирования.", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText16.Wrap(-1) self.m_staticText16.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer19.Add(self.m_staticText16, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.m_staticText17 = wx.StaticText(self, wx.ID_ANY, u"Загрузите листы в лоток.", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText17.Wrap(-1) self.m_staticText17.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer19.Add(self.m_staticText17, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) bSizer17.Add(bSizer19, 1, wx.EXPAND, 5) bSizer20 = wx.BoxSizer(wx.HORIZONTAL) self.cancel_button = wx.Button(self, wx.ID_ANY, u"Отмена", wx.DefaultPosition, wx.DefaultSize, 0) self.cancel_button.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer20.Add(self.cancel_button, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.next_button = wx.Button(self, wx.ID_ANY, u"Далее >>", wx.DefaultPosition, wx.DefaultSize, 0) self.next_button.SetDefault() self.next_button.SetFont(wx.Font(14, 74, 90, 90, False, "Sans")) bSizer20.Add(self.next_button, 0, wx.ALL, 5) bSizer17.Add(bSizer20, 0, wx.ALIGN_RIGHT, 5) self.SetSizer(bSizer17) self.Layout() bSizer17.Fit(self) self.Centre(wx.BOTH) # Connect Events self.cancel_button.Bind(wx.EVT_BUTTON, self.onCancelButtonClick) self.next_button.Bind(wx.EVT_BUTTON, self.onNextButtonClick)
def __init__(self, parent): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(669, 428), style=wx.TAB_TRAVERSAL) container = wx.BoxSizer(wx.VERTICAL) self.m_staticText17 = wx.StaticText(self, wx.ID_ANY, u"All Classes", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) self.m_staticText17.Wrap(-1) self.m_staticText17.SetFont( wx.Font(14, 70, 90, 92, False, wx.EmptyString)) container.Add(self.m_staticText17, 0, wx.TOP | wx.EXPAND, 25) horizontal_sizer = wx.BoxSizer(wx.HORIZONTAL) left_sizer = wx.BoxSizer(wx.HORIZONTAL) OLV_sizer = wx.BoxSizer(wx.VERTICAL) # # Classes Object list View # ---------------------------------------------------------------- # Search # ---------------------------------------------------------------- search_container = wx.BoxSizer(wx.HORIZONTAL) self.refresh_btn = wx.BitmapButton( self, wx.ID_ANY, wx.Bitmap(u"images/reload_16x16.bmp", wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW) self.refresh_btn.SetBitmapHover( wx.Bitmap(u"images/reload_16x16_rotated.bmp", wx.BITMAP_TYPE_ANY)) search_container.Add(self.refresh_btn, 0, wx.BOTTOM | wx.LEFT | wx.RIGHT, 5) self.m_staticText53 = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText53.Wrap(-1) search_container.Add(self.m_staticText53, 1, wx.ALL, 5) self.search_classes = wx.SearchCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER) self.search_classes.ShowSearchButton(True) self.search_classes.ShowCancelButton(False) search_container.Add(self.search_classes, 0, wx.BOTTOM, 8) self.search_classes.Bind(wx.EVT_TEXT, self.searchClasses) self.search_classes.Bind(wx.EVT_TEXT_ENTER, self.searchClasses) OLV_sizer.Add(search_container, 0, wx.EXPAND, 5) # # # ---------------------------------------------------------------- # Table # ---------------------------------------------------------------- self.classes = getClassDets() self.classesOLV = ObjectListView(self, wx.ID_ANY, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.setClassesData() OLV_sizer.Add(self.classesOLV, 1, wx.EXPAND | wx.ALL, 5) # ---------------------------------------------------------------- # # left_btns_sizer = wx.BoxSizer(wx.VERTICAL) self.view_students_btn = wx.Button(self, wx.ID_ANY, u"View Students", wx.DefaultPosition, wx.DefaultSize, 0) self.view_students_btn.Bind(wx.EVT_BUTTON, self.getClassStudents) left_btns_sizer.Add(self.view_students_btn, 0, wx.EXPAND | wx.ALL, 5) self.edit_class_btn = wx.Button(self, wx.ID_ANY, u"Edit Class", wx.DefaultPosition, wx.DefaultSize, 0) self.edit_class_btn.Bind(wx.EVT_BUTTON, self.getClassInfo) left_btns_sizer.Add(self.edit_class_btn, 0, wx.ALL | wx.EXPAND, 5) self.delete_class_btn = wx.Button(self, wx.ID_ANY, u"Delete", wx.DefaultPosition, wx.DefaultSize, 0) self.delete_class_btn.Bind(wx.EVT_BUTTON, self.deleteClass) left_btns_sizer.Add(self.delete_class_btn, 0, wx.ALL | wx.EXPAND, 5) # # left_sizer.Add(OLV_sizer, 3, wx.EXPAND | wx.ALL, 5) left_sizer.Add(left_btns_sizer, 1, wx.ALL, 5) horizontal_sizer.Add(left_sizer, 1, wx.EXPAND, 5) right_sizer = wx.BoxSizer(wx.VERTICAL) # self.m_staticText59 = wx.StaticText(self, wx.ID_ANY, u"Exams", wx.DefaultPosition, wx.DefaultSize, 0) # self.m_staticText59.Wrap(-1) # right_sizer.Add(self.m_staticText59, 0, wx.ALL, 5) self.edit_class_panel = EditClass(self) self.show_students = ViewClassStudents(self) # # # right_sizer.Add(self.edit_class_panel, 1, wx.EXPAND) right_sizer.Add(self.show_students, 1, wx.EXPAND) self.show_students.Hide() horizontal_sizer.Add(right_sizer, 1, wx.EXPAND, 5) container.Add(horizontal_sizer, 1, wx.ALL | wx.EXPAND, 10) self.SetSizer(container) self.Layout() # Connect Events self.refresh_btn.Bind(wx.EVT_BUTTON, self.refreshTable)
def __init__(self, parent, ID=wx.ID_ANY, title=_("About"), pos=wx.DefaultPosition, size=wx.Size(570, 590), style=wx.DEFAULT_DIALOG_STYLE): super(DialogAbout, self).__init__(parent, ID, title, pos, size, style) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) sizer_all = wx.BoxSizer(wx.VERTICAL) sizer_img = wx.BoxSizer(wx.HORIZONTAL) img = wx.Image(data_directory + "icon.ico", wx.BITMAP_TYPE_PNG) self.__bitmapIcone = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap(img), wx.DefaultPosition, wx.Size(48, 48)) sizer_img.Add(self.__bitmapIcone, 0, wx.ALL, 5) sizer_text = wx.BoxSizer(wx.VERTICAL) self.__staticTextTitre = wx.StaticText(self, wx.ID_ANY, "WoeUSB-ng") self.__staticTextTitre.SetFont(wx.Font(16, 74, 90, 92, False, "Sans")) self.__staticTextTitre.SetForegroundColour(wx.Colour(0, 60, 118)) sizer_text.Add(self.__staticTextTitre, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) self.__staticTextVersion = wx.StaticText(self, wx.ID_ANY, WoeUSB.__version__) self.__staticTextVersion.SetFont(wx.Font(10, 74, 90, 92, False, "Sans")) self.__staticTextVersion.SetForegroundColour(wx.Colour(69, 141, 196)) sizer_text.Add(self.__staticTextVersion, 0, wx.LEFT, 5) sizer_img.Add(sizer_text, 0, 0, 5) sizer_all.Add(sizer_img, 0, wx.EXPAND, 5) self.__NotebookAutorLicence = wx.Notebook(self, wx.ID_ANY) self.__NotebookAutorLicence.AddPage( PanelNoteBookAutors(self.__NotebookAutorLicence, wx.ID_ANY, "slacka et al.", data_directory + "woeusb-logo.png", "github.com/slacka/WoeUSB"), "Authors", True) self.__NotebookAutorLicence.AddPage( PanelNoteBookAutors(self.__NotebookAutorLicence, wx.ID_ANY, "Colin GILLE / Congelli501", data_directory + "c501-logo.png", "www.congelli.eu"), "Original WinUSB Developer", False) licence_str = ''' This file is part of WoeUSB-ng. WoeUSB-ng is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WoeUSB-ng is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with WoeUSB-ng. If not, see <http://www.gnu.org/licenses/>. ''' licence_txt = wx.TextCtrl(self.__NotebookAutorLicence, wx.ID_ANY, licence_str, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY) self.__NotebookAutorLicence.AddPage(licence_txt, _("License")) sizer_all.Add(self.__NotebookAutorLicence, 1, wx.EXPAND | wx.ALL, 5) self.__BtOk = wx.Button(self, wx.ID_OK) sizer_all.Add(self.__BtOk, 0, wx.ALIGN_RIGHT | wx.BOTTOM | wx.RIGHT, 5) self.__BtOk.SetFocus() self.SetSizer(sizer_all) self.Layout()
def create_GUI(self): #self.selectedPressureUnits = 'kbar' self.xs_font = 10 self.s_font = 12 self.m_font = 16 self.l_font = 24 self.xl_font = 32 self.xl_font = 60 self.wx_xs_font = wx_xs_font=wx.Font(self.xs_font,wx.DEFAULT,wx.NORMAL,wx.NORMAL) self.wx_s_font = wx_s_font=wx.Font(self.s_font,wx.DEFAULT,wx.NORMAL,wx.NORMAL) self.wx_m_font = wx_m_font=wx.Font(self.m_font,wx.DEFAULT,wx.NORMAL,wx.NORMAL) self.wx_l_font = wx_l_font=wx.Font(self.l_font,wx.DEFAULT,wx.NORMAL,wx.NORMAL) self.wx_xl_font = wx_xl_font=wx.Font(self.xl_font,wx.DEFAULT,wx.NORMAL,wx.NORMAL) self.wx_xxl_font = wx_xxl_font=wx.Font(self.xl_font,wx.DEFAULT,wx.NORMAL,wx.NORMAL) frame = wx.Frame.__init__(self, None, wx.ID_ANY, "FLIR cameras")#, size = (1200,1000))#, style= wx.SYSTEM_MENU | wx.CAPTION) self.panel = wx.Panel(self, wx.ID_ANY, style=wx.BORDER_THEME)#, size = (1200,1000)) self.SetBackgroundColour('white') self.Bind(wx.EVT_CLOSE, self.onQuit) self.statusbar = self.CreateStatusBar() # Will likely merge the two fields unless we can think of a reason to keep them split self.statusbar.SetStatusText('This goes field one') #self.statusbar.SetStatusText('Field 2 here!', 1) self.statusbar.SetBackgroundColour('green') ########################################################################### ##MENU for the GUI ########################################################################### file_item = {} about_item = {} self.setting_item = {} menubar = wx.MenuBar() fileMenu = wx.Menu() file_item[0] = fileMenu.Append(wx.ID_EXIT, 'Quit', 'Quit application') self.Bind(wx.EVT_MENU, self.onQuit, file_item[0]) aboutMenu = wx.Menu() about_item[0]= aboutMenu.Append(wx.ID_ANY, 'About') self.Bind(wx.EVT_MENU, self._on_about, about_item[0]) menubar.Append(fileMenu, '&File') menubar.Append(aboutMenu, '&About') self.SetMenuBar(menubar) self.Centre() self.Show(True) sizer = wx.GridBagSizer(hgap = 0, vgap = 0)#(13, 11) ########################################################################### ###MENU ENDS### ########################################################################### ########################################################################### ###FIGURE#### ########################################################################### self.bitmap = wx.StaticBitmap(self.panel) self.gui_sizers[b'graph_image'] = wx.BoxSizer(wx.VERTICAL) self.gui_sizers[b'graph_image'].Add(self.bitmap,0) ########################################################################### ###FIGURE ENDS#### ########################################################################### ########################################################################### ###On Button Press### ########################################################################### ###Sidebar### ### self.gui_labels[b'gain'] = wx.StaticText(self.panel, label= 'gain [dB]') self.gui_labels[b'gain'].SetFont(wx_m_font) self.gui_fields[b'gain'] = wx.TextCtrl(self.panel,-1, style = wx.TE_PROCESS_ENTER, size = (60,-1), value = 'nan') self.gui_sizers[b'gain'] = wx.BoxSizer(wx.HORIZONTAL) self.gui_sizers[b'gain'].Add(self.gui_labels[b'gain'],0) self.gui_sizers[b'gain'].Add(self.gui_fields[b'gain'],0) self.Bind(wx.EVT_TEXT_ENTER, self.on_set_gain, self.gui_fields[b'gain']) self.gui_labels[b'exposure'] = wx.StaticText(self.panel, label= 'exposure time [ms]') self.gui_labels[b'exposure'].SetFont(wx_m_font) self.gui_fields[b'exposure'] = wx.TextCtrl(self.panel,-1, style = wx.TE_PROCESS_ENTER, size = (180,-1), value = 'nan') self.gui_sizers[b'exposure'] = wx.BoxSizer(wx.HORIZONTAL) self.gui_sizers[b'exposure'].Add(self.gui_labels[b'exposure'],0) self.gui_sizers[b'exposure'].Add(self.gui_fields[b'exposure'],0) self.Bind(wx.EVT_TEXT_ENTER, self.on_set_exposure, self.gui_fields[b'exposure']) self.gui_labels[b'roiRows'] = wx.StaticText(self.panel, label= 'roi rows') self.gui_labels[b'roiRows'].SetFont(wx_m_font) self.gui_fields[b'roiRows_s'] = wx.TextCtrl(self.panel,-1, style = wx.TE_PROCESS_ENTER, size = (100,-1), value = 'nan') self.gui_fields[b'roiRows_e'] = wx.TextCtrl(self.panel,-1, style = wx.TE_PROCESS_ENTER, size = (100,-1), value = 'nan') self.gui_sizers[b'roiRows'] = wx.BoxSizer(wx.HORIZONTAL) self.gui_sizers[b'roiRows'].Add(self.gui_labels[b'roiRows'],0) self.gui_sizers[b'roiRows'].Add(self.gui_fields[b'roiRows_s'],0) self.gui_sizers[b'roiRows'].Add(self.gui_fields[b'roiRows_e'],0) self.Bind(wx.EVT_TEXT_ENTER, self.on_roiRows_s, self.gui_fields[b'roiRows_s']) self.Bind(wx.EVT_TEXT_ENTER, self.on_roiRows_e, self.gui_fields[b'roiRows_e']) self.gui_labels[b'roiCols'] = wx.StaticText(self.panel, label= 'roi cols') self.gui_labels[b'roiCols'].SetFont(wx_m_font) self.gui_fields[b'roiCols_s'] = wx.TextCtrl(self.panel,-1, style = wx.TE_PROCESS_ENTER, size = (100,-1), value = 'nan') self.gui_fields[b'roiCols_e'] = wx.TextCtrl(self.panel,-1, style = wx.TE_PROCESS_ENTER, size = (100,-1), value = 'nan') self.gui_sizers[b'roiCols'] = wx.BoxSizer(wx.HORIZONTAL) self.gui_sizers[b'roiCols'].Add(self.gui_labels[b'roiCols'],0) self.gui_sizers[b'roiCols'].Add(self.gui_fields[b'roiCols_s'],0) self.gui_sizers[b'roiCols'].Add(self.gui_fields[b'roiCols_e'],0) self.Bind(wx.EVT_TEXT_ENTER, self.on_roiCols_s, self.gui_fields[b'roiCols_s']) self.Bind(wx.EVT_TEXT_ENTER, self.on_roiCols_e, self.gui_fields[b'roiCols_e']) self.gui_labels[b'gamma'] = wx.StaticText(self.panel, label= 'gamma') self.gui_labels[b'gamma'].SetFont(wx_m_font) self.gui_fields[b'gamma'] = wx.TextCtrl(self.panel,-1, style = wx.TE_PROCESS_ENTER, size = (200,-1), value = 'nan') self.gui_sizers[b'gamma'] = wx.BoxSizer(wx.HORIZONTAL) self.gui_sizers[b'gamma'].Add(self.gui_labels[b'gamma'],0) self.gui_sizers[b'gamma'].Add(self.gui_fields[b'gamma'],0) self.Bind(wx.EVT_TEXT_ENTER, self.on_set_gamma, self.gui_fields[b'gamma']) self.gui_labels[b'filename'] = wx.StaticText(self.panel, label= 'filename prefix') self.gui_labels[b'filename'].SetFont(wx_m_font) self.gui_fields[b'filename'] = wx.TextCtrl(self.panel,-1, style = wx.TE_PROCESS_ENTER, size = (200,-1), value = 'nan') self.gui_sizers[b'filename'] = wx.BoxSizer(wx.HORIZONTAL) self.gui_sizers[b'filename'].Add(self.gui_labels[b'filename'],0) self.gui_sizers[b'filename'].Add(self.gui_fields[b'filename'],0) self.Bind(wx.EVT_TEXT_ENTER, self.on_filename, self.gui_fields[b'filename']) self.gui_fields[b'save_to_file'] = wx.Button(self.panel, label = 'Save') self.gui_fields[b'save_to_file'].Bind(wx.EVT_BUTTON, self.on_save_to_file) self.gui_fields[b'save_to_file'].SetFont(wx_m_font) self.gui_sizers[b'save_to_file'] = wx.BoxSizer(wx.HORIZONTAL) self.gui_sizers[b'save_to_file'].Add(self.gui_fields[b'save_to_file'],0) self.gui_fields[b'set_background'] = wx.Button(self.panel, label = 'Set Background') self.gui_fields[b'set_background'].Bind(wx.EVT_BUTTON, self.on_set_background) self.gui_fields[b'set_background'].SetFont(wx_m_font) self.gui_sizers[b'set_background'] = wx.BoxSizer(wx.HORIZONTAL) self.gui_sizers[b'set_background'].Add(self.gui_fields[b'set_background'],0) self.gui_labels[b'intensity'] = wx.StaticText(self.panel, size = (220,-1),label= 'M00 intensity') self.gui_labels[b'intensity'].SetFont(wx_l_font) self.gui_fields[b'intensity'] = wx.StaticText(self.panel, size = (100,-1), label = 'nan') self.gui_fields[b'intensity'].SetFont(wx_l_font) self.gui_sizers[b'intensity'] = wx.BoxSizer(wx.VERTICAL) self.gui_sizers[b'intensity'].Add(self.gui_labels[b'intensity'],0) self.gui_sizers[b'intensity'].Add(self.gui_fields[b'intensity'],0) self.gui_labels[b'moments_max'] = wx.StaticText(self.panel, size = (370,-1),label= 'Max Pixel') self.gui_labels[b'moments_max'].SetFont(wx_m_font) self.gui_fields[b'moments_max_value'] = wx.StaticText(self.panel, size = (300,-1), label = 'Imax = nan') self.gui_fields[b'moments_max_x'] = wx.StaticText(self.panel, size = (300,-1), label = 'Imax,x = nan') self.gui_fields[b'moments_max_y'] = wx.StaticText(self.panel,-1, size = (300,-1), label = 'Imax,y = nan') self.gui_sizers[b'moments_max'] = wx.BoxSizer(wx.VERTICAL) self.gui_fields[b'moments_max_value'].SetFont(wx_l_font) self.gui_fields[b'moments_max_x'].SetFont(wx_l_font) self.gui_fields[b'moments_max_y'].SetFont(wx_l_font) self.gui_sizers[b'moments_max'].Add(self.gui_labels[b'moments_max'],0) self.gui_sizers[b'moments_max'].Add(self.gui_fields[b'moments_max_value'],0) self.gui_sizers[b'moments_max'].Add(self.gui_fields[b'moments_max_x'],0) self.gui_sizers[b'moments_max'].Add(self.gui_fields[b'moments_max_y'],0) self.gui_labels[b'moments_mean'] = wx.StaticText(self.panel, size = (170,-1),label= 'moments mean') self.gui_labels[b'moments_mean'].SetFont(wx_m_font) self.gui_fields[b'moments_mean_x'] = wx.StaticText(self.panel, size = (200,-1), label = 'nan') self.gui_fields[b'moments_mean_y'] = wx.StaticText(self.panel,-1, size = (200,-1), label = 'nan') self.gui_sizers[b'moments_mean'] = wx.BoxSizer(wx.VERTICAL) self.gui_fields[b'moments_mean_x'].SetFont(wx_l_font) self.gui_fields[b'moments_mean_y'].SetFont(wx_l_font) self.gui_sizers[b'moments_mean'].Add(self.gui_labels[b'moments_mean'],0) self.gui_sizers[b'moments_mean'].Add(self.gui_fields[b'moments_mean_x'],0) self.gui_sizers[b'moments_mean'].Add(self.gui_fields[b'moments_mean_y'],0) self.gui_labels[b'moments_var'] = wx.StaticText(self.panel, size = (170,-1),label= 'moments var') self.gui_labels[b'moments_var'].SetFont(wx_m_font) self.gui_fields[b'moments_var_x'] = wx.StaticText(self.panel, size = (200,-1), label = 'nan') self.gui_fields[b'moments_var_y'] = wx.StaticText(self.panel, size = (200,-1), label = 'nan') self.gui_fields[b'moments_var_x'].SetFont(wx_l_font) self.gui_fields[b'moments_var_y'].SetFont(wx_l_font) self.gui_sizers[b'moments_var'] = wx.BoxSizer(wx.VERTICAL) self.gui_sizers[b'moments_var'].Add(self.gui_labels[b'moments_var'],0) self.gui_sizers[b'moments_var'].Add(self.gui_fields[b'moments_var_x'],0) self.gui_sizers[b'moments_var'].Add(self.gui_fields[b'moments_var_y'],0) self.sizer_left.Add(self.gui_sizers[b'graph_image']) self.sizer_right.Add(self.gui_sizers[b'gain']) self.sizer_right.Add(self.gui_sizers[b'exposure']) self.sizer_right.Add(self.gui_sizers[b'roiRows']) self.sizer_right.Add(self.gui_sizers[b'roiCols']) self.sizer_right.Add(self.gui_sizers[b'gamma']) self.sizer_right.Add(self.gui_sizers[b'filename']) self.sizer_right.Add(self.gui_sizers[b'save_to_file']) self.sizer_right.Add(self.gui_sizers[b'set_background']) self.sizer_right.Add(wx.StaticLine(self.panel), 0, wx.ALL|wx.EXPAND, 5) self.sizer_right.Add(self.gui_sizers[b'intensity']) self.sizer_right.Add(self.gui_sizers[b'moments_max']) self.sizer_right.Add(self.gui_sizers[b'moments_mean']) self.sizer_right.Add(self.gui_sizers[b'moments_var']) self.sizer_right.Add(wx.StaticLine(self.panel), 0, wx.ALL|wx.EXPAND, 5) self.sizer_main.Add(self.sizer_left,0) self.sizer_main.Add(self.sizer_right,0) #self.sizer_left.Hide() self.draw()
def __init__(self): self.scorePanel = wx.Panel(self) self.scorePanel_lt = wx.Panel(self) self.AddPage(self.scorePanel, "Energy") self.AddPage(self.scorePanel_lt, "LifeTime") # 能量显示窗口 self.e_gridsizer = wx.GridBagSizer(2, 2) self.scorePanel.SetSizer(self.e_gridsizer) # self.box1 = wx.ListBox(self.scorePanel,size=(800, 500)) # self.drawHistF = Figure(figsize=(8, 5), dpi=100) # self.drawHistCanvas = FigureCanvas(self.box1, -1, self.drawHistF) # self.drawHistCanvas.draw() self.box1 = wx.ListBox(self.scorePanel, size=(800, 500)) self.e_gridsizer.Add(self.box1, pos=(0, 0), flag=wx.EXPAND) self.box2 = wx.Panel(self.scorePanel) self.e_gridsizer.Add(self.box2, pos=(0, 1), flag=wx.EXPAND) self.box3 = wx.Panel(self.scorePanel) self.e_gridsizer.Add(self.box3, span=(1, 2), pos=(1, 0), flag=wx.EXPAND) self.scorePanel.Fit() self.drawHistF = Figure(figsize=(8, 5), dpi=100) self.drawHistCanvas = FigureCanvas(self.box1, -1, self.drawHistF) self.drawHistCanvas.draw() # 右侧区域 # self.box2 = wx.Panel(self.scorePanel, pos=(810, 0), size=(370, 500)) # self.but1 = wx.Button(self.box2, 0, 'start', pos=(10, 10), size=(100, 50)) # self.but2 = wx.Button(self.box2, 0, 'stop', pos=(120, 10), size=(100, 50)) # self.but3 = wx.Button(self.box2, 0, 'clear', pos=(230, 10), size=(100, 50)) # self.but1.Bind(wx.EVT_BUTTON, self.start_but) # self.but2.Bind(wx.EVT_BUTTON, self.stop_but) # self.but3.Bind(wx.EVT_BUTTON, self.energy_clear) self.eb2_gridsizer = wx.GridBagSizer(8, 3) self.box2.SetSizer(self.eb2_gridsizer) self.but1 = wx.Button(self.box2, -1, 'start') self.but2 = wx.Button(self.box2, -1, 'stop') self.but3 = wx.Button(self.box2, -1, 'clear') self.but1.Bind(wx.EVT_BUTTON, self.start_but) self.but2.Bind(wx.EVT_BUTTON, self.stop_but) self.but3.Bind(wx.EVT_BUTTON, self.energy_clear) self.eb2_gridsizer.Add(self.but1, pos=(0, 0), flag=wx.EXPAND) self.eb2_gridsizer.Add(self.but2, pos=(0, 1), flag=wx.EXPAND) self.eb2_gridsizer.Add(self.but3, pos=(0, 2), flag=wx.EXPAND) # 下方区域 self.eb3_gridsizer = wx.GridBagSizer(1, 4) self.box3.SetSizer(self.eb3_gridsizer) self.eb3_c1_panel = wx.Panel(self.box3) self.eb3_gridsizer.Add(self.eb3_c1_panel, pos=(0, 0), flag=wx.EXPAND) self.eb3_c2_panel = wx.Panel(self.box3) self.eb3_gridsizer.Add(self.eb3_c2_panel, pos=(0, 1), flag=wx.EXPAND) # energy_c1_set self.eb3c1_gridsizer = wx.GridBagSizer(6, 4) self.eb3_c1_panel.SetSizer(self.eb3c1_gridsizer) self.eb3c1_title = wx.StaticText(self.eb3_c1_panel, -1, label='channel 1', style=wx.ALIGN_CENTER) self.font1 = wx.Font(15, wx.ROMAN, wx.NORMAL, wx.NORMAL) self.eb3c1_title.SetFont(self.font1) self.eb3c1_gridsizer.Add(self.eb3c1_title, span=(1, 4), pos=(0, 0), flag=wx.EXPAND) # self.eb3c1_trlv = wx.TextCtrl(self.eb3_c1_panel, -1, str(self.para_0['C1_TRLV']), style=wx.TE_CENTER) self.eb3c1_gridsizer.Add(self.eb3c1_trlv, span=(1, 2), pos=(1, 1), flag=wx.EXPAND) self.eb3c1_but1 = wx.Button(self.eb3_c1_panel, -1, 'Set') self.eb3c1_gridsizer.Add(self.eb3c1_but1, span=(1, 1), pos=(1, 3), flag=wx.EXPAND) self.eb3c1_but1.Bind(wx.EVT_BUTTON, self.e_c1_set_trlv) self.eb3c1_trlv_text = wx.StaticText(self.eb3_c1_panel, -1, 'c1_trlv', style=wx.ALIGN_CENTER) self.eb3c1_trlv_text.SetFont(self.font1) self.eb3c1_gridsizer.Add(self.eb3c1_trlv_text, span=(1, 1), pos=(1, 0), flag=wx.EXPAND) # self.eb3c1_erg_l_text = wx.StaticText(self.eb3_c1_panel, -1, 'energy_l', style=wx.ALIGN_CENTER) self.eb3c1_erg_l_text.SetFont(self.font1) self.eb3c1_gridsizer.Add(self.eb3c1_erg_l_text, span=(1, 1), pos=(2, 0), flag=wx.EXPAND) self.eb3c1_erg_l = wx.TextCtrl(self.eb3_c1_panel, -1, str(self.e_rg['c1'][0]), style=wx.TE_CENTER) self.eb3c1_gridsizer.Add(self.eb3c1_erg_l, span=(1, 1), pos=(2, 1), flag=wx.EXPAND) self.eb3c1_erg_r_text = wx.StaticText(self.eb3_c1_panel, -1, 'energy_r', style=wx.ALIGN_CENTER) self.eb3c1_erg_r_text.SetFont(self.font1) self.eb3c1_gridsizer.Add(self.eb3c1_erg_r_text, span=(1, 1), pos=(2, 2), flag=wx.EXPAND) self.eb3c1_erg_r = wx.TextCtrl(self.eb3_c1_panel, -1, str(self.e_rg['c1'][1]), style=wx.TE_CENTER) self.eb3c1_gridsizer.Add(self.eb3c1_erg_r, span=(1, 1), pos=(2, 3), flag=wx.EXPAND) self.eb3c1_amp_l_text = wx.StaticText(self.eb3_c1_panel, -1, 'amp_l', style=wx.ALIGN_CENTER) self.eb3c1_amp_l_text.SetFont(self.font1) self.eb3c1_gridsizer.Add(self.eb3c1_amp_l_text, span=(1, 1), pos=(3, 0), flag=wx.EXPAND) self.eb3c1_amp_l = wx.TextCtrl(self.eb3_c1_panel, -1, str(self.e_rg['c1_amp'][0]), style=wx.TE_CENTER) self.eb3c1_gridsizer.Add(self.eb3c1_amp_l, span=(1, 1), pos=(3, 1), flag=wx.EXPAND) self.eb3c1_amp_r_text = wx.StaticText(self.eb3_c1_panel, -1, 'amp_r', style=wx.ALIGN_CENTER) self.eb3c1_amp_r_text.SetFont(self.font1) self.eb3c1_gridsizer.Add(self.eb3c1_amp_r_text, span=(1, 1), pos=(3, 2), flag=wx.EXPAND) self.eb3c1_amp_r = wx.TextCtrl(self.eb3_c1_panel, -1, str(self.e_rg['c1_amp'][1]), style=wx.TE_CENTER) self.eb3c1_gridsizer.Add(self.eb3c1_amp_r, span=(1, 1), pos=(3, 3), flag=wx.EXPAND) self.eb3c1_but2 = wx.Button(self.eb3_c1_panel, -1, 'Set') self.eb3c1_gridsizer.Add(self.eb3c1_but2, span=(1, 4), pos=(4, 0), flag=wx.EXPAND) self.eb3c1_but2.Bind(wx.EVT_BUTTON, self.e_c1_set_range) # energy_c2_set self.eb3c2_gridsizer = wx.GridBagSizer(6, 4) self.eb3_c2_panel.SetSizer(self.eb3c2_gridsizer) self.eb3c2_title = wx.StaticText(self.eb3_c2_panel, -1, label='channel 1', style=wx.ALIGN_CENTER) self.eb3c2_title.SetFont(self.font1) self.eb3c2_gridsizer.Add(self.eb3c2_title, span=(1, 4), pos=(0, 0), flag=wx.EXPAND) # self.eb3c2_trlv = wx.TextCtrl(self.eb3_c2_panel, -1, str(self.para_0['C2_TRLV']), style=wx.TE_CENTER) self.eb3c2_gridsizer.Add(self.eb3c2_trlv, span=(1, 2), pos=(1, 1), flag=wx.EXPAND) self.eb3c2_but1 = wx.Button(self.eb3_c2_panel, -1, 'Set') self.eb3c2_gridsizer.Add(self.eb3c2_but1, span=(1, 1), pos=(1, 3), flag=wx.EXPAND) self.eb3c2_but1.Bind(wx.EVT_BUTTON, self.e_c2_set_trlv) self.eb3c2_trlv_text = wx.StaticText(self.eb3_c2_panel, -1, 'c2_trlv', style=wx.ALIGN_CENTER) self.eb3c2_trlv_text.SetFont(self.font1) self.eb3c2_gridsizer.Add(self.eb3c2_trlv_text, span=(1, 1), pos=(1, 0), flag=wx.EXPAND) # self.eb3c2_erg_l_text = wx.StaticText(self.eb3_c2_panel, -1, 'energy_l', style=wx.ALIGN_CENTER) self.eb3c2_erg_l_text.SetFont(self.font1) self.eb3c2_gridsizer.Add(self.eb3c2_erg_l_text, span=(1, 1), pos=(2, 0), flag=wx.EXPAND) self.eb3c2_erg_l = wx.TextCtrl(self.eb3_c2_panel, -1, str(self.e_rg['c2'][0]), style=wx.TE_CENTER) self.eb3c2_gridsizer.Add(self.eb3c2_erg_l, span=(1, 1), pos=(2, 1), flag=wx.EXPAND) self.eb3c2_erg_r_text = wx.StaticText(self.eb3_c2_panel, -1, 'energy_r', style=wx.ALIGN_CENTER) self.eb3c2_erg_r_text.SetFont(self.font1) self.eb3c2_gridsizer.Add(self.eb3c2_erg_r_text, span=(1, 1), pos=(2, 2), flag=wx.EXPAND) self.eb3c2_erg_r = wx.TextCtrl(self.eb3_c2_panel, -1, str(self.e_rg['c2'][1]), style=wx.TE_CENTER) self.eb3c2_gridsizer.Add(self.eb3c2_erg_r, span=(1, 1), pos=(2, 3), flag=wx.EXPAND) self.eb3c2_amp_l_text = wx.StaticText(self.eb3_c2_panel, -1, 'amp_l', style=wx.ALIGN_CENTER) self.eb3c2_amp_l_text.SetFont(self.font1) self.eb3c2_gridsizer.Add(self.eb3c2_amp_l_text, span=(1, 1), pos=(3, 0), flag=wx.EXPAND) self.eb3c2_amp_l = wx.TextCtrl(self.eb3_c2_panel, -1, str(self.e_rg['c2_amp'][0]), style=wx.TE_CENTER) self.eb3c2_gridsizer.Add(self.eb3c2_amp_l, span=(1, 1), pos=(3, 1), flag=wx.EXPAND) self.eb3c2_amp_r_text = wx.StaticText(self.eb3_c2_panel, -1, 'amp_r', style=wx.ALIGN_CENTER) self.eb3c2_amp_r_text.SetFont(self.font1) self.eb3c2_gridsizer.Add(self.eb3c2_amp_r_text, span=(1, 1), pos=(3, 2), flag=wx.EXPAND) self.eb3c2_amp_r = wx.TextCtrl(self.eb3_c2_panel, -1, str(self.e_rg['c2_amp'][1]), style=wx.TE_CENTER) self.eb3c2_gridsizer.Add(self.eb3c2_amp_r, span=(1, 1), pos=(3, 3), flag=wx.EXPAND) self.eb3c2_but2 = wx.Button(self.eb3_c2_panel, -1, 'Set') self.eb3c2_gridsizer.Add(self.eb3c2_but2, span=(1, 4), pos=(4, 0), flag=wx.EXPAND) self.eb3c2_but2.Bind(wx.EVT_BUTTON, self.e_c2_set_range) # self.e_panel3_c2 = wx.Panel(self.scorePanel) # self.p3c2_gridsizer = wx.GridBagSizer(5, 4) # self.buttest3 = wx.Button(self.e_panel3_c2, 0, 'test') # self.buttest4 = wx.Button(self.e_panel3_c2, 0, 'test0') # self.p3c2_gridsizer.Add(self.buttest3, span=(1, 4), pos=(0, 0), flag=wx.EXPAND) # self.p3c2_gridsizer.Add(self.buttest4, pos=(4, 2), flag=wx.EXPAND) # self.e_panel3_c2.SetSizer(self.p3c2_gridsizer) # self.e_panel3_c2.Fit() # lt_page self.lt_gridsizer = wx.GridBagSizer(2, 2) self.scorePanel_lt.SetSizer(self.lt_gridsizer) # self.lt_box1 = wx.ListBox(self.scorePanel_lt,size=(800, 500)) # self.drawHistF = Figure(figsize=(8, 5), dpi=100) # self.drawHistCanvas = FigureCanvas(self.lt_box1, -1, self.drawHistF) # self.drawHistCanvas.draw() self.lt_box1 = wx.ListBox(self.scorePanel_lt, size=(800, 500)) self.lt_gridsizer.Add(self.lt_box1, pos=(0, 0), flag=wx.EXPAND) self.lt_box2 = wx.Panel(self.scorePanel_lt) self.lt_gridsizer.Add(self.lt_box2, pos=(0, 1), flag=wx.EXPAND) self.lt_box3 = wx.Panel(self.scorePanel_lt) self.lt_gridsizer.Add(self.lt_box3, span=(1, 2), pos=(1, 0), flag=wx.EXPAND) self.scorePanel_lt.Fit() self.drawHistF_lt = Figure(figsize=(8, 5), dpi=100) self.drawHistCanvas_lt = FigureCanvas(self.lt_box1, -1, self.drawHistF_lt) self.drawHistCanvas_lt.draw() # lt右侧区域 # self.lt_box2 = wx.Panel(self.scorePanel, pos=(810, 0), size=(370, 500)) # self.lt_but1 = wx.Button(self.lt_box2, 0, 'start', pos=(10, 10), size=(100, 50)) # self.lt_but2 = wx.Button(self.lt_box2, 0, 'stop', pos=(120, 10), size=(100, 50)) # self.lt_but3 = wx.Button(self.lt_box2, 0, 'clear', pos=(230, 10), size=(100, 50)) # self.lt_but1.Bind(wx.EVT_BUTTON, self.start_but) # self.lt_but2.Bind(wx.EVT_BUTTON, self.stop_but) # self.lt_but3.Bind(wx.EVT_BUTTON, self.energy_clear) self.ltb2_gridsizer = wx.GridBagSizer(8, 3) self.lt_box2.SetSizer(self.ltb2_gridsizer) self.lt_but1 = wx.Button(self.lt_box2, -1, 'start') self.lt_but2 = wx.Button(self.lt_box2, -1, 'stop') self.lt_but3 = wx.Button(self.lt_box2, -1, 'clear') self.lt_but1.Bind(wx.EVT_BUTTON, self.lt_start_but) self.lt_but2.Bind(wx.EVT_BUTTON, self.lt_stop_but) self.lt_but3.Bind(wx.EVT_BUTTON, self.lt_clear) self.lt_cps_stext = wx.StaticText(self.lt_box2, -1, 'cps', style=wx.ALIGN_CENTER) self.lt_cps_stext.SetFont(self.font1) self.lt_cps_text = wx.TextCtrl(self.lt_box2, -1, str(self.cps), style=wx.TE_CENTER) self.lt_counts_stext = wx.StaticText(self.lt_box2, -1, 'counts', style=wx.ALIGN_CENTER) self.lt_counts_stext.SetFont(self.font1) self.lt_counts_text = wx.TextCtrl(self.lt_box2, -1, str(self.total_counts), style=wx.TE_CENTER) self.lt_but_save = wx.Button(self.lt_box2, -1, 'save') self.lt_but_save.Bind(wx.EVT_BUTTON, self.save_file) self.ltb2_gridsizer.Add(self.lt_but1, pos=(0, 0), flag=wx.EXPAND) self.ltb2_gridsizer.Add(self.lt_but2, pos=(0, 1), flag=wx.EXPAND) self.ltb2_gridsizer.Add(self.lt_but3, pos=(0, 2), flag=wx.EXPAND) self.ltb2_gridsizer.Add(self.lt_cps_stext, pos=(1, 0), flag=wx.EXPAND) self.ltb2_gridsizer.Add(self.lt_cps_text, pos=(1, 1), flag=wx.EXPAND) self.ltb2_gridsizer.Add(self.lt_counts_stext, pos=(2, 0), flag=wx.EXPAND) self.ltb2_gridsizer.Add(self.lt_counts_text, pos=(2, 1), flag=wx.EXPAND) self.ltb2_gridsizer.Add(self.lt_but_save, pos=(3, 0), flag=wx.EXPAND) self.lt_box2.Fit() # 下方区域 self.ltb3_gridsizer = wx.GridBagSizer(1, 4) self.lt_box3.SetSizer(self.ltb3_gridsizer) self.ltb3_c1_panel = wx.Panel(self.lt_box3) self.ltb3_gridsizer.Add(self.ltb3_c1_panel, pos=(0, 0), flag=wx.EXPAND) self.ltb3_c2_panel = wx.Panel(self.lt_box3) self.ltb3_gridsizer.Add(self.ltb3_c2_panel, pos=(0, 1), flag=wx.EXPAND) # lt_c1_set self.ltb3c1_gridsizer = wx.GridBagSizer(7, 4) self.ltb3_c1_panel.SetSizer(self.ltb3c1_gridsizer) self.ltb3c1_title = wx.StaticText(self.ltb3_c1_panel, -1, label='start_channel', style=wx.ALIGN_CENTER) self.ltb3c1_title.SetFont(self.font1) self.ltb3c1_gridsizer.Add(self.ltb3c1_title, span=(1, 5), pos=(0, 0), flag=wx.EXPAND) self.ltb3c1_startdown_text = wx.StaticText(self.ltb3_c1_panel, -1, 'down', style=wx.ALIGN_CENTER) self.ltb3c1_startdown_text.SetFont(self.font1) self.ltb3c1_gridsizer.Add(self.ltb3c1_startdown_text, span=(1, 1), pos=(1, 0), flag=wx.EXPAND) self.ltb3c1_startdown = wx.TextCtrl(self.ltb3_c1_panel, -1, str(self.lt_start_l), style=wx.TE_CENTER) self.ltb3c1_gridsizer.Add(self.ltb3c1_startdown, span=(1, 1), pos=(1, 1), flag=wx.EXPAND) self.ltb3c1_startup_text = wx.StaticText(self.ltb3_c1_panel, -1, 'up', style=wx.ALIGN_CENTER) self.ltb3c1_startup_text.SetFont(self.font1) self.ltb3c1_gridsizer.Add(self.ltb3c1_startup_text, span=(1, 1), pos=(1, 2), flag=wx.EXPAND) self.ltb3c1_startup = wx.TextCtrl(self.ltb3_c1_panel, -1, str(self.lt_start_r), style=wx.TE_CENTER) self.ltb3c1_gridsizer.Add(self.ltb3c1_startup, span=(1, 1), pos=(1, 3), flag=wx.EXPAND) self.ltb3c1_startfrac_text = wx.StaticText(self.ltb3_c1_panel, -1, 'fraction', style=wx.ALIGN_CENTER) self.ltb3c1_startfrac_text.SetFont(self.font1) self.ltb3c1_gridsizer.Add(self.ltb3c1_startfrac_text, span=(1, 2), pos=(2, 0), flag=wx.EXPAND) self.ltb3c1_startfrac = wx.TextCtrl(self.ltb3_c1_panel, -1, str(self.start_fraction), style=wx.TE_CENTER) self.ltb3c1_gridsizer.Add(self.ltb3c1_startfrac, span=(1, 2), pos=(2, 2), flag=wx.EXPAND) self.ltb3c1_title = wx.StaticText(self.ltb3_c1_panel, -1, label='stop_channel', style=wx.ALIGN_CENTER) self.ltb3c1_title.SetFont(self.font1) self.ltb3c1_gridsizer.Add(self.ltb3c1_title, span=(1, 5), pos=(3, 0), flag=wx.EXPAND) self.ltb3c1_stopdown_text = wx.StaticText(self.ltb3_c1_panel, -1, 'down', style=wx.ALIGN_CENTER) self.ltb3c1_stopdown_text.SetFont(self.font1) self.ltb3c1_gridsizer.Add(self.ltb3c1_stopdown_text, span=(1, 1), pos=(4, 0), flag=wx.EXPAND) self.ltb3c1_stopdown = wx.TextCtrl(self.ltb3_c1_panel, -1, str(self.lt_stop_l), style=wx.TE_CENTER) self.ltb3c1_gridsizer.Add(self.ltb3c1_stopdown, span=(1, 1), pos=(4, 1), flag=wx.EXPAND) self.ltb3c1_stopup_text = wx.StaticText(self.ltb3_c1_panel, -1, 'up', style=wx.ALIGN_CENTER) self.ltb3c1_stopup_text.SetFont(self.font1) self.ltb3c1_gridsizer.Add(self.ltb3c1_stopup_text, span=(1, 1), pos=(4, 2), flag=wx.EXPAND) self.ltb3c1_stopup = wx.TextCtrl(self.ltb3_c1_panel, -1, str(self.lt_stop_r), style=wx.TE_CENTER) self.ltb3c1_gridsizer.Add(self.ltb3c1_stopup, span=(1, 1), pos=(4, 3), flag=wx.EXPAND) self.ltb3c1_stopfrac_text = wx.StaticText(self.ltb3_c1_panel, -1, 'fraction', style=wx.ALIGN_CENTER) self.ltb3c1_stopfrac_text.SetFont(self.font1) self.ltb3c1_gridsizer.Add(self.ltb3c1_stopfrac_text, span=(1, 2), pos=(5, 0), flag=wx.EXPAND) self.ltb3c1_stopfrac = wx.TextCtrl(self.ltb3_c1_panel, -1, str(self.stop_fraction), style=wx.TE_CENTER) self.ltb3c1_gridsizer.Add(self.ltb3c1_stopfrac, span=(1, 2), pos=(5, 2), flag=wx.EXPAND) self.ltb3c1_but1 = wx.Button(self.ltb3_c1_panel, -1, 'set', size=(200, 30)) self.ltb3c1_but1.Bind(wx.EVT_BUTTON, self.lt_ch_set) self.ltb3c1_gridsizer.Add(self.ltb3c1_but1, span=(1, 2), pos=(6, 1), flag=wx.EXPAND) # lt_box3_c2 self.ltb3c2_gridsizer = wx.GridBagSizer(7, 4) self.ltb3_c2_panel.SetSizer(self.ltb3c2_gridsizer) self.ltb3c2_title = wx.StaticText(self.ltb3_c2_panel, -1, label='lifetime_spectrum', style=wx.ALIGN_CENTER) self.ltb3c2_title.SetFont(self.font1) self.ltb3c2_gridsizer.Add(self.ltb3c2_title, span=(1, 5), pos=(0, 0), flag=wx.EXPAND) self.ltb3c2_sp_left_text = wx.StaticText(self.ltb3_c2_panel, -1, 'sp_left', style=wx.ALIGN_CENTER) self.ltb3c2_sp_left_text.SetFont(self.font1) self.ltb3c2_gridsizer.Add(self.ltb3c2_sp_left_text, span=(1, 1), pos=(1, 0), flag=wx.EXPAND) self.ltb3c2_sp_left = wx.TextCtrl(self.ltb3_c2_panel, -1, str(self.lt_l), style=wx.TE_CENTER) self.ltb3c2_gridsizer.Add(self.ltb3c2_sp_left, span=(1, 1), pos=(1, 1), flag=wx.EXPAND) self.ltb3c2_sp_right_text = wx.StaticText(self.ltb3_c2_panel, -1, 'sp_right', style=wx.ALIGN_CENTER) self.ltb3c2_sp_right_text.SetFont(self.font1) self.ltb3c2_gridsizer.Add(self.ltb3c2_sp_right_text, span=(1, 1), pos=(1, 2), flag=wx.EXPAND) self.ltb3c2_sp_right = wx.TextCtrl(self.ltb3_c2_panel, -1, str(self.lt_r), style=wx.TE_CENTER) self.ltb3c2_gridsizer.Add(self.ltb3c2_sp_right, span=(1, 1), pos=(1, 3), flag=wx.EXPAND) self.ltb3c2_bins_text = wx.StaticText(self.ltb3_c2_panel, -1, 'bins', style=wx.ALIGN_CENTER) self.ltb3c2_bins_text.SetFont(self.font1) self.ltb3c2_gridsizer.Add(self.ltb3c2_bins_text, span=(1, 2), pos=(2, 0), flag=wx.EXPAND) self.ltb3c2_bins = wx.TextCtrl(self.ltb3_c2_panel, -1, str(self.lt_bins), style=wx.TE_CENTER) self.ltb3c2_gridsizer.Add(self.ltb3c2_bins, span=(1, 2), pos=(2, 2), flag=wx.EXPAND) self.ltb3c2_counts_text = wx.StaticText(self.ltb3_c2_panel, -1, 'counts', style=wx.ALIGN_CENTER) self.ltb3c2_counts_text.SetFont(self.font1) self.ltb3c2_gridsizer.Add(self.ltb3c2_counts_text, span=(1, 2), pos=(3, 0), flag=wx.EXPAND) self.ltb3c2_counts = wx.TextCtrl(self.ltb3_c2_panel, -1, str(self.counts_set), style=wx.TE_CENTER) self.ltb3c2_gridsizer.Add(self.ltb3c2_counts, span=(1, 2), pos=(3, 2), flag=wx.EXPAND) self.ltb3c2_but1 = wx.Button(self.ltb3_c2_panel, -1, 'set', size=(200, 30)) self.ltb3c2_but1.Bind(wx.EVT_BUTTON, self.lt_sp_set) self.ltb3c2_gridsizer.Add(self.ltb3c2_but1, span=(1, 2), pos=(4, 1), flag=wx.EXPAND) # 参数 self.m = 3.0 self.energy_c1 = [] self.amp_c1 = [] self.energy_c2 = [] self.amp_c2 = [] self.lifetime = [] self.wave0 = [] self.wave1 = [] self.lt_spe = [] self.e_start_but = 0 self.lt_start_but_switch = 0
def onFind(self, event): if not self.FIND_DLG: self.FIND_DLG = True self.__start = 1 self.__card = self.parent.cell_edit self.__find = '' self.__replace = '' self.__direction = 'Down' print 'Find and Replace' dlg = wx.Dialog(self.parent, -1, 'Find and Replace') font = wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL) card = wx.Choice(dlg, -1, choices=['Cell Card', 'Surface Card', 'Data Card']) card.SetSelection(0) self.__correct = wx.CheckBox(dlg, -1, 'Correct position error') self.__correct.SetValue(True) find = wx.TextCtrl(dlg, -1) find.SetFont(font) replace = wx.TextCtrl(dlg, -1) replace.SetFont(font) direction = wx.RadioBox(dlg, -1, '', choices=['Down', 'Up'], majorDimension=wx.RA_SPECIFY_ROWS)#, size=(300, 50)) btn_find = wx.Button(dlg, -1, 'Find') btn_replace =wx.Button(dlg, -1, 'Replace') btn_replaceall = wx.Button(dlg, -1, 'Replace All') sizer_card = wx.BoxSizer(wx.HORIZONTAL) sizer_card.Add((20, 1)) sizer_card.Add(wx.StaticText(dlg, -1, 'Which Card?', size=(80, 20))) sizer_card.Add(card) sizer_card.Add((1, 1), proportion=1) sizer_card.Add(self.__correct) sizer_card.Add((20, 1)) sizer_find = wx.BoxSizer(wx.HORIZONTAL) sizer_find.Add((20, 1)) sizer_find.Add(wx.StaticText(dlg, -1, 'Find', size=(80, 20))) sizer_find.Add(find, proportion=1) sizer_find.Add((20, 1)) sizer_replace = wx.BoxSizer(wx.HORIZONTAL) sizer_replace.Add((20, 1)) sizer_replace.Add(wx.StaticText(dlg, -1, 'Replace', size=(80, 20))) sizer_replace.Add(replace, proportion=1) sizer_replace.Add((20, 1)) sizer_direction = wx.BoxSizer(wx.HORIZONTAL) sizer_direction.Add((20, 1)) sizer_direction.Add(wx.StaticText(dlg, -1, 'Direction', size=(80, 20)), flag=wx.ALIGN_CENTER_VERTICAL) sizer_direction.Add(direction) sizer_direction.Add((20, 1)) sizer_btn = wx.BoxSizer(wx.HORIZONTAL) sizer_btn.Add((1, 1), proportion=1) sizer_btn.Add(btn_find) sizer_btn.Add((20, 1)) sizer_btn.Add(btn_replace) sizer_btn.Add((20, 1)) sizer_btn.Add(btn_replaceall) sizer_btn.Add((1, 1), proportion=1) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add((1, 20)) sizer.Add(sizer_card, flag=wx.EXPAND) sizer.Add((1, 5)) sizer.Add(sizer_find, flag=wx.EXPAND) sizer.Add((1, 5)) sizer.Add(sizer_replace, flag=wx.EXPAND) sizer.Add((1, 5)) sizer.Add(sizer_direction, flag=wx.EXPAND) sizer.Add((1, 20)) sizer.Add(sizer_btn, flag=wx.EXPAND) sizer.Add((1, 20)) dlg.SetSizer(sizer) dlg.Fit() dlg.Show() dlg.Bind(wx.EVT_CLOSE, lambda event: self.__onFind('close', dlg)) btn_find.Bind(wx.EVT_BUTTON, lambda event: self.__onFind('find', find.GetValue())) btn_replace.Bind(wx.EVT_BUTTON, lambda event: self.__onFind('replace', replace.GetValue())) btn_replaceall.Bind(wx.EVT_BUTTON, lambda event: self.__onFind('replaceall', find.GetValue(), replace.GetValue())) dlg.Bind(wx.EVT_CHOICE, lambda event: self.__onFind('card', card)) dlg.Bind(wx.EVT_RADIOBOX, lambda event: self.__onFind('direction', direction)) else: print 'Find dlg existed'
def _init_ctrls(self, prnt): # generated method, don't edit wx.MDIChildFrame.__init__(self, id=wxID_MDICHILDTEXTCAT, name=u'MDIChildTextCat', parent=prnt, pos=wx.Point(529, 333), size=wx.Size(1040, 680), style=wx.DEFAULT_FRAME_STYLE, title=u'Text Categorization') self.SetClientSize(wx.Size(1040, 680)) self.SetBackgroundColour(wx.Colour(125, 152, 221)) self.SetAutoLayout(True) self.panTextMining = wx.Panel(id=wxID_MDICHILDTEXTCATPANSTOPWORDS, name=u'panStopwords', parent=self, pos=wx.Point(4, 4), size=wx.Size(1032, 672), style=wx.TAB_TRAVERSAL) self.panTextMining.SetBackgroundColour(wx.Colour(225, 236, 255)) self.panTextMining.SetConstraints( LayoutAnchors(self.panTextMining, True, True, True, True)) self.btnClose = wx.Button(id=wxID_MDICHILDTEXTCATBTNCLOSE, label=u'Close', name=u'btnClose', parent=self.panTextMining, pos=wx.Point(791, 8), size=wx.Size(75, 23), style=0) self.btnClose.SetConstraints( LayoutAnchors(self.btnClose, False, True, True, False)) self.btnClose.Bind(wx.EVT_BUTTON, self.OnBtnCloseButton, id=wxID_MDICHILDTEXTCATBTNCLOSE) self.lblKeywordsSearch = wx.StaticText( id=wxID_MDICHILDTEXTCATLBLKEYWORDSSEARCH, label=u'Text Preprocessing...', name=u'lblKeywordsSearch', parent=self.panTextMining, pos=wx.Point(16, 8), size=wx.Size(136, 16), style=0) self.lblKeywordsSearch.SetForegroundColour(wx.Colour(0, 0, 187)) self.lblKeywordsSearch.SetFont( wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False, u'Tahoma')) self.lblKeywordsSearch.SetConstraints( LayoutAnchors(self.lblKeywordsSearch, True, True, False, False)) self.btnPreprocessing = wx.Button( id=wxID_MDICHILDTEXTCATBTNPREPROCESSING, label=u'Text Preprocessing...', name=u'btnPreprocessing', parent=self.panTextMining, pos=wx.Point(176, 8), size=wx.Size(128, 24), style=0) self.btnPreprocessing.Bind(wx.EVT_BUTTON, self.OnBtnPreprocessingButton, id=wxID_MDICHILDTEXTCATBTNPREPROCESSING) self.btnExportWordFeatures = wx.Button( id=wxID_MDICHILDTEXTCATBTNEXPORTWORDFEATURES, label='Export Words', name='btnExportWordFeatures', parent=self.panTextMining, pos=wx.Point(176, 56), size=wx.Size(128, 24), style=0) self.btnExportWordFeatures.Bind( wx.EVT_BUTTON, self.OnBtnExportWordFeaturesButton, id=wxID_MDICHILDTEXTCATBTNEXPORTWORDFEATURES) self.btnExportStemmedWords = wx.Button( id=wxID_MDICHILDTEXTCATBTNEXPORTSTEMMEDWORDS, label='Export Stemmed Words', name='btnExportStemmedWords', parent=self.panTextMining, pos=wx.Point(336, 56), size=wx.Size(128, 24), style=0) self.btnExportStemmedWords.Bind( wx.EVT_BUTTON, self.OnBtnExportStemmedWordsButton, id=wxID_MDICHILDTEXTCATBTNEXPORTSTEMMEDWORDS)
def _init_ui(self): def on_reload(event): self.choice.SetItems(self._get_serial_ports()) def on_baud_changed(event): radio_button = event.GetEventObject() if radio_button.GetValue(): self._config.baud = radio_button.rate def on_mode_changed(event): radio_button = event.GetEventObject() if radio_button.GetValue(): self._config.mode = radio_button.mode def on_erase_changed(event): radio_button = event.GetEventObject() if radio_button.GetValue(): self._config.erase_before_flash = radio_button.erase def on_clicked(event): self.console_ctrl.SetValue("") worker = FlashingThread(self, self._config) worker.start() def on_select_port(event): choice = event.GetEventObject() self._config.port = choice.GetString(choice.GetSelection()) def on_pick_file(event): self._config.firmware_path = event.GetPath().replace("'", "") panel = wx.Panel(self) hbox = wx.BoxSizer(wx.HORIZONTAL) fgs = wx.FlexGridSizer(7, 2, 10, 10) self.choice = wx.Choice(panel, choices=self._get_serial_ports()) self.choice.Bind(wx.EVT_CHOICE, on_select_port) self._select_configured_port() bmp = images.Reload.GetBitmap() reload_button = wx.BitmapButton(panel, id=wx.ID_ANY, bitmap=bmp, size=(bmp.GetWidth() + 7, bmp.GetHeight() + 7)) reload_button.Bind(wx.EVT_BUTTON, on_reload) reload_button.SetToolTip("Reload serial device list") file_picker = wx.FilePickerCtrl(panel, style=wx.FLP_USE_TEXTCTRL) file_picker.Bind(wx.EVT_FILEPICKER_CHANGED, on_pick_file) serial_boxsizer = wx.BoxSizer(wx.HORIZONTAL) serial_boxsizer.Add(self.choice, 1, wx.EXPAND) serial_boxsizer.AddStretchSpacer(0) serial_boxsizer.Add(reload_button, 0, wx.ALIGN_RIGHT, 20) baud_boxsizer = wx.BoxSizer(wx.HORIZONTAL) def add_baud_radio_button(sizer, index, baud_rate): style = wx.RB_GROUP if index == 0 else 0 radio_button = wx.RadioButton(panel, name="baud-%d" % baud_rate, label="%d" % baud_rate, style=style) radio_button.rate = baud_rate # sets default value radio_button.SetValue(baud_rate == self._config.baud) radio_button.Bind(wx.EVT_RADIOBUTTON, on_baud_changed) sizer.Add(radio_button) sizer.AddSpacer(10) for idx, rate in enumerate(__supported_baud_rates__): add_baud_radio_button(baud_boxsizer, idx, rate) flashmode_boxsizer = wx.BoxSizer(wx.HORIZONTAL) def add_flash_mode_radio_button(sizer, index, mode, label): style = wx.RB_GROUP if index == 0 else 0 radio_button = wx.RadioButton(panel, name="mode-%s" % mode, label="%s" % label, style=style) radio_button.Bind(wx.EVT_RADIOBUTTON, on_mode_changed) radio_button.mode = mode radio_button.SetValue(mode == self._config.mode) sizer.Add(radio_button) sizer.AddSpacer(10) add_flash_mode_radio_button(flashmode_boxsizer, 0, "qio", "Quad I/O (QIO)") add_flash_mode_radio_button(flashmode_boxsizer, 1, "dio", "Dual I/O (DIO)") add_flash_mode_radio_button(flashmode_boxsizer, 2, "dout", "Dual Output (DOUT)") erase_boxsizer = wx.BoxSizer(wx.HORIZONTAL) def add_erase_radio_button(sizer, index, erase_before_flash, label, value): style = wx.RB_GROUP if index == 0 else 0 radio_button = wx.RadioButton(panel, name="erase-%s" % erase_before_flash, label="%s" % label, style=style) radio_button.Bind(wx.EVT_RADIOBUTTON, on_erase_changed) radio_button.erase = erase_before_flash radio_button.SetValue(value) sizer.Add(radio_button) sizer.AddSpacer(10) erase = self._config.erase_before_flash add_erase_radio_button(erase_boxsizer, 0, False, "否", erase is False) add_erase_radio_button(erase_boxsizer, 1, True, "是,清除所有数据", erase is True) button = wx.Button(panel, -1, "烧写") button.Bind(wx.EVT_BUTTON, on_clicked) self.console_ctrl = wx.TextCtrl(panel, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) self.console_ctrl.SetFont( wx.Font(13, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) self.console_ctrl.SetBackgroundColour(wx.BLACK) self.console_ctrl.SetForegroundColour(wx.RED) self.console_ctrl.SetDefaultStyle(wx.TextAttr(wx.RED)) port_label = wx.StaticText(panel, label="串口选择") file_label = wx.StaticText(panel, label="8266 固件") baud_label = wx.StaticText(panel, label="波特率") flashmode_label = wx.StaticText(panel, label="烧写模式") def on_info_hover(event): from HtmlPopupTransientWindow import HtmlPopupTransientWindow win = HtmlPopupTransientWindow(self, wx.SIMPLE_BORDER, __flash_help__, "#FFB6C1", (410, 140)) image = event.GetEventObject() image_position = image.ClientToScreen((0, 0)) image_size = image.GetSize() win.Position(image_position, (0, image_size[1])) win.Popup() icon = wx.StaticBitmap(panel, wx.ID_ANY, images.Info.GetBitmap()) icon.Bind(wx.EVT_MOTION, on_info_hover) flashmode_label_boxsizer = wx.BoxSizer(wx.HORIZONTAL) flashmode_label_boxsizer.Add(flashmode_label, 1, wx.EXPAND) flashmode_label_boxsizer.AddStretchSpacer(0) flashmode_label_boxsizer.Add(icon, 0, wx.ALIGN_RIGHT, 20) erase_label = wx.StaticText(panel, label="清空flash") console_label = wx.StaticText(panel, label="控制台") fgs.AddMany([ port_label, (serial_boxsizer, 1, wx.EXPAND), file_label, (file_picker, 1, wx.EXPAND), baud_label, baud_boxsizer, flashmode_label_boxsizer, flashmode_boxsizer, erase_label, erase_boxsizer, (wx.StaticText(panel, label="")), (button, 1, wx.EXPAND), (console_label, 1, wx.EXPAND), (self.console_ctrl, 1, wx.EXPAND) ]) fgs.AddGrowableRow(6, 1) fgs.AddGrowableCol(1, 1) hbox.Add(fgs, proportion=2, flag=wx.ALL | wx.EXPAND, border=15) panel.SetSizer(hbox)
def __init__(self): wx.Frame.__init__(self, None, -1, 'Real World Test') self.panel = panel = wx.Panel(self) #First create the controls topLbl = wx.StaticText(panel, -1, 'Account Information') topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) nameLbl = wx.StaticText(panel, -1, 'Name:') name = wx.TextCtrl(panel, -1, '') addrLbl = wx.StaticText(panel, -1, 'Address:') addr1 = wx.TextCtrl(panel, -1, '') addr2 = wx.TextCtrl(panel, -1, '') cstLbl = wx.StaticText(panel, -1, 'City State, Zip:') city = wx.TextCtrl(panel, -1, '', size = (150, -1)) state = wx.TextCtrl(panel, -1, '', size = (50, -1)) zip = wx.TextCtrl(panel, -1, '', size = (70, -1)) phoneLbl = wx.StaticText(panel, -1, 'Phone:') phone = wx.TextCtrl(panel, -1, '') emailLbl = wx.StaticText(panel, -1, 'Email:') email = wx.TextCtrl(panel, -1, '') saveBtn = wx.Button(panel, -1, 'Save') cancelBtn = wx.Button(panel, -1, 'Cancel') #Now do the layout. mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(topLbl, 0, wx.ALL, 5) mainSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) addrSizer = wx.FlexGridSizer(cols = 2, hgap = 5, vgap = 5) addrSizer.AddGrowableCol(1) addrSizer.Add(nameLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) addrSizer.Add(name, 0, wx.EXPAND) addrSizer.Add(addrLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) addrSizer.Add(addr1, 0, wx.EXPAND) addrSizer.Add((10, 10)) addrSizer.Add(addr2, 0, wx.EXPAND) addrSizer.Add(cstLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) cstSizer = wx.BoxSizer(wx.HORIZONTAL) cstSizer.Add(city, 1) cstSizer.Add(state, 0, wx.LEFT|wx.RIGHT, 5) cstSizer.Add(zip) addrSizer.Add(cstSizer, 0, wx.EXPAND) addrSizer.Add(phoneLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) addrSizer.Add(phone, 0, wx.EXPAND) addrSizer.Add(emailLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) addrSizer.Add(email, 0, wx.EXPAND) mainSizer.Add(addrSizer, 0, wx.EXPAND|wx.ALL, 10) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add((20, 20), 1) btnSizer.Add(saveBtn) btnSizer.Add((20, 20), 1) btnSizer.Add(cancelBtn) btnSizer.Add((20, 20), 1) mainSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) panel.SetSizer(mainSizer) mainSizer.Fit(self) mainSizer.SetSizeHints(self)
def set_default_font_style(self, elements=[]): for element in elements: element.SetFont( wx.Font(wx.DEFAULT, wx.DEFAULT, style=wx.NORMAL, weight=wx.NORMAL))
def add(self, widget): widget_type = type(widget) print widget_type if (widget_type == TextArea or isinstance(widget, TextArea)): widget.controller = wx.TextCtrl(self.panel, -1, widget.text, widget.position, widget.size, style=wx.TE_MULTILINE) elif (widget_type == TextField or isinstance(widget, TextField)): widget.controller = wx.TextCtrl(self.panel, -1, widget.text, widget.position, widget.size) elif (widget_type == Button or isinstance(widget, Button)): widget.controller = wx.Button(self.panel, -1, widget.title, widget.position, widget.size) #(self, parent, id, label, pos, size, style, validator, name) if (widget.callback != None): widget.controller.Bind(wx.EVT_BUTTON, widget.callback) elif (widget_type == CheckBox or isinstance(widget, CheckBox)): widget.controller = wx.CheckBox(self.panel, -1, widget.title, widget.position, widget.size) widget.controller.SetValue(widget.value) elif (widget_type == RadioGroup or isinstance(widget, RadioGroup)): widget.controller = [] radio_controller = wx.RadioButton(self.panel, -1, widget.labels[0], widget.positions[0], widget.size, style=wx.RB_GROUP) widget.controller.append(radio_controller) for i in range(1, len(widget.labels)): radio_controller = wx.RadioButton(self.panel, -1, widget.labels[i], widget.positions[i], widget.size) widget.controller.append(radio_controller) if (widget.selected_index != None): widget.controller[widget.selected_index].SetValue(True) elif (widget_type == ValueList or isinstance(widget, ValueList)): widget.controller = wx.ComboBox(self.panel, -1, widget.value, widget.position, widget.size, widget.choices, style=wx.CB_READONLY) elif (widget_type == LabelText or isinstance(widget, LabelText)): widget.controller = wx.StaticText(self.panel, -1, widget.text, widget.position, widget.size) if (widget.fontsize is not None): font1 = wx.Font(widget.fontsize, wx.NORMAL, wx.NORMAL, wx.NORMAL, False) widget.controller.SetFont(font1) elif (widget_type == Slider or isinstance(widget, Slider)): widget.controller = wx.Slider(self.panel, -1, minValue=widget._from, maxValue=widget._to, pos=widget.position, size=widget.size, style=wx.SL_HORIZONTAL) elif (widget_type == Dialog or isinstance(widget, Dialog)): widget.controller = wx.MessageDialog(self.panel, widget.text, widget.title, wx.OK | wx.ICON_INFORMATION) elif (widget_type == Image or isinstance(widget, Image)): #widget.controller = wx.StaticText(self.panel, -1,"",widget.position,widget.size) img = wx.Image(widget.image, wx.BITMAP_TYPE_PNG).ConvertToBitmap() #widget.controller.SetBitmap(img) self.button1 = wx.BitmapButton(self.panel, id=-1, bitmap=img, pos=widget.position, size=widget.size)
def __init__(self, parent): wx.Frame.__init__(self, parent) self.panel = wx.Panel(self) self.heading = wx.StaticText(self.panel, label="IIT Patna Academic Alexa", style=wx.ALIGN_CENTRE) self.heading.SetFont(wx.Font(15, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)) self.heading.SetForegroundColour(wx.RED) self.quote = wx.StaticText(self.panel, label="Chatbot:") #self.result = wx.StaticText(self.panel, label="") self.result = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH, size=(540, 200)) self.result.SetForegroundColour(wx.BLUE) self.button = wx.Button(self.panel, label="Enter") self.lblname = wx.StaticText(self.panel, label="Your Question:") self.editname = wx.TextCtrl(self.panel, size=(540, -1)) self.rbox = wx.RadioBox(self.panel, label='Type', choices=['Non-DB', 'DB'], majorDimension=1, style=wx.RA_SPECIFY_ROWS) self.rbox.SetSelection(0) self.rbox.Bind(wx.EVT_RADIOBOX, self.onRadioBox) # insert a picture of 100*100 size of your choice bmp = wx.Bitmap('iitp_resize.png') self.imgbutton = wx.Button(self.panel, label="", size=(100, 100)) self.imgbutton.SetBitmap(bmp) # self.jpg1 = wx.Image('nischal_resize.jpg', wx.BITMAP_TYPE_ANY).ConvertToBitmap() # self.imgbutton = wx.StaticBitmap(self, -1, self.jpg1, (10 + self.jpg1.GetWidth(), 5), (self.jpg1.GetWidth(), self.jpg1.GetHeight())) # Set sizer for the frame, so we can change frame size to match widgets self.windowSizer = wx.BoxSizer() self.windowSizer.Add(self.panel, 1, wx.ALL | wx.EXPAND) # Set sizer for the panel content self.sizer = wx.GridBagSizer(30, 30) self.sizer.Add(self.imgbutton, (0, 0)) self.sizer.Add(self.heading, (0, 1)) self.sizer.Add(self.lblname, (1, 0)) self.sizer.Add(self.editname, (1, 1)) self.sizer.Add(self.quote, (2, 0)) self.sizer.Add(self.result, (2, 1)) self.sizer.Add(self.rbox, (3, 0)) self.sizer.Add(self.button, (4, 0), (3, 2)) # Set simple sizer for a nice border self.border = wx.BoxSizer() self.border.Add(self.sizer, 1, wx.ALL | wx.EXPAND, 5) # Use the sizers self.panel.SetSizerAndFit(self.border) self.SetSizerAndFit(self.windowSizer) # Set event handlers self.button.Bind(wx.EVT_BUTTON, self.OnButton) # Trying to call initialize string = "Hello! My name is academic chatbot. I am here at your service\nPlease wait! I am configuring myself" self.result.SetLabel(string) self.sentiment_polarity = [] self.embedding_matrix, self.tokenizer, self.MAX_LENGTH, self.db, self.nlp = initialize( ) string = "Thanks for your patience!\nI am ready! Let\'s Start!" self.result.SetLabel(string) # Feedback initialization self.type_input = 0 self.class_feedback_file = open('class_feedback.csv', 'a+') self.db_feedback_file = open('db_feedback_file.csv', 'a+') self.ndb_feedback_file = open('ndb_feedback_file.csv', 'a+') self.prev_string = '' self.prev_selection = -1
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) #Plugin page self.pluginList = profile.getPluginList() sizer = wx.GridBagSizer(2, 2) self.SetSizer(sizer) effectStringList = [] for effect in self.pluginList: effectStringList.append(effect['name']) self.listbox = wx.ListBox(self, -1, choices=effectStringList) title = wx.StaticText(self, -1, "Plugins:") title.SetFont( wx.Font( wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD)) helpButton = wx.Button(self, -1, '?', style=wx.BU_EXACTFIT) addButton = wx.Button(self, -1, 'V', style=wx.BU_EXACTFIT) openPluginLocationButton = wx.Button(self, -1, 'Open plugin location') sb = wx.StaticBox(self, label="Enabled plugins") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) self.pluginEnabledPanel = scrolledpanel.ScrolledPanel(self) self.pluginEnabledPanel.SetupScrolling(False, True) sizer.Add(title, (0, 0), border=10, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.TOP) sizer.Add(helpButton, (0, 1), border=10, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.TOP) sizer.Add(self.listbox, (1, 0), span=(2, 2), border=10, flag=wx.EXPAND | wx.LEFT | wx.RIGHT) sizer.Add(addButton, (3, 0), span=(1, 2), border=5, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_BOTTOM) sizer.Add(boxsizer, (4, 0), span=(4, 2), border=10, flag=wx.EXPAND | wx.LEFT | wx.RIGHT) sizer.Add(openPluginLocationButton, (8, 0), border=10, flag=wx.LEFT | wx.BOTTOM) boxsizer.Add(self.pluginEnabledPanel, 1, flag=wx.EXPAND) sizer.AddGrowableCol(0) sizer.AddGrowableRow(1) # Plugins list box sizer.AddGrowableRow(4) # Enabled plugins sizer.AddGrowableRow(5) # Enabled plugins sizer.AddGrowableRow(6) # Enabled plugins sizer = wx.BoxSizer(wx.VERTICAL) self.pluginEnabledPanel.SetSizer(sizer) self.Bind(wx.EVT_BUTTON, self.OnAdd, addButton) self.Bind(wx.EVT_BUTTON, self.OnGeneralHelp, helpButton) self.Bind(wx.EVT_BUTTON, self.OnOpenPluginLocation, openPluginLocationButton) self.listbox.Bind(wx.EVT_LEFT_DCLICK, self.OnAdd) self.panelList = [] self.updateProfileToControls()
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent=parent) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.SetBackgroundColour(wx.WHITE) self.frame = parent # detect what's currently on needed_robots = autodetect() # if you can't find a single robot # then show all of them just in case if needed_robots.find("GoPiGo") == -1 and \ needed_robots.find("GrovePi") == -1 and \ needed_robots.find("BrickPi3") == -1: needed_robots = "GoPiGo_GrovePi_BrickPi3" vSizer = wx.BoxSizer(wx.VERTICAL) font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, u'Helvetica') self.SetFont(font) #------------------------------------------------------------------- # icon icon_sizer = wx.BoxSizer(wx.HORIZONTAL) bmp = wx.Bitmap( "/home/pi/di_update/Raspbian_For_Robots/Troubleshooting_GUI/dex.png", type=wx.BITMAP_TYPE_PNG) # Draw the photograph. bitmap = wx.StaticBitmap(self, bitmap=bmp) bmpW, bmpH = bitmap.GetSize() icon_sizer.Add(bitmap, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 50) # Troubleshoot the GoPiGo if needed_robots.find("GoPiGo") != -1: gopigo_sizer = wx.BoxSizer(wx.HORIZONTAL) troubleshoot_gopigo = wx.Button(self, label="Troubleshoot GoPiGo") troubleshoot_gopigo.Bind(wx.EVT_BUTTON, self.troubleshoot_gopigo) gopigo_txt = wx.StaticText( self, -1, "This button runs a series of tests on the GoPiGo Hardware.") gopigo_txt.Wrap(150) gopigo_sizer.AddSpacer(50) gopigo_sizer.Add(troubleshoot_gopigo, 1, wx.EXPAND) gopigo_sizer.AddSpacer(20) gopigo_sizer.Add(gopigo_txt, 1, wx.ALIGN_CENTER_VERTICAL) gopigo_sizer.AddSpacer(50) if needed_robots.find("GrovePi") != -1: # Troubleshoot the GrovePi grovepi_sizer = wx.BoxSizer(wx.HORIZONTAL) troubleshoot_grovepi = wx.Button(self, label="Troubleshoot GrovePi") troubleshoot_grovepi.Bind(wx.EVT_BUTTON, self.grovepi) grovepi_txt = wx.StaticText( self, -1, "This button runs a series of tests on the GrovePi Hardware.") grovepi_txt.Wrap(150) grovepi_sizer.AddSpacer(50) grovepi_sizer.Add(troubleshoot_grovepi, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 10) grovepi_sizer.AddSpacer(20) grovepi_sizer.Add(grovepi_txt, 1) grovepi_sizer.AddSpacer(50) #Troubleshoot the BrickPi3 if needed_robots.find("BrickPi3") != -1: brickpi3_sizer = wx.BoxSizer(wx.HORIZONTAL) troubleshoot_brickpi3 = wx.Button(self, label="Troubleshoot BrickPi3") troubleshoot_brickpi3.Bind(wx.EVT_BUTTON, self.brickpi3) brickpi3_txt = wx.StaticText( self, -1, "This button runs a series of tests on the BrickPi3 Hardware. (not BrickPi+)" ) brickpi3_txt.Wrap(150) brickpi3_sizer.AddSpacer(50) brickpi3_sizer.Add(troubleshoot_brickpi3, 1, wx.EXPAND) brickpi3_sizer.AddSpacer(20) brickpi3_sizer.Add(brickpi3_txt, 1, wx.ALIGN_CENTER_VERTICAL) brickpi3_sizer.AddSpacer(50) # Demo the GoPiGo if needed_robots.find("GoPiGo") != -1: demo_sizer = wx.BoxSizer(wx.HORIZONTAL) demo_gopigo = wx.Button(self, label="Demo GoPiGo") demo_gopigo.Bind(wx.EVT_BUTTON, self.demo_gopigo) demo_gopigo_txt = wx.StaticText( self, -1, "This button demonstrates the GoPiGo Hardware.") demo_gopigo_txt.Wrap(150) demo_sizer.AddSpacer(50) demo_sizer.Add(demo_gopigo, 1, wx.EXPAND) demo_sizer.AddSpacer(20) demo_sizer.Add(demo_gopigo_txt, 1, wx.ALIGN_CENTER_VERTICAL) demo_sizer.AddSpacer(50) # Exit exit_sizer = wx.BoxSizer(wx.HORIZONTAL) exit_button = wx.Button(self, label="Exit") exit_button.Bind(wx.EVT_BUTTON, self.onClose) exit_sizer.AddSpacer(50) exit_sizer.Add(exit_button, 1, wx.EXPAND) exit_sizer.AddSpacer(50) caution_sizer = wx.BoxSizer(wx.HORIZONTAL) caution_txt = wx.StaticText( self, -1, "Caution: Do not close the LXTerminal window running in the background right now." ) caution_sizer.AddSpacer(50) caution_sizer.Add(caution_txt, 1, wx.EXPAND) caution_sizer.AddSpacer(50) vSizer.Add(icon_sizer, 0, wx.SHAPED | wx.FIXED_MINSIZE) if needed_robots.find("GoPiGo") != -1: vSizer.Add(gopigo_sizer, 1, wx.EXPAND) vSizer.AddSpacer(20) if needed_robots.find("GrovePi") != -1: vSizer.Add(grovepi_sizer, 1, wx.EXPAND) vSizer.AddSpacer(20) if needed_robots.find("BrickPi3") != -1: vSizer.Add(brickpi3_sizer, 1, wx.EXPAND) vSizer.AddSpacer(20) if needed_robots.find("GoPiGo") != -1: vSizer.Add(demo_sizer, 1, wx.EXPAND) vSizer.AddSpacer(20) vSizer.Add(exit_sizer, 1, wx.EXPAND) vSizer.AddSpacer(20) vSizer.Add(caution_sizer, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL) self.SetSizerAndFit(vSizer)
def _buildPluginPanel(self, pluginConfig): plugin = None for pluginTest in self.pluginList: if pluginTest['filename'] == pluginConfig['filename']: plugin = pluginTest if plugin is None: return False pluginPanel = wx.Panel(self.pluginEnabledPanel) s = wx.GridBagSizer(2, 2) pluginPanel.SetSizer(s) title = wx.StaticText(pluginPanel, -1, plugin['name']) title.SetFont( wx.Font( wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD)) remButton = wx.Button(pluginPanel, -1, 'X', style=wx.BU_EXACTFIT) helpButton = wx.Button(pluginPanel, -1, '?', style=wx.BU_EXACTFIT) s.Add(title, pos=(0, 1), span=(1, 2), flag=wx.ALIGN_BOTTOM | wx.TOP | wx.LEFT | wx.RIGHT, border=5) s.Add(helpButton, pos=(0, 0), span=(1, 1), flag=wx.TOP | wx.LEFT | wx.ALIGN_RIGHT, border=5) s.Add(remButton, pos=(0, 3), span=(1, 1), flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT, border=5) s.Add(wx.StaticLine(pluginPanel), pos=(1, 0), span=(1, 4), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=3) info = wx.StaticText(pluginPanel, -1, plugin['info']) info.Wrap(300) s.Add(info, pos=(2, 0), span=(1, 4), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=3) pluginPanel.paramCtrls = {} i = 0 for param in plugin['params']: value = param['default'] if param['name'] in pluginConfig['params']: value = pluginConfig['params'][param['name']] ctrl = wx.TextCtrl(pluginPanel, -1, value) s.Add(wx.StaticText(pluginPanel, -1, param['description']), pos=(3 + i, 0), span=(1, 2), flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, border=3) s.Add(ctrl, pos=(3 + i, 2), span=(1, 2), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=3) ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange) pluginPanel.paramCtrls[param['name']] = ctrl i += 1 s.Add(wx.StaticLine(pluginPanel), pos=(3 + i, 0), span=(1, 4), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=3) self.Bind(wx.EVT_BUTTON, self.OnRem, remButton) self.Bind(wx.EVT_BUTTON, self.OnHelp, helpButton) s.AddGrowableCol(1) pluginPanel.SetBackgroundColour(self.GetParent().GetBackgroundColour()) self.pluginEnabledPanel.GetSizer().Add(pluginPanel, flag=wx.EXPAND) self.pluginEnabledPanel.Layout() self.pluginEnabledPanel.SetSize((1, 1)) self.Layout() self.pluginEnabledPanel.ScrollChildIntoView(pluginPanel) self.panelList.append(pluginPanel) return True
def getFonts( self, fontSize ): font = wx.Font( (0,fontSize), wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL ) fontBold = wx.Font( (0,fontSize), wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD ) return font, fontBold
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, u"异常频点定位数据请求", size=(450, 400)) self.SetFont( wx.Font(10, wx.ROMAN, wx.NORMAL, wx.LIGHT, underline=False, faceName=u"微软雅黑", encoding=wx.FONTENCODING_DEFAULT)) ############################### self.parent = parent self.tail = FrameTail(0, 0, 0xAA) self.id = staticVar.getid() self.lowid = self.id & 0x00FF self.highid = self.id >> 8 ############################################### panel = wx.Panel(self, -1) self.CentreFreq = wx.TextCtrl(panel, -1, size=(80, 25)) self.UploadNum = wx.TextCtrl(panel, -1, "1", size=(80, 25)) self.radioBox = wx.RadioBox(panel, -1, choices=["POA", "POA/TDOA"]) self.radioBox.SetSelection(0) sampleList = ['5/5', '2.5/2.5', '1/1', '0.5/0/5', '0.1/0/1'] self.BandWidth = wx.ComboBox(panel, -1, '5/5', size=(80, 30), choices=sampleList) self.BandWidth.SetSelection(0) self.StartTimeYear = wx.ComboBox( panel, -1, "2015", choices=["2015", "2016", "2017", "2018"]) self.StartTimeMonth = wx.ComboBox(panel, -1, "12", choices=[ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ]) self.StartTimeDay = wx.TextCtrl(panel, -1, "1", size=(60, 25)) self.StartTimeHour = wx.TextCtrl(panel, -1, "0", size=(60, 25)) self.StartTimeMinute = wx.TextCtrl(panel, -1, "0", size=(60, 25)) self.StartTimeSecond = wx.TextCtrl(panel, -1, "0", size=(60, 25)) self.StartTimeYear.SetSelection(0) self.StartTimeMonth.SetSelection(11) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add((15, 15)) sizer.Add(wx.StaticText(panel, -1, u"几何定位方法", size=(120, 25)), 0, wx.LEFT, 20) sizer.Add(self.radioBox, 0, wx.LEFT, 20) sizer.Add((10, 10)) hBox1 = wx.BoxSizer(wx.HORIZONTAL) hBox1.Add(wx.StaticText(panel, -1, u"中心频率(MHz)", size=(160, 25)), 0, wx.LEFT, 20) hBox1.Add(self.CentreFreq, 0, wx.LEFT, 20) sizer.Add(hBox1) sizer.Add((10, 10)) hBox1 = wx.BoxSizer(wx.HORIZONTAL) hBox1.Add( wx.StaticText(panel, -1, u"带宽/数据率 (MHz/Msps):", size=(160, 25)), 0, wx.LEFT, 20) hBox1.Add(self.BandWidth, 0, wx.LEFT, 20) sizer.Add(hBox1) sizer.Add((10, 10)) hBox1 = wx.BoxSizer(wx.HORIZONTAL) hBox1.Add(wx.StaticText(panel, -1, u"上传数据块个数(1-256):", size=(160, 25)), 0, wx.LEFT, 20) hBox1.Add(self.UploadNum, 0, wx.LEFT, 20) sizer.Add(hBox1) sizer.Add((10, 10)) sizer.Add(wx.StaticText(panel, -1, u"采集起始时间(年-月-日-时-分-秒):"), 0, wx.LEFT, 20) sizer.Add((10, 10)) hBox1 = wx.BoxSizer(wx.HORIZONTAL) hBox1.Add(self.StartTimeYear, 0, wx.LEFT, 20) hBox1.Add(wx.StaticText(panel, -1, "-"), 0, wx.LEFT | wx.RIGHT | wx.ALIGN_BOTTOM, 5) hBox1.Add(self.StartTimeMonth, 0) hBox1.Add(wx.StaticText(panel, -1, "-"), 0, wx.LEFT | wx.RIGHT | wx.ALIGN_BOTTOM, 5) hBox1.Add(self.StartTimeDay, 0) hBox1.Add(wx.StaticText(panel, -1, "-"), 0, wx.LEFT | wx.RIGHT | wx.ALIGN_BOTTOM, 5) hBox1.Add(self.StartTimeHour, 0) hBox1.Add(wx.StaticText(panel, -1, "-"), 0, wx.LEFT | wx.RIGHT | wx.ALIGN_BOTTOM, 5) hBox1.Add(self.StartTimeMinute, 0) hBox1.Add(wx.StaticText(panel, -1, "-"), 0, wx.LEFT | wx.RIGHT | wx.ALIGN_BOTTOM, 5) hBox1.Add(self.StartTimeSecond, 0) sizer.Add(hBox1) sizer.Add((30, 30)) hBox1 = wx.BoxSizer(wx.HORIZONTAL) self.btn_ok = wx.Button(panel, -1, "OK", size=(60, 25)) hBox1.Add(self.btn_ok, 0, wx.LEFT, 20) hBox1.Add(wx.Button(panel, wx.ID_ANY, "CANCEL", size=(60, 25)), 0, wx.LEFT, 20) sizer.Add(hBox1) panel.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH) #Events self.btn_ok.Bind(wx.EVT_BUTTON, self.OnbtnOk)