def __init__(self, parent): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(507, 397), style=wx.TAB_TRAVERSAL) bSizer6 = wx.BoxSizer(wx.VERTICAL) sbSizer1 = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"EXPANDIR / EXPAND"), wx.HORIZONTAL) self.m_button_designer = wx.BitmapButton( self, wx.ID_ANY, wx.Bitmap(u"recursos/images/designer_vipera.png", wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW) self.m_button_designer.SetToolTipString(u"Diseñador de clases") self.m_button_designer.SetToolTipString(u"Diseñador de clases") sbSizer1.Add(self.m_button_designer, 0, wx.ALL, 0) self.m_button_editor = wx.BitmapButton( self, wx.ID_ANY, wx.Bitmap(u"recursos/images/editor_vipera.png", wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW) self.m_button_editor.SetToolTipString(u"Editor Python") self.m_button_editor.SetToolTipString(u"Editor Python") sbSizer1.Add(self.m_button_editor, 0, wx.ALL, 0) bSizer6.Add(sbSizer1, 0, wx.EXPAND, 5) self.m_splitter_principal = wx.SplitterWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_3D | wx.SP_LIVE_UPDATE) self.m_splitter_principal.Bind(wx.EVT_IDLE, self.m_splitter_principalOnIdle) self.m_splitter_principal.SetMinimumPaneSize(10) self.m_panel_designer = wx.Panel(self.m_splitter_principal, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer7 = wx.BoxSizer(wx.VERTICAL) self.m_choicebook = wx.Choicebook(self.m_panel_designer, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.CHB_DEFAULT) self.m_panel_clases = wx.Panel(self.m_choicebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_choicebook.AddPage(self.m_panel_clases, u"Diagrama de clases", False) self.m_panel_funciones = wx.Panel(self.m_choicebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer4 = wx.BoxSizer(wx.VERTICAL) self.m_listCtrl_funciones = wx.ListCtrl( self.m_panel_funciones, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_HRULES | wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_SORT_ASCENDING) bSizer4.Add(self.m_listCtrl_funciones, 1, wx.ALL | wx.EXPAND, 5) self.m_panel_funciones.SetSizer(bSizer4) self.m_panel_funciones.Layout() bSizer4.Fit(self.m_panel_funciones) self.m_choicebook.AddPage(self.m_panel_funciones, u"Funciones", False) bSizer7.Add(self.m_choicebook, 1, wx.EXPAND | wx.ALL, 5) self.m_panel_designer.SetSizer(bSizer7) self.m_panel_designer.Layout() bSizer7.Fit(self.m_panel_designer) self.m_panel_editor = wx.Panel(self.m_splitter_principal, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_splitter_principal.SplitVertically(self.m_panel_designer, self.m_panel_editor, 10000) bSizer6.Add(self.m_splitter_principal, 1, wx.EXPAND, 5) sbSizer2 = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"Fichero actual / Current file"), wx.HORIZONTAL) self.m_textCtrl_nombre_fichero = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(200, -1), wx.TE_READONLY) self.m_textCtrl_nombre_fichero.SetFont( wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 94, 92, False, wx.EmptyString)) self.m_textCtrl_nombre_fichero.SetForegroundColour(wx.Colour( 0, 0, 255)) sbSizer2.Add(self.m_textCtrl_nombre_fichero, 0, wx.ALL, 5) self.m_textCtrl_fichero = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_READONLY) self.m_textCtrl_fichero.SetFont( wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 94, 92, False, wx.EmptyString)) self.m_textCtrl_fichero.SetForegroundColour(wx.Colour(255, 255, 255)) self.m_textCtrl_fichero.SetBackgroundColour(wx.Colour(0, 0, 255)) sbSizer2.Add(self.m_textCtrl_fichero, 1, wx.ALL | wx.EXPAND, 5) bSizer6.Add(sbSizer2, 0, wx.ALL | wx.EXPAND, 5) self.SetSizer(bSizer6) self.Layout() # Connect Events self.m_button_designer.Bind(wx.EVT_BUTTON, self.OnDesigner) self.m_button_editor.Bind(wx.EVT_BUTTON, self.OnEditor)
def __init__(self, parent, id=-1): """Constructor""" wx.Panel.__init__(self, parent, id, size=(800, 480)) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) # dictionary update self.batupdater = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.DictUpdater, self.batupdater) self.batupdater.Start(100) # warning timer self.timerx = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.BatteryWarn, self.timerx) self.timerx.Start(10) # label updaters # 1 self.timer1 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatetq1, self.timer1) self.timer1.Start(10) # 2 self.timer2 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatetq2, self.timer2) self.timer2.Start(10) # 3 self.timer3 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatetq3, self.timer3) self.timer3.Start(10) # 4 self.timer4 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatetq4, self.timer4) self.timer4.Start(10) # 5 self.timer5 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatemaxdc, self.timer5) self.timer5.Start(10) # 6 self.timer6 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatemindc, self.timer6) self.timer6.Start(10) # 7 self.timer7 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatemaxc, self.timer7) self.timer7.Start(10) # dictionary of lists self.imp_dict = {} # title title = wx.StaticText(self, -1, 'Battery') title.SetFont(wx.Font(24, wx.DEFAULT, wx.BOLD, wx.FONTWEIGHT_BOLD)) title.SetForegroundColour('white') # label declarations self.labelOne = wx.StaticText( self, -1, 'Battery (NE) Temperature : ' + str(self.btq1)) self.labelTwo = wx.StaticText( self, -1, 'Battery (NW) Temperature : ' + str(self.btq2)) self.labelThree = wx.StaticText( self, -1, 'Battery (SE) Temperature : ' + str(self.btq3)) self.labelFour = wx.StaticText( self, -1, 'Battery (SW) Temperature : ' + str(self.btq4)) self.labelFive = wx.StaticText( self, -1, 'Max. Discharge Current : ' + str(self.maxdisc)) self.labelSix = wx.StaticText( self, -1, 'Min. Discharge Current : ' + str(self.mindisc)) self.labelSeven = wx.StaticText( self, -1, 'Battery (SW) Temperature : ' + str(self.maxc)) # the label describers self.labelOne.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelOne.SetForegroundColour('white') self.labelTwo.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelTwo.SetForegroundColour('white') self.labelThree.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelThree.SetForegroundColour('white') self.labelFour.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelFour.SetForegroundColour('white') self.labelFive.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelFive.SetForegroundColour('white') self.labelSix.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelSix.SetForegroundColour('white') self.labelSeven.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelSeven.SetForegroundColour('white') # image button creation self.wbutton0 = wx.Button(self, -1, '- M P P T -') self.wbutton1 = wx.Button(self, -1, '- B M S -') self.wbutton2 = wx.Button(self, -1, '- M O T O R -') self.wbutton3 = wx.Button(self, -1, '- G E N E R A L -') imageFile = "mppt.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() MPPTBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnMPPT, MPPTBtn) imageFile = "battery.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() BatteryBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, None, BatteryBtn) imageFile = "motor.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() MotorBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnMotor, MotorBtn) imageFile = "general.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() GenBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnGeneral, GenBtn) # generating sizers topSizer = wx.BoxSizer(wx.VERTICAL) toolBtn = wx.BoxSizer(wx.HORIZONTAL) toolBtn_h = wx.BoxSizer(wx.VERTICAL) warnSizer = wx.BoxSizer(wx.HORIZONTAL) warnSizer_h = wx.BoxSizer(wx.VERTICAL) titleSizer = wx.BoxSizer(wx.HORIZONTAL) inputOneSizer = wx.BoxSizer(wx.HORIZONTAL) inputTwoSizer = wx.BoxSizer(wx.HORIZONTAL) inputThreeSizer = wx.BoxSizer(wx.HORIZONTAL) inputFourSizer = wx.BoxSizer(wx.HORIZONTAL) inputFiveSizer = wx.BoxSizer(wx.HORIZONTAL) inputSixSizer = wx.BoxSizer(wx.HORIZONTAL) inputSevenSizer = wx.BoxSizer(wx.HORIZONTAL) # adding toolbar toolBtn.Add(MPPTBtn, 0, wx.ALL, 5) toolBtn.Add(BatteryBtn, 0, wx.ALL, 5) toolBtn.Add(MotorBtn, 0, wx.ALL, 5) toolBtn.Add(GenBtn, 0, wx.ALL, 5) # adding them in a vertical sizer to center them completely toolBtn_h.Add(toolBtn, 0, wx.CENTER, 5) # same done for warnsizers warnSizer.Add(self.wbutton0, 0, wx.ALL, 5) warnSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) warnSizer.Add(self.wbutton1, 0, wx.ALL, 5) warnSizer.Add(self.wbutton2, 0, wx.ALL, 5) warnSizer.Add(self.wbutton3, 0, wx.ALL, 5) warnSizer_h.Add(warnSizer, 0, wx.CENTER, 5) titleSizer.Add(title, 0, wx.ALL, 5) inputOneSizer.Add(self.labelOne, 0, wx.ALL, 5) inputTwoSizer.Add(self.labelTwo, 0, wx.ALL, 5) inputThreeSizer.Add(self.labelThree, 0, wx.ALL, 5) inputFourSizer.Add(self.labelFour, 0, wx.ALL, 5) inputFiveSizer.Add(self.labelFive, 0, wx.ALL, 5) inputSixSizer.Add(self.labelSix, 0, wx.ALL, 5) topSizer.Add(toolBtn_h, 0, wx.ALL | wx.EXPAND | wx.CENTER, 5) topSizer.Add(warnSizer_h, 0, wx.ALL | wx.EXPAND | wx.CENTER, 5) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(titleSizer, 0, wx.CENTER) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputOneSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputTwoSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputThreeSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputFourSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputFiveSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputSixSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputSevenSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) self.SetSizer(topSizer) topSizer.Fit(self) self.Raise() self.SetPosition((0, 0)) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) # value declarations self.btq1 = 0 self.btq2 = 0 self.btq3 = 0 self.btq4 = 0 self.maxdisc = 0 self.mindisc = 0 self.maxc = 0
def __init__(self, parent, IDfamille=None): wx.Panel.__init__(self, parent, id=-1, name="panel_cotisations", style=wx.TAB_TRAVERSAL) self.parent = parent self.IDfamille = IDfamille self.staticbox_cotisations = wx.StaticBox(self, -1, _(u"Cotisations familiales et individuelles")) # OL Cotisations codesColonnes = ["IDcotisation", "date_debut", "date_fin", "beneficiaires", "nom", "numero", "date_creation_carte", "depot_nom", "activites", "observations"] checkColonne = True triColonne = "date_debut" self.listviewAvecFooter = OL_Liste_cotisations.ListviewAvecFooter(self, kwargs={"IDfamille" : IDfamille, "mode" : "famille", "codesColonnes" : codesColonnes, "checkColonne" : checkColonne, "triColonne" : triColonne}) self.ctrl_listview = self.listviewAvecFooter.GetListview() self.ctrl_recherche = OL_Liste_cotisations.CTRL_Outils(self, listview=self.ctrl_listview, afficherCocher=True) self.ctrl_recherche.SetBackgroundColour((255, 255, 255)) # Commandes boutons self.bouton_ajouter = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Ajouter.png"), wx.BITMAP_TYPE_ANY)) self.bouton_modifier = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Modifier.png"), wx.BITMAP_TYPE_ANY)) self.bouton_supprimer = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Supprimer.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)) # Binds self.Bind(wx.EVT_BUTTON, self.OnBoutonAjouter, self.bouton_ajouter) self.Bind(wx.EVT_BUTTON, self.OnBoutonModifier, self.bouton_modifier) self.Bind(wx.EVT_BUTTON, self.OnBoutonSupprimer, self.bouton_supprimer) self.Bind(wx.EVT_BUTTON, self.OnBoutonImprimer, self.bouton_imprimer) # Propriétés self.bouton_ajouter.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour saisir une cotisation"))) self.bouton_modifier.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour modifier la cotisation sélectionnée"))) self.bouton_supprimer.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour supprimer la cotisation sélectionnée"))) self.bouton_imprimer.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour imprimer un document"))) # Layout grid_sizer_base = wx.FlexGridSizer(rows=1, cols=2, vgap=5, hgap=5) staticbox_cotisations = wx.StaticBoxSizer(self.staticbox_cotisations, wx.VERTICAL) grid_sizer_cotisations = wx.FlexGridSizer(rows=2, cols=2, vgap=5, hgap=5) grid_sizer_cotisations.Add(self.listviewAvecFooter, 1, wx.EXPAND, 0) grid_sizer_boutons = wx.FlexGridSizer(rows=6, cols=1, vgap=5, hgap=5) grid_sizer_boutons.Add(self.bouton_ajouter, 0, wx.ALL, 0) grid_sizer_boutons.Add(self.bouton_modifier, 0, wx.ALL, 0) grid_sizer_boutons.Add(self.bouton_supprimer, 0, wx.ALL, 0) grid_sizer_boutons.Add( (5, 5), 0, wx.ALL, 0) grid_sizer_boutons.Add(self.bouton_imprimer, 0, wx.ALL, 0) grid_sizer_cotisations.Add(grid_sizer_boutons, 1, wx.ALL, 0) grid_sizer_cotisations.Add(self.ctrl_recherche, 1, wx.EXPAND, 0) grid_sizer_cotisations.AddGrowableCol(0) grid_sizer_cotisations.AddGrowableRow(0) staticbox_cotisations.Add(grid_sizer_cotisations, 1, wx.EXPAND|wx.ALL, 5) grid_sizer_base.Add(staticbox_cotisations, 1, wx.EXPAND|wx.ALL, 5) grid_sizer_base.AddGrowableCol(0) grid_sizer_base.AddGrowableRow(0) self.SetSizer(grid_sizer_base) grid_sizer_base.Fit(self) self.Layout()
def __init__(self, parent, top): """ Device specific functions and UI for interfacing Model 3201 with GUI Args: self: The self parameter is a reference to the current instance of the class,and is used to access variables that belongs to the class. parent: Pointer to a parent window. top: creates an object Returns: None """ wx.Window.__init__(self, parent) self.SetBackgroundColour("White") self.parent = parent self.top = top self.pcnt = 0 self.duty = 0 self.OnTime = 0 self.OffTime = 0 self.On_flg = False self.auto_flg = False self.pulse_flg = False self.usb_flg = False # The Timer class allows you to execute code at specified intervals. self.timer = wx.Timer(self) self.timer_usb = wx.Timer(self) self.timer_va = wx.Timer(self) # Call this to give the sizer a minimal size. self.SetMinSize((290, 190)) self.st_p1 = wx.StaticText(self, -1, "Port 1", size=(-1, -1)) self.st_p2 = wx.StaticText(self, -1, "Port 2", size=(-1, -1)) self.st_p3 = wx.StaticText(self, -1, "Port 3", size=(-1, -1)) self.st_p4 = wx.StaticText(self, -1, "Port 4", size=(-1, -1)) base = os.path.abspath(os.path.dirname(__file__)) self.picf = wx.Bitmap(base + "/icons/" + IMG_BTN_OFF, wx.BITMAP_TYPE_ANY) self.picn = wx.Bitmap(base + "/icons/" + IMG_BTN_ON, wx.BITMAP_TYPE_ANY) self.btn_p1 = wx.BitmapButton(self, 0, self.picf, size=(-1, -1)) self.btn_p2 = wx.BitmapButton(self, 1, self.picf, size=(-1, -1)) self.btn_p3 = wx.BitmapButton(self, 2, self.picf, size=(-1, -1)) self.btn_p4 = wx.BitmapButton(self, 3, self.picf, size=(-1, -1)) self.st_ss = wx.StaticText(self, -1, "SuperSpeed") self.rbtn_ss1 = wx.RadioButton(self, ID_RBTN_SS1, "Enable", style=wx.RB_GROUP | wx.ALIGN_CENTER) self.rbtn_ss0 = wx.RadioButton(self, ID_RBTN_SS0, "Disable") #self.st_si = wx.StaticText(self, -1, "Interval") self.stlbl_volts = wx.StaticText(self, -1, "Bus Voltage :", size=(-1, -1)) self.st_volts = wx.StaticText(self, -1, " --- ", style=wx.ALIGN_CENTER_VERTICAL) self.stlbl_amps = wx.StaticText(self, -1, "Bus Current:", size=(-1, -1)) self.st_amps = wx.StaticText(self, -1, " --- ", style=wx.ALIGN_CENTER_VERTICAL, size=(-1, -1)) # BoxSizer fixed with Horizontal self.hbox1 = wx.BoxSizer(wx.HORIZONTAL) self.hbox2 = wx.BoxSizer(wx.HORIZONTAL) self.hbox3 = wx.BoxSizer(wx.HORIZONTAL) self.hbox4 = wx.BoxSizer(wx.HORIZONTAL) self.hbox5 = wx.BoxSizer(wx.HORIZONTAL) self.hboxi = wx.BoxSizer(wx.HORIZONTAL) self.hbox6 = wx.BoxSizer(wx.HORIZONTAL) self.hboxp1 = wx.BoxSizer(wx.HORIZONTAL) self.hboxp2 = wx.BoxSizer(wx.HORIZONTAL) self.hboxp3 = wx.BoxSizer(wx.HORIZONTAL) self.hboxp4 = wx.BoxSizer(wx.HORIZONTAL) self.hboxs1 = wx.BoxSizer(wx.HORIZONTAL) self.hboxs2 = wx.BoxSizer(wx.HORIZONTAL) self.hboxp1.Add(self.st_p1, 0, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=0) self.hboxp1.Add(self.btn_p1, flag=wx.LEFT, border=10) self.hboxp2.Add(self.st_p2, 0, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=0) self.hboxp2.Add(self.btn_p2, flag=wx.LEFT, border=10) self.hboxp3.Add(self.st_p3, flag=wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=0) self.hboxp3.Add(self.btn_p3, flag=wx.LEFT, border=10) self.hboxp4.Add(self.st_p4, 0, flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=0) self.hboxp4.Add(self.btn_p4, flag=wx.LEFT, border=10) self.hboxs1.Add(self.hboxp1, flag=wx.LEFT, border=20) self.hboxs1.Add((0, 0), 1, wx.EXPAND) self.hboxs1.Add(self.hboxp2, flag=wx.RIGHT, border=20) self.hboxs2.Add(self.hboxp3, flag=wx.LEFT, border=20) self.hboxs2.Add((0, 0), 1, wx.EXPAND) self.hboxs2.Add(self.hboxp4, flag=wx.RIGHT, border=20) #self.hbox1.Add(self.hboxs1, flag=wx.ALIGN_CENTER_VERTICAL ) #self.hbox1.Add(0,1,0) #self.hbox1.Add(self.hboxs2, flag=wx.LEFT, border=20 ) #self.hboxs2.Add(0,10,0) self.hbox3.Add(self.st_ss, 0, flag=wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=20) self.hbox3.Add(self.rbtn_ss1, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=20) self.hbox3.Add(self.rbtn_ss0, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=18) self.hbox5.Add(self.stlbl_volts, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=20) self.hbox5.Add(self.st_volts, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) self.hbox5.Add(self.stlbl_amps, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, border=20) self.hbox5.Add(self.st_amps, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) sb = wx.StaticBox(self, -1, "Model 3201") self.vbox = wx.StaticBoxSizer(sb, wx.VERTICAL) self.vbox.AddMany([(0, 10, 0), (self.hboxs1, 1, wx.EXPAND), (0, 10, 0), (self.hboxs2, 1, wx.EXPAND), (0, 10, 0), (self.hbox3, 1, wx.EXPAND), (self.hbox5, 1, wx.EXPAND)]) # Set size of frame self.SetSizer(self.vbox) self.SetAutoLayout(True) self.vbox.Fit(self) self.Layout() # Bind the timer event to handler self.Bind(wx.EVT_TIMER, self.UsbTimer, self.timer_usb) self.Bind(wx.EVT_TIMER, self.VaTimer, self.timer_va) # Bind the button event to handler self.Bind(wx.EVT_RADIOBUTTON, self.PortSpeedChanged) self.Bind(wx.EVT_BUTTON, self.OnOffPort, self.btn_p1) self.Bind(wx.EVT_BUTTON, self.OnOffPort, self.btn_p2) self.Bind(wx.EVT_BUTTON, self.OnOffPort, self.btn_p3) self.Bind(wx.EVT_BUTTON, self.OnOffPort, self.btn_p4) self.rbtn = [] self.rbtn.append(self.btn_p1) self.rbtn.append(self.btn_p2) self.rbtn.append(self.btn_p3) self.rbtn.append(self.btn_p4) self.btnStat = [False, False, False, False] self.enable_controls(False)
def __init__(self, parent, id=-1): """Constructor""" wx.Panel.__init__(self, parent, id, size=(800, 480)) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) # dictionary update self.mpptupdater = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.DictUpdater, self.mpptupdater) self.mpptupdater.Start(100) # warning timer self.timerx = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.MPPTWarn, self.timerx) self.timerx.Start(10) # label updater # 1 self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatemppt2bat(), self.timer1) self.timer1.Start(10) # 2 self.timer1 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatesp2mppt(), self.timer2) self.timer2.Start(10) # dictionary of lists # buttons and labels title = wx.StaticText(self, -1, 'MPPT') title.SetFont( wx.Font(24, wx.FONTFAMILY_DEFAULT, wx.BOLD, wx.FONTWEIGHT_BOLD)) title.SetForegroundColour('white') # label declarations self.labelOne = wx.StaticText(self, -1, 'Panels to MPPT : ' + str(self.sp2mppt)) self.labelTwo = wx.StaticText( self, -1, 'MPPT to Battery : ' + str(self.mppt2bat)) # label describers self.labelOne.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelTwo.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelTwo.SetForegroundColour('white') self.wbutton0 = wx.Button(self, -1, '- M P P T -') self.wbutton1 = wx.Button(self, -1, '- B M S -') self.wbutton2 = wx.Button(self, -1, '- M O T O R -') self.wbutton3 = wx.Button(self, -1, '- G E N E R A L -') imageFile = "battery.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() BatteryBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnBattery, BatteryBtn) imageFile = "mppt.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() MPPTBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) imageFile = "motor.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() MotorBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnMotor, MotorBtn) self.Bind(wx.EVT_BUTTON, None, MPPTBtn) imageFile = "general.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() GenBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnGeneral, GenBtn) topSizer = wx.BoxSizer(wx.VERTICAL) toolBtn = wx.BoxSizer(wx.HORIZONTAL) toolBtn_h = wx.BoxSizer(wx.VERTICAL) warnSizer = wx.BoxSizer(wx.HORIZONTAL) warnSizer_h = wx.BoxSizer(wx.VERTICAL) titleSizer = wx.BoxSizer(wx.HORIZONTAL) inputOneSizer = wx.BoxSizer(wx.HORIZONTAL) inputTwoSizer = wx.BoxSizer(wx.HORIZONTAL) toolBtn.Add(MPPTBtn, 0, wx.ALL, 5) toolBtn.Add(BatteryBtn, 0, wx.ALL, 5) toolBtn.Add(MotorBtn, 0, wx.ALL, 5) toolBtn.Add(GenBtn, 0, wx.ALL, 5) toolBtn_h.Add(toolBtn, 0, wx.CENTER, 5) warnSizer.Add(self.wbutton0, 0, wx.ALL, 5) warnSizer.Add(self.wbutton1, 0, wx.ALL, 5) warnSizer.Add(self.wbutton2, 0, wx.ALL, 5) warnSizer.Add(self.wbutton3, 0, wx.ALL, 5) warnSizer_h.Add(warnSizer, 0, wx.CENTER, 5) titleSizer.Add(title, 0, wx.ALL, 5) inputOneSizer.Add(self.labelOne, 0, wx.ALL, 5) inputTwoSizer.Add(self.labelTwo, 0, wx.ALL, 5) topSizer.Add(toolBtn_h, 0, wx.ALL | wx.EXPAND | wx.CENTER, 5) topSizer.Add(warnSizer_h, 0, wx.ALL | wx.EXPAND | wx.CENTER, 5) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND | wx.CENTER, 5) topSizer.Add(titleSizer, 0, wx.CENTER) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputOneSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputTwoSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) self.SetSizer(topSizer) topSizer.Fit(self) self.Raise() self.SetPosition((0, 0)) self.Hide() self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
def __init__(self, parent, labelControleNom=_(u"Nom")): wx.Panel.__init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL) self.labelControleNom = labelControleNom # Nom self.box_nom_staticbox = wx.StaticBox(self, -1, labelControleNom) self.label_nom = wx.StaticText(self, -1, u"%s :" % labelControleNom) self.ctrl_nom = wx.TextCtrl(self, -1, u"") # Protection self.box_mdp_staticbox = wx.StaticBox(self, -1, _(u"Protection")) self.label_cryptage = wx.StaticText(self, -1, _(u"Cryptage :")) self.check_cryptage = wx.CheckBox(self, -1, u"") self.label_mdp = wx.StaticText(self, -1, _(u"Mot de passe :")) self.ctrl_mdp = wx.TextCtrl(self, -1, u"", style=wx.TE_PASSWORD) self.label_confirmation = wx.StaticText(self, -1, _(u"Confirmation :")) self.ctrl_confirmation = wx.TextCtrl(self, -1, u"", style=wx.TE_PASSWORD) # Destination self.box_destination_staticbox = wx.StaticBox(self, -1, _(u"Destination")) self.check_repertoire = wx.CheckBox(self, -1, _(u"Répertoire :")) self.ctrl_repertoire = wx.TextCtrl(self, -1, u"") self.bouton_repertoire = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Repertoire.png"), wx.BITMAP_TYPE_ANY)) self.check_email = wx.CheckBox(self, -1, _(u"Envoi par Email :")) self.ctrl_email = wx.TextCtrl(self, -1, u"") # Données self.box_donnees_staticbox = wx.StaticBox( self, -1, _(u"Données à sauvegarder")) self.ctrl_donnees = CTRL_Donnees(self) self.ctrl_donnees.SetMinSize((300, -1)) self.check_locaux = wx.CheckBox(self, -1, _(u"Fichiers locaux")) self.check_reseau = wx.CheckBox(self, -1, _(u"Fichiers réseau")) self.__set_properties() self.__do_layout() # Binds self.Bind(wx.EVT_CHECKBOX, self.OnCheckCryptage, self.check_cryptage) self.Bind(wx.EVT_CHECKBOX, self.OnCheckRepertoire, self.check_repertoire) self.Bind(wx.EVT_BUTTON, self.OnBoutonRepertoire, self.bouton_repertoire) self.Bind(wx.EVT_CHECKBOX, self.OnCheckEmail, self.check_email) self.Bind(wx.EVT_CHECKBOX, self.OnCheckLocaux, self.check_locaux) self.Bind(wx.EVT_CHECKBOX, self.OnCheckReseau, self.check_reseau) # Init Contrôles self.OnCheckCryptage(None) self.OnCheckRepertoire(None) self.OnCheckEmail(None) self.check_locaux.SetValue(True) # Récupération des paramètres de connexion réseau self.dictConnexion = None DB = GestionDB.DB() if DB.echec != 1: if DB.isNetwork == True: self.check_reseau.SetValue(True) self.dictConnexion = DB.GetParamConnexionReseau() DB.Close() self.ctrl_donnees.MAJ()
def __init__(self, parent): wx.Panel.__init__(self, parent) default_colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR) self.SetBackgroundColour(default_colour) ## LINE 1 text1 = wx.StaticText(self, -1, _("Choose brush type, size or operation:")) ## LINE 2 menu = wx.Menu() CIRCLE_BMP = wx.Bitmap("../icons/brush_circle.jpg", wx.BITMAP_TYPE_JPEG) item = wx.MenuItem(menu, MENU_BRUSH_CIRCLE, _("Circle")) item.SetBitmap(CIRCLE_BMP) SQUARE_BMP = wx.Bitmap("../icons/brush_square.jpg", wx.BITMAP_TYPE_JPEG) item2 = wx.MenuItem(menu, MENU_BRUSH_SQUARE, _("Square")) item2.SetBitmap(SQUARE_BMP) menu.AppendItem(item) menu.AppendItem(item2) bmp_brush_format = {const.BRUSH_CIRCLE: CIRCLE_BMP, const.BRUSH_SQUARE: SQUARE_BMP} selected_bmp = bmp_brush_format[const.DEFAULT_BRUSH_FORMAT] btn_brush_format = pbtn.PlateButton(self, wx.ID_ANY,"", selected_bmp, style=pbtn.PB_STYLE_SQUARE) btn_brush_format.SetMenu(menu) self.btn_brush_format = btn_brush_format # To calculate best width to spinctrl dc = wx.WindowDC(self) dc.SetFont(self.GetFont()) width, height = dc.GetTextExtent("MMM") spin_brush_size = wx.SpinCtrl(self, -1, "", size=(width + 20, -1)) spin_brush_size.SetRange(1,100) spin_brush_size.SetValue(const.BRUSH_SIZE) spin_brush_size.Bind(wx.EVT_SPINCTRL, self.OnBrushSize) self.spin = spin_brush_size combo_brush_op = wx.ComboBox(self, -1, "", size=(15,-1), choices = (_("Foreground"), _("Background"), _("Erase")), style = wx.CB_DROPDOWN|wx.CB_READONLY) combo_brush_op.SetSelection(0) if sys.platform != 'win32': combo_brush_op.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) self.combo_brush_op = combo_brush_op # Sizer which represents the second line line2 = wx.BoxSizer(wx.HORIZONTAL) line2.Add(btn_brush_format, 0, wx.EXPAND|wx.GROW|wx.RIGHT, 5) line2.Add(spin_brush_size, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 5) line2.Add(combo_brush_op, 1, wx.RIGHT|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 5) ## LINE 3 ## LINE 4 # LINE 5 check_box = wx.CheckBox(self, -1, _("Overwrite mask")) ww_wl_cbox = wx.CheckBox(self, -1, _("Use WW&WL")) ww_wl_cbox.SetValue(True) self.check_box = check_box self.ww_wl_cbox = ww_wl_cbox # Line 6 bmp = wx.Bitmap("../icons/configuration.png", wx.BITMAP_TYPE_PNG) self.btn_wconfig = wx.BitmapButton(self, -1, bitmap=bmp, size=(bmp.GetWidth()+10, bmp.GetHeight()+10)) self.btn_exp_watershed = wx.Button(self, -1, _('Expand watershed to 3D')) sizer_btns = wx.BoxSizer(wx.HORIZONTAL) sizer_btns.Add(self.btn_wconfig, 0, wx.ALIGN_LEFT | wx.LEFT | wx.TOP | wx.DOWN, 5) sizer_btns.Add(self.btn_exp_watershed, 0, wx.GROW|wx.EXPAND| wx.ALL, 5) # Add lines into main sizer sizer = wx.BoxSizer(wx.VERTICAL) sizer.AddSpacer(7) sizer.Add(text1, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) sizer.AddSpacer(2) sizer.Add(line2, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) sizer.AddSpacer(5) sizer.Add(check_box, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) sizer.AddSpacer(2) sizer.Add(ww_wl_cbox, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) sizer.AddSpacer(5) sizer.Add(sizer_btns, 0, wx.EXPAND) sizer.AddSpacer(7) sizer.Fit(self) self.SetSizerAndFit(sizer) self.Update() self.SetAutoLayout(1) self.__bind_events_wx() self.__bind_pubsub_evt()
def __init__(self, parent, set_dir=None): """ Default class constructor. :param Window `parent`: parent window. :param string `set_dir`: path to set as working directory """ wx.Dialog.__init__(self, parent, -1, _("Image Browser"), wx.DefaultPosition, (400, 400), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) self.set_dir = os.getcwd() self.set_file = None if set_dir != None: if os.path.exists( set_dir): # set to working directory if nothing set self.set_dir = set_dir vbox_top = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox_top) hbox_loc = wx.BoxSizer(wx.HORIZONTAL) vbox_top.Add(hbox_loc, 0, wx.GROW | wx.ALIGN_LEFT | wx.ALL, 0) loc_label = wx.StaticText(self, -1, "Folder:") hbox_loc.Add( loc_label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.ADJUST_MINSIZE, 5) self.dir = wx.TextCtrl(self, -1, self.set_dir, style=wx.TE_RICH | wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_TEXT_ENTER, self.OnDirectoryTextSet, self.dir) hbox_loc.Add(self.dir, 1, wx.GROW | wx.ALIGN_LEFT | wx.ALL, 5) up_bmp = wx.ArtProvider.GetBitmap(wx.ART_GO_DIR_UP, wx.ART_BUTTON, (16, 16)) btn = wx.BitmapButton(self, -1, up_bmp) btn.SetHelpText(_("Up one level")) btn.SetToolTip(_("Up one level")) self.Bind(wx.EVT_BUTTON, self.OnUpDirectory, btn) hbox_loc.Add(btn, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2) folder_bmp = wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_BUTTON, (16, 16)) btn = wx.BitmapButton(self, -1, folder_bmp) btn.SetHelpText(_("Browse for a &folder...")) btn.SetToolTip(_("Browse for a folder...")) self.Bind(wx.EVT_BUTTON, self.OnChooseDirectory, btn) hbox_loc.Add(btn, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) hbox_nav = wx.BoxSizer(wx.HORIZONTAL) vbox_top.Add(hbox_nav, 0, wx.ALIGN_LEFT | wx.ALL, 0) label = wx.StaticText(self, -1, "Files of type:") hbox_nav.Add(label, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5) self.fl_ext = '*.bmp' # initial setting for file filtering self.GetFiles() # get the file list self.fl_ext_types = ( # display, filter ("All supported formats", "All"), ("BMP (*.bmp)", "*.bmp"), ("GIF (*.gif)", "*.gif"), ("PNG (*.png)", "*.png"), ("JPEG (*.jpg)", "*.jpg"), ("ICO (*.ico)", "*.ico"), ("PNM (*.pnm)", "*.pnm"), ("PCX (*.pcx)", "*.pcx"), ("TIFF (*.tif)", "*.tif"), ("All Files", "*.*"), ) self.set_type, self.fl_ext = self.fl_ext_types[ 0] # initial file filter setting self.fl_types = [x[0] for x in self.fl_ext_types] self.sel_type = wx.ComboBox(self, -1, self.set_type, wx.DefaultPosition, wx.DefaultSize, self.fl_types, wx.CB_DROPDOWN) # after this we don't care about the order any more self.fl_ext_types = dict(self.fl_ext_types) self.Bind(wx.EVT_COMBOBOX, self.OnSetType, self.sel_type) hbox_nav.Add(self.sel_type, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) splitter = wx.SplitterWindow(self, -1, wx.DefaultPosition, wx.Size(100, 100), 0) splitter.SetMinimumPaneSize(100) split_left = wx.Panel(splitter, -1, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER | wx.TAB_TRAVERSAL) vbox_left = wx.BoxSizer(wx.VERTICAL) split_left.SetSizer(vbox_left) self.tb = tb = wx.ListBox(split_left, -1, wx.DefaultPosition, wx.DefaultSize, self.fl_list, wx.LB_SINGLE) self.Bind(wx.EVT_LISTBOX, self.OnListClick, tb) self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnListDClick, tb) vbox_left.Add(self.tb, 1, wx.GROW | wx.ALL, 0) width, height = self.tb.GetSize() split_right = wx.Panel(splitter, -1, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER | wx.TAB_TRAVERSAL) vbox_right = wx.BoxSizer(wx.VERTICAL) split_right.SetSizer(vbox_right) self.image_view = ImagePanel(split_right) vbox_right.Add(self.image_view, 1, wx.GROW | wx.ALL, 0) splitter.SplitVertically(split_left, split_right, 150) vbox_top.Add(splitter, 1, wx.GROW | wx.ALL, 5) hbox_btns = wx.BoxSizer(wx.HORIZONTAL) vbox_top.Add(hbox_btns, 0, wx.ALIGN_RIGHT | wx.ALL, 5) ok_btn = wx.Button(self, wx.ID_OPEN, "", wx.DefaultPosition, wx.DefaultSize, 0) self.Bind(wx.EVT_BUTTON, self.OnOk, ok_btn) #ok_btn.SetDefault() hbox_btns.Add(ok_btn, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) cancel_btn = wx.Button(self, wx.ID_CANCEL, "", wx.DefaultPosition, wx.DefaultSize, 0) hbox_btns.Add(cancel_btn, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.ResetFiles()
def __init_ui(self): self.panel = wx.Panel(self) height1 = 20 height2 = height1 + 30 height3 = height2 + 30 height4 = height3 + 30 height5 = height4 + 30 height6 = height5 + 30 height7 = height6 + 30 height8 = height7 + 32 height9 = height8 + 30 height10 = height9 + 305 height11 = height10 + 30 height12 = height11 + 30 height13 = height12 + 30 height14 = height13 + 40 static_text_width = 105 x_gap = 5 width1 = 15 width2 = width1 + static_text_width + x_gap width3 = width2 + 120 + x_gap width4 = width3 + static_text_width + x_gap width5 = width4 + 120 + x_gap width6 = width5 + static_text_width + x_gap width7 = width2 + 235 + x_gap width8 = width7 + static_text_width + x_gap self.__static_text(pos=(width1, height1), label='Project*') self.project_choice = wx.Choice(self.panel, -1, pos=(width2, height1), choices=ic.project.get(ic.choice), size=(120, -1)) self.project_choice.Disable() self.__static_text(pos=(width3, height1), label='Issue Type*') self.issue_type_choice = wx.Choice(self.panel, -1, pos=(width4, height1), choices=ic.issue_type.get(ic.choice), size=(120, -1)) self.issue_type_choice.Disable() self.__static_text(pos=(width5, height1), label='Crash*') self.crash_choice = wx.Choice(self.panel, -1, pos=(width6, height1), choices=ic.crash.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width1, height2), label='Repeatability*') self.repeatability_choice = wx.Choice(self.panel, -1, pos=(width2, height2), choices=ic.repeatability.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width3, height2), label='Severity*') self.severity_choice = wx.Choice(self.panel, -1, pos=(width4, height2), choices=ic.severity.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width5, height2), label='Component/s*') self.component_input = wx.TextCtrl(self.panel, -1, pos=(width6, height2), size=(100, 24), style=wx.TE_READONLY) component_button = wx.Button(self.panel, -1, label='...', pos=(width6+100, height2-1), size=(20, 26)) self.Bind(wx.EVT_BUTTON, self.on_components, component_button) self.__static_text(pos=(width1, height3), label='Product Name*') self.product_name_choice = wx.Choice(self.panel, -1, pos=(width2, height3), choices=ic.product_name.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width3, height3), label='Test Group*') self.test_group_choice = wx.Choice(self.panel, -1, pos=(width4, height3), choices=ic.test_group.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width5, height3), label='Test Phase*') self.test_phase_choice = wx.Choice(self.panel, -1, pos=(width6, height3), choices=ic.test_phase.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width1, height4), label='LA Functionality') self.la_functionality_choice = wx.Choice(self.panel, -1, pos=(width2, height4), choices=ic.la_functionality.get(ic.choice), size=(230, -1), style=wx.LB_HSCROLL) self.__static_text(pos=(width2+280, height4), label='MM Functionality') self.mm_functionality_choice = wx.Choice(self.panel, -1, pos=(width2+395, height4), choices=ic.mm_functionality.get(ic.choice), size=(195, -1)) self.__static_text(pos=(width1, height5), label='UI Functionality') self.ui_functionality_choice = wx.Choice(self.panel, -1, pos=(width2, height5), choices=ic.ui_functionality.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width3, height5), label='CNSS Functionality') self.cnss_functionality_choice = wx.Choice(self.panel, -1, pos=(width4, height5), choices=ic.cnss_functionality.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width5, height5), label='BSP Functionality') self.bsp_functionality_choice = wx.Choice(self.panel, -1, pos=(width6, height5), choices=ic.bsp_functionality.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width1, height6), label='Area') self.area_choice = wx.Choice(self.panel, -1, pos=(width2, height6), choices=ic.area.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width3, height6), label='Customer Name') self.customer_name_choice = wx.Choice(self.panel, -1, pos=(width4, height6), choices=ic.customer_name.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width5, height6), label='Labels') self.labels_input = wx.TextCtrl(self.panel, -1, pos=(width6, height6), size=(100, 24), style=wx.TE_READONLY) labels__button = wx.Button(self.panel, -1, label='...', pos=(width6+100, height6-1), size=(20, 26)) self.Bind(wx.EVT_BUTTON, self.on_labels, labels__button) self.__static_text(pos=(width1, height7), label='Sprint') self.sprint_choice = wx.Choice(self.panel, -1, pos=(width2, height7), choices=['1'], size=(120, -1)) self.sprint_choice.Disable() self.__static_text(pos=(width3, height7), label='Category Type') self.category_type_choice = wx.Choice(self.panel, -1, pos=(width4, height7), choices=ic.category_type.get(ic.choice), size=(120, -1)) self.__static_text(pos=(width5, height7), label='Assignee') self.assignee_input = wx.TextCtrl(self.panel, -1, pos=(width6, height7), size=(100, 24), style=wx.TE_READONLY) assignee_button = wx.Button(self.panel, -1, label='...', pos=(width6+100, height7-1), size=(20, 26)) assignee_button.Disable() self.Bind(wx.EVT_BUTTON, self.on_assignee, assignee_button) self.__static_text(pos=(width1, height8), label='Summary*') self.summary_input = wx.TextCtrl(self.panel, -1, pos=(width2, height8), size=(590, -1)) self.__static_text(pos=(width1, height9), label='Description*') self.description_input = wx.TextCtrl(self.panel, -1, pos=(width2, height9), size=(590, 300), style=wx.TE_MULTILINE) self.__static_text(pos=(width1, height10), label='Log link*') self.log_link_input = wx.TextCtrl(self.panel, -1, pos=(width2, height10), size=(590, -1)) self.__static_text(pos=(width1, height11), label='SR Number') self.sr_number_input = wx.TextCtrl(self.panel, -1, pos=(width2, height11), size=(240, -1)) self.__static_text(pos=(width7, height11), label='External JIRA ID') self.external_jira_id_input = wx.TextCtrl(self.panel, -1, pos=(width8, height11), size=(240, -1)) self.__static_text(pos=(width1, height12), label='Serial Number') self.serial_number_input = wx.TextCtrl(self.panel, -1, pos=(width2, height12), size=(240, -1)) self.__static_text(pos=(width7, height12), label='MCN number') self.mcn_number_input = wx.TextCtrl(self.panel, -1, pos=(width8, height12), size=(240, -1)) self.__static_text(pos=(width1, height13), label='MetaBuildLocation') self.meta_build_location_input = wx.TextCtrl(self.panel, -1, pos=(width2, height13), size=(590, -1)) self.create_button = wx.Button(self.panel, -1, label='Create', pos=(550, height14), size=(80, 30)) cancel_button = wx.Button(self.panel, wx.ID_CANCEL, label='Cancel', pos=(635, height14), size=(80, 30)) import_button = wx.BitmapButton(self.panel, id=wx.ID_ANY, bitmap=wx.Bitmap(GlobalVariable.icon_import, wx.BITMAP_TYPE_PNG), pos=(width1 + 18, height14 + 8), size=(34, 34)) export_button = wx.BitmapButton(self.panel, id=wx.ID_ANY, bitmap=wx.Bitmap(GlobalVariable.icon_export, wx.BITMAP_TYPE_PNG), pos=(width1 + 52, height14 + 8), size=(34, 34)) save_button = wx.BitmapButton(self.panel, id=wx.ID_ANY, bitmap=wx.Bitmap(GlobalVariable.icon_save, wx.BITMAP_TYPE_PNG), pos=(width1 + 86, height14 + 8), size=(34, 34)) self.Bind(wx.EVT_BUTTON, self.on_create, self.create_button) self.Bind(wx.EVT_BUTTON, self.on_save, save_button) self.Bind(wx.EVT_BUTTON, self.on_export, export_button) self.Bind(wx.EVT_BUTTON, self.on_import, import_button)
def __init__(self, parent): 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 intro = _( u"Vous pouvez ici saisir, modifier ou supprimer des postes analytiques" ) titre = _(u"Gestion des postes analytiques") self.ctrl_bandeau = CTRL_Bandeau.Bandeau( self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Reglement.png") self.ctrl_listview = OL_Analytiques.ListView( self, id=-1, style=wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_SINGLE_SEL | wx.LC_HRULES | wx.LC_VRULES) self.ctrl_listview.MAJ() self.ctrl_recherche = OL_Analytiques.CTRL_Outils( self, listview=self.ctrl_listview) self.bouton_ajouter = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ajouter.png"), wx.BITMAP_TYPE_ANY)) self.bouton_modifier = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Modifier.png"), wx.BITMAP_TYPE_ANY)) self.bouton_supprimer = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Supprimer.png"), wx.BITMAP_TYPE_ANY)) self.bouton_defaut = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ok.png"), wx.BITMAP_TYPE_ANY)) self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.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_BUTTON, self.ctrl_listview.Ajouter, self.bouton_ajouter) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.Modifier, self.bouton_modifier) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.Supprimer, self.bouton_supprimer) self.Bind(wx.EVT_BUTTON, self.ctrl_listview.SetDefaut, self.bouton_defaut) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)
def __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER): wx.Panel.__init__(self, parent, id, pos, size, style=style) vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) self.view = ImageView(self) vbox.Add(self.view, 1, wx.GROW | wx.ALL, 0) hbox_ctrls = wx.BoxSizer(wx.HORIZONTAL) vbox.Add(hbox_ctrls, 0, wx.ALIGN_RIGHT | wx.TOP, 4) bmp = GetNamedBitmap('White') btn = wx.BitmapButton(self, ID_WHITE_BG, bmp, style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnSetImgBackground, btn) btn.SetToolTip(_("Set background to white")) hbox_ctrls.Add(btn, 0, wx.ALIGN_LEFT | wx.LEFT, 4) bmp = GetNamedBitmap('Grey') btn = wx.BitmapButton(self, ID_GREY_BG, bmp, style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnSetImgBackground, btn) btn.SetToolTip(_("Set background to grey")) hbox_ctrls.Add(btn, 0, wx.ALIGN_LEFT | wx.LEFT, 4) bmp = GetNamedBitmap('Black') btn = wx.BitmapButton(self, ID_BLACK_BG, bmp, style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnSetImgBackground, btn) btn.SetToolTip(_("Set background to black")) hbox_ctrls.Add(btn, 0, wx.ALIGN_LEFT | wx.LEFT, 4) bmp = GetNamedBitmap('Checked') btn = wx.BitmapButton(self, ID_CHECK_BG, bmp, style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnSetImgBackground, btn) btn.SetToolTip(_("Set background to chekered pattern")) hbox_ctrls.Add(btn, 0, wx.ALIGN_LEFT | wx.LEFT, 4) hbox_ctrls.AddSpacer(7) bmp = GetNamedBitmap('NoFrame') btn = wx.BitmapButton(self, ID_NO_FRAME, bmp, style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnSetBorderMode, btn) btn.SetToolTip(_("No framing around image")) hbox_ctrls.Add(btn, 0, wx.ALIGN_LEFT | wx.LEFT, 4) bmp = GetNamedBitmap('BoxFrame') btn = wx.BitmapButton(self, ID_BOX_FRAME, bmp, style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnSetBorderMode, btn) btn.SetToolTip(_("Frame image with a box")) hbox_ctrls.Add(btn, 0, wx.ALIGN_LEFT | wx.LEFT, 4) bmp = GetNamedBitmap('CropFrame') btn = wx.BitmapButton(self, ID_CROP_FRAME, bmp, style=wx.BU_EXACTFIT | wx.BORDER_SIMPLE) self.Bind(wx.EVT_BUTTON, self.OnSetBorderMode, btn) btn.SetToolTip(_("Frame image with a dimmed background")) hbox_ctrls.Add(btn, 0, wx.ALIGN_LEFT | wx.LEFT, 4)
def __init__(self, parent, IDreglement=None): wx.Dialog.__init__(self, parent, -1, name="DLG_Impression_recu", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME) self.parent = parent self.IDreglement = IDreglement self.dictSave = {} self.listeAdresses = [] # Importation des données self.dictReglement = self.Importation() self.IDfamille = self.dictReglement["IDfamille"] # Bandeau intro = _( u"Vous pouvez ici éditer un reçu de règlement au format PDF. Pour un reçu standard, cliquez tout simplement sur 'Aperçu' ou sur 'Envoyer Par Email'." ) titre = _(u"Edition d'un reçu de règlement") self.ctrl_bandeau = CTRL_Bandeau.Bandeau( self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Imprimante.png") # Données self.staticbox_donnees_staticbox = wx.StaticBox( self, -1, _(u"Données")) self.ctrl_donnees = CTRL_Donnees(self) # Options self.staticbox_options_staticbox = wx.StaticBox( self, -1, _(u"Options")) self.label_modele = wx.StaticText(self, -1, _(u"Modèle :")) self.ctrl_modele = CTRL_Choix_modele.CTRL_Choice(self, categorie="reglement") self.bouton_gestion_modeles = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Mecanisme.png"), wx.BITMAP_TYPE_ANY)) self.label_signataire = wx.StaticText(self, -1, _(u"Signataire :")) self.ctrl_signataire = CTRL_Signataires(self) self.label_intro = wx.StaticText(self, -1, _(u"Intro :")) self.ctrl_intro = wx.CheckBox(self, -1, u"") self.ctrl_intro.SetValue(True) self.ctrl_texte_intro = wx.TextCtrl(self, -1, TEXTE_INTRO) self.label_prestations = wx.StaticText(self, -1, _(u"Prestations :")) self.ctrl_prestations = wx.CheckBox( self, -1, _(u"Afficher la liste des prestations payées avec ce règlement")) # Boutons 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 par Email"), cheminImage="Images/32x32/Emails_exp.png") self.bouton_ok = CTRL_Bouton_image.CTRL( self, texte=_(u"Aperçu"), cheminImage="Images/32x32/Apercu.png") self.bouton_annuler = CTRL_Bouton_image.CTRL( self, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonModeles, self.bouton_gestion_modeles) self.Bind(wx.EVT_CHECKBOX, self.OnCheckIntro, self.ctrl_intro) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonEmail, self.bouton_email) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler) self.Bind(wx.EVT_CLOSE, self.OnBoutonAnnuler) # Importation des paramètres perso dictValeursDefaut = { "intro_activer": True, "intro_texte": TEXTE_INTRO, "prestations_afficher": False, } dictParametres = UTILS_Parametres.ParametresCategorie( mode="get", categorie="impression_recu", dictParametres=dictValeursDefaut) # Init contrôles self.ctrl_intro.SetValue(dictParametres["intro_activer"]) if dictParametres["intro_texte"] != None: self.ctrl_texte_intro.SetValue(dictParametres["intro_texte"]) self.ctrl_prestations.SetValue(dictParametres["prestations_afficher"]) self.OnCheckIntro(None)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Top!", pos=wx.DefaultPosition, size=wx.Size(1024, 768), style=wx.CAPTION | wx.TAB_TRAVERSAL) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) self.SetFont( wx.Font(16, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "メイリオ")) self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT)) self.SetToolTip(u"How?") bSizer1 = wx.BoxSizer(wx.VERTICAL) self.bbb = wx.Button(self, wx.ID_ANY, u"Touch me", wx.DefaultPosition, wx.DefaultSize, 0) self.bbb.SetLabelMarkup(u"Touch me") self.bbb.SetFont( wx.Font(16, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "メイリオ")) bSizer1.Add(self.bbb, 0, wx.ALL, 5) self.mayu = wx.BitmapButton( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.Size(64, 64), wx.BU_AUTODRAW | wx.BORDER_NONE | wx.BU_BOTTOM | wx.BU_LEFT | wx.BU_RIGHT | wx.BU_TOP) self.mayu.SetBitmap(wx.Bitmap(u"images/640.jpg", wx.BITMAP_TYPE_ANY)) bSizer1.Add(self.mayu, 0, wx.ALL, 5) self.m_toggleBtn1 = wx.ToggleButton(self, wx.ID_ANY, u"とぐる", wx.DefaultPosition, wx.DefaultSize, 0) self.m_toggleBtn1.SetValue(True) self.m_toggleBtn1.SetFont( wx.Font(16, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_BOLD, False, "メイリオ")) self.m_toggleBtn1.SetForegroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNTEXT)) self.m_toggleBtn1.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)) bSizer1.Add(self.m_toggleBtn1, 0, wx.ALL, 5) self.m_checkBox1 = wx.CheckBox(self, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0) bSizer1.Add(self.m_checkBox1, 0, wx.ALL, 5) self.SetSizer(bSizer1) self.Layout() self.m_statusBar1 = self.CreateStatusBar(1, wx.STB_SIZEGRIP, wx.ID_ANY) self.Centre(wx.BOTH) # Connect Events self.bbb.Bind(wx.EVT_BUTTON, self.tako) self.mayu.Bind(wx.EVT_BUTTON, self.talk) self.m_checkBox1.Bind(wx.EVT_CHECKBOX, self.speech)
def __init__(self, *args, **kwds): # begin wxGlade: Principal.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.estatusbar = self.CreateStatusBar(1) self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Buscar Postulantes")) self.notebook_8 = wx.Notebook(self, wx.ID_ANY) self.notebook_8_pane_1 = wx.Panel(self.notebook_8, wx.ID_ANY) self.label_9 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Nombres:")) self.txtNombre = wx.TextCtrl(self.notebook_8_pane_1, wx.ID_ANY, "") self.label_5 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Fecha Nacimiento:")) self.cobDia = wx.ComboBox(self.notebook_8_pane_1, wx.ID_ANY, choices=[ _("01"), _("02"), _("03"), _("04"), _("05"), _("06"), _("07"), _("08"), _("09"), _("10"), _("11"), _("12"), _("13"), _("14"), _("15"), _("16"), _("17"), _("18"), _("19"), _("20"), _("21"), _("22"), _("23"), _("24"), _("25"), _("26"), _("27"), _("28"), _("29"), _("30"), _("31") ], style=wx.CB_READONLY) self.cobMes = wx.ComboBox(self.notebook_8_pane_1, wx.ID_ANY, choices=[ _("01"), _("02"), _("03"), _("04"), _("05"), _("06"), _("07"), _("08"), _("09"), _("10"), _("11"), _("12") ], style=wx.CB_READONLY) self.cobAno = wx.ComboBox(self.notebook_8_pane_1, wx.ID_ANY, choices=[], style=wx.CB_READONLY) self.label_13 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Estado:")) self.cobEstado = wx.ComboBox(self.notebook_8_pane_1, wx.ID_ANY, choices=[ _("Amazonas"), _("Anzoategui"), _("Apure"), _("Aragua"), _("Barinas"), _("Bolivar"), _("Carabobo"), _("Cojedes"), _("Delta Amacuro"), _("Distrito Capital"), _("Falcon"), _("Guarico"), _("Lara"), _("Merida"), _("Miranda"), _("Monagas"), _("Nueva Esparta"), _("Portuguesa"), _("Sucre"), _("Tachira"), _("Trujillo"), _("Vargas"), _("Yaracuy"), _("Zulia") ], style=wx.CB_READONLY) self.label_10 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Apellidos:")) self.txtApellidos = wx.TextCtrl(self.notebook_8_pane_1, wx.ID_ANY, "") self.label_6 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Edad:")) self.txtEdad = wx.TextCtrl(self.notebook_8_pane_1, wx.ID_ANY, "") self.label_14 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Municipio:")) self.cobMunicipio = wx.ComboBox(self.notebook_8_pane_1, wx.ID_ANY, choices=[]) self.label_11 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Cedula:")) self.txtCedula = wx.TextCtrl(self.notebook_8_pane_1, wx.ID_ANY, "") self.bitmap_button_1 = wx.BitmapButton( self.notebook_8_pane_1, wx.ID_ANY, wx.Bitmap("iconos/buscar.png", wx.BITMAP_TYPE_ANY)) self.label_7 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Correo:")) self.txtCorreo = wx.TextCtrl(self.notebook_8_pane_1, wx.ID_ANY, "") self.label_15 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Parroquia:")) self.cobParroquia = wx.ComboBox(self.notebook_8_pane_1, wx.ID_ANY, choices=[]) self.label_12 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Sexo:")) self.CobSexo = wx.ComboBox(self.notebook_8_pane_1, wx.ID_ANY, choices=[_("M"), _("F")], style=wx.CB_READONLY) self.label_8 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Telefono:")) self.txtTelefono = wx.TextCtrl(self.notebook_8_pane_1, wx.ID_ANY, "") self.label_16 = wx.StaticText(self.notebook_8_pane_1, wx.ID_ANY, _("Direccion:")) self.txtDireccion = wx.TextCtrl(self.notebook_8_pane_1, wx.ID_ANY, "") self.notebook_9 = wx.Notebook(self, wx.ID_ANY) self.notebook_9_pane_1 = wx.Panel(self.notebook_9, wx.ID_ANY) self.label_17 = wx.StaticText(self.notebook_9_pane_1, wx.ID_ANY, _("Nivel de Instruccion:")) self.cobEducacion = wx.ComboBox(self.notebook_9_pane_1, wx.ID_ANY, choices=[ _("PRIMARIA"), _("SECUNDARIA"), _("PREGRADO"), _("POSTGRADO") ], style=wx.CB_READONLY) self.label_20 = wx.StaticText(self.notebook_9_pane_1, wx.ID_ANY, _(u"A\u00f1o de Graduacion:")) self.txtAnoG = wx.TextCtrl(self.notebook_9_pane_1, wx.ID_ANY, "") self.label_24 = wx.StaticText(self.notebook_9_pane_1, wx.ID_ANY, _("Contabilidad Basica:")) self.cobContabilidad = wx.ComboBox(self.notebook_9_pane_1, wx.ID_ANY, choices=[_("SI"), _("NO")], style=wx.CB_READONLY) self.label_18 = wx.StaticText(self.notebook_9_pane_1, wx.ID_ANY, _("Titulo:")) self.txtTitulo = wx.TextCtrl(self.notebook_9_pane_1, wx.ID_ANY, "") self.label_21 = wx.StaticText(self.notebook_9_pane_1, wx.ID_ANY, _("Orden de Merito:")) self.txtMerito = wx.TextCtrl(self.notebook_9_pane_1, wx.ID_ANY, "") self.label_24_copy = wx.StaticText(self.notebook_9_pane_1, wx.ID_ANY, _("Ultimo Curso Realizado:")) self.txtCurso = wx.TextCtrl(self.notebook_9_pane_1, wx.ID_ANY, "") self.label_19 = wx.StaticText(self.notebook_9_pane_1, wx.ID_ANY, _("Idioma:")) self.cobIdioma = wx.ComboBox(self.notebook_9_pane_1, wx.ID_ANY, choices=[ _("INGLES"), _("OTROS"), _(u"CASTELLANO/INGLES"), _(u"CASTELLANO") ], style=wx.CB_READONLY) self.label_23 = wx.StaticText(self.notebook_9_pane_1, wx.ID_ANY, _("Maneja Paquete Office:")) self.cobOffice = wx.ComboBox(self.notebook_9_pane_1, wx.ID_ANY, choices=[_("SI"), _("NO")], style=wx.CB_READONLY) self.label_25 = wx.StaticText(self.notebook_9_pane_1, wx.ID_ANY, _("Servicio Militar:")) self.cobMilitar = wx.ComboBox(self.notebook_9_pane_1, wx.ID_ANY, choices=[_("SI"), _("NO")], style=wx.CB_READONLY) self.notebook_10 = wx.Notebook(self, wx.ID_ANY) self.notebook_10_pane_1 = wx.Panel(self.notebook_10, wx.ID_ANY) self.label_2 = wx.StaticText(self.notebook_10_pane_1, wx.ID_ANY, _("Trabaja en la empresa:")) self.cobSalario = wx.ComboBox(self.notebook_10_pane_1, wx.ID_ANY, choices=[_("SI"), _("NO")], style=wx.CB_READONLY) self.label_22 = wx.StaticText(self.notebook_10_pane_1, wx.ID_ANY, _("Cargo:")) self.cobCargo = wx.ComboBox(self.notebook_10_pane_1, wx.ID_ANY, choices=[ _("ADMINISTRACION"), _("ASISTENTE"), _("CAJERO"), _("CHOFER"), _("VIGILANTE"), _("GERENTE VENTAS"), _("ASISTENTE VENTAS"), _("SERVICIO AL CLIENTE"), _("RECURSOS HUMANOS") ], style=wx.CB_READONLY) self.label_26 = wx.StaticText(self.notebook_10_pane_1, wx.ID_ANY, _("Cargo Postulado:")) self.cobCargoP = wx.ComboBox(self.notebook_10_pane_1, wx.ID_ANY, choices=[ _("ADMINISTRACION"), _("ASISTENTE"), _("CAJERO"), _("CHOFER"), _("VIGILANTE"), _("GERENTE VENTAS"), _("ASISTENTE VENTAS"), _("SERVICIO AL CLIENTE"), _("RECURSOS HUMANOS") ], style=wx.CB_DROPDOWN) self.label_3 = wx.StaticText(self.notebook_10_pane_1, wx.ID_ANY, _("Empresa donde trabajo:")) self.txtEmpresaT = wx.TextCtrl(self.notebook_10_pane_1, wx.ID_ANY, "") self.label_4 = wx.StaticText(self.notebook_10_pane_1, wx.ID_ANY, _(u"A\u00f1os de trabajo:")) self.cobAtrabajo = wx.ComboBox( self.notebook_10_pane_1, wx.ID_ANY, choices=[_("0-2"), _("2-4"), _("4-6"), _("6+")], style=wx.CB_READONLY) self.button_1 = wx.Button(self, wx.ID_ANY, _("Modificar")) self.button_2 = wx.Button(self, wx.ID_ANY, _("Limpiar")) f.Ano(self) self.__set_properties() self.txtCedula.SetValidator(ContieneDatos()) #activa la validacion self.__do_layout() self.Bind(wx.EVT_TEXT, self.OnLetras, self.txtNombre) self.Bind(wx.EVT_TEXT, self.OnEdad, self.cobAno) self.Bind(wx.EVT_TEXT, self.OnEstado, self.cobEstado) self.Bind(wx.EVT_TEXT, self.OnLetras, self.txtApellidos) self.Bind(wx.EVT_TEXT, self.OnMunicipio, self.cobMunicipio) self.Bind(wx.EVT_TEXT, self.OnCedula, self.txtCedula) self.Bind(wx.EVT_BUTTON, self.OnBuscar, self.bitmap_button_1) self.Bind(wx.EVT_TEXT, self.OnCorreo, self.txtCorreo) self.Bind(wx.EVT_TEXT, self.OnParroquia, self.cobParroquia) self.Bind(wx.EVT_TEXT, self.OnNumeros, self.txtTelefono) self.Bind(wx.EVT_TEXT_ENTER, self.OnNumeros, self.txtTelefono) self.Bind(wx.EVT_TEXT, self.OnNumeros, self.txtMerito) self.Bind(wx.EVT_TEXT, self.OnNumeros, self.txtAnoG) self.Bind(wx.EVT_TEXT, self.OnTEmpresa, self.cobSalario) self.Bind(wx.EVT_BUTTON, self.OnGuardar, self.button_1) self.Bind(wx.EVT_BUTTON, self.OnLimpiar, self.button_2)
def __init__(self, parent, filtres=[]): wx.Panel.__init__(self, parent, id=-1, name="CTRL_Liste_inscriptions", style=wx.TAB_TRAVERSAL) self.parent = parent # Liste des locations self.listviewAvecFooter = OL_Liste_inscriptions.ListviewAvecFooter( self, kwargs={"checkColonne": True}) self.ctrl_inscriptions = self.listviewAvecFooter.GetListview() # Commandes de liste self.bouton_apercu = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Apercu.png"), wx.BITMAP_TYPE_ANY)) self.bouton_email = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Emails_exp.png"), wx.BITMAP_TYPE_ANY)) self.bouton_supprimer = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Supprimer.png"), wx.BITMAP_TYPE_ANY)) self.bouton_liste_apercu = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Apercu.png"), wx.BITMAP_TYPE_ANY)) self.bouton_liste_imprimer = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Imprimante.png"), wx.BITMAP_TYPE_ANY)) self.bouton_liste_export_texte = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Texte2.png"), wx.BITMAP_TYPE_ANY)) self.bouton_liste_export_excel = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Excel.png"), wx.BITMAP_TYPE_ANY)) # Options de liste self.ctrl_recherche = OL_Liste_inscriptions.CTRL_Outils( self, listview=self.ctrl_inscriptions, afficherCocher=True) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonApercu, self.bouton_apercu) self.Bind(wx.EVT_BUTTON, self.OnBoutonEmail, self.bouton_email) self.Bind(wx.EVT_BUTTON, self.OnBoutonSupprimer, self.bouton_supprimer) self.Bind(wx.EVT_BUTTON, self.OnBoutonListeApercu, self.bouton_liste_apercu) self.Bind(wx.EVT_BUTTON, self.OnBoutonListeImprimer, self.bouton_liste_imprimer) self.Bind(wx.EVT_BUTTON, self.OnBoutonListeExportTexte, self.bouton_liste_export_texte) self.Bind(wx.EVT_BUTTON, self.OnBoutonListeExportExcel, self.bouton_liste_export_excel)
def __init__(self, parent, IDfamille=None): wx.Dialog.__init__(self, parent, id=-1, name="fiche_famille", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME) self.parent = parent self.IDfamille = IDfamille self.nouvelleFiche = False if IDfamille == None: self.CreateIDfamille() self.nouvelleFiche = True # Adapte taille Police pour Linux from Utils import UTILS_Linux UTILS_Linux.AdaptePolice(self) # Composition self.sizer_composition_staticbox = wx.StaticBox( self, -1, _(u"Composition de la famille")) self.ctrl_composition = CTRL_Composition.Notebook( self, IDfamille=self.IDfamille) self.bouton_ajouter = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ajouter.png"), wx.BITMAP_TYPE_ANY)) self.bouton_modifier = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Modifier.png"), wx.BITMAP_TYPE_ANY)) self.bouton_supprimer = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Supprimer.png"), wx.BITMAP_TYPE_ANY)) self.bouton_calendrier = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Calendrier.png"), wx.BITMAP_TYPE_ANY)) self.bouton_liens_famille = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Composition.png"), wx.BITMAP_TYPE_ANY)) # Notebook self.notebook = Notebook(self, IDfamille=self.IDfamille) # Boutons de commande self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_outils = CTRL_Bouton_image.CTRL( self, texte=_(u"Outils"), cheminImage="Images/32x32/Configuration.png") self.bouton_consommations = CTRL_Bouton_image.CTRL( self, texte=_(u"Consommations"), cheminImage="Images/32x32/Calendrier.png") self.bouton_saisie_reglement = CTRL_Bouton_image.CTRL( self, texte=_(u"Saisir un règlement"), cheminImage="Images/32x32/Reglement.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, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonAjouterIndividu, self.bouton_ajouter) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonOutils, self.bouton_outils) self.Bind(wx.EVT_BUTTON, self.OnBoutonLiens, self.bouton_liens_famille) self.Bind(wx.EVT_BUTTON, self.OnBoutonCalendrier, self.bouton_calendrier) self.Bind(wx.EVT_BUTTON, self.OnBoutonConsommations, self.bouton_consommations) self.Bind(wx.EVT_BUTTON, self.OnBoutonSaisieReglement, self.bouton_saisie_reglement) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler) self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(wx.EVT_BUTTON, self.OnBoutonAjouter, self.bouton_ajouter) self.Bind(wx.EVT_BUTTON, self.OnBoutonModifier, self.bouton_modifier) self.Bind(wx.EVT_BUTTON, self.OnBoutonSupprimer, self.bouton_supprimer) self.notebook.SetFocus() # Si c'est une nouvelle fiche, on propose immédiatement la création d'un individu if self.nouvelleFiche == True: wx.CallAfter(self.CreerPremierIndividu) # MAJ de l'onglet Informations self.notebook.GetPageAvecCode("informations").MAJ() # MAJ CTRL composition self.ctrl_composition.MAJ()
def __init__(self, parent, pname, ps, dname): wx.Dialog.__init__(self, parent, wx.ID_ANY, "Upload to %s" % pname) self.parent = parent self.ps = ps self.pname = pname self.fn = dname sizer = wx.BoxSizer(wx.VERTICAL) btnsizer = wx.BoxSizer(wx.HORIZONTAL) fl = ps.gfile.listFiles() if fl is None: wx.CallAfter(self.notConnected) return flist = [x[0] for x in fl] self.ch = wx.Choice(self, wx.ID_ANY, choices=["<none>"] + sorted(flist), size=(300, -1)) self.ch.SetSelection(0) self.Bind(wx.EVT_CHOICE, self.onChoice, self.ch) self.entry = wx.TextCtrl(self, wx.ID_ANY, "%s" % self.fn, size=(300, -1)) sizer.AddSpacer(20) sizer.Add(wx.StaticText(self, wx.ID_ANY, "Choose an existing file:"), 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.LEFT, 10) sizer.Add( self.ch, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL | wx.LEFT | wx.RIGHT, 10) sizer.AddSpacer(20) sizer.Add(wx.StaticText(self, wx.ID_ANY, "Or enter a new name:"), 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.LEFT, 10) sizer.Add( self.entry, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL | wx.LEFT | wx.RIGHT, 10) sizer.AddSpacer(20) btn = wx.BitmapButton(self, wx.ID_ANY, self.parent.images.pngOk, size=BUTTONDIM) btn.SetToolTip("Upload") btnsizer.Add(btn) self.Bind(wx.EVT_BUTTON, self.onOk, btn) btnsizer.AddSpacer(30) btn = wx.BitmapButton(self, wx.ID_ANY, self.parent.images.pngCancel, size=BUTTONDIM) btn.SetToolTip("Cancel Upload") btnsizer.Add(btn) self.Bind(wx.EVT_BUTTON, self.onCancel, btn) sizer.Add( btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) sizer.AddSpacer(20) self.SetSizer(sizer) sizer.Fit(self)
def __init__(self, parent, typeOperation="credit", track=None, dateOperation=None): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE) self.parent = parent self.typeOperation = typeOperation self.track = track self.IDventilation = None self.label_date_budget = wx.StaticText(self, wx.ID_ANY, _(u"Date budget :")) self.ctrl_date_budget = CTRL_Saisie_date.Date2(self) self.ctrl_date_budget.SetDate(dateOperation) self.label_analytique = wx.StaticText(self, wx.ID_ANY, _(u"Analytique :")) self.ctrl_analytique = CTRL_Analytique(self) self.ctrl_analytique.SetMinSize((300, -1)) self.label_categorie = wx.StaticText(self, wx.ID_ANY, _(u"Catégorie :")) self.ctrl_categorie = CTRL_Categorie(self, typeOperation=typeOperation) self.label_libelle = wx.StaticText(self, wx.ID_ANY, _(u"Libellé :")) self.ctrl_libelle = wx.TextCtrl(self, wx.ID_ANY, u"") self.label_montant = wx.StaticText(self, wx.ID_ANY, _(u"Montant :")) self.ctrl_montant = CTRL_Saisie_euros.CTRL(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, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png") self.bouton_analytiques = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Mecanisme.png"), wx.BITMAP_TYPE_ANY)) self.bouton_categories = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Mecanisme.png"), wx.BITMAP_TYPE_ANY)) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonCategories, self.bouton_categories) self.Bind(wx.EVT_BUTTON, self.OnBoutonAnalytiques, self.bouton_analytiques) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler) if self.typeOperation == "credit": titre = _(u"Ventilation d'une opération au crédit") elif self.typeOperation == "debit": titre = _(u"Ventilation d'une opération au débit") else: titre = u"" self.SetTitle(titre) if self.track != None: self.Importation() wx.CallAfter(self.ctrl_date_budget.SetInsertionPoint, 0)
def __init__(self, parent, categorie=None): wx.Dialog.__init__(self, parent, -1, name="DLG_modeles_docs", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.parent = parent # Bandeau titre = _(u"Modèles d'Emails") intro = _(u"Vous pouvez paramétrer ici des modèles d'Emails.") self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau( self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Emails_modele.png") # Catégorie self.staticbox_categorie_staticbox = wx.StaticBox( self, -1, _(u"Catégorie")) self.label_categorie = wx.StaticText(self, -1, _(u"Catégorie :")) self.ctrl_categorie = CTRL_Categorie(self) if categorie != None: self.ctrl_categorie.SetCategorie(categorie) # Modèles self.staticbox_modeles_staticbox = wx.StaticBox( self, -1, _(u"Modèles disponibles")) self.ctrl_modeles = OL_Modeles_emails.ListView( self, id=-1, style=wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_SINGLE_SEL | wx.LC_HRULES | wx.LC_VRULES) self.bouton_ajouter = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Ajouter.png"), wx.BITMAP_TYPE_ANY)) self.bouton_modifier = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Modifier.png"), wx.BITMAP_TYPE_ANY)) self.bouton_supprimer = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Supprimer.png"), wx.BITMAP_TYPE_ANY)) self.bouton_dupliquer = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Dupliquer.png"), wx.BITMAP_TYPE_ANY)) self.bouton_defaut = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Ok.png"), wx.BITMAP_TYPE_ANY)) ## self.hyper_telecharger = Hyperlien(self, label=_(u"Télécharger de nouveaux modèles"), infobulle=_(u"Cliquez ici pour télécharger de nouveaux modèles de documents sur internet"), URL="telecharger") ## self.label_separation = wx.StaticText(self, -1, u"|") ## self.hyper_proposer = Hyperlien(self, label=_(u"Proposer un modèle"), infobulle=_(u"Cliquez ici pour proposer un modèle à la communauté"), URL="proposer") # Boutons self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.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_CHOICE, self.OnChoixCategorie, self.ctrl_categorie) self.Bind(wx.EVT_BUTTON, self.OnBoutonAjouter, self.bouton_ajouter) self.Bind(wx.EVT_BUTTON, self.OnBoutonModifier, self.bouton_modifier) self.Bind(wx.EVT_BUTTON, self.OnBoutonSupprimer, self.bouton_supprimer) self.Bind(wx.EVT_BUTTON, self.OnBoutonDupliquer, self.bouton_dupliquer) self.Bind(wx.EVT_BUTTON, self.OnBoutonDefaut, self.bouton_defaut) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonFermer, self.bouton_fermer) # Init contrôle self.OnChoixCategorie(None)
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"Avant de générer les factures d'une activité de type P.S.U., vous devez commencer par générer ici les mensualités pour le mois souhaité. Notez qu'il est est possible de saisir manuellement un nombre d'heures de régularisation avant de valider la génération.") titre = _(u"Validation des contrats P.S.U.") self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau(self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Contrat.png") # Paramètres self.box_parametres_staticbox = wx.StaticBox(self, -1, _(u"Paramètres")) self.label_mois = wx.StaticText(self, -1, _(u"Mois :")) self.ctrl_mois = wx.Choice(self, -1, choices=LISTE_MOIS) self.spin_mois = wx.SpinButton(self, -1, size=(18, 20), style=wx.SP_VERTICAL) self.spin_mois.SetRange(-1, 1) self.ctrl_annee = wx.SpinCtrl(self, -1, size=(60, -1), min=2000, max=2999) self.label_activite = wx.StaticText(self, -1, _(u"Activité :")) self.ctrl_activite = CTRL_Activite(self) # Contrats self.box_contrats_staticbox = wx.StaticBox(self, -1, _(u"Mensualités")) self.listviewAvecFooter = OL_Contratspsu_validation.ListviewAvecFooter(self) self.ctrl_contrats = self.listviewAvecFooter.GetListview() self.ctrl_recherche = OL_Contratspsu_validation.CTRL_Outils(self, listview=self.ctrl_contrats, afficherCocher=True) self.bouton_detail = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/zoom_plus.png"), wx.BITMAP_TYPE_ANY)) self.bouton_supprimer = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Supprimer.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.label_info = wx.StaticText(self, -1, _(u"Remarque : Vous pouvez double-cliquer dans la colonne 'H. régular.' pour saisir un nombre positif ou négatif d'heures de régularisation.")) self.label_info.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL)) self.label_info.SetForegroundColour(wx.Colour(180, 180, 180)) # 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, id=-1, texte=_(u"Valider"), cheminImage="Images/32x32/Valider.png") self.bouton_annuler = CTRL_Bouton_image.CTRL(self, id=-1, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_CHOICE, self.OnChangeParametres, self.ctrl_mois) self.Bind(wx.EVT_SPIN, self.OnSpinMois, self.spin_mois) self.Bind(wx.EVT_SPINCTRL, self.OnChangeParametres, self.ctrl_annee) self.Bind(wx.EVT_CHOICE, self.OnChangeParametres, self.ctrl_activite) self.Bind(wx.EVT_BUTTON, self.ctrl_contrats.Detail, self.bouton_detail) self.Bind(wx.EVT_BUTTON, self.ctrl_contrats.Supprimer, self.bouton_supprimer) self.Bind(wx.EVT_BUTTON, self.ctrl_contrats.Apercu, self.bouton_apercu) self.Bind(wx.EVT_BUTTON, self.ctrl_contrats.Imprimer, self.bouton_imprimer) self.Bind(wx.EVT_BUTTON, self.ctrl_contrats.ExportTexte, self.bouton_texte) self.Bind(wx.EVT_BUTTON, self.ctrl_contrats.ExportExcel, self.bouton_excel) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler) self.Bind(wx.EVT_CLOSE, self.OnBoutonAnnuler) # Init date = datetime.date.today() self.SetMois(mois=date.month, annee=date.year) self.OnChangeParametres()
def __init__(self, parent, settings, images, macroOrder, macroFiles, closehandler): self.parent = parent self.settings = settings self.macroOrder = macroOrder self.macroFiles = macroFiles self.closehandler = closehandler wx.Dialog.__init__(self, parent, wx.ID_ANY, "Manage Macros", size=(800, 804)) self.SetBackgroundColour("white") dsizer = wx.BoxSizer(wx.HORIZONTAL) dsizer.AddSpacer(10) self.editDlg = None self.images = images leftsizer = wx.BoxSizer(wx.VERTICAL) leftsizer.AddSpacer(10) self.lbQueue = MacroListCtrl(self, macroOrder, macroFiles, self.images) leftsizer.Add(self.lbQueue) leftsizer.AddSpacer(10) lbbtns = wx.BoxSizer(wx.VERTICAL) lbbtns.AddSpacer(10) self.bAdd = wx.BitmapButton(self, wx.ID_ANY, self.images.pngAdd, size=BUTTONDIM) self.bAdd.SetToolTip("Add new macros") self.Bind(wx.EVT_BUTTON, self.doAdd, self.bAdd) lbbtns.Add(self.bAdd) self.bDel = wx.BitmapButton(self, wx.ID_ANY, self.images.pngDel, size=BUTTONDIM) self.bDel.SetToolTip("Delete a macro") lbbtns.Add(self.bDel) self.Bind(wx.EVT_BUTTON, self.doDel, self.bDel) self.bDel.Enable(False) lbbtns.AddSpacer(20) self.bUp = wx.BitmapButton(self, wx.ID_ANY, self.images.pngUp, size=BUTTONDIM) self.bUp.SetToolTip("Move selected macro up in list") lbbtns.Add(self.bUp) self.Bind(wx.EVT_BUTTON, self.doUp, self.bUp) self.bUp.Enable(False) self.bDown = wx.BitmapButton(self, wx.ID_ANY, self.images.pngDown, size=BUTTONDIM) self.bDown.SetToolTip("Move selected macro down in list") lbbtns.Add(self.bDown) self.Bind(wx.EVT_BUTTON, self.doDown, self.bDown) self.bDown.Enable(False) lbbtns.AddSpacer(20) self.bRename = wx.BitmapButton(self, wx.ID_ANY, self.images.pngRename, size=BUTTONDIM) self.bRename.SetToolTip("Rename the selected macro") lbbtns.Add(self.bRename) self.Bind(wx.EVT_BUTTON, self.doRename, self.bRename) self.bRename.Enable(False) self.bChgFile = wx.BitmapButton(self, wx.ID_ANY, self.images.pngChangefile, size=BUTTONDIM) self.bChgFile.SetToolTip("Change the selected macro file") lbbtns.Add(self.bChgFile) self.Bind(wx.EVT_BUTTON, self.doChangeFile, self.bChgFile) self.bChgFile.Enable(False) lbbtns.AddSpacer(20) self.bEditSel = wx.BitmapButton(self, wx.ID_ANY, self.images.pngEdit, size=BUTTONDIM) self.bEditSel.SetToolTip("Edit the selected macro file") lbbtns.Add(self.bEditSel) self.Bind(wx.EVT_BUTTON, self.doEditSelected, self.bEditSel) self.bEditSel.Enable(False) self.bNewFile = wx.BitmapButton(self, wx.ID_ANY, self.images.pngNewfile, size=BUTTONDIM) self.bNewFile.SetToolTip("New G Code file") lbbtns.Add(self.bNewFile) self.Bind(wx.EVT_BUTTON, self.doNewFile, self.bNewFile) lbbtns.AddSpacer(10) btnsizer = wx.BoxSizer(wx.HORIZONTAL) self.bSave = wx.BitmapButton(self, wx.ID_ANY, self.images.pngOk, size=BUTTONDIM) self.bSave.SetToolTip("Save Changes") btnsizer.Add(self.bSave) self.Bind(wx.EVT_BUTTON, self.doSave, self.bSave) self.bSave.Enable(False) btnsizer.AddSpacer(5) self.bCancel = wx.BitmapButton(self, wx.ID_ANY, self.images.pngCancel, size=BUTTONDIM) self.bCancel.SetToolTip("Exit without saving") btnsizer.Add(self.bCancel) self.Bind(wx.EVT_BUTTON, self.doCancel, self.bCancel) leftsizer.Add( btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) dsizer.Add(leftsizer) dsizer.AddSpacer(10) dsizer.Add(lbbtns) dsizer.AddSpacer(10) self.SetSizer(dsizer) dsizer.Fit(self)
def __init__(self, parent, frame): wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize) self._frame = frame vert = wx.BoxSizer(wx.VERTICAL) s1 = wx.BoxSizer(wx.HORIZONTAL) self._border_size = wx.SpinCtrl(self, ID_PaneBorderSize, "", wx.DefaultPosition, wx.Size(50,20)) s1.Add((1, 1), 1, wx.EXPAND) s1.Add(wx.StaticText(self, -1, "Pane Border Size:")) s1.Add(self._border_size) s1.Add((1, 1), 1, wx.EXPAND) s1.SetItemMinSize(1, (180, 20)) #vert.Add(s1, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) s2 = wx.BoxSizer(wx.HORIZONTAL) self._sash_size = wx.SpinCtrl(self, ID_SashSize, "", wx.DefaultPosition, wx.Size(50,20)) s2.Add((1, 1), 1, wx.EXPAND) s2.Add(wx.StaticText(self, -1, "Sash Size:")) s2.Add(self._sash_size) s2.Add((1, 1), 1, wx.EXPAND) s2.SetItemMinSize(1, (180, 20)) #vert.Add(s2, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) s3 = wx.BoxSizer(wx.HORIZONTAL) self._caption_size = wx.SpinCtrl(self, ID_CaptionSize, "", wx.DefaultPosition, wx.Size(50,20)) s3.Add((1, 1), 1, wx.EXPAND) s3.Add(wx.StaticText(self, -1, "Caption Size:")) s3.Add(self._caption_size) s3.Add((1, 1), 1, wx.EXPAND) s3.SetItemMinSize(1, (180, 20)) #vert.Add(s3, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) #vert.Add(1, 1, 1, wx.EXPAND) b = self.CreateColorBitmap(wx.BLACK) s4 = wx.BoxSizer(wx.HORIZONTAL) self._background_color = wx.BitmapButton(self, ID_BackgroundColor, b, wx.DefaultPosition, wx.Size(50,25)) s4.Add((1, 1), 1, wx.EXPAND) s4.Add(wx.StaticText(self, -1, "Background Color:")) s4.Add(self._background_color) s4.Add((1, 1), 1, wx.EXPAND) s4.SetItemMinSize(1, (180, 20)) s5 = wx.BoxSizer(wx.HORIZONTAL) self._sash_color = wx.BitmapButton(self, ID_SashColor, b, wx.DefaultPosition, wx.Size(50,25)) s5.Add((1, 1), 1, wx.EXPAND) s5.Add(wx.StaticText(self, -1, "Sash Color:")) s5.Add(self._sash_color) s5.Add((1, 1), 1, wx.EXPAND) s5.SetItemMinSize(1, (180, 20)) s6 = wx.BoxSizer(wx.HORIZONTAL) self._inactive_caption_color = wx.BitmapButton(self, ID_InactiveCaptionColor, b, wx.DefaultPosition, wx.Size(50,25)) s6.Add((1, 1), 1, wx.EXPAND) s6.Add(wx.StaticText(self, -1, "Normal Caption:")) s6.Add(self._inactive_caption_color) s6.Add((1, 1), 1, wx.EXPAND) s6.SetItemMinSize(1, (180, 20)) s7 = wx.BoxSizer(wx.HORIZONTAL) self._inactive_caption_gradient_color = wx.BitmapButton(self, ID_InactiveCaptionGradientColor, b, wx.DefaultPosition, wx.Size(50,25)) s7.Add((1, 1), 1, wx.EXPAND) s7.Add(wx.StaticText(self, -1, "Normal Caption Gradient:")) s7.Add(self._inactive_caption_gradient_color) s7.Add((1, 1), 1, wx.EXPAND) s7.SetItemMinSize(1, (180, 20)) s8 = wx.BoxSizer(wx.HORIZONTAL) self._inactive_caption_text_color = wx.BitmapButton(self, ID_InactiveCaptionTextColor, b, wx.DefaultPosition, wx.Size(50,25)) s8.Add((1, 1), 1, wx.EXPAND) s8.Add(wx.StaticText(self, -1, "Normal Caption Text:")) s8.Add(self._inactive_caption_text_color) s8.Add((1, 1), 1, wx.EXPAND) s8.SetItemMinSize(1, (180, 20)) s9 = wx.BoxSizer(wx.HORIZONTAL) self._active_caption_color = wx.BitmapButton(self, ID_ActiveCaptionColor, b, wx.DefaultPosition, wx.Size(50,25)) s9.Add((1, 1), 1, wx.EXPAND) s9.Add(wx.StaticText(self, -1, "Active Caption:")) s9.Add(self._active_caption_color) s9.Add((1, 1), 1, wx.EXPAND) s9.SetItemMinSize(1, (180, 20)) s10 = wx.BoxSizer(wx.HORIZONTAL) self._active_caption_gradient_color = wx.BitmapButton(self, ID_ActiveCaptionGradientColor, b, wx.DefaultPosition, wx.Size(50,25)) s10.Add((1, 1), 1, wx.EXPAND) s10.Add(wx.StaticText(self, -1, "Active Caption Gradient:")) s10.Add(self._active_caption_gradient_color) s10.Add((1, 1), 1, wx.EXPAND) s10.SetItemMinSize(1, (180, 20)) s11 = wx.BoxSizer(wx.HORIZONTAL) self._active_caption_text_color = wx.BitmapButton(self, ID_ActiveCaptionTextColor, b, wx.DefaultPosition, wx.Size(50,25)) s11.Add((1, 1), 1, wx.EXPAND) s11.Add(wx.StaticText(self, -1, "Active Caption Text:")) s11.Add(self._active_caption_text_color) s11.Add((1, 1), 1, wx.EXPAND) s11.SetItemMinSize(1, (180, 20)) s12 = wx.BoxSizer(wx.HORIZONTAL) self._border_color = wx.BitmapButton(self, ID_BorderColor, b, wx.DefaultPosition, wx.Size(50,25)) s12.Add((1, 1), 1, wx.EXPAND) s12.Add(wx.StaticText(self, -1, "Border Color:")) s12.Add(self._border_color) s12.Add((1, 1), 1, wx.EXPAND) s12.SetItemMinSize(1, (180, 20)) s13 = wx.BoxSizer(wx.HORIZONTAL) self._gripper_color = wx.BitmapButton(self, ID_GripperColor, b, wx.DefaultPosition, wx.Size(50,25)) s13.Add((1, 1), 1, wx.EXPAND) s13.Add(wx.StaticText(self, -1, "Gripper Color:")) s13.Add(self._gripper_color) s13.Add((1, 1), 1, wx.EXPAND) s13.SetItemMinSize(1, (180, 20)) grid_sizer = wx.GridSizer(cols=2) grid_sizer.SetHGap(5) grid_sizer.Add(s1) grid_sizer.Add(s4) grid_sizer.Add(s2) grid_sizer.Add(s5) grid_sizer.Add(s3) grid_sizer.Add(s13) grid_sizer.Add((1, 1)) grid_sizer.Add(s12) grid_sizer.Add(s6) grid_sizer.Add(s9) grid_sizer.Add(s7) grid_sizer.Add(s10) grid_sizer.Add(s8) grid_sizer.Add(s11) cont_sizer = wx.BoxSizer(wx.VERTICAL) cont_sizer.Add(grid_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(cont_sizer) self.GetSizer().SetSizeHints(self) self._border_size.SetValue(frame.GetDockArt().GetMetric(wx.aui.AUI_DOCKART_PANE_BORDER_SIZE)) self._sash_size.SetValue(frame.GetDockArt().GetMetric(wx.aui.AUI_DOCKART_SASH_SIZE)) self._caption_size.SetValue(frame.GetDockArt().GetMetric(wx.aui.AUI_DOCKART_CAPTION_SIZE)) self.UpdateColors() self.Bind(wx.EVT_SPINCTRL, self.OnPaneBorderSize, id=ID_PaneBorderSize) self.Bind(wx.EVT_SPINCTRL, self.OnSashSize, id=ID_SashSize) self.Bind(wx.EVT_SPINCTRL, self.OnCaptionSize, id=ID_CaptionSize) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_BackgroundColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_SashColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionGradientColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionTextColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionGradientColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionTextColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_BorderColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_GripperColor)
def __init__(self, parent, type="individu"): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.parent = parent self.type = type intro = _( u"Vous pouvez ici concevoir des questionnaires personnalisés pour les fiches individuelles. Commencez par créer des catégories puis paramétrez des questions basées sur les contrôles de votre choix en fonction des données à saisir : texte, liste, entier, etc..." ) titre = _(u"Questionnaires") self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau( self, titre=titre, texte=intro, hauteurHtml=30, nomImage=Chemins.GetStaticPath("Images/32x32/Questionnaire.png")) # Questionnaire self.box_questionnaire_staticbox = wx.StaticBox( self, -1, _(u"Questionnaire")) self.ctrl_questionnaire = CTRL_Questionnaire.CTRL( self, type=type, menuActif=True, afficherInvisibles=True) self.bouton_ajouter = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ajouter.png"), wx.BITMAP_TYPE_ANY)) self.bouton_modifier = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Modifier.png"), wx.BITMAP_TYPE_ANY)) self.bouton_supprimer = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Supprimer.png"), wx.BITMAP_TYPE_ANY)) self.bouton_monter = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Fleche_haut.png"), wx.BITMAP_TYPE_ANY)) self.bouton_descendre = wx.BitmapButton( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Fleche_bas.png"), wx.BITMAP_TYPE_ANY)) # Boutons self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage=Chemins.GetStaticPath("Images/32x32/Aide.png")) self.bouton_fermer = CTRL_Bouton_image.CTRL( self, texte=_(u"Fermer"), cheminImage=Chemins.GetStaticPath("Images/32x32/Fermer.png")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonAjouter, self.bouton_ajouter) self.Bind(wx.EVT_BUTTON, self.OnBoutonModifier, self.bouton_modifier) self.Bind(wx.EVT_BUTTON, self.OnBoutonSupprimer, self.bouton_supprimer) self.Bind(wx.EVT_BUTTON, self.OnBoutonMonter, self.bouton_monter) self.Bind(wx.EVT_BUTTON, self.OnBoutonDescendre, self.bouton_descendre) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonFermer, self.bouton_fermer) # Init contrôles self.ctrl_questionnaire.MAJ()
def __init__(self, parent, track_mensualite=None, titre_detail=""): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.parent = parent self.track_mensualite = track_mensualite intro = _( u"Vous pouvez consulter ici le détail de la mensualité sélectionnée avec un regroupement par date." ) titre = _(u"Détail de la mensualité") self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau( self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Contrat.png") # dates self.box_dates_staticbox = wx.StaticBox( self, -1, _(u"Détail de la mensualité de %s pour %s" % (titre_detail, track_mensualite.individu_nom_complet))) self.listviewAvecFooter = OL_Contratspsu_detail.ListviewAvecFooter( self) self.ctrl_dates = self.listviewAvecFooter.GetListview() self.ctrl_recherche = OL_Contratspsu_detail.CTRL_Outils( self, listview=self.ctrl_dates) 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)) # Boutons self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_annuler = CTRL_Bouton_image.CTRL( self, id=-1, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.ctrl_dates.Apercu, self.bouton_apercu) self.Bind(wx.EVT_BUTTON, self.ctrl_dates.Imprimer, self.bouton_imprimer) self.Bind(wx.EVT_BUTTON, self.ctrl_dates.ExportTexte, self.bouton_texte) self.Bind(wx.EVT_BUTTON, self.ctrl_dates.ExportExcel, self.bouton_excel) self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler) self.Bind(wx.EVT_CLOSE, self.OnBoutonAnnuler) # Init self.ctrl_dates.SetDonnees(self.track_mensualite)
def __init__(self, parent, id=-1): """Constructor""" wx.Panel.__init__(self, parent, id, size=(800, 480)) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) # timer for updating dictionary self.mcupdater = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.DictUpdater, self.mcupdater) # timer for warning self.timerx = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.MotorWarn, self.timerx) self.timerx.Start(10) # timer # 1 self.timer1 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatemtl, self.timer1) self.timer1.Start(10) # 2 self.timer2 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatemtr, self.timer2) self.timer2.Start(10) # 3 self.timer3 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatemct, self.timer3) self.timer3.Start(10) # 4 self.timer4 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatemc2mrc, self.timer4) self.timer4.Start(10) # 5 self.timer5 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatemc2mlc, self.timer5) self.timer5.Start(10) # 6 self.timer6 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatemc2bc, self.timer6) self.timer6.Start(10) # title title = wx.StaticText(self, -1, 'Motor Controller') title.SetFont( wx.Font(24, wx.FONTFAMILY_DEFAULT, wx.BOLD, wx.FONTWEIGHT_BOLD)) title.SetForegroundColour('white') # label declarations self.labelOne = wx.StaticText(self, -1, 'Motor Controller Temp. : ') self.labelTwo = wx.StaticText(self, -1, 'Motor(L) Temp. : ') self.labelThree = wx.StaticText(self, -1, 'Motor(R) Temp. : ') self.labelFour = wx.StaticText(self, -1, 'MC to Motor(L) : ') self.labelFive = wx.StaticText(self, -1, 'MC to Motor(R) : ') self.labelSix = wx.StaticText(self, -1, 'MC to BMS : ') # label describers self.labelOne.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelOne.SetForegroundColour('white') self.labelTwo.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelTwo.SetForegroundColour('white') self.labelThree.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelThree.SetForegroundColour('white') self.labelFour.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelFour.SetForegroundColour('white') self.labelFive.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelFive.SetForegroundColour('white') self.labelSix.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelSix.SetForegroundColour('white') # button creators self.wbutton0 = wx.Button(self, -1, '- M P P T -') self.wbutton1 = wx.Button(self, -1, '- B M S -') self.wbutton2 = wx.Button(self, -1, '- M O T O R -') self.wbutton3 = wx.Button(self, -1, '- G E N E R A L -') # image button declaration imageFile = "mppt.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() MPPTBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnMPPT, MPPTBtn) imageFile = "battery.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() BatteryBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnBattery, BatteryBtn) imageFile = "motor.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() MotorBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, None, MotorBtn) imageFile = "general.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() GenBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnGeneral, GenBtn) # sizer generators topSizer = wx.BoxSizer(wx.VERTICAL) toolBtn = wx.BoxSizer(wx.HORIZONTAL) toolBtn_h = wx.BoxSizer(wx.VERTICAL) warnSizer = wx.BoxSizer(wx.HORIZONTAL) warnSizer_h = wx.BoxSizer(wx.VERTICAL) titleSizer = wx.BoxSizer(wx.HORIZONTAL) inputOneSizer = wx.BoxSizer(wx.HORIZONTAL) inputTwoSizer = wx.BoxSizer(wx.HORIZONTAL) inputThreeSizer = wx.BoxSizer(wx.HORIZONTAL) inputFourSizer = wx.BoxSizer(wx.HORIZONTAL) inputFiveSizer = wx.BoxSizer(wx.HORIZONTAL) inputSixSizer = wx.BoxSizer(wx.HORIZONTAL) toolBtn.Add(MPPTBtn, 0, wx.ALL, 5) toolBtn.Add(BatteryBtn, 0, wx.ALL, 5) toolBtn.Add(MotorBtn, 0, wx.ALL, 5) toolBtn.Add(GenBtn, 0, wx.ALL, 5) toolBtn_h.Add(toolBtn, 0, wx.CENTER, 5) warnSizer.Add(self.wbutton0, 0, wx.ALL, 5) warnSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) warnSizer.Add(self.wbutton1, 0, wx.ALL, 5) warnSizer.Add(self.wbutton2, 0, wx.ALL, 5) warnSizer.Add(self.wbutton3, 0, wx.ALL, 5) warnSizer_h.Add(warnSizer, 0, wx.CENTER, 5) titleSizer.Add(title, 0, wx.ALL, 5) inputOneSizer.Add(self.labelOne, 0, wx.ALL, 5) inputTwoSizer.Add(self.labelTwo, 0, wx.ALL, 5) inputThreeSizer.Add(self.labelThree, 0, wx.ALL, 5) inputFourSizer.Add(self.labelFour, 0, wx.ALL, 5) inputFiveSizer.Add(self.labelFive, 0, wx.ALL, 5) inputSixSizer.Add(self.labelSix, 0, wx.ALL, 5) topSizer.Add(toolBtn_h, 0, wx.ALL | wx.EXPAND | wx.CENTER, 5) topSizer.Add(warnSizer_h, 0, wx.ALL | wx.EXPAND | wx.CENTER, 5) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(titleSizer, 0, wx.CENTER) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputOneSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputTwoSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputThreeSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputFourSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputFiveSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputSixSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) self.SetSizer(topSizer) topSizer.Fit(self) self.Raise() self.SetPosition((0, 0)) self.Hide() self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) # value declarations self.mct = 0 self.mtl = 0 self.mtr = 0 self.mc2bc = 0 self.mc2mlc = 0 self.mc2mrc = 0
def __init__(self, parent): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL) self.charEditor = self.Parent.Parent # first parent is Notebook, second is Character Editor self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) pmainSizer = wx.BoxSizer(wx.VERTICAL) hSizer = wx.BoxSizer(wx.HORIZONTAL) self.clonesChoice = wx.Choice(self, wx.ID_ANY, style=0) i = self.clonesChoice.Append("Omega Clone", None) self.clonesChoice.SetSelection(i) hSizer.Add(self.clonesChoice, 5, wx.ALL | wx.EXPAND, 5) self.searchInput = PlaceholderTextCtrl(self, wx.ID_ANY, placeholder="Search...") hSizer.Add(self.searchInput, 1, wx.ALL | wx.EXPAND, 5) self.searchInput.Bind(wx.EVT_TEXT, self.delaySearch) sChar = Character.getInstance() self.alphaClones = sChar.getAlphaCloneList() char = self.charEditor.entityEditor.getActiveEntity() for clone in self.alphaClones: i = self.clonesChoice.Append(clone.alphaCloneName, clone.ID) if clone.ID == char.alphaCloneID: self.clonesChoice.SetSelection(i) self.clonesChoice.Bind(wx.EVT_CHOICE, self.cloneChanged) self.clonesChoice.SetToolTip( wx.ToolTip( "Setting an Alpha clone does not replace the character's skills, but rather caps them to Alpha levels." )) pmainSizer.Add(hSizer, 0, wx.EXPAND | wx.ALL, 5) # Set up timer for skill search self.searchTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.populateSkillTreeSkillSearch, self.searchTimer) tree = self.skillTreeListCtrl = TreeListCtrl( self, wx.ID_ANY, style=wx.dataview.TL_DEFAULT_STYLE) pmainSizer.Add(tree, 1, wx.EXPAND | wx.ALL, 5) self.imageList = wx.ImageList(16, 16) tree.SetImageList(self.imageList) self.skillBookImageId = self.imageList.Add( wx.Icon(BitmapLoader.getBitmap("skill_small", "gui"))) self.skillBookDirtyImageId = self.imageList.Add( wx.Icon(BitmapLoader.getBitmap("skill_small_red", "gui"))) tree.AppendColumn("Skill") tree.AppendColumn("Level", align=wx.ALIGN_CENTER) # tree.SetMainColumn(0) self.root = tree.GetRootItem() # self.root = tree.AppendItem(root, "Skills") # # tree.SetItemText(self.root, 1, "Levels") # first one doesn't work right in Windows. Second one doesn't work right in GTK. Together, we make sure it works. # Gotta love wx tree.SetColumnWidth(0, 525) tree.SetColumnWidth(1, 100) self.btnSecStatus = wx.Button( self, wx.ID_ANY, "Sec Status: {0:.2f}".format(char.secStatus or 0.0)) self.btnSecStatus.Bind(wx.EVT_BUTTON, self.onSecStatus) self.populateSkillTree() tree.Bind(wx.dataview.EVT_TREELIST_ITEM_ACTIVATED, self.expand) tree.Bind(wx.dataview.EVT_TREELIST_ITEM_EXPANDING, self.expandLookup) tree.Bind(wx.dataview.EVT_TREELIST_ITEM_CONTEXT_MENU, self.spawnMenu) bSizerButtons = wx.BoxSizer(wx.HORIZONTAL) bSizerButtons.Add(self.btnSecStatus, 0, wx.ALL, 5) bSizerButtons.AddStretchSpacer() importExport = (("Import", wx.ART_FILE_OPEN, "from"), ("Export", wx.ART_FILE_SAVE_AS, "to")) for name, art, direction in importExport: bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) btn = wx.BitmapButton(self, wx.ID_ANY, bitmap) btn.SetMinSize(btn.GetSize()) btn.SetMaxSize(btn.GetSize()) btn.Layout() setattr(self, "{}Btn".format(name.lower()), btn) btn.Enable(True) btn.SetToolTip("%s skills %s clipboard" % (name, direction)) bSizerButtons.Add( btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT | wx.ALL, 5) btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Skills".format(name.lower()))) pmainSizer.Add(bSizerButtons, 0, wx.EXPAND, 5) # bind the Character selection event self.charEditor.entityEditor.Bind(wx.EVT_CHOICE, self.charChanged) self.charEditor.Bind(GE.CHAR_LIST_UPDATED, self.populateSkillTree) # Context menu stuff self.idUnlearned = wx.NewId() self.levelIds = {} self.idLevels = {} self.levelIds[self.idUnlearned] = "Not learned" for level in range(6): id = wx.NewId() self.levelIds[id] = level self.idLevels[level] = id self.revertID = wx.NewId() self.saveID = wx.NewId() self.SetSizer(pmainSizer)
def __init__(self, parent, id=-1): """Constructor""" wx.Panel.__init__(self, parent, id, size=(800, 480)) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) # timer for updating dictionary self.genupdater = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.genupdater, self.genupdater) # timers # 1 self.timer1 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatesoc, self.timer1) self.timer1.Start(10) # 2 self.timer2 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatespeedfl, self.timer2) self.timer2.Start(10) # 3 self.timer3 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatespeedfr, self.timer3) self.timer3.Start(10) # 4 self.timer4 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatespeedbl, self.timer4) self.timer4.Start(10) # 5 self.timer5 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updatespeedbr, self.timer5) self.timer5.Start(10) # 6 self.timer6 = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updateoiltemp, self.timer6) self.timer6.Start(9) # title creator title = wx.StaticText(self, -1, 'General') title.SetFont( wx.Font(24, wx.FONTFAMILY_DEFAULT, wx.BOLD, wx.FONTWEIGHT_BOLD)) title.SetForegroundColour('white') # label declarations self.labelOne = wx.StaticText(self, -1) self.labelOne.SetLabel('Car Speed (FR FL) : ') self.labelTwo = wx.StaticText(self, -1) self.labelTwo.SetLabel('Car speed (BR BL) : ') self.labelThree = wx.StaticText(self, -1) self.labelThree.SetLabel('Ambient Temperature :') self.labelFour = wx.StaticText(self, -1) self.labelFour.SetLabel('Oil temperature : ') self.labelFive = wx.StaticText(self, -1) self.labelFive.SetLabel('State of Charge : ') # label describers self.labelOne.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelOne.SetForegroundColour('white') self.labelTwo.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelTwo.SetForegroundColour('white') self.labelThree.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelThree.SetForegroundColour('white') self.labelFour.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelFour.SetForegroundColour('white') self.labelFive.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.BOLD, wx.FONTWEIGHT_BOLD)) self.labelFive.SetForegroundColour('white') # image buttons self.wbutton0 = wx.Button(self, -1, '- M P P T -') self.wbutton1 = wx.Button(self, -1, '- B M S -') self.wbutton2 = wx.Button(self, -1, '- M O T O R -') self.wbutton3 = wx.Button(self, -1, '- G E N E R A L -') imageFile = "battery.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() BatteryBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnBattery, BatteryBtn) imageFile = "mppt.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() MPPTBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnMotor, MPPTBtn) imageFile = "motor.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() MotorBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, self.OnMotor, MotorBtn) imageFile = "general.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() GenBtn = wx.BitmapButton(self, id=-1, bitmap=image1, pos=(10, 20), size=(image1.GetWidth() + 10, image1.GetHeight() + 10)) self.Bind(wx.EVT_BUTTON, None, GenBtn) topSizer = wx.BoxSizer(wx.VERTICAL) toolBtn = wx.BoxSizer(wx.HORIZONTAL) toolBtn_h = wx.BoxSizer(wx.VERTICAL) warnSizer = wx.BoxSizer(wx.HORIZONTAL) warnSizer_h = wx.BoxSizer(wx.VERTICAL) titleSizer = wx.BoxSizer(wx.HORIZONTAL) inputOneSizer = wx.BoxSizer(wx.HORIZONTAL) inputTwoSizer = wx.BoxSizer(wx.HORIZONTAL) inputThreeSizer = wx.BoxSizer(wx.HORIZONTAL) inputFourSizer = wx.BoxSizer(wx.HORIZONTAL) inputFiveSizer = wx.BoxSizer(wx.HORIZONTAL) toolBtn.Add(MPPTBtn, 0, wx.ALL, 5) toolBtn.Add(BatteryBtn, 0, wx.ALL, 5) toolBtn.Add(MotorBtn, 0, wx.ALL, 5) toolBtn.Add(GenBtn, 0, wx.ALL, 5) toolBtn_h.Add(toolBtn, 0, wx.CENTER, 5) warnSizer.Add(self.wbutton0, 0, wx.ALL, 5) warnSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) warnSizer.Add(self.wbutton1, 0, wx.ALL, 5) warnSizer.Add(self.wbutton2, 0, wx.ALL, 5) warnSizer.Add(self.wbutton3, 0, wx.ALL, 5) warnSizer_h.Add(warnSizer, 0, wx.CENTER, 5) titleSizer.Add(title, 0, wx.ALL, 5) inputOneSizer.Add(self.labelOne, 0, wx.ALL, 5) inputTwoSizer.Add(self.labelTwo, 0, wx.ALL, 5) inputThreeSizer.Add(self.labelThree, 0, wx.ALL, 5) inputFourSizer.Add(self.labelFour, 0, wx.ALL, 5) inputFiveSizer.Add(self.labelFive, 0, wx.ALL, 5) topSizer.Add(toolBtn_h, 0, wx.ALL | wx.EXPAND | wx.CENTER, 5) topSizer.Add(warnSizer_h, 0, wx.ALL | wx.EXPAND | wx.CENTER, 5) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(titleSizer, 0, wx.CENTER) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputOneSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputTwoSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputThreeSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputFourSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(inputFiveSizer, 0, wx.ALL | wx.EXPAND, 5) topSizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) self.SetSizer(topSizer) topSizer.Fit(self) self.Raise() self.SetPosition((0, 0)) self.Hide() self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) # value declarations self.speedfl = 0 self.speedfr = 0 self.speedbr = 0 self.speedbl = 0 self.oiltemp = 0 self.soc = 0
def __init__(self, parent=None): wx.Panel.__init__(self, parent) bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/cancel.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.delete = wx.BitmapButton(self, -1, bmp) if sys.platform in ('win32', 'win64'): bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/cancelDisabled.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.delete.SetBitmapDisabled(bmp) self.delete.SetToolTip( wx.ToolTip( 'Left click to delete selected output. Right click to delete all output.' )) bmp = wx.Image(os.path.join(resourcePath, 'gui/icons/16x16/up.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.moveUp = wx.BitmapButton(self, -1, bmp) if sys.platform in ('win32', 'win64'): bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/upDisabled.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.moveUp.SetBitmapDisabled(bmp) self.moveUp.SetToolTip(wx.ToolTip('Move up.')) bmp = wx.Image(os.path.join(resourcePath, 'gui/icons/16x16/down.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.moveDown = wx.BitmapButton(self, -1, bmp) if sys.platform in ('win32', 'win64'): bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/downDisabled.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.moveDown.SetBitmapDisabled(bmp) self.moveDown.SetToolTip(wx.ToolTip('Move down.')) bmp = wx.Image(os.path.join(resourcePath, 'gui/icons/16x16/plot.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.plot = wx.BitmapButton(self, -1, bmp) if sys.platform in ('win32', 'win64'): bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/plotDisabled.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.plot.SetBitmapDisabled(bmp) self.plot.SetToolTip( wx.ToolTip('Plot populations or reaction counts.')) bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/gnuplot.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.gnuplot = wx.BitmapButton(self, -1, bmp) if sys.platform in ('win32', 'win64'): bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/gnuplotDisabled.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.gnuplot.SetBitmapDisabled(bmp) self.gnuplot.SetToolTip(wx.ToolTip('Export data to gnuplot files.')) bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/x-office-spreadsheet.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.table = wx.BitmapButton(self, -1, bmp) if sys.platform in ('win32', 'win64'): bmp = wx.Image( os.path.join( resourcePath, 'gui/icons/16x16/x-office-spreadsheetDisabled.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.table.SetBitmapDisabled(bmp) self.table.SetToolTip(wx.ToolTip('Display data in a table.')) bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/HistogramDistance.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.distance = wx.BitmapButton(self, -1, bmp) if sys.platform in ('win32', 'win64'): bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/HistogramDistanceDisabled.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.distance.SetBitmapDisabled(bmp) self.distance.SetToolTip(wx.ToolTip('Compute histogram distance.')) bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/pValue.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.pValue = wx.BitmapButton(self, -1, bmp) if sys.platform in ('win32', 'win64'): bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/pValueDisabled.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.pValue.SetBitmapDisabled(bmp) self.pValue.SetToolTip( wx.ToolTip('Compute p-value for mean equality.')) bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/filesave.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.export = wx.BitmapButton(self, -1, bmp) if sys.platform in ('win32', 'win64'): bmp = wx.Image( os.path.join(resourcePath, 'gui/icons/16x16/filesaveDisabled.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.export.SetBitmapDisabled(bmp) self.export.SetToolTip(wx.ToolTip('Export data to a file.')) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.delete) sizer.Add(self.moveUp) sizer.Add(self.moveDown) sizer.Add(self.plot) sizer.Add(self.gnuplot) sizer.Add(self.table) sizer.Add(self.distance) sizer.Add(self.pValue) sizer.Add(self.export) self.SetSizer(sizer)
def __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, strings=[], style=LE_ALLOW_NEW | LE_ALLOW_EDIT | LE_ALLOW_DELETE, validator=wx.DefaultValidator, name='ListEditor'): """Initialiser. @param parent: The parent window for this control. @param id: The window ID. @param pos: Window position. wxDefaultPosition indicates that wxWidgets should generate a default position for the window. If using the wxWindow class directly, supply an actual position. @param size: Window size. wxDefaultSize indicates that wxWidgets should generate a default size for the window. If no suitable size can be found, the window will be sized to 20x20 pixels so that the window is visible but obviously not correctly sized. @param strings: An array of strings with which to initialise the control. @param style: The style flags for the control: B{LE_ALLOW_NEW} - Allow new items to be added to the list. B{LE_ALLOW_EDIT} - Allow items to be edited. B{LE_ALLOW_DELETE} - Allow items to be deleted from the list. @param validator: Window validator. @param name: The name of this control. """ self.modified = False self.style = style wx.Panel.__init__(self, parent, id, pos, size, name=name) self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY) self.text = wx.TextCtrl(self, -1, '', validator=validator) if style & LE_ALLOW_NEW: self.add = wx.BitmapButton(self, -1, images.getTextfield_AddBitmap()) self.add.SetToolTipString('Add Item') self.Bind(wx.EVT_BUTTON, self.OnAdd, self.add) self.list = wx.ListBox(self, -1, choices=strings) if style & LE_ALLOW_EDIT: self.edit = wx.BitmapButton(self, -1, images.getTextfield_RenameBitmap()) self.edit.SetToolTipString('Update Item') self.Bind(wx.EVT_BUTTON, self.OnEdit, self.edit) if style & LE_ALLOW_DELETE: self.delete = wx.BitmapButton(self, -1, images.getTextfield_DeleteBitmap()) self.delete.SetToolTipString('Delete Item') self.Bind(wx.EVT_BUTTON, self.OnDelete, self.delete) self.up = wx.BitmapButton(self, -1, images.getArrow_UpBitmap()) self.up.SetToolTipString('Move Item Up') self.down = wx.BitmapButton(self, -1, images.getArrow_DownBitmap()) self.down.SetToolTipString('Move Item Down') # layout spacing = 4 # spacing between elements msizer = wx.BoxSizer(wx.VERTICAL) tsizer = wx.BoxSizer(wx.HORIZONTAL) tsizer.Add(self.text, 1, wx.EXPAND) if style & LE_ALLOW_NEW: tsizer.Add(self.add, 0, wx.LEFT, spacing) msizer.Add(tsizer, 0, wx.EXPAND) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(self.list, 1, wx.EXPAND) bsizer = wx.BoxSizer(wx.VERTICAL) if style & LE_ALLOW_EDIT: bsizer.Add(self.edit, 0, wx.BOTTOM, spacing) if style & LE_ALLOW_DELETE: bsizer.Add(self.delete, 0, wx.BOTTOM, spacing) bsizer.Add(self.up, 0, wx.BOTTOM, spacing) bsizer.Add(self.down) hsizer.Add(bsizer, 0, wx.LEFT, spacing) msizer.Add(hsizer, 1, wx.EXPAND | wx.TOP, spacing) self.SetSizerAndFit(msizer) self.Bind(wx.EVT_BUTTON, self.OnUp, self.up) self.Bind(wx.EVT_BUTTON, self.OnDown, self.down) self.Bind(wx.EVT_LISTBOX, self.OnListBox, self.list)
def __init__(self, config): self.config = config # Note: don't set position from config, since it's not yet loaded. wx.Frame.__init__( self, None, title=self.TITLE, style=wx.DEFAULT_FRAME_STYLE & ~(wx.RESIZE_BORDER | wx.RESIZE_BOX | wx.MAXIMIZE_BOX)) root = wx.Panel(self, style=wx.DEFAULT_FRAME_STYLE) # Menu Bar MenuBar = wx.MenuBar() self.SetMenuBar(MenuBar) # Application icon icon = wx.Icon(self.PLOVER_ICON_FILE, wx.BITMAP_TYPE_ICO) self.SetIcon(icon) # Configure button. self.configure_button = wx.Button(root, label=self.CONFIGURE_BUTTON_LABEL) self.configure_button.Bind(wx.EVT_BUTTON, self._show_config_dialog) # About button. self.about_button = wx.Button(root, label=self.ABOUT_BUTTON_LABEL) self.about_button.Bind(wx.EVT_BUTTON, self._show_about_dialog) # Status radio buttons. self.radio_output_enable = wx.RadioButton( root, label=self.ENABLE_OUTPUT_LABEL) self.radio_output_enable.Bind( wx.EVT_RADIOBUTTON, lambda e: self.steno_engine.set_is_running(True)) self.radio_output_disable = wx.RadioButton( root, label=self.DISABLE_OUTPUT_LABEL) self.radio_output_disable.Bind( wx.EVT_RADIOBUTTON, lambda e: self.steno_engine.set_is_running(False)) # Machine status. # TODO: Figure out why spinner has darker gray background. self.spinner = wx.animate.GIFAnimationCtrl(root, -1, SPINNER_FILE) self.spinner.GetPlayer().UseBackgroundColour(True) # Need to call this so the size of the control is not # messed up (100x100 instead of 16x16) on Linux... self.spinner.InvalidateBestSize() self.spinner.Hide() self.connected_bitmap = wx.Bitmap(self.CONNECTED_IMAGE_FILE, wx.BITMAP_TYPE_PNG) self.disconnected_bitmap = wx.Bitmap(self.DISCONNECTED_IMAGE_FILE, wx.BITMAP_TYPE_PNG) self.connection_ctrl = wx.StaticBitmap(root, bitmap=self.disconnected_bitmap) border_flag = wx.SizerFlags(1).Border(wx.ALL, self.BORDER) # Create Settings Box settings_sizer = wx.BoxSizer(wx.HORIZONTAL) settings_sizer.AddF(self.configure_button, border_flag.Expand()) settings_sizer.AddF(self.about_button, border_flag.Expand()) # Create Output Status Box box = wx.StaticBox(root, label=self.HEADER_OUTPUT) status_sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) status_sizer.AddF(self.radio_output_enable, border_flag) status_sizer.AddF(self.radio_output_disable, border_flag) # Create Machine Status Box machine_sizer = wx.BoxSizer(wx.HORIZONTAL) center_flag =\ wx.SizerFlags()\ .Align(wx.ALIGN_CENTER_VERTICAL)\ .Border(wx.LEFT | wx.RIGHT, self.BORDER) machine_sizer.AddF(self.spinner, center_flag) machine_sizer.AddF(self.connection_ctrl, center_flag) longest_machine = max(machine_registry.get_all_names(), key=len) longest_state = max((STATE_ERROR, STATE_INITIALIZING, STATE_RUNNING), key=len) longest_machine_status = '%s: %s' % (longest_machine, longest_state) self.machine_status_text = wx.StaticText(root, label=longest_machine_status) machine_sizer.AddF(self.machine_status_text, center_flag) refresh_bitmap = wx.Bitmap(self.REFRESH_IMAGE_FILE, wx.BITMAP_TYPE_PNG) self.reconnect_button = wx.BitmapButton(root, bitmap=refresh_bitmap) machine_sizer.AddF(self.reconnect_button, center_flag) # Assemble main UI global_sizer = wx.GridBagSizer(vgap=self.BORDER, hgap=self.BORDER) global_sizer.Add(settings_sizer, flag=wx.EXPAND, pos=(0, 0), span=(1, 2)) global_sizer.Add(status_sizer, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=self.BORDER, pos=(1, 0), span=(1, 2)) global_sizer.Add(machine_sizer, flag=wx.CENTER | wx.ALIGN_CENTER | wx.EXPAND | wx.LEFT, pos=(2, 0), border=self.BORDER, span=(1, 2)) self.machine_sizer = machine_sizer # Add a border around the entire sizer. border = wx.BoxSizer() border.AddF(global_sizer, wx.SizerFlags(1).Border(wx.ALL, self.BORDER).Expand()) root.SetSizerAndFit(border) border.SetSizeHints(self) self.Bind(wx.EVT_CLOSE, self._quit) self.Bind(wx.EVT_MOVE, self.on_move) self.reconnect_button.Bind(wx.EVT_BUTTON, lambda e: self._reconnect()) try: with open(config.target_file, 'rb') as f: self.config.load(f) except Exception: log.error('loading configuration failed, reseting to default', exc_info=True) self.config.clear() copy_default_dictionaries(self.config) rect = wx.Rect(config.get_main_frame_x(), config.get_main_frame_y(), *self.GetSize()) self.SetRect(AdjustRectToScreen(rect)) self.steno_engine = app.StenoEngine() self.steno_engine.add_callback( lambda s: wx.CallAfter(self._update_status, s)) self.steno_engine.set_output( Output(self.consume_command, self.steno_engine)) self.steno_engine.add_stroke_listener( StrokeDisplayDialog.stroke_handler) if self.config.get_show_stroke_display(): StrokeDisplayDialog.display(self, self.config) self.steno_engine.formatter.add_listener( SuggestionsDisplayDialog.stroke_handler) if self.config.get_show_suggestions_display(): SuggestionsDisplayDialog.display(self, self.config, self.steno_engine) try: app.init_engine(self.steno_engine, self.config) except Exception: log.error('engine initialization failed', exc_info=True) self._show_config_dialog()