def __init__(self, parent, spectrum, settings): self.spectrum = sort_spectrum(spectrum) self.settings = settings self.smoothed = None wx.Dialog.__init__(self, parent=parent, title='Smooth Spectrum') self.queue = Queue.Queue() self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.__on_timer, self.timer) self.timer.Start(self.POLL) self.figure = matplotlib.figure.Figure(facecolor='white') self.canvas = FigureCanvas(self, -1, self.figure) settings = copy.copy(settings) settings.plotFunc = PlotFunc.NONE self.plot = Plotter(self.queue, self.figure, settings) textFunc = wx.StaticText(self, label='Window function') self.choiceFunc = wx.Choice(self, choices=WINFUNC[::2]) self.choiceFunc.SetSelection(WINFUNC[::2].index(settings.smoothFunc)) textRatio = wx.StaticText(self, label='Smoothing') self.slideRatio = wx.Slider(self, value=settings.smoothRatio, minValue=2, maxValue=100, style=wx.SL_INVERSE) buttonSmooth = wx.Button(self, label='Smooth') self.Bind(wx.EVT_BUTTON, self.__on_smooth, buttonSmooth) sizerButtons = wx.StdDialogButtonSizer() self.buttonOk = wx.Button(self, wx.ID_OK) self.buttonOk.Disable() buttonCancel = wx.Button(self, wx.ID_CANCEL) sizerButtons.AddButton(self.buttonOk) sizerButtons.AddButton(buttonCancel) sizerButtons.Realize() self.Bind(wx.EVT_BUTTON, self.__on_ok, self.buttonOk) sizerGrid = wx.GridBagSizer(5, 5) sizerGrid.Add(self.canvas, pos=(0, 0), span=(10, 6), flag=wx.EXPAND | wx.ALL, border=5) sizerGrid.Add(textFunc, pos=(0, 6), flag=wx.ALL, border=5) sizerGrid.Add(self.choiceFunc, pos=(1, 6), span=(1, 2), flag=wx.EXPAND | wx.ALL, border=5) sizerGrid.Add(textRatio, pos=(2, 6), flag=wx.ALL, border=5) sizerGrid.Add(self.slideRatio, pos=(3, 6), span=(1, 2), flag=wx.EXPAND | wx.ALL, border=5) sizerGrid.Add(buttonSmooth, pos=(4, 6), span=(1, 2), flag=wx.ALL | wx.ALIGN_CENTRE, border=5) sizerGrid.Add(sizerButtons, pos=(10, 6), span=(1, 2), flag=wx.ALIGN_RIGHT | wx.ALL, border=5) self.SetSizerAndFit(sizerGrid) self.__draw_plot(self.spectrum)
def __init__(self, parent, fontData, sampleText='AaBbCc ... XxYyZz'): """ Initialize the Font Dialog Box. fontData should be a FormatDialog.FormatDef object so that some values can be ambiguous due to conflicting settings in the selected text. """ # Capture the Font Data self.font = fontData # Remember the original FormatDialog.FormatDef settings in case the user presses Cancel self.originalFont = self.font.copy() # Define our Sample Text's Text. self.sampleText = sampleText # Create the Font Dialog wx.Panel.__init__(self, parent, -1) # To look right, the Mac needs the Small Window Variant. if "__WXMAC__" in wx.PlatformInfo: self.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) # Create the main Sizer, which will hold the boxTop, boxMiddle, and boxButton sizers box = wx.BoxSizer(wx.VERTICAL) # Create the boxTop sizer, which will hold the boxFont and boxSize sizers boxTop = wx.BoxSizer(wx.HORIZONTAL) # Create the boxFont sizer, which will hold the Font Face widgets boxFont = wx.BoxSizer(wx.VERTICAL) # Add Font Face widgets. # Create the label lblFont = wx.StaticText(self, -1, _('Font:')) boxFont.Add(lblFont, 0, wx.ALIGN_LEFT | wx.ALIGN_TOP) boxFont.Add((0, 5)) # Spacer # Create a text control for the font face name. # First, determine the initial value. if self.font.fontFace == None: fontFace = '' else: fontFace = self.font.fontFace.strip() self.txtFont = wx.TextCtrl(self, -1, fontFace, style=wx.TE_LEFT) self.txtFont.Bind(wx.EVT_TEXT, self.OnTxtFontChange) self.txtFont.Bind(wx.EVT_KILL_FOCUS, self.OnTxtFontKillFocus) boxFont.Add(self.txtFont, 0, wx.ALIGN_LEFT | wx.EXPAND) # Create a list box control of all available font face names. The user can type into the text control, but the # font should only change when what is typed matches an entry in the list box. # First, let's get a list of all available fonts using a wxFontEnumerator. fontEnum = wx.FontEnumerator() fontEnum.EnumerateFacenames() fontList = fontEnum.GetFacenames() # Sort the Font List fontList.sort() # Now create the Font Face Names list box. We can't use the LB_SORT parameter on OS X with wxPython 2.9.5.0.b self.lbFont = wx.ListBox(self, -1, choices=fontList, style=wx.LB_SINGLE | wx.LB_ALWAYS_SB) # | wx.LB_SORT) # Make sure the initial font is in the list ... if self.font.fontFace != None: # If the font name IS found in the dropdown ... if self.font.fontFace in fontList: # self.lbFont.FindString(self.font.fontFace) != wx.NOT_FOUND: # ... then select that font name. self.lbFont.SetStringSelection(self.font.fontFace.strip()) # If not ... else: # Try to use the Default Font instead. If the default font IS found in the dropdown ... if TransanaGlobal.configData.defaultFontFace in fontList: # self.lbFont.FindString(TransanaGlobal.configData.defaultFontFace) != wx.NOT_FOUND: # ... then select that font name in the dropdown and update the text control. self.txtFont.SetValue( TransanaGlobal.configData.defaultFontFace.strip()) self.lbFont.SetStringSelection( TransanaGlobal.configData.defaultFontFace.strip()) # If neither the current font nor the default font are in the list ... else: # ... select the first font in the list in both the dropdown and in the text control. self.lbFont.SetSelection(0) self.txtFont.SetValue(self.lbFont.GetStringSelection()) # Bind the List Box Change event self.lbFont.Bind(wx.EVT_LISTBOX, self.OnLbFontChange) boxFont.Add(self.lbFont, 3, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM | wx.EXPAND | wx.GROW) # Add the boxFont sizer to the boxTop sizer boxTop.Add(boxFont, 5, wx.ALIGN_LEFT | wx.EXPAND) # Create the boxSize sizer, which will hold the Font Size widgets boxSize = wx.BoxSizer(wx.VERTICAL) # Add Font Size widgets. # Create the label lblSize = wx.StaticText(self, -1, _('Size: (points)')) boxSize.Add(lblSize, 0, wx.ALIGN_LEFT | wx.ALIGN_TOP) boxSize.Add((0, 5)) # Spacer # Create a text control for the font size # First, determine the initial value. if self.font.fontSize == None: fontSize = '' else: fontSize = str(self.font.fontSize) self.txtSize = wx.TextCtrl(self, -1, fontSize, style=wx.TE_LEFT) self.txtSize.Bind(wx.EVT_TEXT, self.OnTxtSizeChange) boxSize.Add(self.txtSize, 0, wx.ALIGN_LEFT | wx.EXPAND) # Create a list box control of available font sizes, though the user can type other options in the text control. # First, let's make a list of available font sizes. It doesn't have to be complete. The blank first entry # is used when the user types in something that isn't in the list. sizeList = [ '', '6', '7', '8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '30', '32', '36', '40', '44', '48', '54', '64', '72' ] # Now create the Font Sizes list box self.lbSize = wx.ListBox(self, -1, choices=sizeList, style=wx.LB_SINGLE | wx.LB_ALWAYS_SB) if (self.font.fontSize != None) and (str(self.font.fontSize) in sizeList): self.lbSize.SetStringSelection(str(self.font.fontSize)) self.lbSize.Bind(wx.EVT_LISTBOX, self.OnLbSizeChange) boxSize.Add(self.lbSize, 3, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM | wx.EXPAND | wx.GROW) boxTop.Add((15, 0)) # Spacer # Add the boxSize sizer to the boxTop sizer boxTop.Add(boxSize, 3, wx.ALIGN_RIGHT | wx.EXPAND | wx.GROW) # Add the boxTop sizer to the main box sizer box.Add(boxTop, 3, wx.ALIGN_LEFT | wx.ALIGN_TOP | wx.EXPAND | wx.GROW | wx.ALL, 10) # Create the boxMiddle sizer, which will hold the boxStyle and boxSample sizers boxMiddle = wx.BoxSizer(wx.HORIZONTAL) # Create the boxStyle sizer, which will hold the Style and Color widgets boxStyle = wx.BoxSizer(wx.VERTICAL) # Add the Font Style and Font Color widgets # Start with the Style label lblStyle = wx.StaticText(self, -1, _('Style:')) boxStyle.Add(lblStyle, 0, wx.ALIGN_LEFT | wx.ALIGN_TOP) boxStyle.Add((0, 5)) # Spacer # Add a checkbox for Bold self.checkBold = wx.CheckBox(self, -1, _('Bold'), style=wx.CHK_3STATE) # Determine and set the initial value. if self.font.fontWeight == FormatDialog.fd_OFF: checkValue = wx.CHK_UNCHECKED elif self.font.fontWeight == FormatDialog.fd_BOLD: checkValue = wx.CHK_CHECKED elif self.font.fontWeight == FormatDialog.fd_AMBIGUOUS: checkValue = wx.CHK_UNDETERMINED self.checkBold.Set3StateValue(checkValue) self.checkBold.Bind(wx.EVT_CHECKBOX, self.OnBold) boxStyle.Add(self.checkBold, 0, wx.ALIGN_LEFT | wx.LEFT, 5) boxStyle.Add((0, 5)) # Spacer # Add a checkbox for Italics self.checkItalics = wx.CheckBox(self, -1, _('Italics'), style=wx.CHK_3STATE) # Determine and set the initial value. if self.font.fontStyle == FormatDialog.fd_OFF: checkValue = wx.CHK_UNCHECKED elif self.font.fontStyle == FormatDialog.fd_ITALIC: checkValue = wx.CHK_CHECKED elif self.font.fontStyle == FormatDialog.fd_AMBIGUOUS: checkValue = wx.CHK_UNDETERMINED self.checkItalics.Set3StateValue(checkValue) self.checkItalics.Bind(wx.EVT_CHECKBOX, self.OnItalics) boxStyle.Add(self.checkItalics, 0, wx.ALIGN_LEFT | wx.LEFT, 5) boxStyle.Add((0, 5)) # Spacer # Add a checkbox for Underline self.checkUnderline = wx.CheckBox(self, -1, _('Underline'), style=wx.CHK_3STATE) # Determine and set the initial value. if self.font.fontUnderline == FormatDialog.fd_OFF: checkValue = wx.CHK_UNCHECKED elif self.font.fontUnderline == FormatDialog.fd_UNDERLINE: checkValue = wx.CHK_CHECKED elif self.font.fontUnderline == FormatDialog.fd_AMBIGUOUS: checkValue = wx.CHK_UNDETERMINED self.checkUnderline.Set3StateValue(checkValue) self.checkUnderline.Bind(wx.EVT_CHECKBOX, self.OnUnderline) boxStyle.Add(self.checkUnderline, 0, wx.ALIGN_LEFT | wx.LEFT, 5) boxStyle.Add((0, 10)) # Spacer # Add a label for Color lblColor = wx.StaticText(self, -1, _('Color:')) boxStyle.Add(lblColor, 0, wx.ALIGN_LEFT | wx.ALIGN_TOP) boxStyle.Add((0, 5)) # Spacer # We want enough colors, but not too many. This list seems about right to me. I doubt my color names are standard. # But then, I'm often perplexed by the colors that are included and excluded by most programs. (Excel for example.) # Each entry is made up of a color name and a tuple of the RGB values for the color. self.colorList = TransanaGlobal.transana_textColorList # We need to create a list of the colors to be included in the control. choiceList = [] # Default to undefined to allow for ambiguous colors, if the original color isn't included in the list. # NOTE: This dialog will only support the colors in this list at this point. initialColor = '' # _('Black') initialBgColor = '' # _('White') # Iterate through the list of colors ... for (color, colDef) in self.colorList: # ... adding each color name to the list of what should be displayed ... choiceList.append(_(color)) # ... and checking to see if the color in the list matches the initial color sent to the dialog. if colDef == self.font.fontColorDef: # If the current color matches a color in the list, remember it's name. initialColor = _(color) if colDef == self.font.fontBackgroundColorDef: initialBgColor = _(color) # Now create a Choice box listing all the colors in the color list self.cbColor = wx.Choice(self, -1, choices=[''] + choiceList) # Set the initial value of the Choice box to the default value determined above. self.cbColor.SetStringSelection(initialColor) self.cbColor.Bind(wx.EVT_CHOICE, self.OnCbColorChange) boxStyle.Add(self.cbColor, 1, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM) boxStyle.Add((0, 10)) # Spacer # Add a label for Color lblBgColor = wx.StaticText(self, -1, _('Background Color:')) boxStyle.Add(lblBgColor, 0, wx.ALIGN_LEFT | wx.ALIGN_TOP) boxStyle.Add((0, 5)) # Spacer # Now create a Choice box listing all the colors in the color list self.cbBgColor = wx.Choice(self, -1, choices=choiceList + ['']) # Set the initial value of the Choice box to the default value determined above. self.cbBgColor.SetStringSelection(initialBgColor) self.cbBgColor.Bind(wx.EVT_CHOICE, self.OnCbColorChange) boxStyle.Add(self.cbBgColor, 1, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM) # Add the boxStyle sizer to the boxMiddle sizer boxMiddle.Add(boxStyle, 1, wx.ALIGN_LEFT | wx.RIGHT, 10) # Create the boxSample sizer, which will hold the Text Sample widgets boxSample = wx.BoxSizer(wx.VERTICAL) # Create the Text Sample widgets. # Start with a label lblSample = wx.StaticText(self, -1, _('Sample:')) boxSample.Add(lblSample, 0, wx.ALIGN_LEFT | wx.ALIGN_TOP) boxSample.Add((0, 5)) # Spacer # We'll use a StaticBitmap for the sample text, painting directly on its Device Context. The TextCtrl # on the Mac can't handle all we need it to for this task. # We create this here, as it may get called while creating other controls. We'll add it to the sizers later. self.txtSample = wx.StaticBitmap(self, -1) # We added the txtSample control earlier. Set its background color and add it to the Sizers here. self.txtSample.SetBackgroundColour(self.font.fontBackgroundColorDef) boxSample.Add(self.txtSample, 1, wx.ALIGN_RIGHT | wx.EXPAND | wx.GROW) # Add the boxSample sizer to the boxMiddle sizer boxMiddle.Add(boxSample, 3, wx.ALIGN_RIGHT | wx.EXPAND | wx.GROW) # Add the boxMiddle sizer to the main box sizer box.Add(boxMiddle, 2, wx.ALIGN_LEFT | wx.EXPAND | wx.GROW | wx.ALL, 10) # Define box as the form's main sizer self.SetSizer(box) # Fit the form to the widgets created self.Fit() # Set this as the minimum size for the form. self.SetSizeHints(minW=self.GetSize()[0], minH=self.GetSize()[1]) # Tell the form to maintain the layout and have it set the intitial Layout self.SetAutoLayout(True) self.Layout() # We need an Size event for the form for a little mainenance when the form size is changed self.Bind(wx.EVT_SIZE, self.OnSize) # Under wxPython 2.6.1.0-unicode, this form is throwing a segment fault when the color gets changed. # The following variable prevents that! self.closing = False
def makemenubar(self): # 创建面板 panel = wx.Panel(self) # 选择用户名字典文件 statictext = wx.StaticText(panel, label='请选择用户名字典文件:', pos=(20, 25)) font = statictext.GetFont() #font.PointSize += 2 font = font.Bold() statictext.SetFont(font) self.user_name = wx.TextCtrl(panel, -1, size=(175, -1), pos=(175, 20)) self.user_name.SetInsertionPoint(0) # 选择密码字典文件 statictext = wx.StaticText(panel, label='请选择密码字典文件:', pos=(20, 65)) font = statictext.GetFont() #font.PointSize += 2 font = font.Bold() statictext.SetFont(font) self.user_pwd = wx.TextCtrl(panel, -1, size=(175, -1), pos=(175, 60)) self.user_pwd.SetInsertionPoint(0) # 是否显示浏览器 statictext = wx.StaticText(panel, label='是否显示浏览器:', pos=(20, 105)) font = statictext.GetFont() #font.PointSize += 2 font = font.Bold() statictext.SetFont(font) list0 = ['是', '否'] self.browser_bar = wx.Choice(panel, choices=list0, pos=(175, 100)) self.Bind(wx.EVT_CHOICE, self.on_browser, self.browser_bar) # 设备下拉框 # statictext = wx.StaticText(panel,label='请选择要进行扫描的设备:', pos=(20,105)) # font = statictext.GetFont() # #font.PointSize += 2 # font = font.Bold() # statictext.SetFont(font) # '''设备列表,如果需要请自行添加 值从0开始''' # list1 = ['LogBase','绿盟IPS','绿盟防火墙','天融信防火墙'] # """下拉选项""" # self.product = wx.Choice(panel, choices=list1, pos=(175,100)) # self.Bind(wx.EVT_CHOICE, self.on_combobox, self.product) # web登陆页面url statictext = wx.StaticText(panel, label='请输入设备登陆界面URL:', pos=(20, 145)) font = statictext.GetFont() #font.PointSize += 2 font = font.Bold() statictext.SetFont(font) # url输入 self.input_url = wx.TextCtrl(panel, -1, size=(175, -1), pos=(175, 140)) self.input_url.SetInsertionPoint(0) self.Bind(wx.EVT_TEXT, self.url, self.input_url) # 创建 button self.button_start = wx.Button(panel, 1, "开始扫描", pos=(355, 137)) self.button_start.Bind(wx.EVT_BUTTON, self.OnClick) #self.button.SetDefault() self.button_stop = wx.Button(panel, 1, "停止扫描", pos=(450, 137)) self.button_stop.Bind(wx.EVT_BUTTON, self.Stop) self.button_stop.Enable(False) self.button_open_user = wx.Button(panel, 1, "打开", pos=(355, 17)) self.button_open_user.Bind(wx.EVT_BUTTON, self.open_user) self.button_open_pw = wx.Button(panel, 1, "打开", pos=(355, 57)) self.button_open_pw.Bind(wx.EVT_BUTTON, self.open_pwd) # 扫描状态 statictext = wx.StaticText(panel, label='扫描状态:', pos=(20, 180)) font = statictext.GetFont() #font.PointSize += 2 font = font.Bold() statictext.SetFont(font) self.status = wx.TextCtrl(panel, -1, size=(450, 130), pos=(30, 205), style=wx.TE_MULTILINE) #self.status.SetInsertionPoint(0) # 创建选项卡 helpbar = wx.Menu() about = helpbar.Append(wx.ID_ABOUT, "关于") readme = helpbar.Append(wx.ID_ANY, "使用说明") self.Bind(wx.EVT_MENU, self.about, about) self.Bind(wx.EVT_MENU, self.readme, readme) # filebar = wx.Menu() # self.user = filebar.Append(wx.ID_OPEN, "选择用户名文件") # self.pwd = filebar.Append(wx.ID_ANY, "选择密码文件") # self.Bind(wx.EVT_MENU, self.open_user, self.user) # self.Bind(wx.EVT_MENU, self.open_pwd, self.pwd) # 创建菜单栏 menuBar = wx.MenuBar() # 将选项卡添加到帮助目录下 menuBar.Append(helpbar, "&帮助") # menuBar.Append(filebar, "&打开") self.SetMenuBar(menuBar)
def __init__(self, parent, listeFichiers=None): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME) self.parent = parent self.listeFichiers = listeFichiers # Bandeau intro = _( u"Cliquez simplement sur le bouton Importer pour importer dans Noethys les données cochées." ) titre = _(u"Importation des données") self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau( self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Nomadhys.png") # Données self.box_donnees_staticbox = wx.StaticBox(self, wx.ID_ANY, _(u"Données à importer")) self.ctrl_donnees = OL_Synchronisation_donnees.ListView( self, id=-1, listeFichiers=self.listeFichiers, style=wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_SINGLE_SEL | wx.LC_HRULES | wx.LC_VRULES) self.ctrl_donnees.SetMinSize((100, 100)) self.bouton_apercu = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Apercu.png"), wx.BITMAP_TYPE_ANY)) self.bouton_imprimer = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Imprimante.png"), wx.BITMAP_TYPE_ANY)) self.bouton_texte = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Texte2.png"), wx.BITMAP_TYPE_ANY)) self.bouton_excel = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Excel.png"), wx.BITMAP_TYPE_ANY)) self.ctrl_recherche = OL_Synchronisation_donnees.CTRL_Outils( self, listview=self.ctrl_donnees, afficherCocher=True) self.check_cacher_doublons = wx.CheckBox(self, -1, _(u"Cacher les doublons")) self.check_cacher_doublons.SetValue(True) self.label_regroupement = wx.StaticText(self, -1, _(u"Regrouper par")) self.ctrl_regroupement = wx.Choice( self, -1, choices=[_(u"Catégorie"), _(u"Action"), _(u"Individu")]) self.ctrl_regroupement.Select(0) # Journal self.box_journal_staticbox = wx.StaticBox(self, wx.ID_ANY, _(u"Journal d'évènements")) self.ctrl_journal = wx.TextCtrl(self, wx.ID_ANY, u"", style=wx.TE_MULTILINE | wx.TE_READONLY) self.bouton_enregistrer = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Sauvegarder.png"), wx.BITMAP_TYPE_ANY)) # Boutons self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_ok = CTRL_Bouton_image.CTRL( self, texte=_(u"Importer"), cheminImage="Images/32x32/Fleche_bas.png") self.bouton_fermer = CTRL_Bouton_image.CTRL( self, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_CHECKBOX, self.OnCheckCacherDoublons, self.check_cacher_doublons) self.Bind(wx.EVT_CHOICE, self.OnChoixRegroupement, self.ctrl_regroupement) self.Bind(wx.EVT_BUTTON, self.ctrl_donnees.Apercu, self.bouton_apercu) self.Bind(wx.EVT_BUTTON, self.ctrl_donnees.Imprimer, self.bouton_imprimer) self.Bind(wx.EVT_BUTTON, self.ctrl_donnees.ExportTexte, self.bouton_texte) self.Bind(wx.EVT_BUTTON, self.ctrl_donnees.ExportExcel, self.bouton_excel) self.Bind(wx.EVT_BUTTON, self.OnBoutonEnregistrer, self.bouton_enregistrer) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonFermer, self.bouton_fermer) self.Bind(wx.EVT_CLOSE, self.OnBoutonFermer) # Init self.ctrl_donnees.MAJ()
def AddPanel(self): panel = self.panel # 空白行 # self.label = wx.StaticText(panel, -1, "") # 添加语音集标题及选择框,并绑定事件 self.labelList = wx.StaticText(panel, -1, "选择用例") currentList = self.myfile.testtxt(mp3path) self.choiceList = wx.Choice(panel, -1, choices=currentList) self.Bind(wx.EVT_CHOICE, self.OnChoiceList, self.choiceList) # 添加测试集控制按钮 self.buttonStartTest = wx.Button(panel, -1, "开始测试", size=(75, 25)) self.Bind(wx.EVT_BUTTON, self.StartTest, self.buttonStartTest) self.buttonStopTest = wx.Button(panel, -1, "停止测试", size=(75, 25)) self.Bind(wx.EVT_BUTTON, self.btnStopTest, self.buttonStopTest) # 调整语音间隔时间 self.setTime = wx.StaticText(panel, -1, "语音间隔") self.textTime = wx.TextCtrl(panel, -1, value=str(self.time), size=(75, 25), style=wx.TE_PROCESS_ENTER | wx.TE_CENTER) self.Bind(wx.EVT_TEXT_ENTER, self.OntextTime, self.textTime) # 设置重复次数 self.setRep = wx.StaticText(panel, -1, "重复次数") self.textRep = wx.TextCtrl(panel, -1, value=str(self.repetition), size=(75, 25), style=wx.TE_PROCESS_ENTER | wx.TE_CENTER) self.Bind(wx.EVT_TEXT_ENTER, self.OntextRep, self.textRep) # 用例管理 self.buttonAddCase = wx.Button(panel, -1, "新增用例", size=(75, 25)) self.Bind(wx.EVT_BUTTON, self.OnaddCase, self.buttonAddCase) self.buttonDelCase = wx.Button(panel, -1, "删除用例", size=(75, 25)) self.Bind(wx.EVT_BUTTON, self.OndelCase, self.buttonDelCase) # currentList = self.myfile.testtxt(mp3path) self.addList = wx.ComboBox(panel, -1, value="请输入新用例名称或选择已有用例", choices=currentList, style=wx.CB_DROPDOWN) self.Bind(wx.EVT_COMBOBOX, self.OnaddList, self.addList) # self.Bind(wx.EVT_TEXT, self.OnaddCase, self.addList) currentFile = self.myfile.testmp3(mp3path) self.allList = wx.ListBox(panel, -1, choices=currentFile, style=wx.LB_SINGLE | wx.LB_SORT) # self.Bind(wx.EVT_LISTBOX, self.OnChoiceFile, self.choiceFile) self.buttonAddAudio = wx.Button(panel, -1, ">>", size=(25, 25)) self.Bind(wx.EVT_BUTTON, self.OnbtnAddAudio, self.buttonAddAudio) self.buttonDelAudio = wx.Button(panel, -1, "<<", size=(25, 25)) self.Bind(wx.EVT_BUTTON, self.OnbtnDelAudio, self.buttonDelAudio) self.newList = wx.ListBox(panel, -1, style=wx.LB_SINGLE) # self.Bind(wx.EVT_LISTBOX, self.OnChoiceFile, self.choiceFile) # 添加音频文件选择框,并绑定事件 currentFile = self.myfile.testmp3(mp3path) self.choiceFile = wx.ListBox(panel, -1, choices=currentFile, style=wx.LB_SINGLE | wx.LB_SORT) self.Bind(wx.EVT_LISTBOX, self.OnChoiceFile, self.choiceFile) # 添加音频文件控制按钮 self.buttonStart = wx.Button(panel, -1, "开始播放", size=(75, 25)) self.Bind(wx.EVT_BUTTON, self.btnStart, self.buttonStart) self.buttonPause = wx.Button(panel, -1, "暂停播放", size=(75, 25)) self.Bind(wx.EVT_BUTTON, self.btnPause, self.buttonPause) self.buttonUnpause = wx.Button(panel, -1, "继续播放", size=(75, 25)) self.Bind(wx.EVT_BUTTON, self.btnUnpause, self.buttonUnpause) self.buttonStop = wx.Button(panel, -1, "停止播放", size=(75, 25)) self.Bind(wx.EVT_BUTTON, self.btnStop, self.buttonStop) # 添加信息展示标题及窗口 self.labelInfo = wx.StaticText(panel, -1, "用例详情:") self.textInfo = wx.TextCtrl(panel, -1, style=wx.TE_READONLY | wx.TE_MULTILINE) # 添加测试LOG展示标题及窗口 self.labelLog = wx.StaticText(panel, -1, "测试记录:") self.textLog = wx.TextCtrl(panel, -1, style=wx.TE_READONLY | wx.TE_MULTILINE) # 绑定定时器事件 self.timer1 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnTimer1, self.timer1) # self.timer1.Start(1000) self.timer2 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnTimer2, self.timer2)
def __init__(self, parent, type="variable", IDferie=None): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME) self.parent = parent self.type = type self.staticBox_staticbox = wx.StaticBox(self, -1, "") self.label_nom = wx.StaticText(self, -1, _(u"Nom :")) self.text_ctrl_nom = wx.TextCtrl(self, -1, "") self.label_jour_fixe = wx.StaticText(self, -1, _(u"Jour :")) choices = [] for x in range(1, 32): choices.append(str(x)) self.choice_jour_fixe = wx.Choice(self, -1, choices=choices) self.label_mois_fixe = wx.StaticText(self, -1, _(u"Mois :")) self.choice_mois_fixe = wx.Choice(self, -1, choices=[ _(u"Janvier"), _(u"Février"), _(u"Mars"), _(u"Avril"), _(u"Mai"), _(u"Juin"), _(u"Juillet"), _(u"Août"), _(u"Septembre"), _(u"Octobre"), _(u"Novembre"), _(u"Décembre") ]) self.label_date_variable = wx.StaticText(self, -1, _(u"Date :")) self.datepicker_date_variable = DatePickerCtrl(self) self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_ok = CTRL_Bouton_image.CTRL( self, texte=_(u"Ok"), cheminImage="Images/32x32/Valider.png") self.bouton_annuler = CTRL_Bouton_image.CTRL( self, id=wx.ID_CANCEL, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png") # Affiche en fonction du type de de jour férié if self.type == "fixe": self.label_date_variable.Show(False) self.datepicker_date_variable.Show(False) else: self.label_jour_fixe.Show(False) self.choice_jour_fixe.Show(False) self.label_mois_fixe.Show(False) self.choice_mois_fixe.Show(False) # Propriétés self.choice_jour_fixe.SetMinSize((50, -1)) self.choice_mois_fixe.SetMinSize((130, 21)) self.text_ctrl_nom.SetToolTipString( _(u"Saisissez un nom pour ce jour férié (ex: 'Noël', 'Ascension', 'Jour de l'an', etc...)" )) self.choice_jour_fixe.SetToolTipString(_(u"Sélectionnez le jour")) self.choice_mois_fixe.SetToolTipString(_(u"Sélectionnez le mois")) self.datepicker_date_variable.SetToolTipString( _(u"Saisissez ou sélectionnez une date pour ce jour férié")) self.bouton_aide.SetToolTipString( _(u"Cliquez ici pour obtenir de l'aide")) self.bouton_ok.SetToolTipString(_(u"Cliquez ici pour valider")) self.bouton_annuler.SetToolTipString( _(u"Cliquez ici pour annuler la saisie")) if IDferie == None: if self.type == "fixe": self.SetTitle(_(u"Saisie d'un jour férié fixe")) else: self.SetTitle(_(u"Saisie d'un jour férié variable")) else: if self.type == "fixe": self.SetTitle(_(u"Modification d'un jour férié fixe")) else: self.SetTitle(_(u"Modification d'un jour férié variable")) self.SetMinSize((350, -1)) # Layout grid_sizer_base = wx.FlexGridSizer(rows=2, cols=1, vgap=0, hgap=0) grid_sizer_boutons = wx.FlexGridSizer(rows=1, cols=4, vgap=10, hgap=10) staticBox = wx.StaticBoxSizer(self.staticBox_staticbox, wx.VERTICAL) grid_sizer_staticBox = wx.FlexGridSizer(rows=3, cols=1, vgap=10, hgap=10) grid_sizer_variable = wx.FlexGridSizer(rows=1, cols=2, vgap=5, hgap=5) grid_sizer_fixe = wx.FlexGridSizer(rows=1, cols=5, vgap=5, hgap=5) grid_sizer_nom = wx.FlexGridSizer(rows=1, cols=2, vgap=5, hgap=5) grid_sizer_nom.Add(self.label_nom, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_nom.Add(self.text_ctrl_nom, 0, wx.EXPAND, 0) grid_sizer_nom.AddGrowableCol(1) grid_sizer_staticBox.Add(grid_sizer_nom, 1, wx.EXPAND, 0) grid_sizer_fixe.Add(self.label_jour_fixe, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_fixe.Add(self.choice_jour_fixe, 0, wx.RIGHT, 10) grid_sizer_fixe.Add(self.label_mois_fixe, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_fixe.Add(self.choice_mois_fixe, 0, wx.EXPAND, 0) grid_sizer_fixe.AddGrowableCol(4) grid_sizer_staticBox.Add(grid_sizer_fixe, 1, wx.EXPAND, 0) grid_sizer_variable.Add(self.label_date_variable, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_variable.Add(self.datepicker_date_variable, 0, 0, 0) grid_sizer_staticBox.Add(grid_sizer_variable, 1, wx.EXPAND, 0) grid_sizer_staticBox.AddGrowableCol(0) staticBox.Add(grid_sizer_staticBox, 1, wx.ALL | wx.EXPAND, 10) grid_sizer_base.Add(staticBox, 1, wx.ALL | wx.EXPAND, 10) grid_sizer_boutons.Add(self.bouton_aide, 0, 0, 0) grid_sizer_boutons.Add((20, 20), 0, 0, 0) grid_sizer_boutons.Add(self.bouton_ok, 0, 0, 0) grid_sizer_boutons.Add(self.bouton_annuler, 0, 0, 0) grid_sizer_boutons.AddGrowableCol(1) grid_sizer_base.Add(grid_sizer_boutons, 1, wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 10) self.SetSizer(grid_sizer_base) grid_sizer_base.Fit(self) grid_sizer_base.AddGrowableCol(0) self.Layout() self.CenterOnScreen() # Binds self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)
def populatePanel(self, panel): self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.HTMLExportSettings = service.settings.HTMLExportSettings.getInstance( ) self.dirtySettings = False dlgWidth = panel.GetParent().GetParent().ClientSize.width mainSizer = wx.BoxSizer(wx.VERTICAL) self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0) self.stTitle.Wrap(-1) self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) mainSizer.Add(self.stTitle, 0, wx.ALL, 5) self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.stDesc = wx.StaticText(panel, wx.ID_ANY, self.desc, wx.DefaultPosition, wx.DefaultSize, 0) self.stDesc.Wrap(dlgWidth - 50) mainSizer.Add(self.stDesc, 0, wx.ALL, 5) self.PathLinkCtrl = wx.HyperlinkCtrl( panel, wx.ID_ANY, self.HTMLExportSettings.getPath(), u'file:///{}'.format(self.HTMLExportSettings.getPath()), wx.DefaultPosition, wx.DefaultSize, wx.HL_ALIGN_LEFT | wx.NO_BORDER | wx.HL_CONTEXTMENU) mainSizer.Add(self.PathLinkCtrl, 0, wx.ALL | wx.EXPAND, 5) self.fileSelectDialog = wx.FileDialog( None, "Save Fitting As...", wildcard="EVE IGB HTML fitting file (*.html)|*.html", style=wx.FD_SAVE) self.fileSelectDialog.SetPath(self.HTMLExportSettings.getPath()) self.fileSelectDialog.SetFilename( os.path.basename(self.HTMLExportSettings.getPath())) self.fileSelectButton = wx.Button(panel, -1, "Set export destination", pos=(0, 0)) self.fileSelectButton.Bind(wx.EVT_BUTTON, self.selectHTMLExportFilePath) mainSizer.Add(self.fileSelectButton, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.stDesc2 = wx.StaticText(panel, wx.ID_ANY, self.desc2, wx.DefaultPosition, wx.DefaultSize, 0) self.stDesc2.Wrap(dlgWidth - 50) mainSizer.Add(self.stDesc2, 0, wx.ALL, 5) self.exportEnabled = wx.CheckBox(panel, wx.ID_ANY, u"Enable automatic HTML export", wx.DefaultPosition, wx.DefaultSize, 0) self.exportEnabled.SetValue(self.HTMLExportSettings.getEnabled()) self.exportEnabled.Bind(wx.EVT_CHECKBOX, self.OnExportEnabledChange) mainSizer.Add(self.exportEnabled, 0, wx.ALL | wx.EXPAND, 5) self.stDesc4 = wx.StaticText(panel, wx.ID_ANY, self.desc4, wx.DefaultPosition, wx.DefaultSize, 0) self.stDesc4.Wrap(dlgWidth - 50) mainSizer.Add(self.stDesc4, 0, wx.ALL, 5) self.exportMinimal = wx.CheckBox(panel, wx.ID_ANY, u"Enable minimal export Format", wx.DefaultPosition, wx.DefaultSize, 0) self.exportMinimal.SetValue( self.HTMLExportSettings.getMinimalEnabled()) self.exportMinimal.Bind(wx.EVT_CHECKBOX, self.OnMinimalEnabledChange) mainSizer.Add(self.exportMinimal, 0, wx.ALL | wx.EXPAND, 5) self.stDesc3 = wx.StaticText(panel, wx.ID_ANY, self.desc3, wx.DefaultPosition, wx.DefaultSize, 0) self.stDesc3.Wrap(dlgWidth - 50) mainSizer.Add(self.stDesc3, 0, wx.ALL, 5) websiteSizer = wx.BoxSizer(wx.HORIZONTAL) self.stWebsite = wx.StaticText(panel, wx.ID_ANY, u"Website:", wx.DefaultPosition, wx.DefaultSize, 0) self.stWebsite.Wrap(-1) websiteSizer.Add(self.stWebsite, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.chWebsiteChoices = ["o.smium.org", "null-sec.com"] self.chWebsiteType = wx.Choice(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, self.chWebsiteChoices, 0) self.chWebsiteType.SetStringSelection( self.HTMLExportSettings.getWebsite()) websiteSizer.Add(self.chWebsiteType, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.chWebsiteType.Bind(wx.EVT_CHOICE, self.OnCHWebsiteTypeSelect) mainSizer.Add(websiteSizer, 0, wx.EXPAND, 5) panel.SetSizer(mainSizer) panel.Layout()
def __init__(self, parent, IDactivite=None, dictSelections={}, activeIncompatibilites=True): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.parent = parent self.IDactivite = IDactivite intro = _( u"Cliquez sur les cases blanches pour sélectionner des combinaisons d'unités. <U>Important :</U> Cliquez avec le bouton droit de la souris sur les cases Dates pour utiliser le Copier-Coller ou utilisez la fonction de traitement par lot pour effectuer des saisies ou modifications encore plus rapides." ) titre = _(u"Sélection de combinaisons d'unités") self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau( self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Calendrier.png") # Selection Mois self.staticbox_mois_staticbox = wx.StaticBox(self, -1, _(u"Sélection du mois")) self.label_mois = wx.StaticText(self, -1, _(u"Mois :")) self.ctrl_mois = wx.Choice(self, -1, choices=[ _(u"Janvier"), _(u"Février"), _(u"Mars"), _(u"Avril"), _(u"Mai"), _(u"Juin"), _(u"Juillet"), _(u"Août"), _(u"Septembre"), _(u"Octobre"), _(u"Novembre"), _(u"Décembre") ]) self.spin_mois = wx.SpinButton(self, -1, size=(18, 20), style=wx.SP_VERTICAL) self.spin_mois.SetRange(-1, 1) self.label_annee = wx.StaticText(self, -1, _(u"Année :")) self.ctrl_annee = wx.SpinCtrl(self, -1, "", min=1977, max=2999) dateDuJour = datetime.date.today() self.ctrl_annee.SetValue(dateDuJour.year) self.ctrl_mois.SetSelection(dateDuJour.month - 1) # Légende self.staticbox_legende_staticbox = wx.StaticBox( self, -1, _(u"Légende")) self.listeLegende = [ { "label": _(u"Sélections"), "couleur": COULEUR_SELECTION, "ctrl_label": None, "ctrl_img": None }, { "label": _(u"Ouvert"), "couleur": COULEUR_OUVERTURE, "ctrl_label": None, "ctrl_img": None }, { "label": _(u"Fermé"), "couleur": COULEUR_FERMETURE, "ctrl_label": None, "ctrl_img": None }, { "label": _(u"Vacances"), "couleur": COULEUR_VACANCES, "ctrl_label": None, "ctrl_img": None }, { "label": _(u"Férié"), "couleur": COULEUR_FERIE, "ctrl_label": None, "ctrl_img": None }, ] index = 0 for dictTemp in self.listeLegende: img = wx.StaticBitmap(self, -1, CreationImage(12, 12, dictTemp["couleur"])) label = wx.StaticText(self, -1, dictTemp["label"]) self.listeLegende[index]["ctrl_img"] = img self.listeLegende[index]["ctrl_label"] = label index += 1 # Calendrier self.staticbox_calendrier_staticbox = wx.StaticBox( self, -1, _(u"Calendrier")) self.ctrl_calendrier = Calendrier(self, self.IDactivite, dictSelections, activeIncompatibilites) self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_saisie_lot = CTRL_Bouton_image.CTRL( self, texte=_(u"Saisie et suppression par lot"), cheminImage="Images/32x32/Magique.png") self.bouton_ok = CTRL_Bouton_image.CTRL( self, texte=_(u"Ok"), cheminImage="Images/32x32/Valider.png") self.bouton_annuler = CTRL_Bouton_image.CTRL( self, id=wx.ID_CANCEL, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_SPIN, self.OnSpinMois, self.spin_mois) self.Bind(wx.EVT_CHOICE, self.OnMois, self.ctrl_mois) self.Bind(wx.EVT_SPINCTRL, self.OnAnnee, self.ctrl_annee) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonSaisieLot, self.bouton_saisie_lot) self.MAJCalendrier()
def __init__(self, parent, solver, solvergui, fom_string): '''__init__(self, parent, solver, fom_string, mut_schemes,\ current_mut_scheme) parent - parent window, solver - the solver (Diffev alg.) fom_string - the fom function string ''' wx.Dialog.__init__(self, parent, -1, 'Optimizer settings') #self.SetAutoLayout(True) self.solver = solver self.solvergui = solvergui self.apply_change = None col_sizer = wx.BoxSizer(wx.HORIZONTAL) row_sizer1 = wx.BoxSizer(wx.VERTICAL) # Make the Diff. Ev. box de_box = wx.StaticBox(self, -1, "Diff. Ev.") de_box_sizer = wx.StaticBoxSizer(de_box, wx.VERTICAL) de_grid = wx.GridBagSizer(2, 2) km_sizer = wx.BoxSizer(wx.HORIZONTAL) km_text = wx.StaticText(self, -1, 'k_m ') self.km_control = NumCtrl(self, value = self.solver.km,\ fractionWidth = 2, integerWidth = 2) km_sizer.Add(km_text,0, \ wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, border = 10) km_sizer.Add(self.km_control,1, \ wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border = 10) km_sizer.Add((10, 20), 0, wx.EXPAND) de_grid.Add(km_sizer, (0,0),\ flag = wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL,\ border = 5) kr_sizer = wx.BoxSizer(wx.HORIZONTAL) kr_sizer.Add((10, 20), 0, wx.EXPAND) kr_text = wx.StaticText(self, -1, 'k_r ') self.kr_control = NumCtrl(self, value = self.solver.kr,\ fractionWidth = 2, integerWidth = 2) kr_sizer.Add(kr_text, 1, \ wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, border = 10) kr_sizer.Add(self.kr_control, 0, \ wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border = 10) de_grid.Add(kr_sizer, (0,1), \ flag = wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL,\ border = 5) method_sizer = wx.BoxSizer(wx.HORIZONTAL) method_text = wx.StaticText(self, -1, 'Method ') mut_schemes = [f.__name__ for f in self.solver.mutation_schemes] self.method_choice = wx.Choice(self, -1,\ choices = mut_schemes) self.method_choice.SetSelection(self.solver.get_create_trial(True)) method_sizer.Add(method_text,0, \ wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, border = 10) method_sizer.Add(self.method_choice,0,\ wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border = 10) de_grid.Add(method_sizer, (1,0),(1,2), \ flag = wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND,\ border = 5) de_box_sizer.Add(de_grid, 0, wx.ALIGN_CENTRE | wx.ALL, 5) row_sizer1.Add(de_box_sizer, 0, wx.EXPAND, 5) #FOM BOX SIZER fom_box = wx.StaticBox(self, -1, "FOM") fom_box_sizer = wx.StaticBoxSizer(fom_box, wx.VERTICAL) # FOM choice fom_sizer = wx.BoxSizer(wx.HORIZONTAL) fom_text = wx.StaticText(self, -1, 'Figure of merit ') self.fom_choice = wx.Choice(self, -1, choices=fom_funcs.func_names) self.fom_choice.SetSelection(fom_funcs.func_names.index(fom_string)) fom_sizer.Add(fom_text,0, \ wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, border = 10) fom_sizer.Add(self.fom_choice,0,\ wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, border = 10) fom_box_sizer.Add(fom_sizer, 0, wx.ALIGN_CENTRE | wx.ALL, 5) # Errorbar level errorbar_sizer = wx.BoxSizer(wx.HORIZONTAL) errorbar_text = wx.StaticText(self, -1, 'Error bar level ') self.errorbar_control = NumCtrl(self, value =\ self.solvergui.fom_error_bars_level,\ fractionWidth = 2, integerWidth = 2) errorbar_sizer.Add(errorbar_text,0, \ wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, border = 10) errorbar_sizer.Add(self.errorbar_control,1, \ wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border = 10) errorbar_sizer.Add((10, 20), 0, wx.EXPAND) fom_box_sizer.Add(errorbar_sizer, 0, wx.ALIGN_CENTRE | wx.ALL, 5) row_sizer1.Add(fom_box_sizer, 0, wx.EXPAND, 5) # Make the Fitting box fit_box = wx.StaticBox(self, -1, "Fitting") fit_box_sizer = wx.StaticBoxSizer(fit_box, wx.VERTICAL) # Make a sizer for the check boxes cb_sizer = wx.BoxSizer(wx.HORIZONTAL) fit_box_sizer.Add(cb_sizer, 0, wx.ALIGN_CENTRE | wx.ALL, 5) # Check box for start guess startguess_control = wx.CheckBox(self, -1, "Start guess") cb_sizer.Add(startguess_control, 0, wx.ALIGN_CENTRE | wx.ALL, 5) startguess_control.SetValue(self.solver.use_start_guess) self.startguess_control = startguess_control # Check box for using boundaries bound_control = wx.CheckBox(self, -1, "Use (Max, Min)") cb_sizer.Add(bound_control, 0, wx.ALIGN_CENTRE | wx.ALL, 5) bound_control.SetValue(self.solver.use_boundaries) self.bound_control = bound_control # Check box and integer input for autosave autosave_sizer = wx.BoxSizer(wx.HORIZONTAL) use_autosave_control = wx.CheckBox(self, -1, "Autosave, interval ") use_autosave_control.SetValue(self.solver.use_autosave) autosave_sc = wx.SpinCtrl(self) autosave_sc.SetRange(1, 1000) autosave_sc.SetValue(self.solver.autosave_interval) autosave_sc.Enable(True) autosave_sizer.Add(use_autosave_control, 0, \ wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, border = 5) autosave_sizer.Add(autosave_sc,0,\ wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border = 5) self.autosave_sc = autosave_sc self.use_autosave_control = use_autosave_control fit_box_sizer.Add(autosave_sizer, 0, wx.ALIGN_CENTRE | wx.ALL, 5) # Checkbox for saving all evals save_sizer = wx.BoxSizer(wx.HORIZONTAL) save_all_control = wx.CheckBox(self, -1, "Save evals, buffer ") save_all_control.SetValue(self.solvergui.save_all_evals) buffer_sc = wx.SpinCtrl(self) buffer_sc.SetRange(1000, 100000000) buffer_sc.SetValue(self.solver.max_log) buffer_sc.Enable(True) save_sizer.Add(save_all_control, 0, \ wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, border = 5) save_sizer.Add(buffer_sc,0,\ wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border = 5) self.buffer_sc = buffer_sc self.save_all_control = save_all_control fit_box_sizer.Add(save_sizer, 0, wx.ALIGN_CENTRE | wx.ALL, 5) row_sizer1.Add(fit_box_sizer, 1, wx.EXPAND, 5) col_sizer.Add(row_sizer1, 1, wx.ALIGN_CENTRE | wx.ALL, 5) row_sizer2 = wx.BoxSizer(wx.VERTICAL) # Make the Population box pop_box = wx.StaticBox(self, -1, "Population size") pop_box_sizer = wx.StaticBoxSizer(pop_box, wx.VERTICAL) pop_grid = wx.FlexGridSizer(0, 2, 0, 0) multsize_radio = wx.RadioButton(self, -1, " Relative size ",\ style = wx.RB_GROUP ) fixedsize_radio = wx.RadioButton(self, -1, " Fixed size ") multsize_sc = wx.SpinCtrl(self) multsize_sc.SetRange(1, 1000) multsize_sc.SetValue(self.solver.pop_mult) multsize_sc.Enable(self.solver.use_pop_mult) fixedsize_sc = wx.SpinCtrl(self) fixedsize_sc.SetRange(1, 1000) fixedsize_sc.SetValue(self.solver.pop_size) fixedsize_sc.Enable(not self.solver.use_pop_mult) self.pop_multsize_radio = multsize_radio self.pop_fixedsize_radio = fixedsize_radio self.pop_multsize_sc = multsize_sc self.pop_fixedsize_sc = fixedsize_sc pop_grid.Add(multsize_radio, 0,\ wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) pop_grid.Add(multsize_sc, 0,\ wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) pop_grid.Add( fixedsize_radio, 0,\ wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) pop_grid.Add(fixedsize_sc, 0,\ wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) pop_box_sizer.Add(pop_grid, 0, wx.ALIGN_CENTRE | wx.ALL, 5) row_sizer2.Add(pop_box_sizer, 1, wx.EXPAND, 5) self.Bind(wx.EVT_RADIOBUTTON, self.on_pop_select, multsize_radio) self.Bind(wx.EVT_RADIOBUTTON, self.on_pop_select, fixedsize_radio) multsize_radio.SetValue(self.solver.use_pop_mult) fixedsize_radio.SetValue(not self.solver.use_pop_mult) # Make the Generation box gen_box = wx.StaticBox(self, -1, "Max Generations") gen_box_sizer = wx.StaticBoxSizer(gen_box, wx.VERTICAL) gen_grid = wx.FlexGridSizer(0, 2, 0, 0) gen_multsize_radio = wx.RadioButton( self, -1, " Relative size ",\ style = wx.RB_GROUP ) gen_fixedsize_radio = wx.RadioButton(self, -1, " Fixed size ") gen_multsize_sc = wx.SpinCtrl(self) gen_multsize_sc.SetRange(1, 10000) gen_multsize_sc.SetValue(self.solver.max_generation_mult) gen_multsize_sc.Enable(not self.solver.use_max_generations) gen_fixedsize_sc = wx.SpinCtrl(self) gen_fixedsize_sc.SetRange(1, 10000) gen_fixedsize_sc.SetValue(self.solver.max_generations) gen_fixedsize_sc.Enable(self.solver.use_max_generations) self.gen_multsize_radio = gen_multsize_radio self.gen_fixedsize_radio = gen_fixedsize_radio self.gen_multsize_sc = gen_multsize_sc self.gen_fixedsize_sc = gen_fixedsize_sc gen_grid.Add(gen_multsize_radio, 0,\ wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) gen_grid.Add(gen_multsize_sc, 0,\ wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) gen_grid.Add(gen_fixedsize_radio, 0,\ wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) gen_grid.Add(gen_fixedsize_sc, 0,\ wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) gen_box_sizer.Add(gen_grid, 0, wx.ALIGN_CENTRE | wx.ALL, 5) row_sizer2.Add(gen_box_sizer, 1, wx.EXPAND, 5) self.Bind(wx.EVT_RADIOBUTTON, self.on_gen_select, gen_multsize_radio) self.Bind(wx.EVT_RADIOBUTTON, self.on_gen_select, gen_fixedsize_radio) gen_fixedsize_radio.SetValue(self.solver.use_max_generations) gen_multsize_radio.SetValue(not self.solver.use_max_generations) ## # Make the parallel fitting box parallel_box = wx.StaticBox(self, -1, "Parallel processing") parallel_box_sizer = wx.StaticBoxSizer(parallel_box, wx.VERTICAL) use_parallel_control = wx.CheckBox(self, -1, "Parallel fitting") use_parallel_control.SetValue(self.solver.use_parallel_processing) use_parallel_control.Enable(diffev.__parallel_loaded__) self.use_parallel_control = use_parallel_control parallel_box_sizer.Add(use_parallel_control, 1,\ wx.ALIGN_CENTRE|wx.EXPAND, 5 ) processes_sc = wx.SpinCtrl(self, size=(80, -1)) processes_sc.SetRange(1, 100) processes_sc.SetValue(self.solver.processes) processes_sc.Enable(diffev.__parallel_loaded__) chunk_size_sc = wx.SpinCtrl(self, size=(80, -1)) chunk_size_sc.SetRange(1, 100) chunk_size_sc.SetValue(self.solver.chunksize) chunk_size_sc.Enable(diffev.__parallel_loaded__) self.processes_sc = processes_sc self.chunk_size_sc = chunk_size_sc parallel_sizer = wx.BoxSizer(wx.HORIZONTAL) p_text = wx.StaticText(self, -1, '# Processes') parallel_sizer.Add(p_text, 0, \ wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, border = 10) parallel_sizer.Add((10, 20), 1, wx.EXPAND) parallel_sizer.Add(processes_sc, 0, \ wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border = 10) parallel_box_sizer.Add(parallel_sizer, 1, wx.ALIGN_CENTRE | wx.EXPAND, 10) parallel_sizer = wx.BoxSizer(wx.HORIZONTAL) p_text = wx.StaticText(self, -1, ' Chunk size ') parallel_sizer.Add(p_text, 0, \ wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, border = 10) parallel_sizer.Add((10, 20), 1, wx.EXPAND) parallel_sizer.Add(chunk_size_sc, 0, \ wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border = 10) parallel_box_sizer.Add(parallel_sizer, 1, wx.EXPAND, 10) row_sizer2.Add(parallel_box_sizer, 1, wx.EXPAND, 5) col_sizer.Add(row_sizer2, 1, wx.ALIGN_CENTRE | wx.ALL, 5) ## # Add the Dialog buttons button_sizer = wx.StdDialogButtonSizer() okay_button = wx.Button(self, wx.ID_OK) okay_button.SetDefault() button_sizer.AddButton(okay_button) apply_button = wx.Button(self, wx.ID_APPLY) apply_button.SetDefault() button_sizer.AddButton(apply_button) button_sizer.AddButton(wx.Button(self, wx.ID_CANCEL)) button_sizer.Realize() # Add some eventhandlers self.Bind(wx.EVT_BUTTON, self.on_apply_change, okay_button) self.Bind(wx.EVT_BUTTON, self.on_apply_change, apply_button) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(col_sizer, 1, wx.GROW | wx.ALIGN_CENTER_HORIZONTAL, 20) #sizer.Add(col_sizer, 1, wx.GROW|wx.ALL|wx.EXPAND, 20) line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 20) sizer.Add(button_sizer,0,\ flag = wx.ALIGN_RIGHT, border = 20) self.SetSizer(sizer) sizer.Fit(self) self.Layout()
def makeToolBar(self): tb = wx.ToolBar(self, style=wx.TB_FLAT) self.filePicker = wx.Choice(tb, choices=self.getFileList()) tb.AddControl(self.filePicker) tb.Realize() return tb
def __init__(self, win): text_box_size_for_metre_values = (65, -1) self.staticbox_terrain_details = wx.StaticBox( win, -1, "Terrain details" ) self.label_separation = wx.StaticText( win, -1, "Point separation" ) self.text_ctrl_separation = floatctrl.FloatCtrl( win, -1, size=text_box_size_for_metre_values, style=wx.TE_RIGHT ) self.label_separation_units = wx.StaticText( win, -1, "metres" ) self.label_resolution = wx.StaticText( win, -1, "Terrain size" ) self.choice_resolution = wx.Choice( win, -1, choices = ["17", "33", "65", "129", "257", "513", "1025", "2049"], size = (-1, -1), ) self.label_resolution_units = wx.StaticText( win, -1, "pixels" ) self.label_block = wx.StaticText( win, -1, "Block size" ) self.block_size_choices = ["9", "17", "33", "65", "129"] self.choice_block = wx.Choice( win, -1, choices = self.block_size_choices, size = (-1, -1), ) self.label_block_units = wx.StaticText( win, -1, "pixels" ) self.label_level_size = wx.StaticText( win, -1, "Level size" ) self.choice_level_size = wx.Choice( win, -1, choices = [ str( self.get_default_terrain_size() ) ], size = (-1, -1), style = wx.TE_RIGHT ) self.label_level_size_units = wx.StaticText( win, -1, "metres" ) #set up the terrain height group of controls self.staticbox_height = wx.StaticBox( win, -1, "Height" ) self.label_min = wx.StaticText( win, -1, "Minimum height" ) self.text_ctrl_min = floatctrl.FloatCtrl( win, -1, size=text_box_size_for_metre_values, style=wx.TE_RIGHT ) self.label_min_units = wx.StaticText( win, -1, "metres" ) self.label_max = wx.StaticText( win, -1, "Maximum height" ) self.text_ctrl_max = floatctrl.FloatCtrl( win, -1, size=text_box_size_for_metre_values, style=wx.TE_RIGHT ) self.label_max_units = wx.StaticText( win, -1, "metres" ) self.checkbox_flatten = wx.CheckBox( win, -1, "Flatten all at" ) self.text_ctrl_flatten = floatctrl.FloatCtrl( win, -1, size=text_box_size_for_metre_values, style=wx.TE_RIGHT ) self.label_flatten_units = wx.StaticText( win, -1, "metres" ) #set up the terrain materials group of controls self.staticbox_materials = wx.StaticBox( win, -1, "Materials and textures" ) self.label_weightmap = wx.StaticText( win, -1, "Weightmap resolution" ) self.choice_weightmap = wx.Choice( win, -1, choices = ["64", "128", "256", "512"], size = (-1, -1) ) self.label_weightmap_units = wx.StaticText( win, -1, "pixels" ) self.label_global_res = wx.StaticText( win, -1, "Global texture resolution" ) self.choice_global_res = wx.Choice( win, -1, choices = ["256", "512", "1024", "2048"], size = (-1, -1) ) self.label_global_res_units = wx.StaticText( win, -1, "pixels" ) #set up the vegetation group of controls self.staticbox_vegetation = wx.StaticBox( win, -1, "Vegetation" ) self.label_veg_cells_per_block = wx.StaticText( win, -1, "Cells per terrain block" ) self.choice_veg_cells_per_block = wx.Choice( win, -1, choices = ["1x1", "2x2", "4x4", "8x8", "16x16", "32x32"], size = (-1, -1) ) self.label_vegetation_res = wx.StaticText( win, -1, "Editor map resolution" ) self.choice_vegetation_res = wx.Choice( win, -1, choices = ["2", "4", "8", "16", "32", "64", "128", "256"], size = (-1, -1) ) self.label_vegetation_res_units = wx.StaticText( win, -1, "pixels per block" ) self.set_properties() win.Bind( wx.EVT_TEXT, self.on_change_separation, self.text_ctrl_separation ) win.Bind( wx.EVT_CHOICE, self.__on_choice_resolution, self.choice_resolution ) win.Bind( wx.EVT_CHOICE, self.on_change_block_size, self.choice_block ) win.Bind( wx.EVT_CHECKBOX, self.on_checkbox_flatten, self.checkbox_flatten )
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.parent = parent intro = _( u"Vous pouvez ici consulter et imprimer la liste des comptes internet. Vous pouvez utiliser les fonctions Activer et Désactiver disponibles à droite de la liste pour modifier l'activation des comptes cochés." ) titre = _(u"Liste des comptes internet") self.ctrl_bandeau = CTRL_Bandeau.Bandeau( self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Connecthys.png") self.radio_tous = wx.RadioButton(self, -1, _(u"Toutes les familles"), style=wx.RB_GROUP) self.radio_sans_activite = wx.RadioButton( self, -1, _(u"Les familles inactives depuis plus de")) self.ctrl_date_sans_activite = wx.Choice( self, -1, choices=[x[2] for x in CHOIX_DELAIS]) self.ctrl_date_sans_activite.Select(0) self.radio_avec_activite = wx.RadioButton( self, -1, _(u"Les familles actives depuis")) self.ctrl_date_avec_activite = wx.Choice( self, -1, choices=[x[2] for x in CHOIX_DELAIS]) self.ctrl_date_avec_activite.Select(0) self.listviewAvecFooter = OL_Comptes_internet.ListviewAvecFooter( self, kwargs={}) self.ctrl_listview = self.listviewAvecFooter.GetListview() self.ctrl_recherche = OL_Comptes_internet.CTRL_Outils( self, listview=self.ctrl_listview, afficherCocher=True) self.bouton_ouvrir_fiche = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Famille.png"), wx.BITMAP_TYPE_ANY)) self.bouton_apercu = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Apercu.png"), wx.BITMAP_TYPE_ANY)) self.bouton_imprimer = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Imprimante.png"), wx.BITMAP_TYPE_ANY)) self.bouton_texte = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Texte2.png"), wx.BITMAP_TYPE_ANY)) self.bouton_excel = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Excel.png"), wx.BITMAP_TYPE_ANY)) self.bouton_actif = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ok4.png"), wx.BITMAP_TYPE_ANY)) self.bouton_inactif = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Interdit.png"), wx.BITMAP_TYPE_ANY)) self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_email = CTRL_Bouton_image.CTRL( self, texte=_(u"Envoyer les codes internet par Email"), cheminImage="Images/32x32/Emails_exp.png") self.bouton_reinit_passwords = CTRL_Bouton_image.CTRL( self, texte=_(u"Réinitialiser les mots de passe"), cheminImage="Images/32x32/Actualiser.png") self.bouton_fermer = CTRL_Bouton_image.CTRL( self, id=wx.ID_CANCEL, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioSelection, self.radio_tous) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioSelection, self.radio_sans_activite) self.Bind(wx.EVT_CHOICE, self.OnRadioSelection, self.ctrl_date_sans_activite) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioSelection, self.radio_avec_activite) self.Bind(wx.EVT_CHOICE, self.OnRadioSelection, self.ctrl_date_avec_activite) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.OuvrirFicheFamille, self.bouton_ouvrir_fiche) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.Apercu, self.bouton_apercu) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.Imprimer, self.bouton_imprimer) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.ExportTexte, self.bouton_texte) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.ExportExcel, self.bouton_excel) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.Activer, self.bouton_actif) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.Desactiver, self.bouton_inactif) self.Bind(wx.EVT_BUTTON, self.EnvoyerEmail, self.bouton_email) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.ReinitPasswords, self.bouton_reinit_passwords) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.OnRadioSelection() self.ctrl_listview.MAJ()
def _SetupMPL(self): self.dpi = 100 self.fig = Figure((6.5, 4.5), dpi=self.dpi, edgecolor='black') self.canvas = FigCanvas(self, -1, self.fig) self.axes = self.fig.add_subplot(111) self.axes.set_axis_bgcolor('white') self.mplToolbar = NavigationToolbar(self.canvas) # Layout with sizers mplBox = wx.BoxSizer(wx.VERTICAL) mplBox.Add(self.canvas, 0, wx.LEFT | wx.TOP | wx.EXPAND) mplBox.Add(self.mplToolbar, 0, wx.LEFT | wx.TOP | wx.EXPAND) mplBox.Add((10, 10)) plotOptions = wx.BoxSizer(wx.HORIZONTAL) # Axes labels labelBox = wx.StaticBox(self, -1, "Axes Labels") labelSizer = wx.StaticBoxSizer(labelBox, wx.VERTICAL) xLabelText = wx.StaticText(self, -1, "x Axis:") yLabelText = wx.StaticText(self, -1, "y Axis:") self.xLabelCtrl = wx.TextCtrl(self, -1, "slab width (mfp)", size=(150, 20)) self.yLabelCtrl = wx.TextCtrl(self, -1, "fission source", size=(150, 20)) self.axes.set_xlabel(self.xLabelCtrl.GetValue()) self.axes.set_ylabel(self.yLabelCtrl.GetValue()) self.Bind(wx.EVT_TEXT_ENTER, self.xLabel, self.xLabelCtrl) self.Bind(wx.EVT_TEXT_ENTER, self.yLabel, self.yLabelCtrl) labelSizer.Add(xLabelText, 0, wx.ALL, border=5) labelSizer.Add(self.xLabelCtrl, 0, wx.ALL, border=5) labelSizer.Add(yLabelText, 0, wx.ALL, border=5) labelSizer.Add(self.yLabelCtrl, 0, wx.ALL, border=5) plotOptions.Add(labelSizer, wx.ALL, border=5) # Plot Style options styleBox = wx.StaticBox(self, -1, "Plot Styles") styleSizer = wx.StaticBoxSizer(styleBox, wx.VERTICAL) styleChoices = ['steps', 'errorbars', 'lines', 'linespoints', 'points'] self.plotStyle = wx.Choice(self, -1, choices=styleChoices) styleSizer.Add(self.plotStyle, 0, wx.ALL, border=5) plotOptions.Add((20, 20)) plotOptions.Add(styleSizer, wx.ALL, border=5) # Plot title titleBox = wx.StaticBox(self, -1, "Plot title") titleSizer = wx.StaticBoxSizer(titleBox, wx.VERTICAL) explanation = "This title is ignored during animation." titleExplain = wx.StaticText(self, -1, explanation, style=wx.ALIGN_LEFT) self.titleCtrl = wx.TextCtrl(self, -1, "Fission Source Distribution") self.axes.set_title(self.titleCtrl.GetValue()) titleSizer.Add(self.titleCtrl, 0, wx.ALL | wx.EXPAND, border=5) titleSizer.Add(titleExplain, 0, wx.ALL, border=5) plotOptions.Add((20, 20)) plotOptions.Add(titleSizer) mplBox.Add(plotOptions) self.midSizer.Add(mplBox, 2, wx.ALL, border=5)
def _init_ctrls(self, prnt, _availableTemplates): # generated method, don't edit wx.Frame.__init__(self, id=wxID_COMPFRAME, name='CompFrame', parent=prnt, pos=wx.Point(553, 276), size=wx.Size(656, 544), style=wx.DEFAULT_FRAME_STYLE, title=u'OSSIE Component Editor') self._init_utils() self.SetClientSize(wx.Size(856, 544)) self.SetMenuBar(self.menuBar1) # self.Center(wx.BOTH) self.Bind(wx.EVT_CLOSE, self.OnCompFrameClose) self.Bind(wx.EVT_ACTIVATE, self.OnCompFrameActivate) self.statusBarComponent = wx.StatusBar( id=wxID_COMPFRAMESTATUSBARCOMPONENT, name='statusBarComponent', parent=self, style=0) self.SetStatusBar(self.statusBarComponent) self.AddPortBtn = wx.Button(id=wxID_COMPFRAMEADDPORTBTN, label='Add Port', name='AddPortBtn', parent=self, pos=wx.Point(387, 216), size=wx.Size(100, 30), style=0) self.AddPortBtn.Bind(wx.EVT_BUTTON, self.OnAddPortBtnButton, id=wxID_COMPFRAMEADDPORTBTN) self.RemoveBtn = wx.Button(id=wxID_COMPFRAMEREMOVEBTN, label='Remove Port', name='RemoveBtn', parent=self, pos=wx.Point(387, 259), size=wx.Size(100, 30), style=0) self.RemoveBtn.Bind(wx.EVT_BUTTON, self.OnRemoveBtnButton, id=wxID_COMPFRAMEREMOVEBTN) self.addProp = wx.Button(id=wxID_COMPFRAMEADDPROP, label=u'Add Property', name=u'addProp', parent=self, pos=wx.Point(384, 356), size=wx.Size(100, 30), style=0) self.addProp.Enable(True) self.addProp.Bind(wx.EVT_BUTTON, self.OnaddPropButton, id=wxID_COMPFRAMEADDPROP) self.removeProp = wx.Button(id=wxID_COMPFRAMEREMOVEPROP, label=u'Remove Property', name=u'removeProp', parent=self, pos=wx.Point(384, 404), size=wx.Size(140, 32), style=0) self.removeProp.Enable(True) self.removeProp.Bind(wx.EVT_BUTTON, self.OnRemovePropButton, id=wxID_COMPFRAMEREMOVEPROP) self.staticText2 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT2, label='Ports', name='staticText2', parent=self, pos=wx.Point(167, 89), size=wx.Size(65, 17), style=0) self.CloseBtn = wx.Button(id=wxID_COMPFRAMECLOSEBTN, label='Close', name='CloseBtn', parent=self, pos=wx.Point(530, 424), size=wx.Size(85, 32), style=0) self.CloseBtn.Bind(wx.EVT_BUTTON, self.OnCloseBtnButton, id=wxID_COMPFRAMECLOSEBTN) self.TimingcheckBox = wx.CheckBox(id=wxID_COMPFRAMETIMINGCHECKBOX, label=u'Timing Port Support', name=u'TimingcheckBox', parent=self, pos=wx.Point(634, 126), size=wx.Size(185, 21), style=0) self.TimingcheckBox.SetValue(False) self.TimingcheckBox.Bind(wx.EVT_CHECKBOX, self.OnTimingcheckBoxCheckbox, id=wxID_COMPFRAMETIMINGCHECKBOX) self.ACEcheckBox = wx.CheckBox(id=wxID_COMPFRAMEACECHECKBOX, label=u'ACE Support', name=u'ACEcheckBox', parent=self, pos=wx.Point(634, 157), size=wx.Size(125, 21), style=0) self.ACEcheckBox.SetValue(False) self.ACEcheckBox.Bind(wx.EVT_CHECKBOX, self.OnACEcheckBoxCheckbox, id=wxID_COMPFRAMEACECHECKBOX) self.PortBox = wx.TreeCtrl(id=wxID_COMPFRAMEPORTBOX, name=u'PortBox', parent=self, pos=wx.Point(40, 112), size=wx.Size(312, 185), style=wx.SIMPLE_BORDER | wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT) self.PortBox.SetImageList(self.imageListPorts) self.PortBox.SetBestFittingSize(wx.Size(312, 185)) self.PortBox.Bind(wx.EVT_RIGHT_UP, self.OnPortBoxRightUp) self.AssemblyCcheckBox = wx.CheckBox( id=wxID_COMPFRAMEASSEMBLYCCHECKBOX, label=u'Assembly Controller', name=u'AssemblyCcheckBox', parent=self, pos=wx.Point(384, 126), size=wx.Size(165, 21), style=0) self.AssemblyCcheckBox.SetValue(False) self.AssemblyCcheckBox.Bind(wx.EVT_CHECKBOX, self.OnAssemblyCcheckBoxCheckbox, id=wxID_COMPFRAMEASSEMBLYCCHECKBOX) self.compNameBox = wx.TextCtrl(id=wxID_COMPFRAMECOMPNAMEBOX, name=u'compNameBox', parent=self, pos=wx.Point(138, 10), size=wx.Size(215, 25), style=0, value=u'') self.staticText1 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT1, label=u'Component Name:', name='staticText1', parent=self, pos=wx.Point(24, 13), size=wx.Size(110, 17), style=0) self.compDescrBox = wx.TextCtrl(id=wxID_COMPFRAMECOMPDESCRBOX, name=u'compDescrBox', parent=self, pos=wx.Point(110, 40), size=wx.Size(243, 50), style=wx.TE_BESTWRAP | wx.TE_MULTILINE, value=u'') self.staticText1_1 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT8, label=u'Description:', name='staticText8', parent=self, pos=wx.Point(24, 43), size=wx.Size(110, 17), style=0) self.deviceChoice = wx.Choice(choices=[], id=wxID_COMPFRAMEDEVICECHOICE, name=u'deviceChoice', parent=self, pos=wx.Point(453, 93), size=wx.Size(136, 28), style=0) self.deviceChoice.SetBestFittingSize(wx.Size(136, 28)) self.deviceChoice.Bind(wx.EVT_CHOICE, self.OnDeviceChoiceChoice, id=wxID_COMPFRAMEDEVICECHOICE) self.staticText3 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT3, label=u'Waveform Deployment Settings', name='staticText3', parent=self, pos=wx.Point(384, 24), size=wx.Size(100, 35), style=wx.TE_BESTWRAP | wx.TE_MULTILINE) self.staticText3.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, True, u'Sans')) self.nodeChoice = wx.Choice(choices=[], id=wxID_COMPFRAMENODECHOICE, name=u'nodeChoice', parent=self, pos=wx.Point(453, 60), size=wx.Size(136, 28), style=0) self.nodeChoice.Bind(wx.EVT_CHOICE, self.OnNodeChoiceChoice, id=wxID_COMPFRAMENODECHOICE) self.staticText4 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT4, label=u'Node', name='staticText4', parent=self, pos=wx.Point(384, 65), size=wx.Size(41, 17), style=0) self.staticText5 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT5, label=u'Device', name='staticText5', parent=self, pos=wx.Point(384, 98), size=wx.Size(51, 17), style=0) self.staticText6 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT6, label=u'Component Generation Options', name='staticText6', parent=self, pos=wx.Point(634, 24), size=wx.Size(100, 35), style=wx.TE_BESTWRAP | wx.TE_MULTILINE) self.staticText6.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, True, u'Sans')) self.staticText7 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT7, label=u'Template', name='staticText7', parent=self, pos=wx.Point(634, 65), size=wx.Size(222, 17), style=0) self.propList = wx.ListView(id=wxID_COMPFRAMEPROPLIST, name=u'propList', parent=self, pos=wx.Point(40, 320), size=wx.Size(312, 160), style=wx.LC_SINGLE_SEL | wx.VSCROLL | wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.SIMPLE_BORDER) self.propList.SetBestFittingSize(wx.Size(312, 160)) self._init_coll_propList_Columns(self.propList) #self.propList.Bind(wx.EVT_RIGHT_UP, self.OnPropListRightUp) self.propList.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnPropListListItemRightClick) self.propList.Bind(wx.EVT_LEFT_DCLICK, self.OnPropListLeftDclick) self.staticLine1 = wx.StaticLine(id=wxID_COMPFRAMESTATICLINE1, name='staticLine1', parent=self, pos=wx.Point(610, 17), size=wx.Size(1, 200), style=wx.LI_VERTICAL) self.templateChoice = wx.Choice(choices=_availableTemplates, id=wxID_COMPFRAMETEMPLATECHOICE, name=u'templateChoice', parent=self, pos=wx.Point(703, 60), size=wx.Size(136, 28), style=0) self.templateChoice.SetBestFittingSize(wx.Size(136, 28)) self.templateChoice.Bind(wx.EVT_CHOICE, self.OnTemplateChoiceChoice, id=wxID_COMPFRAMETEMPLATECHOICE)
def layout(self, status): self.SetIcon(logo.get_icon()) self.SetBackgroundColour('MEDIA GRAY') wx.StaticLine(parent=self.panel, id=-1, pos=(0, 0), size=(600, -1), style=wx.ALL | wx.EXPAND) #Basic Infos: Account + Help wx.StaticText(parent=self.panel, id=-1, label='Site Account:' + self.host_fetcher.username, pos=(25, 5), size=(285, 30), style=wx.TE_RICH2) self.help_btn = platebtn.PlateButton(parent=self.panel, id_=-1, label='Help?', pos=(500, 5), size=(50, 30), style=platebtn.PB_STYLE_NOBG | platebtn.PB_STYLE_GRADIENT) # wx.StaticLine(parent=self.panel, id=-1, pos=(0, 30), size=(600, -1), style=wx.ALL | wx.EXPAND) #Path Setting self.path_setting_txt = wx.TextCtrl(parent=self.panel, id=-1, value=self.store_path, pos=(23, 37), size=(355, 27), style=wx.TE_RICH2 | wx.TE_READONLY) self.path_setting_txt.SetBackgroundColour(self.GetBackgroundColour()) self.path_setting_btn = wx.Button(parent=self.panel, id=-1, pos=(420, 35), size=(120, 30), label='Path Setting') # wx.StaticLine(parent=self.panel, id=-1, pos=(0, 70), size=(600, -1), style=wx.ALL | wx.EXPAND) #WebSite + Account + Password wx.StaticText(parent=self.panel, id=-1, label='WebSite:', pos=(33, 80), size=(60, 30)) self.website = wx.Choice(parent=self.panel, id=-1, pos=(98, 73), size=(200, 30), choices=SITE_CHOICES) self.website.SetSelection(0) wx.StaticText(parent=self.panel, id=-1, label='Account:', pos=(32, 110), size=(60, 30)) self.account = wx.TextCtrl(parent=self.panel, id=-1, value='', pos=(98, 105), size=(200, 30)) wx.StaticText(parent=self.panel, id=-1, label='Password:'******'', pos=(98, 140), size=(200, 30), style=wx.TE_PASSWORD) #Start self.start_btn = wx.Button(parent=self.panel, id=-1, label='Start', pos=(440, 135), size=(100, 40)) # wx.StaticLine(parent=self.panel, id=-1, pos=(0, 180), size=(600, -1), style=wx.ALL | wx.EXPAND) #progress bar wx.RadioBox(parent=self.panel, id=-1, label='Progressing', pos=(20, 190), size=(518, 60), style=wx.RA_HORIZONTAL, choices=['']) self.progress_bar = wx.Gauge(parent=self.panel, id=-1, range=100, pos=(25, 208), size=(508, 35), style=wx.GA_HORIZONTAL) self.progress_bar.SetValue(0) values = 'Running...\nCurrent User:'******'\n' values += 'Current Version of Crawler:' + VERSION + '\n' self.logs_txt = wx.TextCtrl(parent=self.panel, id=-1, value=values, size=(520, 210), pos=(20, 255), style=wx.TE_READONLY | wx.TE_RICH2 | wx.TE_MULTILINE) #status stbar = MyStatusBar(self) self.SetStatusBar(stbar)
def __init__(self, parent, sync_model): wx.Panel.__init__(self, parent, style=wx.RAISED_BORDER) headerFont = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD) self.sync_model = sync_model self.cb = wx.CheckBox(self, -1, 'Start sync at launch') self.notif_cb = wx.CheckBox(self, -1, 'Use system notifications for updates') self.cb.SetValue(True) self.notif_cb.SetValue(True) self.cb.Bind(wx.EVT_CHECKBOX, self.AutoSyncSetting) self.notif_cb.Bind(wx.EVT_CHECKBOX, self.OnUseSystemNotif) self.log_choice = wx.Choice(self, -1, choices=["Error", "Information", "Debugging"], name="LevelChoice") self.log_choice.SetSelection(self.sync_model.GetLogLevel()-1) self.lct = wx.StaticText(self, -1, "Debug Level: ") self.log_choice.Bind(wx.EVT_CHOICE, self.OnDebugLogChoice) self.md = wx.StaticText(self, -1, self.sync_model.GetLocalMirrorDirectory(), pos=(0,0)) self.md.SetFont(headerFont) self.si_spin_text = wx.StaticText(self, -1, "Sync Interval (in seconds): ") self.md_button = wx.Button(self, -1, "Change") self.show_button = wx.Button(self, -1, "Open Mirror Directory") self.show_button.Bind(wx.EVT_BUTTON, self.OnOpenMirror) self.md_button.Bind(wx.EVT_BUTTON, self.OnChangeMirror) self.si_spin_btn = wx.SpinCtrl(self, -1, min=30, max=86400) self.si_spin_btn.SetValue(self.sync_model.GetSyncInterval()) self.Bind(wx.EVT_SPINCTRL, self.OnSyncIntervalSelect) if sys.version_info > (3,): ssizer = wx.StaticBoxSizer(wx.VERTICAL, self, "Local Mirror Directory") osizer = wx.StaticBoxSizer(wx.VERTICAL, self, "Other Settings") else: b = wx.StaticBox(self, -1, "Local Mirror Directory") ssizer = wx.StaticBoxSizer(b, wx.VERTICAL) c = wx.StaticBox(self, -1, "Other Settings") osizer = wx.StaticBoxSizer(c, wx.VERTICAL) debug_sizer = wx.BoxSizer(wx.HORIZONTAL) button_sizer = wx.BoxSizer(wx.HORIZONTAL) si_spin_sizer = wx.BoxSizer(wx.HORIZONTAL) si_spin_sizer.Add(self.si_spin_text, 0, wx.ALL | wx.ALIGN_CENTER) si_spin_sizer.Add(self.si_spin_btn, 1, wx.ALL|wx.ALIGN_CENTER) debug_sizer.Add(self.lct, 0, wx.ALL|wx.ALIGN_CENTER) debug_sizer.AddSpacer(80) debug_sizer.Add(self.log_choice, 1, wx.ALL|wx.ALIGN_CENTER) button_sizer.Add(self.md_button, 1, wx.ALL|wx.ALIGN_CENTER, border=5) button_sizer.Add(self.show_button, 2, wx.ALL|wx.ALIGN_CENTER) ssizer.Add(self.md, 0, wx.ALL|wx.ALIGN_CENTER, border=10) ssizer.AddSpacer(10) ssizer.Add(button_sizer, 1, wx.ALL|wx.ALIGN_CENTER) osizer.Add(self.cb, 0, wx.ALL, 0) osizer.Add(self.notif_cb, 1, wx.ALL, 0) osizer.Add(si_spin_sizer, 2, wx.ALL, 0) osizer.Add(debug_sizer, 3, wx.ALL, 5) osizer.AddSpacer(30) sizer = wx.BoxSizer(wx.VERTICAL) sizer.AddSpacer(10) sizer.Add(ssizer, 0, wx.EXPAND|wx.ALL) sizer.AddSpacer(20) sizer.Add(osizer, 1, wx.ALL|wx.EXPAND) sizer.AddSpacer(5) self.SetSizerAndFit(sizer) self.cb.SetValue(self.sync_model.GetAutoSyncState()) self.notif_cb.SetValue(self.sync_model.GetUseSystemNotifSetting())
def __init__( self, parent, map, query=None, cats=None, line=None, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, pos=wx.DefaultPosition, action="add", ignoreError=False, ): """Standard dialog used to add/update/display attributes linked to the vector map. Attribute data can be selected based on layer and category number or coordinates. :param parent: :param map: vector map :param query: query coordinates and distance (used for v.edit) :param cats: {layer: cats} :param line: feature id (requested for cats) :param style: :param pos: :param action: (add, update, display) :param ignoreError: True to ignore errors """ self.parent = parent # mapdisplay.BufferedWindow self.map = map self.action = action # ids/cats of selected features # fid : {layer : cats} self.cats = {} self.fid = -1 # feature id # get layer/table/column information self.mapDBInfo = VectorDBInfo(self.map) layers = self.mapDBInfo.layers.keys() # get available layers # check if db connection / layer exists if len(layers) <= 0: if not ignoreError: dlg = wx.MessageDialog( parent=self.parent, message=_("No attribute table found.\n\n" "Do you want to create a new attribute table " "and defined a link to vector map <%s>?") % self.map, caption=_("Create table?"), style=wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION, ) if dlg.ShowModal() == wx.ID_YES: lmgr = self.parent.lmgr lmgr.OnShowAttributeTable(event=None, selection="layers") dlg.Destroy() self.mapDBInfo = None wx.Dialog.__init__(self, parent=self.parent, id=wx.ID_ANY, title="", style=style, pos=pos) # dialog body mainSizer = wx.BoxSizer(wx.VERTICAL) # notebook self.notebook = wx.Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) self.closeDialog = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_("Close dialog on submit")) self.closeDialog.SetValue(True) if self.action == "display": self.closeDialog.Enable(False) # feature id (text/choice for duplicates) self.fidMulti = wx.Choice(parent=self, id=wx.ID_ANY, size=(150, -1)) self.fidMulti.Bind(wx.EVT_CHOICE, self.OnFeature) self.fidText = StaticText(parent=self, id=wx.ID_ANY) self.noFoundMsg = StaticText(parent=self, id=wx.ID_ANY, label=_("No attributes found")) self.UpdateDialog(query=query, cats=cats) # set title if self.action == "update": self.SetTitle(_("Update attributes")) elif self.action == "add": self.SetTitle(_("Define attributes")) else: self.SetTitle(_("Display attributes")) # buttons btnCancel = Button(self, wx.ID_CANCEL) btnReset = Button(self, wx.ID_UNDO, _("&Reload")) btnSubmit = Button(self, wx.ID_OK, _("&Submit")) if self.action == "display": btnSubmit.Enable(False) btnSizer = wx.StdDialogButtonSizer() btnSizer.AddButton(btnCancel) btnSizer.AddButton(btnReset) btnSizer.SetNegativeButton(btnReset) btnSubmit.SetDefault() btnSizer.AddButton(btnSubmit) btnSizer.Realize() mainSizer.Add(self.noFoundMsg, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) mainSizer.Add(self.notebook, proportion=1, flag=wx.EXPAND | wx.ALL, border=5) fidSizer = wx.BoxSizer(wx.HORIZONTAL) fidSizer.Add( StaticText(parent=self, id=wx.ID_ANY, label=_("Feature id:")), proportion=0, border=5, flag=wx.ALIGN_CENTER_VERTICAL, ) fidSizer.Add(self.fidMulti, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) fidSizer.Add(self.fidText, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) mainSizer.Add(fidSizer, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5) mainSizer.Add( self.closeDialog, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5, ) mainSizer.Add(btnSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) # bindigs btnReset.Bind(wx.EVT_BUTTON, self.OnReset) btnSubmit.Bind(wx.EVT_BUTTON, self.OnSubmit) btnCancel.Bind(wx.EVT_BUTTON, self.OnClose) self.Bind(wx.EVT_CLOSE, self.OnClose) self.SetSizer(mainSizer) mainSizer.Fit(self) # set min size for dialog w, h = self.GetBestSize() w += 50 if h < 200: self.SetMinSize((w, 200)) else: self.SetMinSize((w, h)) if self.notebook.GetPageCount() == 0: Debug.msg(2, "DisplayAttributesDialog(): Nothing found!")
def addControls(self): # Translators: the title of a group of controls in the # general settings page related to the UI UIBox = self.make_static_box(_("User Interface")) # Translators: the label of a combobox containing display languages. wx.StaticText(UIBox, -1, _("Display Language:")) self.languageChoice = wx.Choice(UIBox, -1, style=wx.CB_SORT) self.languageChoice.SetSizerProps(expand=True) wx.CheckBox( UIBox, -1, # Translators: the label of a checkbox _("Speak user interface messages"), name="general.announce_ui_messages", ) wx.CheckBox( UIBox, -1, # Translators: the label of a checkbox _("Speak page number"), name="general.speak_page_number", ) wx.CheckBox( UIBox, -1, # Translators: the label of a checkbox _("Speak section title"), name="general.speak_section_title", ) wx.CheckBox( UIBox, -1, # Translators: the label of a checkbox _("Play pagination sound"), name="general.play_pagination_sound", ) wx.CheckBox( UIBox, -1, # Translators: the label of a checkbox _("Include page label in page title"), name="general.include_page_label", ) wx.CheckBox( UIBox, -1, # Translators: the label of a checkbox _("Use file name instead of book title"), name="general.show_file_name_as_title", ) wx.CheckBox( UIBox, -1, # Translators: the label of a checkbox _("Show reading progress percentage"), name="general.show_reading_progress_percentage", ) # Translators: the title of a group of controls shown in the # general settings page related to miscellaneous settings miscBox = self.make_static_box(_("Miscellaneous")) wx.CheckBox( miscBox, -1, # Translators: the label of a checkbox _("Open recently opened books from the last position"), name="general.open_with_last_position", ) wx.CheckBox( miscBox, -1, # Translators: the label of a checkbox _("Automatically check for updates"), name="general.auto_check_for_updates", ) if not IS_RUNNING_PORTABLE: # Translators: the title of a group of controls shown in the # general settings page related to file associations assocBox = self.make_static_box(_("File Associations")) wx.Button( assocBox, wx.ID_SETUP, # Translators: the label of a button _("Manage File &Associations"), ) self.Bind(wx.EVT_BUTTON, self.onRequestFileAssoc, id=wx.ID_SETUP) languages = [l for l in set(get_available_locales().values())] for langobj in languages: self.languageChoice.Append(langobj.description, langobj) self.languageChoice.SetStringSelection( app.current_language.description)
def __init__(self, *args, **kwds): # begin wxGlade: ParamEditor.__init__ wx.Frame.__init__(self, *args, **kwds) self.read_file = wx.Button(self, wx.ID_ANY, ("Read From File")) self.write_file = wx.Button(self, wx.ID_ANY, ("Write To File")) self.reset_params = wx.Button(self, wx.ID_ANY, ("Reset To Default")) self.read_params = wx.Button(self, wx.ID_ANY, ("Discard Changes")) self.fetch_params = wx.Button(self, wx.ID_ANY, ("Fetch all")) self.write_params = wx.Button(self, wx.ID_ANY, ("Write")) self.search_key = wx.TextCtrl(self, wx.ID_ANY, "") self.param_status = (0, 0) self.param_label = wx.StaticText(self, wx.ID_ANY, "Status: " + str(self.param_status[0]) + "/ " + str(self.param_status[1]), style=wx.ALIGN_CENTRE) self.search_choices = [ 'All:', 'Actions:TMODE_', 'Tuning:PILOT_,ATC_,MOT_,ANGLE_,RC_', 'PosControl:VEL_,POS_,WPNAV_,RTL_', 'Radio:BRD_RADIO_', 'Compass:COMPASS_', 'IMU:INS_', 'Failsafe:FS_', 'EKF2:EK2_,AHRS_EKF_', 'EKF3:EK3_,AHRS_EKF_', 'Fence:FENCE_', 'Logging:LOG_', 'GPS:GPS_', 'Arming:ARMING_', 'Battery:BATT_', 'Flight Modes:MODE', 'Serial:SERIAL_' ] categories = [x.split(':')[0] for x in self.search_choices] self.search_list = wx.Choice(self, wx.ID_ANY, choices=categories) self.categorical_list = {} self.search_list.SetSelection(0) self.display_list = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1)) self.search_key.SetHint("Search") self.__set_properties() self.__do_layout() self.param_received = {} self.modified_param = {} self.requires_redraw = False self.last_grid_update = time.time() self.htree = {} self.selected_fltmode = None self.Bind(wx.EVT_BUTTON, self.Read_File, self.read_file) self.Bind(wx.EVT_BUTTON, self.Write_File, self.write_file) self.Bind(wx.EVT_BUTTON, self.reset_param, self.reset_params) self.Bind(wx.EVT_BUTTON, self.read_param, self.read_params) self.Bind(wx.EVT_BUTTON, self.fetch_param, self.fetch_params) self.Bind(wx.EVT_BUTTON, self.write_param, self.write_params) self.Bind(wx.EVT_TEXT, self.key_change, self.search_key) self.Bind(wx.EVT_CHOICE, self.category_change, self.search_list) if float(str(wx.__version__).split('.')[0]) < 4.0: self.Bind(wx.grid.EVT_GRID_CMD_CELL_CHANGE, self.ParamChanged, self.display_list) else: self.Bind(wx.grid.EVT_GRID_CMD_CELL_CHANGED, self.ParamChanged, self.display_list) self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.onSelect, self.display_list) self.Bind(wx.grid.EVT_GRID_COL_SIZE, self.ColChanged, self.display_list) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.Bind(wx.grid.EVT_GRID_EDITOR_CREATED, self.EditorCreated, self.display_list) self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.time_to_process_gui_events, self.timer) self.timer.Start(200) renderer = wx.grid.GridCellAutoWrapStringRenderer() self.ro_attr = wx.grid.GridCellAttr() self.ro_attr.SetReadOnly(True) self.ce_attr = wx.grid.GridCellAttr() self.ce_attr.SetAlignment(hAlign=wx.ALIGN_CENTER, vAlign=wx.ALIGN_CENTER) self.display_list.SetColAttr(PE_PARAM, self.ro_attr) self.display_list.SetColAttr(PE_UNITS, self.ro_attr) self.display_list.SetColAttr(PE_DESC, self.ro_attr) self.display_list.SetColAttr(PE_VALUE, self.ce_attr) self.display_list.SetRowLabelSize(0) self.display_list.SetDefaultRenderer(renderer) self.display_list.SetDefaultEditor( wx.grid.GridCellFloatEditor(width=-1, precision=4)) self.xml_filepath = None self.last_param_file_path = "" font = wx.Font(pointSize=10, family=wx.DEFAULT, style=wx.NORMAL, weight=wx.NORMAL, faceName='Consolas') self.dc = wx.ScreenDC() self.dc.SetFont(font)
def __init__(self, parent, row): bankcontrols.GBRow.__init__(self, parent, row, name="RecurringPanel") # The daily option is useful if you have something which happens every 30 days, for example. # Some billing cycles work this way, and the date slowly shifts down monthly. self.repeatsCombo = wx.Choice(parent, choices=(_("Daily"), _("Weekly"), _("Monthly"), _("Yearly"))) # Set the default to weekly. self.repeatsCombo.SetSelection(1) self.everyText = wx.StaticText(parent) self.everySpin = wx.SpinCtrl(parent, min=1, max=130, initial=1) self.everySpin.MinSize = (50, -1) bankcontrols.fixMinWidth( self.everyText, (_(x) for x in ("days", "weeks", "months", "years"))) self.endDateCtrl = bankcontrols.DateCtrlFactory(parent) self.endsNeverRadio = wx.RadioButton(parent, label=_("Never"), style=wx.RB_GROUP) self.endsSometimeRadio = wx.RadioButton(parent, label=("On:"), name="EndsSometimeRadio") # Make 'Never' the default. self.endsNeverRadio.SetValue(True) self.ResetEndDate() # The vertical sizer for when the recurring transaction stops ocurring. endsSizer = wx.BoxSizer(wx.VERTICAL) endsSizer.Add(self.endsNeverRadio) endsDateSizer = wx.BoxSizer() endsDateSizer.Add(self.endsSometimeRadio) endsDateSizer.Add(self.endDateCtrl) endsSizer.Add(endsDateSizer) # Create the sizer for the "Every" column and "End". # This all is best as one item which spans the last two cols, otherwise the # description column will be forced to be too wide in a small width window. everySizer = wx.BoxSizer() everySizer.Add(self.repeatsCombo, flag=wx.ALIGN_CENTER) everySizer.AddSpacer(10) everySizer.Add(wx.StaticText(parent, label=_("every")), flag=wx.ALIGN_CENTER) everySizer.AddSpacer(3) everySizer.Add(self.everySpin, flag=wx.ALIGN_CENTER) everySizer.AddSpacer(3) everySizer.Add(self.everyText, flag=wx.ALIGN_CENTER) everySizer.Add(wx.StaticText(parent, label=_("Ends:")), flag=wx.ALIGN_CENTER) everySizer.AddSpacer(3) everySizer.Add(endsSizer) # Add all the columns self.AddNext(wx.StaticText(parent, label=_("Repeats:"))) self.AddNext(everySizer, span=(1, 2)) self.everySpin.Bind(wx.EVT_SPINCTRL, self.Update) self.repeatsCombo.Bind( wx.EVT_CHOICE, self.Update ) # Don't generically bind to the parent, the transfer is a choice too. parent.Bind(wx.EVT_CHECKBOX, self.Update) parent.Bind(wx.EVT_RADIOBUTTON, self.Update)
def _createMirrorModePage(self, notebook): """Create notebook page for general settings""" panel = SP.ScrolledPanel(parent=notebook) panel.SetupScrolling(scroll_x=False, scroll_y=True) notebook.AddPage(page=panel, text=_("Mirror mode")) border = wx.BoxSizer(wx.VERTICAL) box = wx.StaticBox(parent=panel, label=" %s " % _("Mirrored cursor")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridSizer = wx.GridBagSizer(hgap=3, vgap=3) row = 0 gridSizer.Add(wx.StaticText(parent=panel, label=_("Color:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) color = csel.ColourSelect(parent=panel, colour=UserSettings.Get(group='mapswipe', key='cursor', subkey='color'), size=globalvar.DIALOG_COLOR_SIZE) color.SetName('GetColour') self.winId['mapswipe:cursor:color'] = color.GetId() gridSizer.Add(color, pos=(row, 1), flag=wx.ALIGN_RIGHT) row += 1 gridSizer.Add(wx.StaticText(parent=panel, label=_("Shape:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) cursors = wx.Choice(parent=panel, choices=self.settings.Get( group='mapswipe', key='cursor', subkey=['type', 'choices'], settings_type='internal'), name="GetSelection") cursors.SetSelection( self.settings.Get(group='mapswipe', key='cursor', subkey=['type', 'selection'])) self.winId['mapswipe:cursor:type:selection'] = cursors.GetId() gridSizer.Add(cursors, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, pos=(row, 1)) row += 1 gridSizer.Add(wx.StaticText(parent=panel, label=_("Line width:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) width = SpinCtrl(parent=panel, min=1, max=10, initial=self.settings.Get(group='mapswipe', key='cursor', subkey='width'), name="GetValue") self.winId['mapswipe:cursor:width'] = width.GetId() gridSizer.Add(width, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, pos=(row, 1)) row += 1 gridSizer.Add(wx.StaticText(parent=panel, label=_("Size:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) size = SpinCtrl(parent=panel, min=4, max=50, initial=self.settings.Get(group='mapswipe', key='cursor', subkey='size'), name="GetValue") self.winId['mapswipe:cursor:size'] = size.GetId() gridSizer.Add(size, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, pos=(row, 1)) gridSizer.AddGrowableCol(1) sizer.Add(gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=3) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=3) panel.SetSizer(border) return panel
def __init__(self, parent, config): BTFrameWithSizer.__init__( self, parent, style=wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN | wx.RESIZE_BORDER ) # HERE HACK. I added RESIZE_BORDER because the window doesn't resize properly when Advanced button is pressed. --Dave self.parent = parent self.SetTitle(_("%s Publisher") % (app_name)) self.config = config self.tracker_list = [] if self.config['tracker_list']: self.tracker_list = self.config['tracker_list'].split(',') ## widgets # file widgets self.top_text = wx.StaticText(self.panel, label=_("Publish this file/directory:")) self.dir_text = wx.StaticText( self.panel, label=_("(Directories will become batch torrents)")) # title widgets self.title_label = wx.StaticText(self.panel, label=_("Title")) self.title = wx.TextCtrl(self.panel) self.title.SetValue(self.config['title']) # Comment widgets self.comment_label = wx.StaticText(self.panel, label=_("Comments:")) self.comment_text = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE, size=(-1, 50)) self.comment_text.SetValue(self.config['comment']) # horizontal line self.simple_advanced_line = wx.StaticLine(self.panel, style=wx.LI_HORIZONTAL) # piece size widgets self.piece_size_label = wx.StaticText(self.panel, label=_("Piece size:")) self.piece_size = wx.Choice(self.panel) self.piece_size.Append(_("Auto")) self.piece_size.offset = 15 for i in range(7): self.piece_size.Append(str(Size(2**(i + self.piece_size.offset)))) self.piece_size.SetSelection(0) # Announce URL / Tracker widgets self.tracker_radio = wx.RadioButton(self.panel, label=_("Use &tracker:"), style=wx.RB_GROUP) self.tracker_radio.group = [ self.tracker_radio, ] self.tracker_radio.value = True self.announce_entry = wx.ComboBox(self.panel, style=wx.CB_DROPDOWN, choices=self.tracker_list) self.tracker_radio.entry = self.announce_entry if self.tracker_radio.GetValue(): self.announce_entry.Enable(True) else: self.announce_entry.Enable(False) if self.config['tracker_name']: self.announce_entry.SetValue(self.config['tracker_name']) elif len(self.tracker_list): self.announce_entry.SetValue(self.tracker_list[0]) else: self.announce_entry.SetValue('http://my.tracker:6969/announce') # DHT / Trackerless widgets self.dht_radio = wx.RadioButton(self.panel, label=_("Use &DHT:")) self.tracker_radio.group.append(self.dht_radio) self.dht_radio.value = False self.dht_nodes_box = wx.StaticBox(self.panel, label=_("Nodes (optional):")) self.dht_nodes = NodeList(self.panel, 'router.bittorrent.com:6881') self.dht_radio.entry = self.dht_nodes for w in self.tracker_radio.group: w.Bind(wx.EVT_RADIOBUTTON, self.toggle_tracker_dht) for w in self.tracker_radio.group: if w.value == bool(self.config['use_tracker']): w.SetValue(True) else: w.SetValue(False) if self.config['use_tracker']: self.dht_nodes.Disable() else: self.announce_entry.Disable() # Button widgets self.quitbutton = wx.Button(self.panel, label=_("&Close")) self.quitbutton.Bind(wx.EVT_BUTTON, self.quit) self.makebutton = wx.Button(self.panel, label=_("&Publish")) self.makebutton.Bind(wx.EVT_BUTTON, self.make) self.makebutton.Enable(False) self.advancedbutton = wx.Button(self.panel, label=_("&Advanced")) self.advancedbutton.Bind(wx.EVT_BUTTON, self.toggle_advanced) self.simplebutton = wx.Button(self.panel, label=_("&Simple")) self.simplebutton.Bind(wx.EVT_BUTTON, self.toggle_advanced) ## sizers # file sizers def setfunc(path): self.config['torrent_dir'] = path path = '' if self.config.has_key('torrent_dir') and self.config['torrent_dir']: path = self.config['torrent_dir'] elif self.config.has_key('open_from') and self.config['open_from']: path = self.config['open_from'] elif self.config.has_key('save_in') and self.config['save_in']: path = self.config['save_in'] self.choose_file_sizer = ChooseFileOrDirectorySizer(self.panel, path, setfunc=setfunc) self.choose_file_sizer.pathbox.Bind(wx.EVT_TEXT, self.check_buttons) self.box = self.panel.sizer self.box.AddFirst(self.top_text, flag=wx.ALIGN_LEFT) self.box.Add(self.choose_file_sizer, flag=wx.GROW) self.box.Add(self.dir_text, flag=wx.ALIGN_LEFT) self.box.Add(wx.StaticLine(self.panel, style=wx.LI_HORIZONTAL), flag=wx.GROW) # Ye Olde Flexe Gryde Syzer self.table = wx.FlexGridSizer(5, 2, SPACING, SPACING) # Title self.table.Add(self.title_label, flag=wx.ALIGN_CENTER_VERTICAL) self.table.Add(self.title, flag=wx.GROW) # Comments self.table.Add(self.comment_label, flag=wx.ALIGN_CENTER_VERTICAL) self.table.Add(self.comment_text, flag=wx.GROW) # separator self.table.Add((0, 0), 0) self.table.Add(self.simple_advanced_line, flag=wx.GROW) # Piece size sizers self.table.Add(self.piece_size_label, flag=wx.ALIGN_CENTER_VERTICAL) self.table.Add(self.piece_size, flag=wx.GROW) # Announce URL / Tracker sizers self.table.Add(self.tracker_radio, flag=wx.ALIGN_CENTER_VERTICAL) self.table.Add(self.announce_entry, flag=wx.GROW) # DHT / Trackerless sizers self.table.Add(self.dht_radio, flag=wx.ALIGN_CENTER_VERTICAL) self.dht_nodes_sizer = wx.StaticBoxSizer(self.dht_nodes_box, wx.VERTICAL) self.dht_nodes_sizer.Add(self.dht_nodes, flag=wx.ALL, border=SPACING) self.table.Add(self.dht_nodes_sizer, flag=wx.GROW) # add table self.table.AddGrowableCol(1) self.box.Add(self.table, flag=wx.GROW) self.box.Add(wx.StaticLine(self.panel, style=wx.LI_HORIZONTAL), flag=wx.GROW) # Button sizers self.buttonbox = HSizer() self.buttonbox.AddFirst(self.advancedbutton) self.buttonbox.Add(self.simplebutton) self.buttonbox.Add(self.quitbutton) self.buttonbox.Add(self.makebutton) self.box.Add(self.buttonbox, flag=wx.ALIGN_RIGHT, border=0) # bind a bunch of things to check_buttons self.announce_entry.Bind(wx.EVT_TEXT, self.check_buttons) self.choose_file_sizer.pathbox.Bind(wx.EVT_TEXT, self.check_buttons) # radio buttons are checked in toggle_tracker_dht minwidth = self.GetBestSize()[0] self.SetMinSize(wx.Size(minwidth, -1)) # Flip advanced once because toggle_advanced flips it back self.advanced = True self.toggle_advanced(None) if self.config['verbose']: self.toggle_advanced(None) self.check_buttons() self.Show() self.Bind(wx.EVT_CLOSE, self.quit)
def init(self, parent): """ Finishes initializing the editor by creating the underlying toolkit widget. """ factory = self.factory if factory.name != "": self._object, self._name, self._value = self.parse_extended_name( factory.name ) # Create a panel to hold the object trait's view: if factory.editable: self.control = self._panel = parent = TraitsUIPanel(parent, -1) # Build the instance selector if needed: selectable = factory.selectable droppable = factory.droppable items = self.items for item in items: droppable |= item.is_droppable() selectable |= item.is_selectable() if selectable: self._object_cache = {} item = self.item_for(self.value) if item is not None: self._object_cache[id(item)] = self.value self._choice = choice = wx.Choice( parent, -1, wx.Point(0, 0), wx.Size(-1, -1), [] ) choice.Bind(wx.EVT_CHOICE, self.update_object, id=choice.GetId()) if droppable: self._choice.SetBackgroundColour(self.ok_color) self.set_tooltip(self._choice) if factory.name != "": self._object.on_trait_change( self.rebuild_items, self._name, dispatch="ui" ) self._object.on_trait_change( self.rebuild_items, self._name + "_items", dispatch="ui" ) factory.on_trait_change( self.rebuild_items, "values", dispatch="ui" ) factory.on_trait_change( self.rebuild_items, "values_items", dispatch="ui" ) self.rebuild_items() elif droppable: self._choice = wx.TextCtrl(parent, -1, "", style=wx.TE_READONLY) self._choice.SetBackgroundColour(self.ok_color) self.set_tooltip(self._choice) if droppable: self._choice.SetDropTarget(PythonDropTarget(self)) orientation = OrientationMap[factory.orientation] if orientation is None: orientation = self.orientation if (selectable or droppable) and factory.editable: sizer = wx.BoxSizer(orientation) sizer.Add(self._choice, self.extra, wx.EXPAND) if orientation == wx.VERTICAL: sizer.Add( wx.StaticLine(parent, -1, style=wx.LI_HORIZONTAL), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5, ) self.create_editor(parent, sizer) parent.SetSizer(sizer) elif self.control is None: if self._choice is None: self._choice = choice = wx.Choice( parent, -1, wx.Point(0, 0), wx.Size(-1, -1), [] ) choice.Bind(wx.EVT_CHOICE, self.update_object, id=choice.GetId()) self.control = self._choice else: sizer = wx.BoxSizer(orientation) self.create_editor(parent, sizer) parent.SetSizer(sizer) # Synchronize the 'view' to use: # fixme: A normal assignment can cause a crash (for unknown reasons) in # some cases, so we make sure that no notifications are generated: self.trait_setq(view=factory.view) self.sync_value(factory.view_name, "view", "from")
def __init__(self, chipName, parseTagTime, parent, id=wx.ID_ANY, fileSuffix='txt'): wx.Dialog.__init__(self, parent, id, u'{} {}'.format(chipName, _('Import')), style=wx.DEFAULT_DIALOG_STYLE | wx.TAB_TRAVERSAL) self.chipName = chipName self.parseTagTime = parseTagTime self.fileSuffix = fileSuffix todoList = [ u'{} {}'.format(chipName, _('Import Data File')), u'', _('You must first "New" a race and fill in the details.'), _('You must also configure a "Tag" field in your Sign-On Excel Sheet and link the sheet to the race.' ), _('This is required so CrossMgr can link the tags in the import file back to rider numbers and info.' ), u'', _('Race Data:'), _('If the first chip read is NOT the start of the race, you will need to enter the start time manually.' ), _('Otherwise the import will use the first chip read as the race start.' ), u'', _('TimeTrial Data:'), _("The first chip read for each rider will be interpreted as the rider's start time." ), u'', _('Warning: Importing from chip data could replace all the data in this race.' ), _('Proceed with caution.'), ] intro = u'\n'.join(todoList) gs = wx.FlexGridSizer(rows=0, cols=3, vgap=10, hgap=5) gs.Add( wx.StaticText(self, label=u'{} {}:'.format(chipName, _('Data File'))), 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) self.chipDataFile = wx.TextCtrl(self, -1, '', size=(450, -1)) defaultPath = Utils.getFileName() if not defaultPath: defaultPath = Utils.getDocumentsDir() else: defaultPath = os.path.join(os.path.split(defaultPath)[0], '') self.chipDataFile.SetValue(defaultPath) gs.Add(self.chipDataFile, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.GROW) btn = wx.Button(self, label=_('Browse') + u'...') btn.Bind(wx.EVT_BUTTON, self.onBrowseChipReaderDataFile) gs.Add(btn, 0, wx.ALIGN_CENTER_VERTICAL) gs.AddSpacer(1) self.dataType = wx.StaticText(self, label=_("Data Is:")) gs.Add(self.dataType, 1, wx.ALIGN_LEFT) gs.AddSpacer(1) gs.Add(wx.StaticText(self, label=_('Data Policy:')), 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) self.importPolicy = wx.Choice( self, choices=[ _('Clear All Existing Data Before Import'), _('Merge New Data with Existing') ]) self.importPolicy.SetSelection(0) gs.Add(self.importPolicy, 1, wx.ALIGN_LEFT) gs.AddSpacer(1) gs.Add(wx.StaticText(self, label=_('Import Data Time Adjustment:')), 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) self.timeAdjustment = HighPrecisionTimeEdit(self, size=(120, -1)) self.behindAhead = wx.Choice(self, choices=[_('Behind'), _('Ahead')]) self.behindAhead.SetSelection(0) self.timeAdjustment.SetSeconds(0.0) hb = wx.BoxSizer() hb.Add(self.behindAhead, flag=wx.ALIGN_BOTTOM | wx.BOTTOM, border=4) hb.Add(self.timeAdjustment, flag=wx.ALL, border=4) gs.Add(hb, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT) gs.AddSpacer(1) self.manualStartTime = wx.CheckBox( self, label=_('Race Start Time (if NOT first recorded time):')) self.Bind(wx.EVT_CHECKBOX, self.onChangeManualStartTime, self.manualStartTime) gs.Add(self.manualStartTime, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) self.raceStartTime = HighPrecisionTimeEdit(self, seconds=10 * 60 * 60) self.raceStartTime.Enable(False) gs.Add(self.raceStartTime, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT) gs.AddSpacer(1) with Model.LockRace() as race: isTimeTrial = getattr(race, 'isTimeTrial', False) if race else False if isTimeTrial: self.manualStartTime.Enable(False) self.manualStartTime.Show(False) self.raceStartTime.Enable(False) self.raceStartTime.Show(False) self.dataType.SetLabel(_('Data will be imported for a Time Trial')) else: self.dataType.SetLabel(_('Data will be imported for a Race')) self.okBtn = wx.Button(self, wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.onOK, self.okBtn) self.cancelBtn = wx.Button(self, wx.ID_CANCEL) self.Bind(wx.EVT_BUTTON, self.onCancel, self.cancelBtn) bs = wx.BoxSizer(wx.VERTICAL) border = 4 hs = wx.BoxSizer(wx.HORIZONTAL) try: image = wx.Image( os.path.join(Utils.getImageFolder(), '{}Logo.png'.format(chipName)), wx.BITMAP_TYPE_PNG) except Exception as e: image = wx.EmptyImage(32, 32, True) hs.Add(wx.StaticBitmap(self, wx.ID_ANY, image.ConvertToBitmap()), 0) hs.Add(wx.StaticText(self, label=intro), 1, wx.EXPAND | wx.LEFT, border * 2) bs.Add(hs, 1, wx.EXPAND | wx.ALL, border) #------------------------------------------------------------------- bs.AddSpacer(border) bs.Add(gs, 0, wx.EXPAND | wx.ALL, border) buttonBox = wx.BoxSizer(wx.HORIZONTAL) buttonBox.AddStretchSpacer() buttonBox.Add(self.okBtn, flag=wx.RIGHT, border=border) self.okBtn.SetDefault() buttonBox.Add(self.cancelBtn) bs.Add(buttonBox, 0, wx.EXPAND | wx.ALL, border) self.SetSizerAndFit(bs) bs.Fit(self) self.CentreOnParent(wx.BOTH) wx.CallAfter(self.SetFocus)
def __init__(self, parent, connection_callback=None, *args, **kwargs): wx.Panel.__init__(self, parent, *args, **kwargs) self.connection_callback = connection_callback # Implementation info. ## Find all the available devices. self.device_tree = device_tree() self.manufacturers = [''] + sorted(self.device_tree.keys()) self.models = [''] ## Chosen values. self.manufacturer = None self.model = None # Panel. panel_box = wx.BoxSizer(wx.VERTICAL) ## Address. address_static_box = wx.StaticBox(self, label='Address') address_box = wx.StaticBoxSizer(address_static_box, wx.VERTICAL) address_sizer = wx.BoxSizer(wx.HORIZONTAL) address_box.Add(address_sizer, flag=wx.EXPAND) panel_box.Add(address_box, flag=wx.EXPAND | wx.ALL, border=5) ### Ethernet. ethernet_static_box = wx.StaticBox(self) ethernet_box = wx.StaticBoxSizer(ethernet_static_box, wx.VERTICAL) address_sizer.Add(ethernet_box, proportion=1) self.address_mode_eth = wx.RadioButton(self, label='Ethernet', style=wx.RB_GROUP) ethernet_box.Add(self.address_mode_eth) ethernet_sizer = wx.FlexGridSizer(rows=2, cols=2, hgap=5) ethernet_box.Add(ethernet_sizer, flag=wx.EXPAND) ethernet_sizer.Add(wx.StaticText(self, label='IP address:'), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) self.ip_address_input = IpAddrCtrl(self) ethernet_sizer.Add(self.ip_address_input, flag=wx.CENTER) ### GPIB. self.gpib_static_box = wx.StaticBox(self) gpib_box = wx.StaticBoxSizer(self.gpib_static_box, wx.VERTICAL) address_sizer.Add(gpib_box, proportion=1) self.address_mode_gpib = wx.RadioButton(self, label='GPIB') gpib_box.Add(self.address_mode_gpib) gpib_sizer = wx.FlexGridSizer(rows=3, cols=2, hgap=5) gpib_box.Add(gpib_sizer, flag=wx.EXPAND) gpib_sizer.Add(wx.StaticText(self, label='Board:'), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) self.gpib_board_input = wx.SpinCtrl(self, min=0, max=100, initial=0) gpib_sizer.Add(self.gpib_board_input, flag=wx.CENTER) gpib_sizer.Add(wx.StaticText(self, label='PAD:'), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) self.gpib_pad_input = wx.SpinCtrl(self, min=1, max=30, initial=1) gpib_sizer.Add(self.gpib_pad_input, flag=wx.CENTER) gpib_sizer.Add(wx.StaticText(self, label='SAD:'), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) self.gpib_sad_input = wx.SpinCtrl(self, min=0, max=30, initial=0) gpib_sizer.Add(self.gpib_sad_input, flag=wx.CENTER) ### USB. usb_static_box = wx.StaticBox(self) usb_box = wx.StaticBoxSizer(usb_static_box, wx.VERTICAL) address_box.Add(usb_box, flag=wx.EXPAND) self.address_mode_usb = wx.RadioButton(self, label='USB') usb_box.Add(self.address_mode_usb) usb_sizer = wx.BoxSizer(wx.HORIZONTAL) usb_box.Add(usb_sizer, flag=wx.EXPAND) usb_sizer.Add(wx.StaticText(self, label='USB resource: '), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) self.usb_resource_input = wx.TextCtrl(self, size=(300, -1)) usb_sizer.Add(self.usb_resource_input, proportion=1) ## Implementation. implementation_static_box = wx.StaticBox(self, label='Implementation') implementation_box = wx.StaticBoxSizer(implementation_static_box, wx.HORIZONTAL) panel_box.Add(implementation_box, flag=wx.EXPAND | wx.ALL, border=5) self.manufacturer_input = wx.Choice(self, choices=self.manufacturers) self.Bind(wx.EVT_CHOICE, self.OnManufacturer, self.manufacturer_input) implementation_box.Add(self.manufacturer_input, proportion=1) self.model_input = wx.Choice(self, choices=self.models) self.Bind(wx.EVT_CHOICE, self.OnModel, self.model_input) implementation_box.Add(self.model_input, proportion=1) self.mock_input = wx.CheckBox(self, label='Mock') implementation_box.Add(self.mock_input, flag=wx.CENTER) ## Connection buttons. button_box = wx.BoxSizer(wx.HORIZONTAL) panel_box.Add(button_box, flag=wx.CENTER | wx.ALL, border=5) self.connect_button = wx.Button(self, label='Connect') self.Bind(wx.EVT_BUTTON, self.OnConnect, self.connect_button) button_box.Add(self.connect_button) self.disconnect_button = wx.Button(self, label='Disconnect') self.Bind(wx.EVT_BUTTON, self.OnDisconnect, self.disconnect_button) button_box.Add(self.disconnect_button) self.SetSizerAndFit(panel_box)
def __init__(self, parent): """ Initialize the frame """ wx.Panel.__init__(self, parent, -1) self.parent = parent # create the various elements in the panel self.qName1 = wx.StaticText(self, -1, "Type:") self.qName2 = wx.Choice(self, -1, choices=apod_list) self.Bind(wx.EVT_CHOICE, self.ApodChoose, self.qName2) self.q1_1 = wx.StaticText(self, -1, "q1:") self.q1_2 = wx.TextCtrl(self, -1, "0.0") self.q2_1 = wx.StaticText(self, -1, "q2:") self.q2_2 = wx.TextCtrl(self, -1, "1.0") self.q3_1 = wx.StaticText(self, -1, "q3:") self.q3_2 = wx.TextCtrl(self, -1, "1.0") self.c1 = wx.StaticText(self, -1, "c") self.c2 = wx.TextCtrl(self, -1, "1.0") self.start_1 = wx.StaticText(self, -1, "Start") self.start_2 = wx.TextCtrl(self, -1, "1.0") self.size_1 = wx.StaticText(self, -1, "Size") self.size_1.Enable(False) self.size_2 = wx.TextCtrl(self, -1, "1.0") self.size_2.Enable(False) self.inv = wx.CheckBox(self, -1, "Invert") self.use_size = wx.CheckBox(self, -1, "Custom Size") self.Bind(wx.EVT_CHECKBOX, self.OnLimitCheck, self.use_size) self.points_1 = wx.StaticText(self, -1, "Number of Points:") self.points_2 = wx.TextCtrl(self, -1, "1000") self.sw_1 = wx.StaticText(self, -1, "Spectral Width:") self.sw_2 = wx.TextCtrl(self, -1, "50000.") self.b1 = wx.Button(self, 10, "Draw") self.Bind(wx.EVT_BUTTON, self.OnDraw, self.b1) self.b1.SetDefault() self.b2 = wx.Button(self, 20, "Clear") self.Bind(wx.EVT_BUTTON, self.OnClear, self.b2) self.b2.SetDefault() self.InitApod("SP") # layout of the panel apod_grid = wx.GridSizer(8, 2) apod_grid.AddMany([self.qName1, self.qName2, self.q1_1, self.q1_2, self.q2_1, self.q2_2, self.q3_1, self.q3_2, self.c1, self.c2, self.start_1, self.start_2, self.size_1, self.size_2, self.inv, self.use_size]) data_grid = wx.GridSizer(2, 2) data_grid.AddMany([self.points_1, self.points_2, self.sw_1, self.sw_2]) apod_box = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Apodization Parameters")) apod_box.Add(apod_grid) data_box = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Data Parameters")) data_box.Add(data_grid) button_box = wx.GridSizer(1, 2) button_box.AddMany([self.b1, self.b2]) mainbox = wx.BoxSizer(wx.VERTICAL) mainbox.Add(apod_box) mainbox.Add(data_box) mainbox.Add(button_box) self.SetSizer(mainbox)
def __init__(self, *args, **kwargs): if "pngs" in kwargs: self.pngs = kwargs["pngs"] del kwargs["pngs"] if "codes" in kwargs: self.codes = kwargs["codes"] del kwargs["codes"] if "imflag" in kwargs: self.imflag = kwargs["imflag"] del kwargs["imflag"] else: self.imflag = 0 super(TwitterWindow, self).__init__(*args, **kwargs) self.previewsize = 400 self.SetSize((420, 550)) self.SetTitle( "Twitter Extension - Bringing Mass Spectrometry to the Masses") self.APP_KEY = "tQoLvTjNPbeqZGl95ea8rqfvO" self.APP_SECRET = "6knaUv912Db37ZWMMSODuxZvmhjNOcxpHRV6YAyVNSvSfQHVz5" if self.imflag == 0: choices = [ "None", "Data and Fit", "Zero-Charge Mass", "m/z Grid", "Individual Peaks", "Mass Grid", "Bar Chart" ] else: choices = [p[1] for p in self.pngs] choices = ["None"] + choices self.pnl = wx.Panel(self) self.vbox = wx.BoxSizer(wx.VERTICAL) self.sb = wx.StaticBox(self.pnl, label='Tweet a spectrum!') self.sbs = wx.StaticBoxSizer(self.sb, orient=wx.VERTICAL) self.hbox1 = wx.BoxSizer(wx.HORIZONTAL) self.loginbutton = wx.Button(self.pnl, label="Twitter Log In") self.hbox1.Add(wx.StaticText(self.pnl, label=''), 0, wx.ALIGN_CENTER_VERTICAL) self.hbox1.Add(self.loginbutton, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=5) self.hbox1.Add(wx.StaticText(self.pnl, label=' User: '******'Tweet: '), 0, wx.ALIGN_CENTER_VERTICAL) self.hbox2.Add(self.inputbox2, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=5) self.countbox = wx.TextCtrl(self.pnl, value="7", style=wx.TE_READONLY | wx.TE_RIGHT, size=(30, 25)) self.hbox2.Add(wx.StaticText(self.pnl, label=' '), 0, wx.ALIGN_CENTER_VERTICAL) self.hbox2.Add(self.countbox, 0, wx.ALIGN_CENTER_VERTICAL) self.hbox2.Add(wx.StaticText(self.pnl, label=' Characters'), 0, wx.ALIGN_CENTER_VERTICAL) self.sbs.Add(self.hbox2, 0, wx.ALIGN_CENTER_HORIZONTAL) self.sbs.AddSpacer(10) self.hbox3 = wx.BoxSizer(wx.HORIZONTAL) self.hbox3.Add(wx.StaticText(self.pnl, label='Image: '), 0, wx.ALIGN_CENTER_VERTICAL) self.imagechoice = wx.Choice(self.pnl, -1, (115, 50), choices=choices) self.imagechoice.SetSelection(0) self.previewbutton = wx.Button(self.pnl, label="Preview") self.hbox3.Add(self.imagechoice, 0, wx.ALIGN_CENTER_VERTICAL) self.hbox3.Add(self.previewbutton, 0, wx.ALIGN_CENTER_VERTICAL) self.sbs.Add(self.hbox3, 0, wx.ALIGN_CENTER_HORIZONTAL) self.hbox4 = wx.BoxSizer(wx.HORIZONTAL) self.emptyimg = wx.EmptyImage(self.previewsize, self.previewsize) self.emptyimg.Replace(0, 0, 0, 255, 255, 255) self.imageCtrl = StaticBitmap(self.pnl, wx.ID_ANY, wx.Bitmap(self.emptyimg)) self.hbox4.Add(self.imageCtrl, 0) self.sbs.Add(self.hbox4, 1, wx.ALIGN_CENTER_HORIZONTAL) self.hbox5 = wx.BoxSizer(wx.HORIZONTAL) self.hbox5.Add(wx.StaticText(self.pnl, label=''), 0, wx.ALIGN_CENTER_VERTICAL) self.tweetbutton = wx.Button(self.pnl, label="Tweet it!") self.hbox5.Add(self.tweetbutton, 0, wx.ALIGN_CENTER_VERTICAL) self.sbs.Add(self.hbox5, 0, wx.ALIGN_CENTER_HORIZONTAL) self.pnl.SetSizer(self.sbs) self.pnl.SetBackgroundColour("WHITE") self.vbox.Add(self.pnl, proportion=1, flag=wx.ALL | wx.EXPAND, border=5) ''' hboxend = wx.BoxSizer(wx.HORIZONTAL) okButton = wx.Button(self, label='Ok') closeButton = wx.Button(self, label='Cancel') hboxend.Add(okButton) hboxend.Add(closeButton, flag=wx.LEFT, border=5) okButton.Bind(wx.EVT_BUTTON, self.on_close) closeButton.Bind(wx.EVT_BUTTON, self.on_close_cancel) self.vbox.Add(hboxend, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=10) ''' self.SetSizer(self.vbox) self.loginbutton.Bind(wx.EVT_BUTTON, self.OnLaunchWeb) self.inputbox2.Bind(wx.EVT_TEXT, self.OnCharacterCount) self.previewbutton.Bind(wx.EVT_BUTTON, self.OnPreview) self.tweetbutton.Bind(wx.EVT_BUTTON, self.Tweet) self.Center() if self.codes is not None: self.LoadScreenName()
def __init__(self, *args, **kwds): # begin wxGlade: All_Widgets_Frame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # Menu Bar self.All_Widgets_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_OPEN, _("&Open"), _("Open an existing document"), wx.ITEM_NORMAL) wxglade_tmp_menu.Append(wx.ID_CLOSE, _("&Close file"), _("Close current document"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_EXIT, _("E&xit"), _("Finish program"), wx.ITEM_NORMAL) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&File")) wxglade_tmp_menu = wx.Menu() self.mn_Unix = wx.MenuItem(wxglade_tmp_menu, wx.ID_ANY, _("Unix"), _("Use Unix line endings"), wx.ITEM_RADIO) wxglade_tmp_menu.AppendItem(self.mn_Unix) self.mn_Windows = wx.MenuItem(wxglade_tmp_menu, wx.ID_ANY, _("Windows"), _("Use Windows line endings"), wx.ITEM_RADIO) wxglade_tmp_menu.AppendItem(self.mn_Windows) wxglade_tmp_menu.AppendSeparator() self.mn_RemoveTabs = wx.MenuItem(wxglade_tmp_menu, wx.ID_ANY, _("Remove Tabs"), _("Remove all leading tabs"), wx.ITEM_CHECK) wxglade_tmp_menu.AppendItem(self.mn_RemoveTabs) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Edit")) wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_HELP, _("Manual"), _("Show the application manual"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_ABOUT, _("About"), _("Show the About dialog"), wx.ITEM_NORMAL) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Help")) self.SetMenuBar(self.All_Widgets_menubar) # Menu Bar end self.All_Widgets_statusbar = self.CreateStatusBar(1, wx.ST_SIZEGRIP) # Tool Bar self.All_Widgets_toolbar = wx.ToolBar(self, -1) self.SetToolBar(self.All_Widgets_toolbar) self.All_Widgets_toolbar.AddLabelTool( wx.ID_UP, _("UpDown"), wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, _("Up or Down"), _("Up or Down")) self.All_Widgets_toolbar.AddLabelTool(wx.ID_OPEN, _("Open"), wx.EmptyBitmap(32, 32), wx.NullBitmap, wx.ITEM_NORMAL, _("Open a new file"), _("Open a new file")) # Tool Bar end self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=wx.NB_BOTTOM) self.notebook_1_wxBitmapButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.bitmap_button_icon1 = wx.BitmapButton( self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY)) self.bitmap_button_empty1 = wx.BitmapButton( self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.EmptyBitmap(10, 10)) self.bitmap_button_icon2 = wx.BitmapButton( self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY), style=wx.BORDER_NONE | wx.BU_BOTTOM) self.bitmap_button_art = wx.BitmapButton( self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), style=wx.BORDER_NONE | wx.BU_BOTTOM) self.notebook_1_wxButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.button_3 = wx.Button(self.notebook_1_wxButton, wx.ID_BOLD, "") self.notebook_1_wxCalendarCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.calendar_ctrl_1 = wx.calendar.CalendarCtrl( self.notebook_1_wxCalendarCtrl, wx.ID_ANY, style=wx.calendar.CAL_MONDAY_FIRST | wx.calendar.CAL_SEQUENTIAL_MONTH_SELECTION | wx.calendar.CAL_SHOW_SURROUNDING_WEEKS) self.notebook_1_wxCheckBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.checkbox_1 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("one (unchecked)")) self.checkbox_2 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("two (checked)")) self.checkbox_3 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("three"), style=wx.CHK_2STATE) self.checkbox_4 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("four (unchecked)"), style=wx.CHK_3STATE) self.checkbox_5 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("five (checked)"), style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER) self.checkbox_6 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("six (undetermined)"), style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER) self.notebook_1_wxCheckListBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.check_list_box_1 = wx.CheckListBox( self.notebook_1_wxCheckListBox, wx.ID_ANY, choices=[_("one"), _("two"), _("three"), _("four")]) self.notebook_1_wxChoice = wx.Panel(self.notebook_1, wx.ID_ANY) self.choice_empty = wx.Choice(self.notebook_1_wxChoice, wx.ID_ANY, choices=[]) self.choice_filled = wx.Choice( self.notebook_1_wxChoice, wx.ID_ANY, choices=[_("Item 1"), _("Item 2 (pre-selected)")]) self.notebook_1_wxComboBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.combo_box_empty = wx.ComboBox(self.notebook_1_wxComboBox, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.combo_box_filled = wx.ComboBox( self.notebook_1_wxComboBox, wx.ID_ANY, choices=[_("Item 1 (pre-selected)"), _("Item 2")], style=wx.CB_DROPDOWN) self.notebook_1_wxDatePickerCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.datepicker_ctrl_1 = wx.DatePickerCtrl( self.notebook_1_wxDatePickerCtrl, wx.ID_ANY, style=wx.DP_SHOWCENTURY) self.notebook_1_wxGauge = wx.Panel(self.notebook_1, wx.ID_ANY) self.gauge_1 = wx.Gauge(self.notebook_1_wxGauge, wx.ID_ANY, 20) self.notebook_1_wxGrid = wx.Panel(self.notebook_1, wx.ID_ANY) self.grid_1 = wx.grid.Grid(self.notebook_1_wxGrid, wx.ID_ANY, size=(1, 1)) self.notebook_1_wxHyperlinkCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.hyperlink_1 = wx.HyperlinkCtrl(self.notebook_1_wxHyperlinkCtrl, wx.ID_ANY, _("Homepage wxGlade"), _("http://wxglade.sf.net")) self.notebook_1_wxListBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.list_box_empty = wx.ListBox(self.notebook_1_wxListBox, wx.ID_ANY, choices=[]) self.list_box_filled = wx.ListBox( self.notebook_1_wxListBox, wx.ID_ANY, choices=[_("Item 1"), _("Item 2 (pre-selected)")], style=wx.LB_MULTIPLE | wx.LB_SORT) self.notebook_1_wxListCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.list_ctrl_1 = wx.ListCtrl(self.notebook_1_wxListCtrl, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_REPORT) self.notebook_1_wxRadioBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.radio_box_empty1 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_empty1"), choices=[""], majorDimension=1, style=wx.RA_SPECIFY_ROWS) self.radio_box_filled1 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_filled1"), choices=[ _("choice 1"), _("choice 2 (pre-selected)"), _("choice 3") ], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.radio_box_empty2 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_empty2"), choices=[""], majorDimension=1, style=wx.RA_SPECIFY_COLS) self.radio_box_filled2 = wx.RadioBox( self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_filled2"), choices=[_("choice 1"), _("choice 2 (pre-selected)")], majorDimension=0, style=wx.RA_SPECIFY_COLS) self.notebook_1_wxRadioButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.radio_btn_1 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Alice"), style=wx.RB_GROUP) self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") self.radio_btn_2 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Bob")) self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") self.radio_btn_3 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Malroy")) self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") self.notebook_1_wxSlider = wx.Panel(self.notebook_1, wx.ID_ANY) self.slider_1 = wx.Slider(self.notebook_1_wxSlider, wx.ID_ANY, 5, 0, 10) self.notebook_1_wxSpinButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.tc_spin_button = wx.TextCtrl(self.notebook_1_wxSpinButton, wx.ID_ANY, _("1"), style=wx.TE_RIGHT) self.spin_button = wx.SpinButton(self.notebook_1_wxSpinButton, wx.ID_ANY, style=wx.SP_VERTICAL) self.notebook_1_wxSpinCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.spin_ctrl_1 = wx.SpinCtrl(self.notebook_1_wxSpinCtrl, wx.ID_ANY, "4", min=0, max=100, style=wx.SP_ARROW_KEYS | wx.TE_RIGHT) self.notebook_1_wxSplitterWindow_horizontal = wx.ScrolledWindow( self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.splitter_1 = wx.SplitterWindow( self.notebook_1_wxSplitterWindow_horizontal, wx.ID_ANY) self.splitter_1_pane_1 = wx.Panel(self.splitter_1, wx.ID_ANY) self.label_top_pane = wx.StaticText(self.splitter_1_pane_1, wx.ID_ANY, _("top pane")) self.splitter_1_pane_2 = wx.Panel(self.splitter_1, wx.ID_ANY) self.label_buttom_pane = wx.StaticText(self.splitter_1_pane_2, wx.ID_ANY, _("bottom pane")) self.notebook_1_wxSplitterWindow_vertical = wx.ScrolledWindow( self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.splitter_2 = wx.SplitterWindow( self.notebook_1_wxSplitterWindow_vertical, wx.ID_ANY) self.splitter_2_pane_1 = wx.Panel(self.splitter_2, wx.ID_ANY) self.label_left_pane = wx.StaticText(self.splitter_2_pane_1, wx.ID_ANY, _("left pane")) self.splitter_2_pane_2 = wx.Panel(self.splitter_2, wx.ID_ANY) self.label_right_pane = wx.StaticText(self.splitter_2_pane_2, wx.ID_ANY, _("right pane")) self.notebook_1_wxStaticBitmap = wx.Panel(self.notebook_1, wx.ID_ANY) self.bitmap_empty = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.EmptyBitmap(32, 32)) self.bitmap_file = wx.StaticBitmap( self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY)) self.bitmap_nofile = wx.StaticBitmap( self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap("non-existing.bmp", wx.BITMAP_TYPE_ANY)) self.bitmap_art = wx.StaticBitmap( self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_OTHER, (32, 32))) self.notebook_1_wxStaticLine = wx.Panel(self.notebook_1, wx.ID_ANY) self.static_line_2 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY, style=wx.LI_VERTICAL) self.static_line_3 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY, style=wx.LI_VERTICAL) self.static_line_4 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY) self.static_line_5 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY) self.notebook_1_wxStaticText = wx.Panel(self.notebook_1, wx.ID_ANY) self.label_1 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("red text (RGB)"), style=wx.ALIGN_CENTER) self.label_4 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("black on red (RGB)"), style=wx.ALIGN_CENTER) self.label_5 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("green on pink (RGB)"), style=wx.ALIGN_CENTER) self.notebook_1_Spacer = wx.Panel(self.notebook_1, wx.ID_ANY) self.label_3 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY, _("Two labels with a")) self.label_2 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY, _("spacer between")) self.notebook_1_wxTextCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.text_ctrl = wx.TextCtrl(self.notebook_1_wxTextCtrl, wx.ID_ANY, _("This\nis\na\nmultiline\nwxTextCtrl"), style=wx.TE_CHARWRAP | wx.TE_MULTILINE | wx.TE_WORDWRAP) self.notebook_1_wxToggleButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.button_2 = wx.ToggleButton(self.notebook_1_wxToggleButton, wx.ID_ANY, _("Toggle Button 1")) self.button_4 = wx.ToggleButton(self.notebook_1_wxToggleButton, wx.ID_ANY, _("Toggle Button 2"), style=wx.BU_BOTTOM | wx.BU_EXACTFIT) self.notebook_1_wxTreeCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.tree_ctrl_1 = wx.TreeCtrl(self.notebook_1_wxTreeCtrl, wx.ID_ANY) self.static_line_1 = wx.StaticLine(self, wx.ID_ANY) self.button_5 = wx.Button(self, wx.ID_CLOSE, "") self.button_1 = wx.Button(self, wx.ID_OK, "", style=wx.BU_TOP) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_MENU, self.onSelectUnix, self.mn_Unix) self.Bind(wx.EVT_MENU, self.onSelectWindows, self.mn_Windows) self.Bind(wx.EVT_MENU, self.onRemoveTabs, self.mn_RemoveTabs) self.Bind(wx.EVT_MENU, self.onShowManual, id=wx.ID_HELP) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnNotebookPageChanged, self.notebook_1) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnNotebookPageChanging, self.notebook_1) self.Bind(wx.EVT_BUTTON, self.onStartConverting, self.button_1)
def __init__(self, parent, title): super(Recomendaciones, self).__init__(parent, title=title, size=(320, 400)) menubar = wx.MenuBar() fileMenu = wx.Menu() fileItemCDB = fileMenu.Append(wx.ID_ANY, 'Crear DB', 'Crear Base de Datos') fileItemTurismo = fileMenu.Append(wx.ID_ANY, 'Crear Lugar Turistico', 'Crear Lugar Turistico') fileItemClose = fileMenu.Append(wx.ID_EXIT, 'Cerrar', 'Cerrar Aplicación') menubar.Append(fileMenu, '&Archivo') self.SetMenuBar(menubar) self.panel = wx.Panel(self) box = wx.BoxSizer(wx.VERTICAL) # Evento de menu de opciones self.Bind(wx.EVT_MENU, self.CreateDB, fileItemCDB) self.Bind(wx.EVT_MENU, self.openTurismo, fileItemTurismo) self.Bind(wx.EVT_MENU, self.OnQuit, fileItemClose) #Texto Inicial self.titulo = wx.StaticText(self.panel, label="Recomendacion", style=wx.ALIGN_CENTRE) box.Add(self.titulo, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 20) #Configuración ComboBox para selección de Clima lbtipo_clima = wx.StaticText(self.panel, label="Escoja Clima", style=wx.ALIGN_CENTRE) box.Add(lbtipo_clima, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) # Creando información de ComboBox con datos de la base de datos self.TIPO_CLIMA = [] query = "match (clima:Clima) return clima.titulo order by clima.titulo" dato = ControladorGrafo.ExecQuery(query) for record in dato: self.TIPO_CLIMA.append(record[0]) #self.TIPO_CLIMA = ['Templado', 'Húmedo', 'Frío', 'Lluvioso', 'Cálido'] self.cbtipo_clima = wx.Choice(self.panel, choices=self.TIPO_CLIMA) box.Add(self.cbtipo_clima, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) #Configuración ComboBox para selección del Tipo de Viaje self.lbtipo_viaje = wx.StaticText(self.panel, label="Tipo Viaje", style=wx.ALIGN_CENTRE) box.Add(self.lbtipo_viaje, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) # Creando información de ComboBox con datos de la base de datos self.TIPO_VIAJE = [] query = "match (tViaje:Tipo_Viaje) return tViaje.titulo order by tViaje.titulo" dato = ControladorGrafo.ExecQuery(query) for record in dato: self.TIPO_VIAJE.append(record[0]) #self.TIPO_VIAJE = ['Amigos/as', 'Familia', 'Solo'] self.cbtipo_viaje = wx.Choice(self.panel, choices=self.TIPO_VIAJE) box.Add(self.cbtipo_viaje, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) #Configuración ComboBox para selección del Tipo de Turismo self.lbtipo_turismo = wx.StaticText(self.panel, label="Tipo Turismo", style=wx.ALIGN_CENTRE) box.Add(self.lbtipo_turismo, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) # Creando información de ComboBox con datos de la base de datos self.TIPO_TURISMO = [] query = "match (tTurismo:Tipo_Turismo) return tTurismo.titulo order by tTurismo.titulo" dato = ControladorGrafo.ExecQuery(query) for record in dato: self.TIPO_TURISMO.append(record[0]) #self.TIPO_TURISMO = ['Aventura', 'Arqueológico', 'Ecoturismo'] self.cbtipo_turismo = wx.Choice(self.panel, choices=self.TIPO_TURISMO) box.Add(self.cbtipo_turismo, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) #Configuración ComboBox para selección de Presupuesto self.lbtipo_turismo = wx.StaticText(self.panel, label="Tipo Presupuesto", style=wx.ALIGN_CENTRE) box.Add(self.lbtipo_turismo, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) PRESUPUESTO = ['Q', 'QQ', 'QQQ', 'QQQQ'] self.cbpresupuesto = wx.Choice(self.panel, choices=PRESUPUESTO) box.Add(self.cbpresupuesto, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) # Agregamos botón para consulta self.btconsulta = wx.Button(self.panel, -1, "Obtener Recomendación") box.Add(self.btconsulta, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) # Configuramos Eventos box.AddStretchSpacer() self.cbpresupuesto.SetSelection(1) self.btconsulta.Bind(wx.EVT_BUTTON, self.getConsulta) if (not self.cbtipo_clima.IsEmpty()): self.cbtipo_clima.SetSelection(0) if (not self.cbtipo_viaje.IsEmpty()): self.cbtipo_viaje.SetSelection(0) if (not self.cbtipo_turismo.IsEmpty()): self.cbtipo_turismo.SetSelection(0) self.panel.SetSizer(box) self.Centre() self.Show()
def __init__(self, parent): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(255, 285), style=wx.TAB_TRAVERSAL) bSizer86 = wx.BoxSizer(wx.VERTICAL) bSizer87 = wx.BoxSizer(wx.VERTICAL) sbSizer39 = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"Rescaling Pairs"), wx.VERTICAL) fgSizer25 = wx.FlexGridSizer(0, 2, 0, 0) fgSizer25.SetFlexibleDirection(wx.BOTH) fgSizer25.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_staticText97 = wx.StaticText(self, wx.ID_ANY, u"Original Value 1", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText97.Wrap(-1) fgSizer25.Add(self.m_staticText97, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.m_textCtrlOldValue1 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) fgSizer25.Add(self.m_textCtrlOldValue1, 0, wx.ALL, 5) self.m_staticText98 = wx.StaticText(self, wx.ID_ANY, u"Original Value 2", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText98.Wrap(-1) fgSizer25.Add(self.m_staticText98, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.m_textCtrlOldValue2 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) fgSizer25.Add(self.m_textCtrlOldValue2, 0, wx.ALL, 5) self.m_staticText99 = wx.StaticText(self, wx.ID_ANY, u"New Value 1", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText99.Wrap(-1) fgSizer25.Add(self.m_staticText99, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.m_textCtrlNewValue1 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) fgSizer25.Add(self.m_textCtrlNewValue1, 0, wx.ALL, 5) self.m_staticText100 = wx.StaticText(self, wx.ID_ANY, u"New Value 2", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText100.Wrap(-1) fgSizer25.Add(self.m_staticText100, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.m_textCtrlNewValue2 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) fgSizer25.Add(self.m_textCtrlNewValue2, 0, wx.ALL, 5) sbSizer39.Add(fgSizer25, 1, wx.EXPAND, 5) bSizer87.Add(sbSizer39, 0, wx.EXPAND, 5) sbSizer40 = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"Output Setting"), wx.VERTICAL) fgSizer26 = wx.FlexGridSizer(0, 2, 0, 0) fgSizer26.SetFlexibleDirection(wx.BOTH) fgSizer26.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_staticText101 = wx.StaticText(self, wx.ID_ANY, u"Output Scalar Type", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText101.Wrap(-1) fgSizer26.Add(self.m_staticText101, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) m_choiceScalarTypeChoices = [ u"Char", u"Unsigned Char", u"Short", u"Unsigned Short", u"Int", u"Float", u"Double" ] self.m_choiceScalarType = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choiceScalarTypeChoices, 0) self.m_choiceScalarType.SetSelection(0) fgSizer26.Add(self.m_choiceScalarType, 0, wx.ALL, 5) self.m_checkBoxClampOverflow = wx.CheckBox(self, wx.ID_ANY, u"Clamp Overflow", wx.DefaultPosition, wx.DefaultSize, 0) self.m_checkBoxClampOverflow.SetValue(True) fgSizer26.Add(self.m_checkBoxClampOverflow, 0, wx.ALL, 5) sbSizer40.Add(fgSizer26, 1, wx.EXPAND, 5) bSizer87.Add(sbSizer40, 1, wx.EXPAND, 5) self.m_buttonRescale = wx.Button(self, wx.ID_ANY, u"Rescale Image", wx.DefaultPosition, wx.DefaultSize, 0) self.m_buttonRescale.Enable(False) bSizer87.Add(self.m_buttonRescale, 0, wx.ALL, 5) bSizer86.Add(bSizer87, 0, 0, 5) self.SetSizer(bSizer86) self.Layout() # Connect Events self.m_textCtrlOldValue1.Bind(wx.EVT_TEXT, self.onTextValidate) self.m_textCtrlOldValue2.Bind(wx.EVT_TEXT, self.onTextValidate) self.m_textCtrlNewValue1.Bind(wx.EVT_TEXT, self.onTextValidate) self.m_textCtrlNewValue2.Bind(wx.EVT_TEXT, self.onTextValidate)