def __init__(self, parent, user_config, customuser_config): self.temp_userconfig = user_config self.temp_customuserconfig = customuser_config wx.ScrolledWindow.__init__(self, parent) sz1 = wx.BoxSizer(wx.VERTICAL) items = [] items.append ( wx.StaticText(self, -1, '\nActivity computation system.') ) titleFont = wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD) items[-1].SetFont(titleFont) items.append ( wx.StaticText(self, -1, 'Activity of the flies can be computed on the basis of the distance they walk\nor using a virtual TriKinetic Monitor System. In the second case, the video data will be analized counting how many times\nthe flies have crossed an imaginary line that runs in the middle of the recording area, emulating the IR system.')) #sz1.AddMany (items) grid1 = wx.FlexGridSizer( 0, 1, 0, 0 ) self.use_vtm_radio = [] self.use_vtm_radio.append( wx.RadioButton( self, -1, 'Use virtual Trikinetics Monitor System', name = 'virtual_trikinetics', style = wx.RB_GROUP ) ) self.use_vtm_radio.append( wx.RadioButton( self, -1, 'Use distance', name = 'no_virtual_trikinetics') ) for radio in self.use_vtm_radio: grid1.Add( radio, 0, wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) radio.Bind(wx.EVT_RADIOBUTTON, partial(self.OnGroupSelect, 'virtual_trikinetics')) ck = not self.temp_userconfig['virtual_trikinetics'] self.use_vtm_radio[ck].SetValue(True) items.append (grid1) items.append ( (wx.StaticLine(self), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5 ) ) items.append ( wx.StaticText(self, -1, '\nMinimum and Maximum distances to be called movement.') ) titleFont = wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD) items[-1].SetFont(titleFont) items.append ( wx.StaticText(self, -1, 'Tweak the values here to define the the minimum and maximum distance (in pixel) for the movement range.\nDetected movements that will have a smaller or bigger threshold will be considered noise and ignored.\nThis setting depends on the quality of your acquisition and on your desire to detect small fly movements')) grid2 = wx.BoxSizer(wx.HORIZONTAL) mins = str(self.temp_userconfig['min_distance']) maxs = str(self.temp_userconfig['max_distance']) min_sleep = masked.TextCtrl(self , -1, mins, mask = "####") max_sleep = masked.TextCtrl(self , -1, maxs, mask = "####") min_sleep.Bind(wx.EVT_TEXT, partial(self.OnChangeSleepValues, 'min_distance')) max_sleep.Bind(wx.EVT_TEXT, partial(self.OnChangeSleepValues, 'max_distance')) grid2.Add(min_sleep, 0, wx.RIGHT, 3) grid2.Add(max_sleep, 0, wx.LEFT, 3) items.append(grid2) sz1.AddMany (items) self.SetSizer(sz1) sz1.Fit(self)
def __init__(self, parent, user_config, customuser_config): self.temp_userconfig = user_config self.temp_customuserconfig = customuser_config wx.ScrolledWindow.__init__(self, parent) sz1 = wx.BoxSizer(wx.VERTICAL) items = [] items.append ( wx.StaticText(self, -1, '\nUse dropout flies.') ) titleFont = wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD) items[-1].SetFont(titleFont) items.append ( wx.StaticText(self, -1, 'A dropout fly is a fly that died during the course of the experiment, for instance during the last days.\nHere you can decide on whether you want to include in your experiments.\nNB: this option will not affect the behaviour of all the panels\n')) #sz1.AddMany (items) grid1 = wx.FlexGridSizer( 0, 1, 0, 0 ) self.use_dropout_radio = [] self.use_dropout_radio.append( wx.RadioButton( self, -1, 'Use dropout flies', name = 'use_dropout', style = wx.RB_GROUP ) ) self.use_dropout_radio.append( wx.RadioButton( self, -1, 'Do not use dropout flies', name = 'no_dropout' ) ) for radio in self.use_dropout_radio: grid1.Add( radio, 0, wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) radio.Bind(wx.EVT_RADIOBUTTON, partial(self.OnGroupSelect, 'use_dropout')) ck = not self.temp_userconfig['use_dropout'] self.use_dropout_radio[ck].SetValue(True) items.append (grid1) items.append ( (wx.StaticLine(self), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5 ) ) items.append ( wx.StaticText(self, -1, '\nSleep limits.') ) titleFont = wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD) items[-1].SetFont(titleFont) items.append ( wx.StaticText(self, -1, 'Enter the min and max values that are to be used to determine which flies to use.\nOnly flies that slept more than the minimum value and less than then maximum are taken.\nValues have to be entered in minutes (24H = 1440minutes)\n')) grid2 = wx.BoxSizer(wx.HORIZONTAL) mins = str(self.temp_userconfig['min_sleep']) maxs = str(self.temp_userconfig['max_sleep']) min_sleep = masked.TextCtrl(self , -1, mins, mask = "####") max_sleep = masked.TextCtrl(self , -1, maxs, mask = "####") min_sleep.Bind(wx.EVT_TEXT, partial(self.OnChangeSleepValues, 'min_sleep')) max_sleep.Bind(wx.EVT_TEXT, partial(self.OnChangeSleepValues, 'max_sleep')) grid2.Add(min_sleep, 0, wx.RIGHT, 3) grid2.Add(max_sleep, 0, wx.LEFT, 3) items.append(grid2) sz1.AddMany (items) self.SetSizer(sz1) sz1.Fit(self)
def find(self,event): import sys self.findDialog = wx.Dialog(parent=None,id=wx.ID_ANY,pos=(410,180),size=(430,700),title='Localizar Paciente') #self.findDialog.Centre(wx.BOTH) self.vPatientBox1 = wx.BoxSizer(wx.VERTICAL) self.hPatientBox1 = wx.BoxSizer(wx.HORIZONTAL) self.listPatient = wx.ListCtrl(self.findDialog,-1,size=(430,280),style=wx.LC_REPORT) self.listPatient.InsertColumn(0, u'Nome', width=205) self.listPatient.InsertColumn(1, u'Orçado Por', width=75) self.listPatient.InsertColumn(2, u'Data de Nasc.', width=90) self.listPatient.InsertColumn(3,u'Ficha',width=65) self.listPatient.InsertColumn(4,'',width=0) self.hPatientBox1.Add(self.listPatient, 1,wx.EXPAND) self.vPatientBox1.Add(self.hPatientBox1,0,wx.ALL | wx.EXPAND, 5) self.vPatientBox1.Add((-1,10)) #patients = Patient.query.order_by('name').all() #for patient in patients: # index = self.listPatient.InsertStringItem(sys.maxint, patient.name) # self.listPatient.SetStringItem(index, 1, patient.budgetBy) # self.listPatient.SetStringItem(index, 2, patient.registrationForm) # self.listPatient.SetStringItem(index, 3, str(patient.id)) self.listPatient.Bind(wx.EVT_LIST_ITEM_ACTIVATED,self.getSelectedItem,id=-1) self.hPatientBox2 = wx.BoxSizer(wx.HORIZONTAL) findOptions = [u"Nome",u"Data",u"RG",u"CPF"] self.findRadioBox = wx.RadioBox(self.findDialog, -1, u"Localizar por:", (10, 300), wx.DefaultSize,findOptions,2, wx.RA_SPECIFY_COLS) self.hPatientBox2.Add(self.findRadioBox,0,wx.RIGHT,8) self.vPatientBox1.Add(self.hPatientBox2,0,wx.ALL | wx.EXPAND,5) self.findRadioBox.Bind(wx.EVT_RADIOBOX,self.putMaskInFindTextCtrl) self.hPatientBox3 = wx.BoxSizer(wx.HORIZONTAL) self.findTextCtrl = masked.TextCtrl(self.findDialog,-1,mask="") self.findTextCtrl.SetSize((140,40)) self.findTextCtrl.SetPosition((-1,-1)) self.searchBtn = wx.BitmapButton(self.findDialog,ID_FIND_SEARCH,wx.Bitmap('./imagens/search.png')) self.hPatientBox3.Add(self.findTextCtrl,1, wx.LEFT,0) self.hPatientBox3.Add(self.searchBtn,0,5) self.vPatientBox1.Add(self.hPatientBox3,0,wx.ALL | wx.EXPAND, 5) self.findDialog.Bind(wx.EVT_BUTTON,self.search,self.searchBtn) self.findDialog.SetSizerAndFit(self.vPatientBox1) self.findDialog.ShowModal() self.findDialog.SetFocus() self.findDialog.Destroy()
def test_textctrlProperties(self): t = m.TextCtrl(self.frame) t.DefaultStyle t.NumberOfLines t.Hint t.InsertionPoint t.LastPosition t.Margins t.StringSelection t.Value
def getMonthCtrl(panel, value): import wx.lib.masked as masked import lib.month_lib as ml ctl = masked.TextCtrl(panel, -1, mask='##/##', defaultValue=ml.prettify(value), size=(50, -1), formatcodes='0>') ctl.SetFont(wx.Font(9, 70, 90, 90)) return ctl
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, name="DLG_Enregistrement", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX) self.parent = parent self.derniereValidation = (None, None) # Bandeau titre = _(u"Enregistrement") intro = _(u"Vous pouvez saisir ici votre code d'enregistrement personnel afin d'activer votre abonnement Classic ou Premium. Effectuez ce paramétrage sur chacun de vos postes.") self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau(self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Cle.png") # Saisie code self.staticbox_code_staticbox = wx.StaticBox(self, -1, _(u"Code d'enregistrement")) self.label_identifiant = wx.StaticText(self, -1, _(u"Identifiant :")) self.ctrl_identifiant = wx.TextCtrl(self, -1, "") self.label_code = wx.StaticText(self, -1, _(u"Code :")) self.ctrl_code = masked.TextCtrl(self, -1, "", mask="AAAA-AAAA-AAAA-AAAA-AAAA", formatcodes="F!") self.ctrl_code.SetMinSize((190, -1)) self.bouton_validite = wx.Button(self, -1, _(u"Vérifier la validité")) self.ctrl_image = wx.StaticBitmap(self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/absenti.png"), wx.BITMAP_TYPE_ANY)) self.label_validite = wx.StaticText(self, -1, _(u"Veuillez saisir un code.")) # HTML self.ctrl_html = MyHtml(self, texte=TEXTE, hauteur=30) # 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_BUTTON, self.OnBoutonValidite, self.bouton_validite) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonFermer, self.bouton_fermer) self.Bind(wx.EVT_CLOSE, self.OnClose) # Init contrôles identifiant = UTILS_Config.GetParametre("enregistrement_identifiant", defaut=None) code = UTILS_Config.GetParametre("enregistrement_code", defaut=None) if identifiant != None and code != None : self.ctrl_identifiant.SetValue(identifiant) self.ctrl_code.SetValue(code) self.VerifieEtat(identifiant, code) # Vérifie droits utilisateurs if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("parametrage_enregistrement", "modifier", afficheMessage=False) == False : self.ctrl_identifiant.Enable(False) self.ctrl_code.Enable(False) self.bouton_validite.Enable(False)
def create_widget(self, parent, template, with_label=True): label = None widget = None if with_label: if template.kind in [View.VK_PLACEHOLDER, View.VK_BUTTON, View.VK_LABEL]: label = wx.Panel(parent, wx.ID_ANY, style=wx.TRANSPARENT_WINDOW, name="placeholder-%s" % template.name) else: label = wx.StaticText(parent, wx.ID_ANY, " %s " % template.title, name="label-%s" % template.name) if template.kind == View.VK_PLACEHOLDER: widget = wx.Panel(parent, wx.ID_ANY, style=wx.TRANSPARENT_WINDOW, name=template.name) widget.SetBackgroundColour(parent.GetBackgroundColour()) if template.kind == View.VK_LABEL: widget = wx.StaticText(parent, wx.ID_ANY, template.title, name=template.name) elif template.kind == View.VK_BUTTON: widget = wx.Button(parent, wx.ID_ANY, template.title, name=template.name) widget.Bind(wx.EVT_BUTTON, self.on_button, source=widget) elif template.kind == View.VK_DATE: td = TransformDate(template.value) widget = masked.TextCtrl(parent, wx.ID_ANY, td.display(), name=template.name, mask="##-##-####") widget.SetFont(self.GetFont()) if template.readonly: widget.SetEditable(False) widget.SetBackgroundColour(parent.GetBackgroundColour()) widget.Bind(wx.EVT_TEXT, self.on_text, source=widget) elif template.kind == View.VK_TEXT: widget = wx.TextCtrl(parent, wx.ID_ANY, template.value if template.value is not None else "", name=template.name) if template.readonly: widget.SetEditable(False) widget.SetBackgroundColour(parent.GetBackgroundColour()) widget.Bind(wx.EVT_TEXT, self.on_text, source=widget) elif template.kind == View.VK_COMBO: widget = wx.ComboBox(parent, wx.ID_ANY, name=template.name) i = 0 selected = -1 for key, option in template.options: widget.Append(option, key) if key == template.value: selected = i i += 1 if selected != -1: widget.SetSelection(selected) widget.Bind(wx.EVT_COMBOBOX, self.on_combobox, source=widget) # if template.readonly: # widget.Enable(False) # widget.SetBackgroundColour(parent.GetBackgroundColour()) return label, widget
def AddAddressControl(self, panel, address): if address is None: address = self.defaultAddress maskedCtrl = masked.TextCtrl( parent=panel, mask="#### #### - ####", defaultValue="1111 1111 - 1111", excludeChars="056789", formatcodes="F", validRequired=False, ) maskedCtrl.SetValue(GetStringFromAddress(address)) panel.AddLine(self.plugin.text.address, maskedCtrl) return maskedCtrl
def __init__(self, parent): wx.Panel.__init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL) self.parent = parent self.ctrl_numsecu = masked.TextCtrl(self, -1, "", style=wx.TE_CENTRE, mask="# ## ## #N ### ### ##") self.image_numsecu = wx.StaticBitmap( self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Interdit.png"), wx.BITMAP_TYPE_PNG), size=(16, 16)) self.remplissageEnCours = False self.__set_properties() self.__do_layout() self.ctrl_numsecu.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
def Configure(self, address=None, level=1): if address is None: address = self.defaultAddress panel = eg.ConfigPanel() maskedCtrl = masked.TextCtrl( parent=panel, mask="#### #### - ####", defaultValue="1111 1111 - 1111", excludeChars="056789", formatcodes="F", validRequired=False, ) maskedCtrl.SetValue(self.GetStringFromAddress(address)) def LevelCallback(value): return "%.02f %%" % (value * 100.00 / 16) levelCtrl = eg.Slider( panel, value=level, min=1, max=16, minLabel="6.25 %", maxLabel="100.00 %", style = wx.SL_AUTOTICKS|wx.SL_TOP, size=(300,-1), levelCallback=LevelCallback ) levelCtrl.SetMinSize((300, -1)) panel.AddLine("Address:", maskedCtrl) panel.AddLine("Level:", levelCtrl) while panel.Affirmed(): address = self.GetAddressFromString(maskedCtrl.GetPlainValue()) ActionBase.defaultAddress = address panel.SetResult( address, levelCtrl.GetValue(), )
def layoutGeneralTable(self, controls, sizer): for control in controls: sizer.Add( wx.StaticText( self, -1, control[0]) ) sizer.Add( wx.StaticText( self, -1, control[1]) ) sizer.Add( wx.StaticText( self, -1, control[3]) ) sizer.Add( wx.StaticText( self, -1, control[4]) ) if control in controls: newControl = masked.TextCtrl( self, -1, "", mask = control[1], excludeChars = control[2], formatcodes = control[3], includeChars = "", validRegex = control[4], validRange = control[5], choices = control[6], choiceRequired = True, defaultValue = control[7], demo = True, name = control[0]) self.editList.append(newControl) sizer.Add(newControl)
def Configure(self, address=None): if address is None: address = self.defaultAddress panel = eg.ConfigPanel() maskedCtrl = masked.TextCtrl( parent=panel, mask="#### #### - ####", defaultValue="1111 1111 - 1111", excludeChars="056789", formatcodes="F", validRequired=False, ) maskedCtrl.SetValue(self.GetStringFromAddress(address)) panel.AddLine("Address:", maskedCtrl) while panel.Affirmed(): address = self.GetAddressFromString(maskedCtrl.GetPlainValue()) ActionBase.defaultAddress = address panel.SetResult(address)
def makePanelConnect(self): self.panel_connect = Panel(self.frame, size=sizepanel1) self.panel_connect.SetBackgroundColour((200, 200, 11)) # delete lbl1 = wx.StaticText(self.panel_connect, -1, style=wx.ALIGN_CENTER, pos=(10, level1 + 0)) lbl1.SetFont(self.frame.GetFont()) lbl1.SetLabel("ip address") control = [ "ip address", "###.###.###.###", "", 'F^-', "^\d{3}.\d{3}.\d{3}.\d{3}", '', '', '' ] self.maskText = masked.TextCtrl(self.panel_connect, mask=control[1], excludeChars=control[2], formatcodes=control[3], includeChars="", validRegex=control[4], validRange=control[5], choices=control[6], choiceRequired=True, defaultValue=control[7], demo=True, name=control[0], style=wx.TE_PROCESS_ENTER, pos=(10, level1 + 30)) self.b_connect = wx.Button(self.panel_connect, wx.ID_CLOSE, "Connect", pos=(10, level1 + 65)) self.b_connect.Bind(wx.EVT_BUTTON, self.OnConnect) m_shut = wx.Button(self.panel_connect, wx.ID_CLOSE, "Shutdown", pos=(10, level1 + 100)) m_shut.Bind(wx.EVT_BUTTON, self.onShutdown) self.lbl2 = wx.StaticText(self.panel_connect, -1, style=wx.ALIGN_CENTER, pos=(200, level1 + 0)) self.lbl2.SetFont(self.frame.GetFont()) self.lbl2.SetLabel("scanning ...") self.btnReload = wx.Button(self.panel_connect, wx.ID_CLOSE, "Reload", pos=(315, level1 + 0)) self.btnReload.Bind(wx.EVT_BUTTON, self.onReload) self.lst = wx.ListBox(self.panel_connect, pos=(200, level1 + 30), size=(200, 150), choices=[], style=wx.LB_SINGLE) self.Bind(wx.EVT_LISTBOX, self.selectRobotIp, self.lst) self.connect_status = wx.StaticText(self.panel_connect, -1, style=wx.ALIGN_CENTER, pos=(10, level1 + 200)) self.connect_status.SetFont(self.frame.GetFont()) self.connect_status.SetLabel("[CONNECT STATUS] ")
def __init__(self, parent, id=wx.ID_ANY, title='', size=(200, 200)): wx.Frame.__init__(self, parent, id, title, size=size) self.config = wx.Config( appName="CrossMgrImpinj", vendorName="SmartCyclingSolutions", #style=wx.Config.CONFIG_USE_LOCAL_FILE ) self.SetBackgroundColour(wx.Colour(232, 232, 232)) self.LightGreen = wx.Colour(153, 255, 153) self.LightRed = wx.Colour(255, 153, 153) font = self.GetFont() bigFont = wx.Font(int(font.GetPointSize() * 1.5), font.GetFamily(), font.GetStyle(), wx.FONTWEIGHT_BOLD) titleFont = wx.Font(int(bigFont.GetPointSize() * 2.2), bigFont.GetFamily(), bigFont.GetStyle(), bigFont.GetWeight()) self.vbs = wx.BoxSizer(wx.VERTICAL) bs = wx.BoxSizer(wx.HORIZONTAL) self.reset = RoundButton(self, label='Reset', size=(80, 80)) self.reset.SetBackgroundColour(wx.WHITE) self.reset.SetForegroundColour(wx.Colour(0, 128, 128)) self.reset.SetFontToFitLabel( ) # Use the button's default font, but change the font size to fit the label. self.reset.Bind(wx.EVT_BUTTON, self.doReset) self.reset.Refresh() bs.Add(self.reset, border=8, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) bs.Add(setFont(titleFont, wx.StaticText(self, label='CrossMgrImpinj')), border=8, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) bs.AddStretchSpacer() bitmap = wx.Bitmap(clipboard_xpm) self.copyToClipboard = wx.BitmapButton(self, bitmap=bitmap) self.copyToClipboard.SetToolTip( wx.ToolTip('Copy Configuration and Logs to Clipboard...')) self.copyToClipboard.Bind(wx.EVT_BUTTON, self.doCopyToClipboard) bs.Add(self.copyToClipboard, border=32, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) self.tStart = datetime.datetime.now() bs.Add(setFont( bigFont, wx.StaticText(self, label='Last Reset: %s' % self.tStart.strftime('%H:%M:%S'))), border=10, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) self.runningTime = setFont(bigFont, wx.StaticText(self, label='00:00:00')) bs.Add(self.runningTime, border=20, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) bs.Add(setFont(bigFont, wx.StaticText(self, label=' / ')), flag=wx.ALIGN_CENTER_VERTICAL) self.time = setFont(bigFont, wx.StaticText(self, label='00:00:00')) bs.Add(self.time, flag=wx.ALIGN_CENTER_VERTICAL) self.vbs.Add(bs, flag=wx.ALL | wx.EXPAND, border=4) fgs = wx.FlexGridSizer(rows=2, cols=2, vgap=4, hgap=4) fgs.AddGrowableRow(1) fgs.AddGrowableCol(0) fgs.AddGrowableCol(1) fgs.SetFlexibleDirection(wx.BOTH) self.vbs.Add(fgs, flag=wx.EXPAND, proportion=5) #------------------------------------------------------------------------------------------------ # Impinj configuration. # gbs = wx.GridBagSizer(4, 4) fgs.Add(gbs, flag=wx.EXPAND | wx.ALL, border=4) iRow = 0 hb = wx.BoxSizer(wx.HORIZONTAL) hb.Add(setFont(bigFont, wx.StaticText(self, label='Impinj Configuration:')), flag=wx.ALIGN_CENTER_VERTICAL) self.autoDetectButton = wx.Button(self, label='Auto Detect') self.autoDetectButton.Bind(wx.EVT_BUTTON, self.doAutoDetect) hb.Add(self.autoDetectButton, flag=wx.LEFT, border=6) self.advancedButton = wx.Button(self, label='Advanced...') self.advancedButton.Bind(wx.EVT_BUTTON, self.doAdvanced) hb.Add(self.advancedButton, flag=wx.LEFT, border=6) gbs.Add(hb, pos=(iRow, 0), span=(1, 2), flag=wx.ALIGN_LEFT) iRow += 1 gs = wx.GridSizer(rows=0, cols=4, vgap=0, hgap=2) self.antennaLabels = [] self.antennas = [] for i in xrange(4): self.antennaLabels.append( wx.StaticText(self, label='{}'.format(i + 1), style=wx.ALIGN_CENTER)) gs.Add(self.antennaLabels[-1], flag=wx.ALIGN_CENTER | wx.EXPAND) for i in xrange(4): cb = wx.CheckBox(self, wx.ID_ANY, '') if i < 2: cb.SetValue(True) cb.Bind(wx.EVT_CHECKBOX, lambda x: self.getAntennaStr()) gs.Add(cb, flag=wx.ALIGN_CENTER) self.antennas.append(cb) gbs.Add(wx.StaticText(self, label='ANT Ports:'), pos=(iRow, 0), span=(1, 1), flag=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM) gbs.Add(gs, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL) iRow += 1 self.useHostName = wx.RadioButton(self, label='Host Name:', style=wx.RB_GROUP) gbs.Add(self.useHostName, pos=(iRow, 0), span=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL) hb = wx.BoxSizer(wx.HORIZONTAL) hb.Add(wx.StaticText(self, label=ImpinjHostNamePrefix), flag=wx.ALIGN_CENTER_VERTICAL) self.impinjHostName = masked.TextCtrl( self, mask='NN-NN-NN', defaultValue='00-00-00', useFixedWidthFont=True, size=(80, -1), ) hb.Add(self.impinjHostName) hb.Add(wx.StaticText(self, label=ImpinjHostNameSuffix), flag=wx.ALIGN_CENTER_VERTICAL) hb.Add(wx.StaticText(self, label=' : ' + '{}'.format(ImpinjInboundPort)), flag=wx.ALIGN_CENTER_VERTICAL) gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_LEFT) iRow += 1 self.useStaticAddress = wx.RadioButton(self, label='IP:') gbs.Add(self.useStaticAddress, pos=(iRow, 0), span=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL) hb = wx.BoxSizer(wx.HORIZONTAL) self.impinjHost = IpAddrCtrl(self, style=wx.TE_PROCESS_TAB) hb.Add(self.impinjHost) hb.Add(wx.StaticText(self, label=' : ' + '{}'.format(ImpinjInboundPort)), flag=wx.ALIGN_CENTER_VERTICAL) gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_LEFT) self.useHostName.SetValue(True) self.useStaticAddress.SetValue(False) iRow += 1 gbs.Add(wx.StaticText(self, label='ANT Reads:'), pos=(iRow, 0), span=(1, 1), flag=wx.ALIGN_RIGHT) self.antennaReadCount = wx.StaticText( self, label='1:0 0% | 2:0 0% | 3:0 0% | 4:0 0% ') gbs.Add(self.antennaReadCount, pos=(iRow, 1), span=(1, 2), flag=wx.ALIGN_LEFT) iRow += 1 gbs.Add(wx.StaticText(self, label='Backup File:'), pos=(iRow, 0), span=(1, 1), flag=wx.ALIGN_RIGHT) self.backupFile = wx.StaticText( self, label=' ') gbs.Add(self.backupFile, pos=(iRow, 1), span=(1, 2), flag=wx.ALIGN_LEFT) #------------------------------------------------------------------------------------------------ # CrossMgr configuration. # gbs = wx.GridBagSizer(4, 4) fgs.Add(gbs, flag=wx.EXPAND | wx.ALL, border=4) gbs.Add(setFont(bigFont, wx.StaticText(self, label='CrossMgr Configuration:')), pos=(0, 0), span=(1, 2), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) gbs.Add(wx.StaticText(self, label='CrossMgr Address:'), pos=(1, 0), span=(1, 1), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) hb = wx.BoxSizer(wx.HORIZONTAL) self.crossMgrHost = IpAddrCtrl(self, style=wx.TE_PROCESS_TAB) hb.Add(self.crossMgrHost, flag=wx.ALIGN_LEFT) hb.Add(wx.StaticText(self, label=' : 53135'), flag=wx.ALIGN_CENTER_VERTICAL) gbs.Add(hb, pos=(1, 1), span=(1, 1), flag=wx.ALIGN_LEFT) #------------------------------------------------------------------------------------------------ # Add messages # self.impinjMessagesText = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE | wx.HSCROLL, size=(-1, 400)) fgs.Add(self.impinjMessagesText, flag=wx.EXPAND, proportion=2) self.impinjMessages = MessageManager(self.impinjMessagesText) self.crossMgrMessagesText = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE | wx.HSCROLL, size=(-1, 400)) fgs.Add(self.crossMgrMessagesText, flag=wx.EXPAND, proportion=2) self.crossMgrMessages = MessageManager(self.crossMgrMessagesText) self.fgs = fgs #------------------------------------------------------------------------------------------------ # Create a timer to update the messages. # self.timer = wx.Timer() self.timer.Bind(wx.EVT_TIMER, self.updateMessages) self.timer.Start(1000, False) self.Bind(wx.EVT_CLOSE, self.onCloseWindow) self.readOptions() self.SetSizer(self.vbs) self.start()
def __init__(self, parent, ID=-1, title=_(u"Coordonnées"), size=(280, 290), IDcoord=0, IDpersonne=0): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.parent = parent self.IDpersonne = IDpersonne self.IDcoord = IDcoord # Nom de la table if self.parent.GetName() == "panel_candidat": self.nomTable = "coords_candidats" if self.parent.GetName() == "panel_generalites": self.nomTable = "coordonnees" self.panel_frame = wx.Panel(self, -1) self.sizer_infos_staticbox = wx.StaticBox( self.panel_frame, -1, _(u"2. Saisissez les informations")) self.sizer_categories_staticbox = wx.StaticBox( self.panel_frame, -1, _(u"1. Sélectionnez une catégorie")) self.categorieSelect = "" # Boutons self.bouton_fixe = wx.BitmapButton( self.panel_frame, -1, wx.Bitmap(Chemins.GetStaticPath("Images/32x32/Maison_NB.png"), wx.BITMAP_TYPE_ANY)) self.bouton_mobile = wx.BitmapButton( self.panel_frame, -1, wx.Bitmap(Chemins.GetStaticPath("Images/32x32/Mobile_NB.png"), wx.BITMAP_TYPE_ANY)) self.bouton_fax = wx.BitmapButton( self.panel_frame, -1, wx.Bitmap(Chemins.GetStaticPath("Images/32x32/Fax_NB.png"), wx.BITMAP_TYPE_ANY)) self.bouton_email = wx.BitmapButton( self.panel_frame, -1, wx.Bitmap(Chemins.GetStaticPath("Images/32x32/Mail_NB.png"), wx.BITMAP_TYPE_ANY)) self.label_fixe = wx.StaticText(self.panel_frame, -1, "Fixe") self.label_mobile = wx.StaticText(self.panel_frame, -1, "Mobile") self.label_fax = wx.StaticText(self.panel_frame, -1, "Fax") self.label_email = wx.StaticText(self.panel_frame, -1, "Email") self.label_info_mail = wx.StaticText(self.panel_frame, -1, _(u"Email :")) self.text_info_mail = wx.TextCtrl(self.panel_frame, -1, "") self.label_info_tel = wx.StaticText(self.panel_frame, -1, _(u"N° Fixe :")) self.text_info_tel = masked.TextCtrl(self.panel_frame, -1, "", style=wx.TE_CENTRE, mask="##.##.##.##.##.") self.label_info_mail.Hide() self.text_info_mail.Hide() self.label_intitule = wx.StaticText(self.panel_frame, -1, _(u"Intitulé :")) self.text_intitule = wx.TextCtrl(self.panel_frame, -1, "") self.bouton_Ok = CTRL_Bouton_image.CTRL( self.panel_frame, texte=_(u"Ok"), cheminImage=Chemins.GetStaticPath("Images/32x32/Valider.png")) self.bouton_Annuler = CTRL_Bouton_image.CTRL( self.panel_frame, texte=_(u"Annuler"), cheminImage=Chemins.GetStaticPath("Images/32x32/Annuler.png")) self.__set_properties() self.__do_layout() # end wxGlade self.Bind(wx.EVT_BUTTON, self.OnBouton_Fixe, self.bouton_fixe) self.Bind(wx.EVT_BUTTON, self.OnBouton_Mobile, self.bouton_mobile) self.Bind(wx.EVT_BUTTON, self.OnBouton_Fax, self.bouton_fax) self.Bind(wx.EVT_BUTTON, self.OnBouton_Email, self.bouton_email) self.Bind(wx.EVT_BUTTON, self.OnBouton_Ok, self.bouton_Ok) self.Bind(wx.EVT_BUTTON, self.OnBouton_Annuler, self.bouton_Annuler) # Si c'est une modification, on importe les données if self.IDcoord != 0: self.Importation() else: # Désactivation des champs self.ActivationChamps(False)
def __init__(self, prnt, cnt): self.win=wx.ScrolledWindow.__init__(self, parent=prnt, id=-1,size = wx.DefaultSize) self.SetScrollbars(1,1,100,100) ##### self.FitInside() ###### png = wx.Image((cfg.path_img + "cerca19x19.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() #self.Center(wx.BOTH) self.ttl=cnt[0] #self.vtmod=cnt[1][3].upper() self.rec=cnt[2] self.sMM='' self.AggMenu=cnt[3] self.IDMENU=cnt[4] self.color = self.GetBackgroundColour() Nid = wx.NewId() self.__MDI__ = wx.GetApp().GetPhasisMdi() self.font=self.__MDI__.font self.SetFont(self.font) self.CnAz = self.__MDI__.GetConnAZ() self.annoc = self.__MDI__.GetAnnoC() self.datacon = self.__MDI__.GetDataC() self.dzDatiAzienda = self.__MDI__.dzDatiAzienda self.pnl = wx.Panel(id = wx.NewId(), name = '', parent = self, pos = wx.Point(0, 0), size = wx.DLG_SZE(self,680/2,420/2), #size = wx.Size(680, 420), style = wx.SIMPLE_BORDER | wx.TAB_TRAVERSAL) self.pnl.SetFont(self.font) self.ldataDA = wx.StaticText(self.pnl, -1, "Data Da:", wx.DLG_PNT(self.pnl, 35,62)) self.data_docDA = masked.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 65,60), wx.DLG_SZE(self.pnl, 30,cfg.DIMFONTDEFAULT),wx.ALIGN_RIGHT, autoformat='EUDATEDDMMYYYY/') self.ldataDA = wx.StaticText(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 55,62)) self.cdata_docDA = wx.Button(self.pnl, -1, "...", wx.DLG_PNT(self.pnl, 115,60), wx.DLG_SZE(self.pnl,cfg.btnSzeSH,cfg.btnSzeV)) ########################### #wx.StaticText(self.pnl, -1, "Num. Doc. DA", wx.DLG_PNT(self.pnl, 160,62)) self.num_scad = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 235,60), wx.DLG_SZE(self.pnl, 30,cfg.DIMFONTDEFAULT),wx.ALIGN_RIGHT) self.num_docDA = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 235,60), wx.DLG_SZE(self.pnl, 30,cfg.DIMFONTDEFAULT),wx.ALIGN_RIGHT) #wx.StaticText(self.pnl, -1, "Num. Doc. A", wx.DLG_PNT(self.pnl, 160,82)) self.num_docA = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 235,80), wx.DLG_SZE(self.pnl, 30,cfg.DIMFONTDEFAULT),wx.ALIGN_RIGHT) ######################################## self.ldataA = wx.StaticText(self.pnl, -1, "Data A:", wx.DLG_PNT(self.pnl, 130,62)) self.data_docA = masked.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 157,60), wx.DLG_SZE(self.pnl, 30,cfg.DIMFONTDEFAULT),wx.ALIGN_RIGHT, autoformat='EUDATEDDMMYYYY/') self.cdata_docA = wx.Button(self.pnl, -1, "...", wx.DLG_PNT(self.pnl, 207,60), wx.DLG_SZE(self.pnl,cfg.btnSzeSH,cfg.btnSzeV)) # linea 2 wx.StaticText(self.pnl, -1, "Controp.:", wx.DLG_PNT(self.pnl, 35,82)) self.CF = wx.ComboBox(self.pnl, Nid,"", wx.DLG_PNT(self.pnl, 65,80), wx.DLG_SZE(self.pnl, 50,-1), [], wx.CB_DROPDOWN | wx.CB_SORT ) self.vCF = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 65,80)) self.TIPO_SCAD = wx.ComboBox(self.pnl, 300,"", wx.DLG_PNT(self.pnl, 129,80), wx.DLG_SZE(self.pnl, 90,-1),[], wx.CB_DROPDOWN | wx.CB_SORT ) self.vTIPO_SCAD = wx.TextCtrl(self.pnl , -1, "", wx.DLG_PNT(self.pnl , 129,80), wx.DLG_SZE(self.pnl , 0, cfg.DIMFONTDEFAULT),wx.TE_PROCESS_ENTER) wx.StaticText(self.pnl, -1, "Somma Totale Dare:", wx.DLG_PNT(self.pnl, 85,102)) self.tot_docD = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 149,100), wx.DLG_SZE(self.pnl, 70,-1), wx.ALIGN_RIGHT) wx.StaticText(self.pnl, -1, "Somma Totale Avere:", wx.DLG_PNT(self.pnl, 85,122)) self.tot_docA = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 149,120), wx.DLG_SZE(self.pnl, 70,-1), wx.ALIGN_RIGHT) wx.StaticText(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 85,142)) # Crea Button------------------------------------------------- #self.ok = wx.Button(self.pnl, -1, cfg.vcok, #wx.DLG_PNT(self.pnl, 120,10), #wx.DLG_SZE(self.pnl,cfg.btnSzeLH,cfg.btnSzeV)) self.canc = wx.Button(self.pnl, -1, cfg.vccanc, wx.DLG_PNT(self.pnl, 250,60), wx.DLG_SZE(self.pnl,cfg.btnSzeLH,cfg.btnSzeV)) self.stampa = wx.Button(self.pnl, -1, cfg.vcstampa, wx.DLG_PNT(self.pnl, 250,75), wx.DLG_SZE(self.pnl,cfg.btnSzeLH,cfg.btnSzeV)) self.totale = wx.Button(self.pnl, -1, "Totale", wx.DLG_PNT(self.pnl, 250,90), wx.DLG_SZE(self.pnl,cfg.btnSzeLH,cfg.btnSzeV)) self.SetFont(self.font) box_sizer = wx.BoxSizer(wx.VERTICAL) box_sizer.Add(self.pnl, 0, wx.EXPAND|wx.ALL,5) self.SetAutoLayout(1) self.SetSizer(box_sizer) box_sizer.Fit(self) self.TIPO_SCAD.Bind(wx.EVT_COMBOBOX, self.SelCOMBOtiposcadev) self.CF.Bind(wx.EVT_COMBOBOX, self.SelCOMBOcfev) self.canc.Bind(wx.EVT_BUTTON, self.Close) self.cdata_docDA.Bind(wx.EVT_BUTTON, self.SrcDocDA) self.cdata_docA.Bind(wx.EVT_BUTTON, self.SrcDocA) #self.Bind(wx.EVT_TEXT_ENTER, self.SrcDocDA, self.data_docDA) #self.Bind(wx.EVT_TEXT_ENTER, self.SrcDocA, self.data_docA) self.totale.Bind(wx.EVT_BUTTON, self.TotDoc) self.stampa.Bind(wx.EVT_BUTTON, self.Stampa) self.Bind(wx.EVT_CLOSE, self.Close) self.Start(self)
def __init__(self, parent, db): wx.Panel.__init__(self, parent, -1) self.db = db self.changes = {} self.SetSize((396, 379)) self.tabChoice = [ 'inserts tabs + spaces', 'inserts spaces only', 'indents' ] self.backspaceChoice = ['deletes character only', 'deletes indent'] self.homeChoice = ['start/end of document', 'start/end of line'] normen = wx.Font(13, wx.SWISS, wx.NORMAL, wx.DEFAULT) bolden = wx.Font(13, wx.SWISS, wx.NORMAL, wx.BOLD) l1 = wx.StaticText(self, -1, "Tab Key :", (81, 23)) #86)) l2 = wx.StaticText(self, -1, "Backspace :", (65, 122)) #85)) l3 = wx.StaticText(self, -1, "Home/end key :", (36, 154)) l4 = wx.StaticText(self, -1, "Document :", (67, 187)) l5 = wx.StaticText(self, -1, "characters per tab", (209, 57)) l6 = wx.StaticText(self, -1, "characters per indent", (209, 90)) l7 = wx.StaticText(self, -1, "pixels width", (215, 189)) l1.SetFont(bolden) l2.SetFont(bolden) l3.SetFont(bolden) l4.SetFont(bolden) l5.SetFont(normen) l6.SetFont(normen) l7.SetFont(normen) self.choice1 = wx.Choice(self, 780, pos=(152, 21), size=(198, 21), choices=self.tabChoice) self.t1 = masked.TextCtrl(self, -1, "", pos=(173, 54), size=(30, 21), mask='#{2}') self.t2 = masked.TextCtrl(self, -1, "", pos=(173, 87), size=(30, 21), mask='#{2}') self.t3 = masked.TextCtrl(self, -1, "", pos=(153, 186), size=(50, 21), mask='#{5}') self.choice2 = wx.Choice(self, 781, pos=(152, 120), size=(196, 21), choices=self.backspaceChoice) self.choice3 = wx.Choice(self, 782, pos=(152, 153), size=(196, 21), choices=self.homeChoice) self.b1 = wx.Button(self, 782, "Set the base font...", pos=(153, 219), size=(140, 21)) self.b2 = wx.Button(self, wx.ID_CANCEL, pos=(222, 283)) self.b3 = wx.Button(self, wx.ID_OK, pos=(305, 283)) self.b4 = wx.Button(self, 783, "Reset", pos=(21, 283), size=(70, 20)) self.b3.SetDefault() self.Bind(wx.EVT_CHOICE, self.Choice1Changed, self.choice1) self.Bind(wx.EVT_CHOICE, self.Choice2Changed, self.choice2) self.Bind(wx.EVT_CHOICE, self.Choice3Changed, self.choice3) self.Bind(wx.EVT_TEXT, self.t1Changed, self.t1) self.Bind(wx.EVT_TEXT, self.t2Changed, self.t2) self.Bind(wx.EVT_TEXT, self.t3Changed, self.t3) self.Bind(wx.EVT_BUTTON, self.Reset, self.b4) self.GetVals()
def __init__(self, parent, id=wx.ID_ANY, title='', size=(200, 200)): wx.Frame.__init__(self, parent, id, title, size=size) dataDir = Utils.getHomeDir() configFileName = os.path.join(dataDir, 'CrossMgrImpinj.cfg') self.config = wx.Config(appName="CrossMgrImpinj", vendorName="SmartCyclingSolutions", localFilename=configFileName) ID_MENU_ADVANCECONFIG = wx.NewIdRef() ID_MENU_COPYLOGS = wx.NewIdRef() ID_MENU_AUTODETECT = wx.NewIdRef() self.menuBar = wx.MenuBar(wx.MB_DOCKABLE) if 'WXMAC' in wx.Platform: self.appleMenu = self.menuBar.OSXGetAppleMenu() self.appleMenu.SetTitle("CrossMgrImpinj") self.appleMenu.Insert(0, wx.ID_ABOUT, "&About") self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT) self.editMenu = wx.Menu() self.editMenu.Append( wx.MenuItem(self.editMenu, ID_MENU_ADVANCECONFIG, "A&dvanced Configuration")) self.editMenu.Append( wx.MenuItem(self.editMenu, ID_MENU_COPYLOGS, "&Copy Logs to Clipboard")) self.editMenu.Append( wx.MenuItem(self.editMenu, ID_MENU_AUTODETECT, "&Autodetect Reader")) self.Bind(wx.EVT_MENU, self.doAdvanced, id=ID_MENU_ADVANCECONFIG) self.Bind(wx.EVT_MENU, self.doCopyToClipboard, id=ID_MENU_COPYLOGS) self.Bind(wx.EVT_MENU, self.doAutoDetect, id=ID_MENU_AUTODETECT) self.menuBar.Append(self.editMenu, "&Edit") else: self.fileMenu = wx.Menu() self.fileMenu.Append( wx.MenuItem(self.fileMenu, ID_MENU_ADVANCECONFIG, "A&dvanced Configuration")) self.fileMenu.Append( wx.MenuItem(self.fileMenu, ID_MENU_COPYLOGS, "&Copy Logs to Clipboard")) self.fileMenu.Append( wx.MenuItem(self.fileMenu, ID_MENU_AUTODETECT, "&Autodetect Reader")) self.fileMenu.Append(wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.doAdvanced, id=ID_MENU_ADVANCECONFIG) self.Bind(wx.EVT_MENU, self.doCopyToClipboard, id=ID_MENU_COPYLOGS) self.Bind(wx.EVT_MENU, self.doAutoDetect, id=ID_MENU_AUTODETECT) self.Bind(wx.EVT_MENU, self.onCloseWindow, id=wx.ID_EXIT) self.menuBar.Append(self.fileMenu, "&File") self.helpMenu = wx.Menu() self.helpMenu.Insert(0, wx.ID_ABOUT, "&About") self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT) self.menuBar.Append(self.helpMenu, "&Help") self.SetMenuBar(self.menuBar) self.SetBackgroundColour(wx.Colour(232, 232, 232)) self.LightGreen = wx.Colour(153, 255, 153) self.LightRed = wx.Colour(255, 153, 153) font = self.GetFont() bigFont = wx.Font(int(font.GetPointSize() * 1.2), font.GetFamily(), font.GetStyle(), wx.FONTWEIGHT_BOLD) titleFont = wx.Font(int(bigFont.GetPointSize() * 2.2), bigFont.GetFamily(), bigFont.GetStyle(), bigFont.GetWeight()) self.vbs = wx.BoxSizer(wx.VERTICAL) bs = wx.BoxSizer(wx.HORIZONTAL) self.reset = RoundButton(self, label='Reset', size=(80, 80)) self.reset.SetBackgroundColour(wx.WHITE) self.reset.SetForegroundColour(wx.Colour(0, 128, 128)) self.reset.SetFontToFitLabel( ) # Use the button's default font, but change the font size to fit the label. self.reset.Bind(wx.EVT_BUTTON, self.doReset) self.reset.Refresh() bs.Add(self.reset, border=8, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) bs.Add(setFont(titleFont, wx.StaticText(self, label='CrossMgrImpinj')), border=8, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) bs.AddStretchSpacer() bitmap = wx.Bitmap(clipboard_xpm) self.copyToClipboard = wx.BitmapButton(self, bitmap=bitmap) self.copyToClipboard.SetToolTip( wx.ToolTip('Copy Configuration and Logs to Clipboard...')) self.copyToClipboard.Bind(wx.EVT_BUTTON, self.doCopyToClipboard) bs.Add(self.copyToClipboard, border=32, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) self.tStart = datetime.datetime.now() bs.Add(setFont( bigFont, wx.StaticText(self, label='Last Reset: %s' % self.tStart.strftime('%H:%M:%S'))), border=10, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) self.runningTime = setFont(bigFont, wx.StaticText(self, label='00:00:00')) bs.Add(self.runningTime, border=20, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) bs.Add(setFont(bigFont, wx.StaticText(self, label=' / ')), flag=wx.ALIGN_CENTER_VERTICAL) self.time = setFont(bigFont, wx.StaticText(self, label='00:00:00')) bs.Add(self.time, flag=wx.ALIGN_CENTER_VERTICAL) self.vbs.Add(bs, flag=wx.ALL | wx.EXPAND, border=4) fgs = wx.FlexGridSizer(rows=2, cols=2, vgap=4, hgap=4) fgs.AddGrowableRow(1) fgs.AddGrowableCol(0) fgs.AddGrowableCol(1) fgs.SetFlexibleDirection(wx.BOTH) self.vbs.Add(fgs, flag=wx.EXPAND, proportion=5) #------------------------------------------------------------------------------------------------ # Impinj configuration. # gbs = wx.GridBagSizer(4, 4) fgs.Add(gbs, flag=wx.EXPAND | wx.ALL, border=4) iRow = 0 hb = wx.BoxSizer(wx.HORIZONTAL) hb.Add(setFont(bigFont, wx.StaticText(self, label='Impinj Configuration:')), flag=wx.ALIGN_CENTER_VERTICAL) self.autoDetectButton = wx.Button(self, label='Auto Detect') self.autoDetectButton.Bind(wx.EVT_BUTTON, self.doAutoDetect) hb.Add(self.autoDetectButton, flag=wx.LEFT, border=6) self.advancedButton = wx.Button(self, label='Advanced...') self.advancedButton.Bind(wx.EVT_BUTTON, self.doAdvanced) hb.Add(self.advancedButton, flag=wx.LEFT, border=6) gbs.Add(hb, pos=(iRow, 0), span=(1, 2), flag=wx.ALIGN_LEFT) iRow += 1 gs = wx.GridSizer(rows=0, cols=4, vgap=0, hgap=2) self.antennaLabels = [] self.antennas = [] for i in range(4): self.antennaLabels.append( wx.StaticText(self, label='{}'.format(i + 1), style=wx.ALIGN_CENTER)) gs.Add(self.antennaLabels[-1], flag=wx.ALIGN_CENTER | wx.EXPAND) for i in range(4): cb = wx.CheckBox(self, wx.ID_ANY, '') if i < 2: cb.SetValue(True) cb.Bind(wx.EVT_CHECKBOX, lambda x: self.getAntennaStr()) gs.Add(cb, flag=wx.ALIGN_CENTER) self.antennas.append(cb) hb = wx.BoxSizer() hb.Add(gs) self.methodName = wx.StaticText(self) self.refreshMethodName() hb.Add(self.methodName, flag=wx.ALIGN_BOTTOM | wx.LEFT, border=8) gbs.Add(wx.StaticText(self, label='ANT Ports:'), pos=(iRow, 0), span=(1, 1), flag=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM) gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL) iRow += 1 self.useHostName = wx.RadioButton(self, label='Host Name:', style=wx.RB_GROUP) gbs.Add(self.useHostName, pos=(iRow, 0), span=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL) hb = wx.BoxSizer(wx.HORIZONTAL) hb.Add(wx.StaticText(self, label=ImpinjHostNamePrefix), flag=wx.ALIGN_CENTER_VERTICAL) if 'WXMAC' in wx.Platform: self.impinjHostName = masked.TextCtrl( self, defaultValue='00-00-00', useFixedWidthFont=True, size=(80, -1), ) else: self.impinjHostName = masked.TextCtrl( self, mask='NN-NN-NN', defaultValue='00-00-00', useFixedWidthFont=True, size=(80, -1), ) hb.Add(self.impinjHostName) hb.Add(wx.StaticText(self, label=ImpinjHostNameSuffix), flag=wx.ALIGN_CENTER_VERTICAL) hb.Add(wx.StaticText(self, label=' : ' + '{}'.format(ImpinjInboundPort)), flag=wx.ALIGN_CENTER_VERTICAL) gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_LEFT) iRow += 1 self.useStaticAddress = wx.RadioButton(self, label='IP:') gbs.Add(self.useStaticAddress, pos=(iRow, 0), span=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL) hb = wx.BoxSizer(wx.HORIZONTAL) self.impinjHost = IpAddrCtrl(self, style=wx.TE_PROCESS_TAB) hb.Add(self.impinjHost) hb.Add(wx.StaticText(self, label=' : ' + '{}'.format(ImpinjInboundPort)), flag=wx.ALIGN_CENTER_VERTICAL) gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_LEFT) self.useHostName.SetValue(True) self.useStaticAddress.SetValue(False) iRow += 1 self.antennaReads = AntennaReads(self) gbs.Add(self.antennaReads, pos=(iRow, 0), span=(1, 3), flag=wx.ALIGN_LEFT | wx.EXPAND) iRow += 1 self.antennaReadCount = wx.StaticText( self, label='ANT Reads: 1:0 0% | 2:0 0% | 3:0 0% | 4:0 0% ' ) gbs.Add(self.antennaReadCount, pos=(iRow, 0), span=(1, 3), flag=wx.ALIGN_LEFT) iRow += 1 gbs.Add(wx.StaticText(self, label='Backup File:'), pos=(iRow, 0), span=(1, 1), flag=wx.ALIGN_RIGHT) self.backupFile = wx.StaticText( self, label=' ') gbs.Add(self.backupFile, pos=(iRow, 1), span=(1, 2), flag=wx.ALIGN_LEFT) #------------------------------------------------------------------------------------------------ # CrossMgr configuration. # cmcs = wx.BoxSizer(wx.VERTICAL) fgs.Add(cmcs, flag=wx.EXPAND | wx.ALL, border=4) cmcs.Add( setFont(bigFont, wx.StaticText(self, label='CrossMgr Configuration:'))) hh = wx.BoxSizer(wx.HORIZONTAL) hh.Add(wx.StaticText(self, label='CrossMgr Address:'), flag=wx.ALIGN_CENTER_VERTICAL) self.crossMgrHost = IpAddrCtrl(self, style=wx.TE_PROCESS_TAB) hh.Add(self.crossMgrHost, flag=wx.ALIGN_LEFT) hh.Add(wx.StaticText(self, label=' : 53135'), flag=wx.ALIGN_CENTER_VERTICAL) cmcs.Add(hh, flag=wx.ALL, border=4) #------------------------------------------------------------------------------------------------ # Add strays # cmcs.Add(wx.StaticLine(self, style=wx.LI_HORIZONTAL), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=2) self.strayTagsLabel = wx.StaticText(self, label='Stray Tags: ') cmcs.Add(self.strayTagsLabel, flag=wx.LEFT | wx.RIGHT, border=4) self.strays = wx.ListCtrl(self, style=wx.LC_REPORT | wx.BORDER_SUNKEN, size=(-1, 50)) self.strays.InsertColumn(0, 'Tag', wx.LIST_AUTOSIZE_USEHEADER) self.strays.InsertColumn(1, 'Time', wx.LIST_AUTOSIZE_USEHEADER) cmcs.Add(self.strays, 1, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, border=4) #------------------------------------------------------------------------------------------------ # Add messages # self.impinjMessagesText = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE | wx.HSCROLL, size=(-1, 400)) fgs.Add(self.impinjMessagesText, flag=wx.EXPAND, proportion=2) self.impinjMessages = MessageManager(self.impinjMessagesText) self.crossMgrMessagesText = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE | wx.HSCROLL, size=(-1, 400)) fgs.Add(self.crossMgrMessagesText, flag=wx.EXPAND, proportion=2) self.crossMgrMessages = MessageManager(self.crossMgrMessagesText) self.fgs = fgs #------------------------------------------------------------------------------------------------ # Create a timer to update the messages. # self.timer = wx.Timer() self.timer.Bind(wx.EVT_TIMER, self.updateMessages) self.timer.Start(1000, False) self.Bind(wx.EVT_CLOSE, self.onCloseWindow) self.readOptions() self.SetSizer(self.vbs) self.start()
def __init__( self, parent, id = wx.ID_ANY, title = '', size = (550, 480) ): super( MainWin, self ).__init__( parent, id, title = title, size = size ) self.SetTitle( AppVerName ) self.successBitmap = wx.Bitmap( Images.success_xpm ) self.attemptBitmap = wx.Bitmap( Images.attempt_xpm ) self.errorBitmap = wx.Bitmap( Images.error_xpm ) dataDir = Utils.getHomeDir() configFileName = os.path.join(dataDir, 'TagReadWrite.cfg') self.config = wx.Config(appName="TagReadWrite", vendorName="SmartCyclingSolutions", localFilename=configFileName ) ID_MENU_ADVANCECONFIG = wx.NewIdRef() ID_MENU_COPYLOGS = wx.NewIdRef() ID_MENU_AUTODETECT = wx.NewIdRef() self.menuBar = wx.MenuBar(wx.MB_DOCKABLE) if 'WXMAC' in wx.Platform: self.appleMenu = self.menuBar.OSXGetAppleMenu() self.appleMenu.SetTitle("CrossMgrImpinj") self.appleMenu.Insert(0, wx.ID_ABOUT, "&About") self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT) self.editMenu = wx.Menu() self.editMenu.Append(wx.MenuItem(self.editMenu, ID_MENU_AUTODETECT,"&Autodetect Reader")) self.Bind(wx.EVT_MENU, self.doAutoDetect, id=ID_MENU_AUTODETECT) self.menuBar.Append(self.editMenu, "&Edit") else: self.fileMenu = wx.Menu() self.fileMenu.Append(wx.MenuItem(self.fileMenu, ID_MENU_AUTODETECT,"&Autodetect Reader")) self.fileMenu.Append(wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.doAutoDetect, id=ID_MENU_AUTODETECT) self.Bind(wx.EVT_MENU, self.onClose, id=wx.ID_EXIT) self.menuBar.Append(self.fileMenu, "&File") self.helpMenu = wx.Menu() self.helpMenu.Insert(0, wx.ID_ABOUT, "&About") self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT) self.menuBar.Append(self.helpMenu, "&Help") self.SetMenuBar(self.menuBar) self.tagWriter = None self.backgroundColour = wx.Colour(232,232,232) self.SetBackgroundColour( self.backgroundColour ) self.LightGreen = wx.Colour(153,255,153) self.LightRed = wx.Colour(255,153,153) vsMain = wx.BoxSizer( wx.VERTICAL ) self.title = wx.StaticText( self, label = 'CrossMgr Impinj Tag Read/Write' ) self.title.SetFont( wx.Font(16, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD) ) self.url = hl.HyperLinkCtrl( self, label = 'Powered by CrossMgr', URL = 'http://sites.google.com/site/crossmgrsoftware' ) self.url.SetBackgroundColour( self.backgroundColour ) #------------------------------------------------------------------------------------------------- # Impinj configuration. # impinjConfiguration = wx.StaticBox( self, label = 'Impinj Configuration' ) impinjConfigurationSizer = wx.StaticBoxSizer( impinjConfiguration, wx.HORIZONTAL ) gbs = wx.GridBagSizer( 4, 4 ) impinjConfigurationSizer.Add( gbs, flag = wx.ALL, border = 4 ) iRow = 0 self.useHostName = wx.RadioButton( self, label = 'Host Name:', style=wx.RB_GROUP ) gbs.Add( self.useHostName, pos=(iRow,0), span=(1,1), flag=wx.ALIGN_CENTER_VERTICAL ) hb = wx.BoxSizer( wx.HORIZONTAL ) hb.Add( wx.StaticText(self, label = ImpinjHostNamePrefix), flag=wx.ALIGN_CENTER_VERTICAL ) if 'WXMAC' in wx.Platform: self.impinjHostName = masked.TextCtrl( self, wx.ID_ANY, defaultValue = '00-00-00', useFixedWidthFont = True, size=(80, -1), ) else: self.impinjHostName = masked.TextCtrl( self, wx.ID_ANY, mask = 'NN-NN-NN', defaultValue = '00-00-00', useFixedWidthFont = True, size=(80, -1), ) hb.Add( self.impinjHostName ) hb.Add( wx.StaticText(self, label = ImpinjHostNameSuffix), flag=wx.ALIGN_CENTER_VERTICAL ) hb.Add( wx.StaticText(self, label = ' : ' + '{}'.format(ImpinjInboundPort)), flag=wx.ALIGN_CENTER_VERTICAL ) gbs.Add( hb, pos=(iRow,1), span=(1,1), flag=wx.ALIGN_LEFT ) iRow += 1 self.useStaticAddress = wx.RadioButton( self, wx.ID_ANY, 'IP:' ) gbs.Add( self.useStaticAddress, pos=(iRow,0), span=(1,1), flag=wx.ALIGN_CENTER_VERTICAL ) hb = wx.BoxSizer( wx.HORIZONTAL ) self.impinjHost = IpAddrCtrl( self, style = wx.TE_PROCESS_TAB ) hb.Add( self.impinjHost ) hb.Add( wx.StaticText(self, label = ' : ' + '{}'.format(ImpinjInboundPort)), flag=wx.ALIGN_CENTER_VERTICAL ) gbs.Add( hb, pos=(iRow,1), span=(1,1), flag=wx.ALIGN_LEFT ) iRow += 1 gbs.Add( wx.StaticLine(self, style=wx.LI_HORIZONTAL), pos=(iRow,0), span=(1,2) ) iRow += 1 self.autoDetectButton = wx.Button(self, wx.ID_ANY, 'Auto Detect Reader') self.autoDetectButton.Bind( wx.EVT_BUTTON, self.doAutoDetect ) gbs.Add( self.autoDetectButton, pos=(iRow,0), span=(1,2), flag=wx.ALIGN_RIGHT ) iRow += 1 self.disconnectButton = wx.Button(self, wx.ID_ANY, 'Disconnect') self.disconnectButton.Bind( wx.EVT_BUTTON, self.doDisconnect ) gbs.Add( self.disconnectButton, pos=(iRow,0), span=(1,2), flag=wx.ALIGN_RIGHT ) iRow += 1 self.useHostName.SetValue( True ) self.useStaticAddress.SetValue( False ) statusVS = wx.BoxSizer( wx.VERTICAL ) hs = wx.BoxSizer( wx.HORIZONTAL ) self.statusBitmap = wx.StaticBitmap( self, wx.ID_ANY, self.attemptBitmap ) self.statusLabel = wx.StaticText( self, label = 'Connecting...' ) hs.Add( self.statusBitmap ) hs.Add( self.statusLabel, flag = wx.ALIGN_CENTRE_VERTICAL ) self.resetButton = wx.Button( self, label = 'Reset Connection' ) self.resetButton.Bind( wx.EVT_BUTTON, self.doReset ) statusVS.Add( hs, flag = wx.ALL|wx.ALIGN_CENTRE, border = 4 ) statusVS.Add( self.resetButton, flag = wx.ALL|wx.ALIGN_CENTRE, border = 4 ) impinjConfigurationSizer.Add( statusVS, 1, flag = wx.EXPAND|wx.ALL, border = 4 ) #------------------------------------------------------------------------------------------------- writeTags = wx.StaticBox( self, label = 'Write Tags' ) vs1 = wx.StaticBoxSizer( writeTags, wx.VERTICAL ) self.templateLabel = wx.StaticText( self, label = 'Template (0-9A-F, #### for number):' ) self.template = wx.TextCtrl( self, validator = TemplateValidator() ) self.template.SetMaxLength( self.EPCHexCharsMax ) self.template.Bind( wx.EVT_TEXT, self.onTextChange ) self.numberLabel = wx.StaticText( self, label = 'Number:' ) self.number = wx.lib.intctrl.IntCtrl( self, min = 1, max = 99999999, allow_none = True, limited = True, value = 1 ) self.number.Bind( wx.EVT_TEXT, self.onTextChange ) self.incrementLabel = wx.StaticText( self, label = 'Increment by:' ) self.increment = wx.lib.intctrl.IntCtrl( self, min = 0, max = 99999999, limited = True, value = 1 ) self.valueLabel = wx.StaticText( self, label = 'Next Value to Write:' ) self.value = wx.TextCtrl( self, style = wx.TE_READONLY ) self.value.SetMaxLength( self.EPCHexCharsMax ) self.value.SetBackgroundColour( wx.Colour(235,235,235) ) self.writeSuccess = wx.Gauge( self, style = wx.GA_HORIZONTAL, range = 100 ) self.writeButton = wx.Button( self, label = 'Write (F1 or Space)' ) self.writeButton.Enabled = False self.writeButton.Bind( wx.EVT_BUTTON, self.onWriteButton ) readTags = wx.StaticBox( self, label = 'Read Tags' ) vs2 = wx.StaticBoxSizer( readTags, wx.VERTICAL ) self.tags = wx.TextCtrl( self, style = wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_PROCESS_ENTER ) self.readButton = wx.Button( self, label = 'Read (F2)' ) self.readButton.Enabled = False self.readButton.Bind( wx.EVT_BUTTON, self.onReadButton ) hs = wx.BoxSizer( wx.HORIZONTAL ) labelBorderOptions = wx.TOP | wx.LEFT | wx.RIGHT valueBorderOptions = wx.BOTTOM | wx.LEFT | wx.RIGHT border = 2 vs1.Add( self.templateLabel, flag = labelBorderOptions, border = border ) vs1.Add( self.template, flag = wx.EXPAND|valueBorderOptions, border = border ) vs1.Add( self.numberLabel, flag = labelBorderOptions, border = border ) vs1.Add( self.number, flag = wx.EXPAND|valueBorderOptions, border = border ) vs1.Add( self.incrementLabel, flag = labelBorderOptions, border = border ) vs1.Add( self.increment, flag = wx.EXPAND|valueBorderOptions, border = border ) vs1.Add( self.valueLabel, flag = labelBorderOptions, border = border ) vs1.Add( self.value, flag = wx.EXPAND|valueBorderOptions, border = border ) vs1.Add( self.writeSuccess, 0, flag = wx.EXPAND|wx.ALL, border = border ) vs1.AddStretchSpacer() vs1.Add( self.writeButton, flag = wx.EXPAND|wx.ALL|wx.ALIGN_BOTTOM, border = border ) vs2.Add( self.tags, 1, flag = wx.EXPAND|wx.ALL, border = border ) vs2.Add( self.readButton, flag = wx.EXPAND|wx.ALL, border = border ) hs.Add( vs1, 1, flag = wx.EXPAND|wx.ALL, border = border ) hs.Add( vs2, 1, flag = wx.EXPAND|wx.ALL, border = border ) hsTitle = wx.BoxSizer( wx.HORIZONTAL ) hsTitle.Add( self.title ) hsTitle.AddStretchSpacer() hsTitle.Add( self.url, flag = wx.ALIGN_RIGHT|wx.ALIGN_CENTRE_VERTICAL ) vsMain.Add( hsTitle, flag = wx.ALL|wx.EXPAND, border = border ) vsMain.Add( impinjConfigurationSizer, flag = wx.ALL|wx.EXPAND, border = border ) vsMain.Add( hs, 1, flag = wx.EXPAND ) self.sb = self.CreateStatusBar() self.getWriteValue() self.setWriteSuccess( False ) self.SetSizer( vsMain ) self.readOptions() self.Bind( wx.EVT_CLOSE, self.onClose ) self.idWrite, self.idRead = self.writeButton.GetId(), self.readButton.GetId() self.Bind(wx.EVT_MENU, self.onWriteButton, id=self.idWrite) self.Bind(wx.EVT_MENU, self.onReadButton, id=self.idRead) wx.CallAfter( self.doReset )
def __init__(self, parent, log): self.log = log scroll.ScrolledPanel.__init__(self, parent, -1) self.sizer = wx.BoxSizer(wx.VERTICAL) labelMaskedCombos = wx.StaticText( self, -1, """\ These are some examples of masked.ComboBox:""") labelMaskedCombos.SetForegroundColour("Blue") label_statecode = wx.StaticText( self, -1, """\ A state selector; only "legal" values can be entered:""") statecode = masked.ComboBox(self, -1, masked.states[0], choices=masked.states, autoformat="USSTATE") label_statename = wx.StaticText( self, -1, """\ A state name selector, with auto-select:""") # Create this one using factory function: statename = masked.Ctrl(self, -1, masked.state_names[0], controlType=masked.controlTypes.COMBO, choices=masked.state_names, autoformat="USSTATENAME", autoSelect=True) statename.SetCtrlParameters(formatcodes='F!V_') numerators = [str(i) for i in range(1, 4)] denominators = [ string.ljust(str(i), 2) for i in [2, 3, 4, 5, 8, 16, 32, 64] ] fieldsDict = { 0: masked.Field(choices=numerators, choiceRequired=False), 1: masked.Field(choices=denominators, choiceRequired=True) } choices = [] for n in numerators: for d in denominators: if n != d: choices.append('%s/%s' % (n, d)) label_fraction = wx.StaticText( self, -1, """\ A masked ComboBox for fraction selection. Choices for each side of the fraction can be selected with PageUp/Down:""") fraction = masked.Ctrl(self, -1, "", controlType=masked.controlTypes.COMBO, choices=choices, choiceRequired=True, mask="#/##", formatcodes="F_", validRegex="^\d\/\d\d?", fields=fieldsDict) label_code = wx.StaticText( self, -1, """\ A masked ComboBox to validate text from a list of numeric codes:""") choices = ["91", "136", "305", "4579"] code = masked.ComboBox(self, -1, choices[0], choices=choices, choiceRequired=True, formatcodes="F_r", mask="####") label_selector = wx.StaticText( self, -1, """\ Programmatically set choice sets:""") self.list_selector = wx.ComboBox(self, -1, '', choices=['list1', 'list2', 'list3']) self.dynamicbox = masked.Ctrl( self, -1, ' ', controlType=masked.controlTypes.COMBO, mask='XXXX', formatcodes='F_', # these are to give dropdown some initial height, # as base control apparently only sets that size # during initial construction <sigh>: choices=['', '1', '2', '3', '4', '5']) self.dynamicbox.Clear( ) # get rid of initial choices used to size the dropdown labelIpAddrs = wx.StaticText( self, -1, """\ Here are some examples of IpAddrCtrl, a control derived from masked.TextCtrl:""" ) labelIpAddrs.SetForegroundColour("Blue") label_ipaddr1 = wx.StaticText(self, -1, "An empty control:") ipaddr1 = masked.IpAddrCtrl(self, -1, style=wx.TE_PROCESS_TAB) label_ipaddr2 = wx.StaticText(self, -1, "A restricted mask:") ipaddr2 = masked.IpAddrCtrl(self, -1, mask=" 10. 1.109.###") label_ipaddr3 = wx.StaticText( self, -1, """\ A control with restricted legal values: 10. (1|2) . (129..255) . (0..255)""") ipaddr3 = masked.Ctrl(self, -1, controlType=masked.controlTypes.IPADDR, mask=" 10. #.###.###") ipaddr3.SetFieldParameters( 0, validRegex="1|2", validRequired=False) # requires entry to match or not allowed # This allows any value in penultimate field, but colors anything outside of the range invalid: ipaddr3.SetFieldParameters(1, validRange=(129, 255), validRequired=False) labelNumerics = wx.StaticText( self, -1, """\ Here are some useful configurations of a masked.TextCtrl for integer and floating point input that still treat the control as a text control. (For a true numeric control, check out the masked.NumCtrl class!)""" ) labelNumerics.SetForegroundColour("Blue") label_intctrl1 = wx.StaticText( self, -1, """\ An integer entry control with shifting insert enabled:""") self.intctrl1 = masked.TextCtrl(self, -1, name='intctrl', mask="#{9}", formatcodes='_-,F>') label_intctrl2 = wx.StaticText( self, -1, """\ Right-insert integer entry:""") self.intctrl2 = masked.TextCtrl(self, -1, name='intctrl', mask="#{9}", formatcodes='_-,Fr') label_floatctrl = wx.StaticText( self, -1, """\ A floating point entry control with right-insert for ordinal:""") self.floatctrl = masked.TextCtrl(self, -1, name='floatctrl', mask="#{9}.#{2}", formatcodes="F,_-R", useParensForNegatives=False) self.floatctrl.SetFieldParameters( 0, formatcodes='r<', validRequired=True ) # right-insert, require explicit cursor movement to change fields self.floatctrl.SetFieldParameters( 1, defaultValue='00') # don't allow blank fraction label_numselect = wx.StaticText( self, -1, """\ <= Programmatically set the value of the float entry ctrl:""") numselect = wx.ComboBox(self, -1, choices=[ '', '111', '222.22', '-3', '54321.666666666', '-1353.978', '1234567', '-1234567', '123456789', '-123456789.1', '1234567890.', '-1234567890.1' ]) parens_check = wx.CheckBox( self, -1, "Use () to indicate negatives in above controls") gridCombos = wx.FlexGridSizer(cols=4, vgap=10, hgap=10) gridCombos.Add(label_statecode, 0, wx.ALIGN_LEFT) gridCombos.Add(statecode, 0, wx.ALIGN_LEFT) gridCombos.Add(label_fraction, 0, wx.ALIGN_LEFT) gridCombos.Add(fraction, 0, wx.ALIGN_LEFT) gridCombos.Add(label_statename, 0, wx.ALIGN_LEFT) gridCombos.Add(statename, 0, wx.ALIGN_LEFT) gridCombos.Add(label_code, 0, wx.ALIGN_LEFT) gridCombos.Add(code, 0, wx.ALIGN_LEFT) gridCombos.Add(label_selector, 0, wx.ALIGN_LEFT) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.list_selector, 0, wx.ALIGN_LEFT) hbox.Add(wx.StaticText(self, -1, ' => '), 0, wx.ALIGN_LEFT) hbox.Add(self.dynamicbox, 0, wx.ALIGN_LEFT) gridCombos.Add(hbox, 0, wx.ALIGN_LEFT) gridIpAddrs = wx.FlexGridSizer(cols=4, vgap=10, hgap=15) gridIpAddrs.Add(label_ipaddr1, 0, wx.ALIGN_LEFT) gridIpAddrs.Add(ipaddr1, 0, wx.ALIGN_LEFT) gridIpAddrs.Add(label_ipaddr2, 0, wx.ALIGN_LEFT) gridIpAddrs.Add(ipaddr2, 0, wx.ALIGN_LEFT) gridIpAddrs.Add(label_ipaddr3, 0, wx.ALIGN_LEFT) gridIpAddrs.Add(ipaddr3, 0, wx.ALIGN_LEFT) gridNumerics = wx.FlexGridSizer(cols=4, vgap=10, hgap=10) gridNumerics.Add(label_intctrl1, 0, wx.ALIGN_LEFT) gridNumerics.Add(self.intctrl1, 0, wx.ALIGN_LEFT) gridNumerics.Add(label_intctrl2, 0, wx.ALIGN_RIGHT) gridNumerics.Add(self.intctrl2, 0, wx.ALIGN_LEFT) gridNumerics.Add(label_floatctrl, 0, wx.ALIGN_LEFT) gridNumerics.Add(self.floatctrl, 0, wx.ALIGN_LEFT) gridNumerics.Add(label_numselect, 0, wx.ALIGN_RIGHT) gridNumerics.Add(numselect, 0, wx.ALIGN_LEFT) self.sizer.Add(labelMaskedCombos, 0, wx.ALIGN_LEFT | wx.ALL, 5) self.sizer.Add(gridCombos, 0, wx.ALIGN_LEFT | wx.ALL, border=5) self.sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, border=8) self.sizer.Add(labelIpAddrs, 0, wx.ALIGN_LEFT | wx.ALL, 5) self.sizer.Add(gridIpAddrs, 0, wx.ALIGN_LEFT | wx.ALL, border=5) self.sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, border=8) self.sizer.Add(labelNumerics, 0, wx.ALIGN_LEFT | wx.ALL, 5) self.sizer.Add(gridNumerics, 0, wx.ALIGN_LEFT | wx.ALL, border=5) self.sizer.Add(parens_check, 0, wx.ALIGN_LEFT | wx.ALL, 5) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.SetupScrolling() self.Bind(wx.EVT_COMBOBOX, self.OnComboSelection, id=fraction.GetId()) self.Bind(wx.EVT_COMBOBOX, self.OnComboSelection, id=code.GetId()) self.Bind(wx.EVT_COMBOBOX, self.OnComboSelection, id=statecode.GetId()) self.Bind(wx.EVT_COMBOBOX, self.OnComboSelection, id=statename.GetId()) self.Bind(wx.EVT_TEXT, self.OnTextChange, id=code.GetId()) self.Bind(wx.EVT_TEXT, self.OnTextChange, id=statecode.GetId()) self.Bind(wx.EVT_TEXT, self.OnTextChange, id=statename.GetId()) self.Bind(wx.EVT_COMBOBOX, self.OnListSelection, id=self.list_selector.GetId()) self.Bind(wx.EVT_TEXT, self.OnTextChange, id=self.intctrl1.GetId()) self.Bind(wx.EVT_TEXT, self.OnTextChange, id=self.intctrl2.GetId()) self.Bind(wx.EVT_TEXT, self.OnTextChange, id=self.floatctrl.GetId()) self.Bind(wx.EVT_COMBOBOX, self.OnNumberSelect, id=numselect.GetId()) self.Bind(wx.EVT_CHECKBOX, self.OnParensCheck, id=parens_check.GetId()) self.Bind(wx.EVT_TEXT, self.OnIpAddrChange, id=ipaddr1.GetId()) self.Bind(wx.EVT_TEXT, self.OnIpAddrChange, id=ipaddr2.GetId()) self.Bind(wx.EVT_TEXT, self.OnIpAddrChange, id=ipaddr3.GetId())
def __init__(self, parent, log): self.log = log scroll.ScrolledPanel.__init__(self, parent, -1) self.sizer = wx.BoxSizer(wx.VERTICAL) label = wx.StaticText( self, -1, """\ These controls have field-specific choice lists and allow autocompletion. Down arrow or Page Down in an uncompleted field with an auto-completable field will attempt to auto-complete a field if it has a choice list. Page Down and Shift-Down arrow will also auto-complete, or cycle through the complete list. Page Up and Shift-Up arrow will similarly cycle backwards through the list. """) label.SetForegroundColour("Blue") self.sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALL, 5) description = wx.StaticText(self, -1, "Description") autofmt = wx.StaticText(self, -1, "AutoFormat Code") fields = wx.StaticText(self, -1, "Field Objects") ctrl = wx.StaticText(self, -1, "Masked TextCtrl") description.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD)) autofmt.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD)) fields.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD)) ctrl.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD)) grid = wx.FlexGridSizer(cols=4, vgap=10, hgap=10) grid.Add(description, 0, wx.ALIGN_LEFT) grid.Add(autofmt, 0, wx.ALIGN_LEFT) grid.Add(fields, 0, wx.ALIGN_LEFT) grid.Add(ctrl, 0, wx.ALIGN_LEFT) autoformat = "USPHONEFULLEXT" fieldsDict = { 0: masked.Field(choices=["617", "781", "508", "978", "413"], choiceRequired=True) } fieldsLabel = """\ {0: Field(choices=[ "617","781", "508","978","413"], choiceRequired=True)}""" grid.Add(wx.StaticText(self, -1, "Restricted Area Code"), 0, wx.ALIGN_LEFT) grid.Add(wx.StaticText(self, -1, autoformat), 0, wx.ALIGN_LEFT) grid.Add(wx.StaticText(self, -1, fieldsLabel), 0, wx.ALIGN_LEFT) grid.Add( masked.TextCtrl(self, -1, "", autoformat=autoformat, fields=fieldsDict, demo=True, name=autoformat), 0, wx.ALIGN_LEFT) autoformat = "EXPDATEMMYY" fieldsDict = { 1: masked.Field(choices=["03", "04", "05"], choiceRequired=True) } fieldsLabel = """\ {1: Field(choices=[ "03", "04", "05"], choiceRequired=True)}""" exp = masked.TextCtrl(self, -1, "", autoformat=autoformat, fields=fieldsDict, demo=True, name=autoformat) grid.Add(wx.StaticText(self, -1, "Restricted Expiration"), 0, wx.ALIGN_LEFT) grid.Add(wx.StaticText(self, -1, autoformat), 0, wx.ALIGN_LEFT) grid.Add(wx.StaticText(self, -1, fieldsLabel), 0, wx.ALIGN_LEFT) grid.Add(exp, 0, wx.ALIGN_LEFT) fieldsDict = { 0: masked.Field(choices=["02134", "02155"], choiceRequired=True), 1: masked.Field(choices=["1234", "5678"], choiceRequired=False) } fieldsLabel = """\ {0: Field(choices=["02134","02155"], choiceRequired=True), 1: Field(choices=["1234", "5678"], choiceRequired=False)}""" autoformat = "USZIPPLUS4" zip = masked.TextCtrl(self, -1, "", autoformat=autoformat, fields=fieldsDict, demo=True, name=autoformat) grid.Add(wx.StaticText(self, -1, "Restricted Zip + 4"), 0, wx.ALIGN_LEFT) grid.Add(wx.StaticText(self, -1, autoformat), 0, wx.ALIGN_LEFT) grid.Add(wx.StaticText(self, -1, fieldsLabel), 0, wx.ALIGN_LEFT) grid.Add(zip, 0, wx.ALIGN_LEFT) self.sizer.Add(grid, 0, wx.ALIGN_LEFT | wx.ALL, border=5) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.SetupScrolling()
def __init__(self, parent, id=-1, listeDonnees=[], IDmodif=0, mode="planning", panelPlanning=None): wx.Panel.__init__(self, parent, id=id, name="panel_saisiePresences", style=wx.TAB_TRAVERSAL) self.parent = parent self.mode = mode self.panelPlanning = panelPlanning # Si c'est une modif : self.IDmodif = IDmodif if self.IDmodif != 0 and mode == "planning": donneesModif = self.ImportDonneesModif() self.donneesModif = donneesModif listeDonnees = [(donneesModif[1], donneesModif[2])] if self.IDmodif != 0 and mode == "modele": self.listeDonnees = listeDonnees # Création du dictionnaire de données (date, IDpersonne) if mode == "planning": self.CreationDictDonnees(listeDonnees) self.panel_base = wx.Panel(self, -1) self.sizer_heures_staticbox = wx.StaticBox(self.panel_base, -1, _(u"Horaires")) self.sizer_intitule_staticbox = wx.StaticBox(self.panel_base, -1, _(u"Légende")) self.sizer_droit_staticbox = wx.StaticBox(self.panel_base, -1, _(u"Catégorie")) self.sizer_donnees_staticbox = wx.StaticBox( self.panel_base, -1, _(u"Dates et personnes sélectionnées")) self.listCtrl_donnees = ListCtrl_donnees(self.panel_base) self.listCtrl_donnees.SetMinSize((20, 80)) if self.IDmodif != 0: self.listCtrl_donnees.Enable(False) self.label_heure_debut = wx.StaticText(self.panel_base, -1, _(u"Début :")) self.text_heure_debut = masked.TextCtrl( self.panel_base, -1, "", style=wx.TE_CENTRE, mask="##:##", validRegex="[0-2][0-9]:[0-5][0-9]") self.label_heure_fin = wx.StaticText(self.panel_base, -1, _(u"Fin :")) self.text_heure_fin = masked.TextCtrl( self.panel_base, -1, "", style=wx.TE_CENTRE, mask="##:##", validRegex="[0-2][0-9]:[0-5][0-9]") self.text_intitule = wx.TextCtrl(self.panel_base, -1, "", style=wx.TE_MULTILINE) self.treeCtrl_categories = TreeCtrlCategories(self.panel_base) self.bouton_aide = CTRL_Bouton_image.CTRL( self.panel_base, texte=_(u"Aide"), cheminImage=Chemins.GetStaticPath("Images/32x32/Aide.png")) self.bouton_ok = CTRL_Bouton_image.CTRL( self.panel_base, texte=_(u"Ok"), cheminImage=Chemins.GetStaticPath("Images/32x32/Valider.png")) self.bouton_annuler = CTRL_Bouton_image.CTRL( self.panel_base, texte=_(u"Annuler"), cheminImage=Chemins.GetStaticPath("Images/32x32/Annuler.png")) self.dictPersonnes = self.ImportPersonnes() if self.IDmodif != 0 and mode == "planning": self.text_heure_debut.SetValue(str(donneesModif[3])[:5]) self.text_heure_fin.SetValue(str(donneesModif[4])[:5]) self.text_intitule.SetValue(donneesModif[6]) if self.IDmodif != 0 and mode == "modele": self.text_heure_debut.SetValue(listeDonnees[5]) self.text_heure_fin.SetValue(listeDonnees[6]) self.text_intitule.SetValue(listeDonnees[8]) self.__set_properties() self.__do_layout() self.text_heure_debut.SetFocus() self.Bind(wx.EVT_TEXT, self.OnTextHeureDebutText, self.text_heure_debut) self.Bind(wx.EVT_TEXT, self.OnTextHeureFinText, self.text_heure_fin) 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)
def __init__(self,parent): wx.MiniFrame.__init__(self,parent,id=wx.ID_ANY,size=(670,400),pos=(250,140),title="Cadastro de Pacientes",style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN) self.currentIndex = 0 self.totalIndex = len(Patient.query.all())-1 self.parent = parent self.panelPatient = wx.Panel(self, wx.ID_ANY) self.ico=wx.Icon("./imagens/patient.ico", wx.BITMAP_TYPE_ICO) self.SetIcon(self.ico) self.toolBar = wx.ToolBar(self,id=wx.ID_ANY,pos=wx.DefaultPosition,size=wx.DefaultSize,style=wx.TB_TEXT) self.toolBar.AddLabelTool(ID_TOOLBAR_PATIENT_FIRST,u"Primeiro", wx.Bitmap("./imagens/first.png"),shortHelp='Ir para o primeiro registro') self.toolBar.AddLabelTool(ID_TOOLBAR_PATIENT_PREVIOUS,u"Anterior", wx.Bitmap("./imagens/previous.png"),shortHelp='Registro anterior') self.toolBar.AddLabelTool(ID_TOOLBAR_PATIENT_NEXT,u"Próximo", wx.Bitmap("./imagens/next.png"),shortHelp='Próximo registro') self.toolBar.AddLabelTool(ID_TOOLBAR_PATIENT_LAST,u"Último", wx.Bitmap("./imagens/last.png"),shortHelp='Ir para o último registro') self.toolBar.AddSeparator() self.toolBar.AddSeparator() self.toolBar.AddLabelTool(ID_TOOLBAR_PATIENT_NEW,u"Novo (F2)", wx.Bitmap("./imagens/add.png"),shortHelp='Novo Registro') self.toolBar.AddLabelTool(ID_TOOLBAR_PATIENT_SAVE,u"Salvar", wx.Bitmap("./imagens/filesave.png"),shortHelp='Grava alterções no registro') self.toolBar.AddLabelTool(ID_TOOLBAR_PATIENT_REMOVE,u"Remover", wx.Bitmap("./imagens/remove.png"),shortHelp='Remove o registro atual') self.toolBar.AddLabelTool(ID_TOOLBAR_PATIENT_FIND,u"Localizar", wx.Bitmap("./imagens/find.png"),shortHelp='Localiza um Registro') self.toolBar.AddLabelTool(ID_TOOLBAR_PATIENT_EDIT,u"ALterar", wx.Bitmap("./imagens/edit.png"),shortHelp='Altera o registro atual') self.toolBar.AddLabelTool(ID_TOOLBAR_PATIENT_CANCEL,u"Cancelar", wx.Bitmap("./imagens/cancel.png"),shortHelp='Cancela ação') self.toolBar.EnableTool(ID_TOOLBAR_PATIENT_SAVE, False) self.toolBar.Realize() self.SetToolBar(self.toolBar) self.vBox1 = wx.BoxSizer(wx.VERTICAL) self.hBox1 = wx.BoxSizer(wx.HORIZONTAL) self.hBox2 = wx.BoxSizer(wx.HORIZONTAL) self.idTextCtrl = wx.TextCtrl(self.panelPatient,-1,pos=(10,15),size=(0,0)) self.hBox2.Add( self.idTextCtrl,1, wx.LEFT,8) self.nameStaticText = wx.StaticText(self.panelPatient,-1,u'Nome',pos=(18,30),style=wx.ALIGN_LEFT) self.nameTextCtrl = wx.TextCtrl(self.panelPatient,-1,pos=(18,50),size=(400,-1),style=wx.TE_READONLY) self.hBox1.Add(self.nameStaticText, 1, wx.LEFT,8) self.hBox2.Add( self.nameTextCtrl,1, wx.LEFT,8) self.dateOfBirthStaticText = wx.StaticText(self.panelPatient,-1,u'Data de Nasc.',pos=(460,30),style=wx.ALIGN_LEFT) self.dateOfBirthTextCtrl = masked.TextCtrl(self.panelPatient,-1,mask="##/##/####") self.dateOfBirthTextCtrl.SetSize((90,-1)) self.dateOfBirthTextCtrl.SetPosition((460,50)) self.dateOfBirthTextCtrl.SetEditable(False) self.hBox1.Add(self.dateOfBirthStaticText,1,8) self.hBox2.Add(self.dateOfBirthTextCtrl,1,8) self.cpfStaticText = wx.StaticText(self.panelPatient,-1,u'CPF',pos=(18,90),style=wx.ALIGN_LEFT) self.cpfTextCtrl = masked.TextCtrl(self.panelPatient,-1,mask="###.###.###-##") self.cpfTextCtrl.SetSize((120,-1)) self.cpfTextCtrl.SetPosition((18,110)) self.cpfTextCtrl.SetEditable(False) self.hBox1.Add(self.cpfStaticText,1,8) self.hBox2.Add( self.cpfTextCtrl,1,8) self.rgStaticText = wx.StaticText(self.panelPatient,-1,u'RG',pos=(170,90),style=wx.ALIGN_LEFT) self.rgTextCtrl = wx.TextCtrl(self.panelPatient,-1,pos=(170,110),size=(120,-1),style=wx.TE_READONLY) self.hBox1.Add(self.rgStaticText,1,8) self.hBox2.Add( self.rgTextCtrl,1,8) self.telephoneStaticText = wx.StaticText(self.panelPatient,-1,u'Telefone',pos=(18,150),style=wx.ALIGN_LEFT) self.telephoneTextCtrl = masked.TextCtrl(self.panelPatient,-1,mask="(##)####-####") self.telephoneTextCtrl.SetSize((120,-1)) self.telephoneTextCtrl.SetPosition((18,170)) self.telephoneTextCtrl.SetEditable(False) self.hBox1.Add(self.telephoneStaticText, 1,8) self.hBox2.Add( self.telephoneTextCtrl,1,8) self.telephone2StaticText = wx.StaticText(self.panelPatient,-1,u'Telefone 2',pos=(170,150),style=wx.ALIGN_LEFT) self.telephone2TextCtrl = masked.TextCtrl(self.panelPatient,-1,mask="(##)####-####") self.telephone2TextCtrl.SetSize((120,-1)) self.telephone2TextCtrl.SetPosition((170,170)) self.telephone2TextCtrl.SetEditable(False) self.hBox1.Add(self.telephone2StaticText, 1,8) self.hBox2.Add( self.telephone2TextCtrl,1,8) wx.StaticBox(self.panelPatient,-1,u'Informações Pessoais',pos=(5,5),size=(600,220)) self.treatmentStartStaticText = wx.StaticText(self.panelPatient,-1,u'Início do Trat.',pos=(18,250),style=wx.ALIGN_LEFT) self.treatmentStartTextCtrl = masked.TextCtrl(self.panelPatient,-1,mask="##/##/####") self.treatmentStartTextCtrl.SetSize((100,-1)) self.treatmentStartTextCtrl.SetPosition((18,275)) self.treatmentStartTextCtrl.SetEditable(False) self.hBox1.Add(self.treatmentStartStaticText,1,8) self.hBox2.Add(self.treatmentStartTextCtrl,1,8) self.budgetByStaticText = wx.StaticText(self.panelPatient,-1,u'Orçado por',pos=(140,250),style=wx.ALIGN_LEFT) self.budgetByTextCtrl = wx.TextCtrl(self.panelPatient,-1,pos=(140,275),size=(150,-1),style=wx.TE_READONLY) self.hBox1.Add(self.budgetByStaticText, 1, wx.LEFT,8) self.hBox2.Add(self.budgetByTextCtrl,1, wx.LEFT,8) self.registrationFormStaticText = wx.StaticText(self.panelPatient,-1,u'Ficha',pos=(320,250),style=wx.ALIGN_LEFT) self.registrationFormTextCtrl = wx.TextCtrl(self.panelPatient,-1,pos=(320,275),size=(100,-1),style=wx.TE_READONLY) self.hBox1.Add(self.registrationFormStaticText, 1,8) self.hBox2.Add(self.registrationFormTextCtrl,1,8) wx.StaticBox(self.panelPatient,-1,'',pos=(5,230),size=(600,80)) self.vBox1.Add(self.hBox1,0, wx.EXPAND | wx.ALL, 10) self.vBox1.Add(self.hBox2,0, wx.EXPAND | wx.ALL, 10) #-------------BINDS------------------------------------------------------------------------ self.Bind(wx.EVT_MENU,self.getFirst,id=ID_TOOLBAR_PATIENT_FIRST) self.Bind(wx.EVT_MENU,self.getLast,id=ID_TOOLBAR_PATIENT_LAST) self.Bind(wx.EVT_MENU,self.getNext,id=ID_TOOLBAR_PATIENT_NEXT) self.Bind(wx.EVT_MENU,self.getPrevious,id=ID_TOOLBAR_PATIENT_PREVIOUS) self.Bind(wx.EVT_MENU,self.new,id=ID_TOOLBAR_PATIENT_NEW) self.Bind(wx.EVT_MENU,self.cancel,id=ID_TOOLBAR_PATIENT_CANCEL) self.Bind(wx.EVT_MENU,self.save,id=ID_TOOLBAR_PATIENT_SAVE) self.Bind(wx.EVT_MENU,self.edit,id=ID_TOOLBAR_PATIENT_EDIT) self.Bind(wx.EVT_MENU,self.remove,id=ID_TOOLBAR_PATIENT_REMOVE) self.Bind(wx.EVT_MENU,self.find,id=ID_TOOLBAR_PATIENT_FIND) self.Bind(wx.EVT_CLOSE,self.quit) #-------------END BINDS-------------------------------------------------------------------- self.MakeModal(True) self.Show() if not(self.totalIndex<0): self.getFirst(None) self.toolBar.EnableTool(ID_TOOLBAR_PATIENT_CANCEL, False)
def __init__(self, title): wx.Frame.__init__(self, None, title=title, pos=(150, 150), size=(410, 205), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER) self.Bind(wx.EVT_CLOSE, self.OnClose) self.statusbar = self.CreateStatusBar() self.hasPID = False self.iptext = "" self.path = os.path.expanduser( "~/catkin_ws/src/module_gui/puremindgui/script/") self.bashcommand = 'bash ' + self.path + 'launch.bash' menuBar = wx.MenuBar() menu = wx.Menu() m_exit = menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Close window and exit program.") self.Bind(wx.EVT_MENU, self.OnClose, m_exit) menuBar.Append(menu, "&File") self.SetMenuBar(menuBar) self.panel = wx.Panel(self) box = wx.BoxSizer(wx.VERTICAL) lbl1 = wx.StaticText(self.panel, -1, style=wx.ALIGN_CENTER) lbl1.SetFont(self.GetFont()) lbl1.SetLabel(textLocal[0]) box.Add(lbl1, 0, wx.ALL, 5) self.lbl2 = wx.StaticText(self.panel, -1, style=wx.ALIGN_CENTER, pos=(200, 5)) self.lbl2.SetFont(self.GetFont()) self.lbl2.SetLabel(textLocal[1]) control = [ "ip address", "###.###.###.###", "", 'F^-', "^\d{3}.\d{3}.\d{3}.\d{3}", '', '', '' ] self.maskText = masked.TextCtrl(self.panel, mask=control[1], excludeChars=control[2], formatcodes=control[3], includeChars="", validRegex=control[4], validRange=control[5], choices=control[6], choiceRequired=True, defaultValue=control[7], demo=True, name=control[0], style=wx.TE_PROCESS_ENTER) self.maskText.Bind(wx.EVT_KEY_DOWN, self.onTextKeyEvent) box.Add(self.maskText, 0, wx.ALL, 10) self.lst = wx.ListBox(self.panel, pos=(200, 30), size=(200, 150), choices=[], style=wx.LB_SINGLE) self.Bind(wx.EVT_LISTBOX, self.selectRobotIp, self.lst) self.b_connect = wx.Button(self.panel, wx.ID_CLOSE, textLocal[2]) self.b_connect.Bind(wx.EVT_BUTTON, self.OnConnect) box.Add(self.b_connect, 0, wx.ALL, 10) m_shut = wx.Button(self.panel, wx.ID_CLOSE, textLocal[3]) m_shut.Bind(wx.EVT_BUTTON, self.onShutdown) box.Add(m_shut, 0, wx.ALL, 10) self.btnReload = wx.Button(self.panel, wx.ID_CLOSE, textLocal[4], pos=(315, 0)) self.btnReload.Bind(wx.EVT_BUTTON, self.onReload) self.panel.SetSizer(box) self.panel.Layout() self.executor = ThreadPoolExecutor(max_workers=2) threadGetRobotList = self.executor.submit( scanLocalNetwork.getRobotList) threadGetRobotList.add_done_callback(self.callbackRobotList)
def __init__(self, parent, user_config, customuser_config): self.temp_userconfig = user_config self.temp_customuserconfig = customuser_config wx.ScrolledWindow.__init__(self, parent) sz1 = wx.BoxSizer(wx.VERTICAL) desc = [] desc.append ( wx.StaticText(self, -1, '\nDefault Figure size.') ) titleFont = wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD) desc[-1].SetFont(titleFont) desc.append ( wx.StaticText(self, -1, 'Choose default size for all the figures.\nSize can be changed for every figure from their context menu.\n')) sz1.AddMany (desc) actual_size = self.temp_userconfig['FigureSize'] inputsizer = wx.BoxSizer(wx.HORIZONTAL) self.fig_size_textctrl_x = NumCtrl (self, -1, size = (80,-1), value = actual_size[0], allowNegative = False, fractionWidth = 0, autoSize = False) self.fig_size_textctrl_y = NumCtrl (self, -1, size = (80,-1), value = actual_size[1], allowNegative = False, fractionWidth = 0, autoSize = False) self.fig_size_textctrl_x.Bind(wx.EVT_LEAVE_WINDOW, partial (self.OnUpdateSize, 'x')) self.fig_size_textctrl_y.Bind(wx.EVT_LEAVE_WINDOW, partial (self.OnUpdateSize, 'y')) self.fig_size_select_mu = wx.Choice(self, -1, choices = ['in', 'cm', 'mm', 'px'] ) self.fig_size_select_mu.SetSelection(0) self.fig_size_select_mu.Bind(wx.EVT_CHOICE, self.OnChangeMeasureUnit) inputsizer.Add (self.fig_size_textctrl_x, 0, wx.ALL, 1) inputsizer.Add (self.fig_size_textctrl_y, 0, wx.ALL, 1) inputsizer.Add (self.fig_size_select_mu, 0, wx.ALL, 1) sz1.Add(inputsizer, 0, wx.ALL, 3) sz1.Add (wx.StaticLine(self), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5 ) #Define default dpi size when exporting to file desc = [] desc.append ( wx.StaticText(self, -1, '\nDefault dpi of exported images.') ) desc[-1].SetFont(titleFont) desc.append ( wx.StaticText(self, -1, 'You may export images as bitmap files (tif, rgb).\nSelect here the default resolution at export time\n') ) def_dpi = str(self.temp_userconfig['dpi']) txt_dpi = masked.TextCtrl(self , -1, def_dpi, mask = "###", name='DPI') txt_dpi.Bind(wx.EVT_TEXT, partial(self.OnChangeDPI, 'dpi')) desc.append(txt_dpi) sz1.AddMany (desc) sz1.Add (wx.StaticLine(self), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5 ) # Group of radio controls: desc = [] desc.append ( wx.StaticText(self, -1, '\nSelect the graphical interface.') ) desc[-1].SetFont(titleFont) desc.append ( wx.StaticText(self, -1, 'The interactive interface is the default one.\nSelect the second one only in case the first one does not work.\nA restart is needed to see changes.\n') ) grid1 = wx.FlexGridSizer( 0, 1, 0, 0 ) self.canvas_type = [] self.canvas_type.append( wx.RadioButton( self, -1, 'Interactive', name = 'wxmpl', style = wx.RB_GROUP ) ) self.canvas_type.append( wx.RadioButton( self, -1, 'Not interactive', name = 'wx' ) ) for radio in self.canvas_type: grid1.Add( radio, 0, wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) radio.Bind(wx.EVT_RADIOBUTTON, self.OnCanvasSelect) ck = (self.temp_userconfig['Canvas'] == 'wx')*1 self.canvas_type[ck].SetValue(True) desc.append (grid1) radio_sizer = wx.BoxSizer(wx.VERTICAL) radio_sizer.AddMany(desc) sz1.Add(radio_sizer, 0, wx.ALL, 3) self.SetSizer(sz1) sz1.Fit(self)
class LstScad(wx.ScrolledWindow): def __init__(self, prnt, cnt): self.win = wx.ScrolledWindow.__init__(self, parent=prnt, id=-1, size=wx.DefaultSize) self.SetScrollbars(1, 1, 100, 100) ##### self.FitInside() ###### png = wx.Image((cfg.path_img + "cerca19x19.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() #wx.Frame.__init__(self, id=wx.NewId(), name='', # parent=prnt, pos=wx.Point(0, 0), # style=wx.DEFAULT_FRAME_STYLE , title=cnt[0]) #self.SetIcon(wx.Icon(cfg.path_img+"/null.ico", wx.BITMAP_TYPE_ICO)) #self.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False)) self.cnt = cnt Nid = wx.NewId() self.ttl = cnt[0] self.tipoord = cnt[1] self.tcpart = "C" #self.ottl="Gestione Movimenti" self.tbl = "scad" #self.tblart="articoli" self.rec = cnt[2] self.AggMenu = cnt[3] self.IDMENU = cnt[4] self.CMD = cnt[5] #self.font=self.GetFont() #self.SetClientSize(wx.Size(680, 400)) self.__MDI__ = wx.GetApp().GetPhasisMdi() self.font = self.__MDI__.font self.SetFont(self.font) self.CnAz = self.__MDI__.GetConnAZ() self.annoc = self.__MDI__.GetAnnoC() self.datacon = self.__MDI__.GetDataC() self.dzDatiAzienda = self.__MDI__.dzDatiAzienda self.pnl = wx.Panel( id=wx.NewId(), name='panel1', parent=self, pos=wx.Point(0, 0), size=wx.DLG_SZE(self, 680 / 2, 400 / 2), #size=wx.Size(680, 400), style=wx.SIMPLE_BORDER | wx.TAB_TRAVERSAL) self.pnl.SetFont(self.font) btnSzeL = wx.DLG_SZE(self.pnl, 70, 16) btnSzeM = wx.DLG_SZE(self.pnl, 80, 16) btnSzeM1 = wx.DLG_SZE(self.pnl, 60, 16) btnSzeS = wx.DLG_SZE(self.pnl, 16, 16) btnSzeD = wx.DLG_SZE(self.pnl, 60, 14) #self.pnl.SetFont(self.font) data_att_int = self.datacon.split("/") data_att_int = str(data_att_int[2]) + str(data_att_int[1]) + str( data_att_int[0]) valueSql = int(data_att_int) sql = """ select data_scad,data_scad_int from scad where data_scad_int<='%s' and stt_scad!='S' and stt_scad!='Z'""" try: cr = self.CnAz.cursor() cr.execute(sql % valueSql) row = cr.fetchone() if row: self.CnAz.commit() sql = """ update scad set stt_scad='Z' where data_scad_int<='%s' and stt_scad!='S' and stt_scad!='Z' """ cr.execute(sql % valueSql) dlg = wx.MessageDialog(self, "Aggiornamento Scadenzario ......", "Aggiornamento Tabella Scadenzario ", wx.ID_OK | wx.ICON_INFORMATION) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() wx.GetApp().GetPhasisMdi().CloseTabObj(self) self.CnAz.commit() except StandardError, msg: print "Scadenzario", " New Error %s" % (msg) self.lc = wx.ListCtrl(self.pnl, -1, wx.DLG_PNT(self, 5, 5), wx.DLG_SZE(self.pnl, 335, 110), wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES) wx.StaticLine(self.pnl, -1, wx.DLG_PNT(self.pnl, 5, 120), wx.DLG_SZE(self.pnl, 335, -1)) # < diegom linea 1 #wx.StaticText(self.pnl , -1, _("Tipologia Scad.:"), #wx.DLG_PNT(self, 25,147)) self.lscad = wx.StaticText(self.pnl, -1, "Num. :", wx.DLG_PNT(self.pnl, 5, 127)) self.num_scad = wx.TextCtrl( self.pnl, -1, "", wx.DLG_PNT(self.pnl, 27, 125), wx.DLG_SZE(self.pnl, 35, cfg.DIMFONTDEFAULT), wx.ALIGN_RIGHT | wx.TE_PROCESS_ENTER) self.cnum_scad = wx.BitmapButton( self.pnl, -1, png, wx.DLG_PNT(self.pnl, 64, 125), wx.DLG_SZE(self.pnl, cfg.btnSzeSH, cfg.btnSzeV), wx.TE_PROCESS_ENTER) self.ldata_scad = wx.StaticText(self.pnl, -1, _("Scad.:"), wx.DLG_PNT(self.pnl, 66, 127)) self.ldata_scad.SetFont(self.font) self.data_scad = masked.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 85, 125), wx.DLG_SZE(self.pnl, 40, cfg.DIMFONTDEFAULT), wx.ALIGN_RIGHT, autoformat='EUDATEDDMMYYYY/') self.vdata_scad = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 85, 125)) self.cdata_scad = wx.BitmapButton( self.pnl, -1, png, wx.DLG_PNT(self.pnl, 146, 125), wx.DLG_SZE(self.pnl, cfg.btnSzeSH, cfg.btnSzeV), wx.TE_PROCESS_ENTER) self.TIPO_SCAD = wx.ComboBox(self.pnl, 300, "", wx.DLG_PNT(self.pnl, 157, 125), wx.DLG_SZE(self.pnl, 90, -1), [], wx.CB_DROPDOWN | wx.CB_SORT) self.vTIPO_SCAD = wx.TextCtrl( self.pnl, -1, "", wx.DLG_PNT(self.pnl, 157, 125), wx.DLG_SZE(self.pnl, 0, cfg.DIMFONTDEFAULT), wx.TE_PROCESS_ENTER) self.cTIPO_SCAD = wx.BitmapButton( self.pnl, -1, png, wx.DLG_PNT(self.pnl, 250, 125), wx.DLG_SZE(self.pnl, cfg.btnSzeSH, cfg.btnSzeV), wx.TE_PROCESS_ENTER) self.all = wx.Button(self.pnl, Nid, cfg.vcall, wx.DLG_PNT(self.pnl, 269, 125), wx.DLG_SZE(self.pnl, cfg.btnSzeM1H, cfg.btnSzeV)) # < diegom linea 2 #wx.StaticText(self.pnl, -1, "Pagamento :", #wx.DLG_PNT(self.pnl, 155,147)) wx.StaticText(self.pnl, -1, "Controp.:", wx.DLG_PNT(self.pnl, 5, 142)) self.CF = wx.ComboBox(self.pnl, Nid, "", wx.DLG_PNT(self.pnl, 35, 140), wx.DLG_SZE(self.pnl, 50, -1), [], wx.CB_DROPDOWN | wx.CB_SORT) self.vCF = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 35, 140)) self.lc1odcf = wx.StaticText(self.pnl, -1, "Cod.", wx.DLG_PNT(self.pnl, 90, 142)) self.codcf = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 107, 140), wx.DLG_SZE(self.pnl, 40, cfg.DIMFONTDEFAULT)) self.lragsoc1 = wx.StaticText(self.pnl, -1, "Rag.Soc.1:", wx.DLG_PNT(self.pnl, 150, 142)) self.ragsoc1 = wx.TextCtrl( self.pnl, Nid, "", wx.DLG_PNT(self.pnl, 187, 140), wx.DLG_SZE(self.pnl, 80, cfg.DIMFONTDEFAULT), wx.TE_PROCESS_ENTER) self.cragsoc1 = wx.BitmapButton( self.pnl, -1, png, wx.DLG_PNT(self.pnl, 269, 140), # < diegom linea 3 wx.DLG_SZE(self.pnl, cfg.btnSzeSH, cfg.btnSzeV)) self.lragsoc2 = wx.StaticText(self.pnl, -1, "Rag. Soc.2:", wx.DLG_PNT(self.pnl, 5, 157)) self.ragsoc2 = wx.TextCtrl( self.pnl, -1, "", wx.DLG_PNT(self.pnl, 42, 155), wx.DLG_SZE(self.pnl, 90, cfg.DIMFONTDEFAULT)) self.ragsoc4 = wx.TextCtrl( self.pnl, -1, "", wx.DLG_PNT(self.pnl, 42, 155), wx.DLG_SZE(self.pnl, 90, cfg.DIMFONTDEFAULT)) self.PAGAM = wx.ComboBox(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 140, 155), wx.DLG_SZE(self.pnl, 120, -1), [], wx.CB_DROPDOWN | wx.CB_SORT) self.vPAGAM = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 140, 155)) # < diegom linea 4 self.ltipodoc = wx.StaticText(self.pnl, -1, "Tipo Documento.:", wx.DLG_PNT(self.pnl, 5, 172)) self.TIPO_DOC = wx.ComboBox(self.pnl, 300, "", wx.DLG_PNT(self.pnl, 63, 170), wx.DLG_SZE(self.pnl, 110, -1), [], wx.CB_DROPDOWN | wx.CB_SORT) self.vTIPO_DOC = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 63, 172)) self.stt_doc1 = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 63, 170)) self.stt_doc2 = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 63, 170)) self.ldoc = wx.StaticText(self.pnl, -1, "N.Doc.:", wx.DLG_PNT(self.pnl, 176, 172)) self.num_doc = wx.TextCtrl( self.pnl, -1, "", wx.DLG_PNT(self.pnl, 198, 170), wx.DLG_SZE(self.pnl, 30, cfg.DIMFONTDEFAULT), wx.ALIGN_RIGHT | wx.TE_PROCESS_ENTER) self.cnum_doc = wx.BitmapButton( self.pnl, -1, png, wx.DLG_PNT(self.pnl, 230, 170), wx.DLG_SZE(self.pnl, cfg.btnSzeSH, cfg.btnSzeV)) self.vnum_doc = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 230, 170)) self.rbREG = wx.RadioButton(self.pnl, -1, "Registrato", wx.DLG_PNT(self.pnl, 269, 155), wx.DLG_SZE(self.pnl, 60, 10)) self.rbSALD = wx.RadioButton(self.pnl, -1, "Saldato", wx.DLG_PNT(self.pnl, 310, 155), wx.DLG_SZE(self.pnl, 60, 10)) self.rbSCAD = wx.RadioButton(self.pnl, -1, "Scaduti", wx.DLG_PNT(self.pnl, 269, 170), wx.DLG_SZE(self.pnl, 60, 10)) self.rbALL = wx.RadioButton(self.pnl, -1, "Tutti", wx.DLG_PNT(self.pnl, 310, 170), wx.DLG_SZE(self.pnl, 60, 10)) # < diegom linea 5 wx.StaticText(self.pnl, -1, "Totale Entrate", wx.DLG_PNT(self.pnl, 5, 187)) self.tot_E = wx.StaticText(self.pnl, -1, "0,00", wx.DLG_PNT(self.pnl, 55, 187), wx.DLG_SZE(self.pnl, 55, 10)) wx.StaticText(self.pnl, -1, "Saldo Totale:", wx.DLG_PNT(self.pnl, 110, 187)) self.tot_sald_E = wx.StaticText(self.pnl, -1, "0,00", wx.DLG_PNT(self.pnl, 160, 187), wx.DLG_SZE(self.pnl, 60, 10)) wx.StaticText(self.pnl, -1, "Da Saldare:", wx.DLG_PNT(self.pnl, 216, 187)) self.tot_nsald_E = wx.StaticText(self.pnl, -1, "0,00", wx.DLG_PNT(self.pnl, 265, 187), wx.DLG_SZE(self.pnl, 60, 10)) wx.StaticText(self.pnl, -1, "Totale Uscite:", wx.DLG_PNT(self.pnl, 5, 200)) self.tot_U = wx.StaticText(self.pnl, -1, "0,00", wx.DLG_PNT(self.pnl, 55, 200), wx.DLG_SZE(self.pnl, 55, 10)) wx.StaticText(self.pnl, -1, "Saldo Totale:", wx.DLG_PNT(self.pnl, 110, 200)) self.tot_sald_U = wx.StaticText(self.pnl, -1, "0,00", wx.DLG_PNT(self.pnl, 160, 200), wx.DLG_SZE(self.pnl, 60, 10)) wx.StaticText(self.pnl, -1, "Da Saldare:", wx.DLG_PNT(self.pnl, 216, 200)) self.tot_nsald_U = wx.StaticText(self.pnl, -1, "0,00", wx.DLG_PNT(self.pnl, 265, 200), wx.DLG_SZE(self.pnl, 60, 10)) # pulsanti self.ok = wx.Button(self.pnl, -1, cfg.vcok, wx.DLG_PNT(self.pnl, 295, 125), wx.DLG_SZE(self.pnl, cfg.btnSzeLH, cfg.btnSzeV)) self.canc = wx.Button(self.pnl, -1, cfg.vccanc, wx.DLG_PNT(self.pnl, 295, 140), wx.DLG_SZE(self.pnl, cfg.btnSzeLH, cfg.btnSzeV)) self.inte = wx.Button(self.pnl, -1, cfg.vcint, wx.DLG_PNT(self.pnl, 295, 140), wx.DLG_SZE(self.pnl, cfg.btnSzeLH, cfg.btnSzeV)) self.stampa = wx.Button( self.pnl, -1, cfg.vcstampa, wx.DLG_PNT(self.pnl, 295, 155), wx.DLG_SZE(self.pnl, cfg.btnSzeLH, cfg.btnSzeV)) wx.StaticText(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 5, 195)) for x in self.pnl.GetChildren(): x.SetFont(self.font) self.canc.SetFocus() #self.SetFont(self.font) #box_sizer = wx.BoxSizer(wx.VERTICAL) #box_sizer.Add(self.pnl, 0, wx.EXPAND|wx.ALL,0) #self.SetAutoLayout(1) #self.SetSizer(box_sizer) #box_sizer.Fit(self) box = wx.GridSizer(1, 1) box.Add(self.pnl, 0, wx.ALIGN_CENTER | wx.ALL, 10) self.SetSizer(box) box.Fit(self) self.TIPO_SCAD.Bind(wx.EVT_COMBOBOX, self.SelCOMBOtiposcadev) self.CF.Bind(wx.EVT_COMBOBOX, self.SelCOMBOcfev) self.PAGAM.Bind(wx.EVT_COMBOBOX, self.SelPAGAMev) self.TIPO_DOC.Bind(wx.EVT_COMBOBOX, self.SelCOMBOtipodocev) self.canc.Bind(wx.EVT_BUTTON, self.Close) self.inte.Bind(wx.EVT_BUTTON, self.Start) self.cragsoc1.Bind(wx.EVT_BUTTON, self.FndAnag) self.Bind(wx.EVT_CLOSE, self.Close) self.ok.Bind(wx.EVT_BUTTON, self.Ok) self.lc.Bind(wx.EVT_LEFT_DCLICK, self.DblClick) self.stampa.Bind(wx.EVT_BUTTON, self.Stampa) #self.cTIPO_SCAD.Bind(wx.EVT_BUTTON, self.FndSelGen) self.all.Bind(wx.EVT_BUTTON, self.FndSelScadAll) self.cTIPO_SCAD.Bind(wx.EVT_BUTTON, self.FndSelScad) self.cnum_scad.Bind(wx.EVT_BUTTON, self.FndSelScad) self.cdata_scad.Bind(wx.EVT_BUTTON, self.FndSelScad) self.cnum_doc.Bind(wx.EVT_BUTTON, self.FndSelScad) #self.cnum_scad.Bind(wx.EVT_BUTTON, self.FndSelCod) #self.cdata_scad.Bind(wx.EVT_BUTTON, self.FndSelDataScad) self.lc.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.LstAct) self.lc.Bind(wx.EVT_LIST_ITEM_SELECTED, self.LstSlct) self.Start(self)
def __init__( self, parent, log ): wx.Panel.__init__( self, parent, -1 ) self.log = log panel = wx.Panel( self, -1 ) header = wx.StaticText(panel, -1, """\ This shows the various options for masked.NumCtrl. The controls at the top reconfigure the resulting control at the bottom. """) header.SetForegroundColour( "Blue" ) intlabel = wx.StaticText( panel, -1, "Integer width:" ) self.integerwidth = masked.NumCtrl( panel, value=10, integerWidth=2, allowNegative=False ) fraclabel = wx.StaticText( panel, -1, "Fraction width:" ) self.fractionwidth = masked.NumCtrl( panel, value=0, integerWidth=2, allowNegative=False ) groupcharlabel = wx.StaticText( panel,-1, "Grouping char:" ) self.groupchar = masked.TextCtrl( panel, -1, value=',', mask='&', excludeChars = '-()', formatcodes='F', emptyInvalid=True, validRequired=True ) decimalcharlabel = wx.StaticText( panel,-1, "Decimal char:" ) self.decimalchar = masked.TextCtrl( panel, -1, value='.', mask='&', excludeChars = '-()', formatcodes='F', emptyInvalid=True, validRequired=True ) self.set_min = wx.CheckBox( panel, -1, "Set minimum value:" ) # Create this masked.NumCtrl using factory, to show how: self.min = masked.Ctrl( panel, integerWidth=5, fractionWidth=2, controlType=masked.controlTypes.NUMBER ) self.min.Enable( False ) self.set_max = wx.CheckBox( panel, -1, "Set maximum value:" ) self.max = masked.NumCtrl( panel, integerWidth=5, fractionWidth=2 ) self.max.Enable( False ) self.limit_target = wx.CheckBox( panel, -1, "Limit control" ) self.allow_none = wx.CheckBox( panel, -1, "Allow empty control" ) self.group_digits = wx.CheckBox( panel, -1, "Group digits" ) self.group_digits.SetValue( True ) self.allow_negative = wx.CheckBox( panel, -1, "Allow negative values" ) self.allow_negative.SetValue( True ) self.use_parens = wx.CheckBox( panel, -1, "Use parentheses" ) self.select_on_entry = wx.CheckBox( panel, -1, "Select on entry" ) self.select_on_entry.SetValue( True ) label = wx.StaticText( panel, -1, "Resulting numeric control:" ) font = label.GetFont() font.SetWeight(wx.BOLD) label.SetFont(font) self.target_ctl = masked.NumCtrl( panel, -1, name="target control" ) label_numselect = wx.StaticText( panel, -1, """\ Programmatically set the above value entry ctrl:""") self.numselect = wx.ComboBox(panel, -1, choices = [ '0', '111', '222.22', '-3', '54321.666666666', '-1353.978', '1234567', '-1234567', '123456789', '-123456789.1', '1234567890.', '-9876543210.9' ]) grid1 = wx.FlexGridSizer( 0, 4, 0, 0 ) grid1.Add( intlabel, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) grid1.Add( self.integerwidth, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid1.Add( groupcharlabel, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) grid1.Add( self.groupchar, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid1.Add( fraclabel, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) grid1.Add( self.fractionwidth, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid1.Add( decimalcharlabel, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) grid1.Add( self.decimalchar, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid1.Add( self.set_min, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) grid1.Add( self.min, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid1.Add( self.set_max, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) grid1.Add( self.max, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid1.Add( self.limit_target, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid1.Add( self.allow_none, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) hbox1 = wx.BoxSizer( wx.HORIZONTAL ) hbox1.Add( (17,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) hbox1.Add( self.group_digits, 0, wx.ALIGN_LEFT|wx.LEFT, 5 ) grid1.Add( hbox1, 0, wx.ALIGN_LEFT|wx.ALL, 5) grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid1.Add( self.allow_negative, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid1.Add( self.use_parens, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) hbox2 = wx.BoxSizer( wx.HORIZONTAL ) hbox2.Add( (17,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) hbox2.Add( self.select_on_entry, 0, wx.ALIGN_LEFT|wx.LEFT, 5 ) grid1.Add( hbox2, 0, wx.ALIGN_LEFT|wx.ALL, 5) grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid2 = wx.FlexGridSizer( 0, 2, 0, 0 ) grid2.Add( label, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) grid2.Add( self.target_ctl, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid2.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid2.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid2.Add( label_numselect, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) grid2.Add( self.numselect, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid2.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid2.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid2.AddGrowableCol(1) self.outer_box = wx.BoxSizer( wx.VERTICAL ) self.outer_box.Add(header, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT, 20) self.outer_box.Add( grid1, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.BOTTOM|wx.RIGHT, 20 ) self.outer_box.Add( grid2, 0, wx.ALIGN_LEFT|wx.ALL, 20 ) self.grid2 = grid2 panel.SetAutoLayout( True ) panel.SetSizer( self.outer_box ) self.outer_box.Fit( panel ) panel.Move( (50,10) ) self.panel = panel self.Bind(masked.EVT_NUM, self.OnSetIntWidth, self.integerwidth ) self.Bind(masked.EVT_NUM, self.OnSetFractionWidth, self.fractionwidth ) self.Bind(wx.EVT_TEXT, self.OnSetGroupChar, self.groupchar ) self.Bind(wx.EVT_TEXT, self.OnSetDecimalChar, self.decimalchar ) self.Bind(wx.EVT_CHECKBOX, self.OnSetMin, self.set_min ) self.Bind(wx.EVT_CHECKBOX, self.OnSetMax, self.set_max ) self.Bind(masked.EVT_NUM, self.SetTargetMinMax, self.min ) self.Bind(masked.EVT_NUM, self.SetTargetMinMax, self.max ) self.Bind(wx.EVT_CHECKBOX, self.SetTargetMinMax, self.limit_target ) self.Bind(wx.EVT_CHECKBOX, self.OnSetAllowNone, self.allow_none ) self.Bind(wx.EVT_CHECKBOX, self.OnSetGroupDigits, self.group_digits ) self.Bind(wx.EVT_CHECKBOX, self.OnSetAllowNegative, self.allow_negative ) self.Bind(wx.EVT_CHECKBOX, self.OnSetUseParens, self.use_parens ) self.Bind(wx.EVT_CHECKBOX, self.OnSetSelectOnEntry, self.select_on_entry ) self.Bind(masked.EVT_NUM, self.OnTargetChange, self.target_ctl ) self.Bind(wx.EVT_COMBOBOX, self.OnNumberSelect, self.numselect )
def test_textctrlCtor(self): t = m.TextCtrl(self.frame) t = m.TextCtrl(self.frame, -1, "Hello") t = m.TextCtrl(self.frame, style=wx.TE_READONLY) t = m.TextCtrl(self.frame, style=wx.TE_PASSWORD) t = m.TextCtrl(self.frame, style=wx.TE_MULTILINE)
def __init__(self, parent, title=_(u"Saisie des pièces"), IDpiece=0, IDpersonne=0, IDtypePiece=None): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.parent = parent self.IDpersonne = IDpersonne self.IDpiece = IDpiece self.selection1 = ( "NoSelect", ) # Pour mémoriser la sélection dans la liste des pièces à fournir self.selection2 = ( "NoSelect", ) # Pour mémoriser la sélection dans la liste des autres pièces self.panel_base = wx.Panel(self, -1) self.sizer_date_debut_staticbox = wx.StaticBox( self.panel_base, -1, _(u"2. Saisissez la date de début")) self.sizer_date_fin_staticbox = wx.StaticBox( self.panel_base, -1, "3. Saisissez la date de fin") self.sizer_type_staticbox = wx.StaticBox( self.panel_base, -1, _(u"1. Sélectionnez un type de pièce")) self.radio_pieces_1 = wx.RadioButton( self.panel_base, -1, _(u"Dans la liste de pièces que la personne doit fournir :"), style=wx.RB_GROUP) self.list_ctrl_pieces = ListCtrl_Pieces(self.panel_base, -1) self.radio_pieces_2 = wx.RadioButton( self.panel_base, -1, _(u"Dans la liste des autres types de pièces :")) # Importe les durées de validité des types de pièces self.RemplissageAutresTypes() self.combo_box_autres = wx.ComboBox(self.panel_base, -1, choices=self.ListeAutresPourCombo, style=wx.CB_DROPDOWN | wx.CB_READONLY) self.label_date_debut = wx.StaticText(self.panel_base, -1, "Date :") self.text_date_debut = masked.TextCtrl(self.panel_base, -1, "", style=wx.TE_CENTRE, mask="##/##/####") self.radio_date_fin_1 = wx.RadioButton(self.panel_base, -1, "Date :", style=wx.RB_GROUP) self.text_date_fin = masked.TextCtrl(self.panel_base, -1, "", style=wx.TE_CENTRE, mask="##/##/####") self.radio_date_fin_2 = wx.RadioButton(self.panel_base, -1, _(u"Validité illimitée")) # Pages capturées self.sizer_pages_staticbox = wx.StaticBox(self.panel_base, -1, _(u"Documents associés")) self.ctrl_pages = CTRL_Vignettes_documents.CTRL(self.panel_base, IDpiece=self.IDpiece, style=wx.BORDER_SUNKEN) self.bouton_ajouter_page = wx.BitmapButton( self.panel_base, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ajouter.png"), wx.BITMAP_TYPE_ANY)) self.bouton_supprimer_page = wx.BitmapButton( self.panel_base, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Supprimer.png"), wx.BITMAP_TYPE_ANY)) self.bouton_visualiser_page = wx.BitmapButton( self.panel_base, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Loupe.png"), wx.BITMAP_TYPE_ANY)) self.bouton_zoom_plus = wx.BitmapButton( self.panel_base, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/zoom_plus.png"), wx.BITMAP_TYPE_ANY)) self.bouton_zoom_moins = wx.BitmapButton( self.panel_base, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/zoom_moins.png"), wx.BITMAP_TYPE_ANY)) self.bouton_aide = CTRL_Bouton_image.CTRL( self.panel_base, texte=_(u"Aide"), cheminImage=Chemins.GetStaticPath("Images/32x32/Aide.png")) self.bouton_ok = CTRL_Bouton_image.CTRL( self.panel_base, texte=_(u"Ok"), cheminImage=Chemins.GetStaticPath("Images/32x32/Valider.png")) self.bouton_annuler = CTRL_Bouton_image.CTRL( self.panel_base, texte=_(u"Annuler"), cheminImage=Chemins.GetStaticPath("Images/32x32/Annuler.png")) self.__set_properties() self.__do_layout() # Désactive le combobox à l'ouverture de la frame self.combo_box_autres.Enable(False) # Si Modification -> importation des données if IDpiece == 0: self.SetTitle(_(u"Saisie d'une pièce")) else: self.SetTitle(_(u"Modification d'une pièce")) self.Importation() # Binds self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPieces, self.radio_pieces_1) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPieces, self.radio_pieces_2) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioDateFin, self.radio_date_fin_1) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioDateFin, self.radio_date_fin_2) 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) self.Bind(wx.EVT_TEXT, self.OnDateDebut, self.text_date_debut) self.Bind(wx.EVT_COMBOBOX, self.OnComboBoxAutres, self.combo_box_autres) self.Bind(wx.EVT_BUTTON, self.AjouterPage, self.bouton_ajouter_page) self.Bind(wx.EVT_BUTTON, self.SupprimerPage, self.bouton_supprimer_page) self.Bind(wx.EVT_BUTTON, self.VisualiserPage, self.bouton_visualiser_page) self.Bind(wx.EVT_BUTTON, self.ZoomPlus, self.bouton_zoom_plus) self.Bind(wx.EVT_BUTTON, self.ZoomMoins, self.bouton_zoom_moins) # Si c'est une saisie de pièce à partir du listeCtrl des pièces à fournir de la fiche individuelle if IDtypePiece != None: self.list_ctrl_pieces.SetIDtypePieceDefaut(IDtypePiece)
def __init__(self, parent, IDentretien=None, IDcandidat=None, IDpersonne=None): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.IDentretien = IDentretien self.IDcandidat = IDcandidat self.IDpersonne = IDpersonne self.panel = wx.Panel(self, -1) self.sizer_contenu_staticbox = wx.StaticBox(self.panel, -1, "") self.label_date = wx.StaticText(self.panel, -1, _(u"Date :")) self.ctrl_date = DatePickerCtrl(self.panel, -1, style=DP_DROPDOWN) self.label_heure = wx.StaticText(self.panel, -1, _(u"Heure :")) self.ctrl_heure = masked.TextCtrl(self.panel, -1, "", size=(60, -1), style=wx.TE_CENTRE, mask="##:##", validRegex="[0-2][0-9]:[0-5][0-9]") self.ctrl_heure.SetCtrlParameters(invalidBackgroundColour="PINK") self.label_avis = wx.StaticText(self.panel, -1, _(u"Avis :")) listeImages = [ (_(u"Avis inconnu"), "Smiley_question.png"), (_(u"Pas convaincant"), "Smiley_nul.png"), (_(u"Mitigé"), "Smiley_bof.png"), (_(u"Bien"), "Smiley_bien.png"), (_(u"Très bien"), "Smiley_genial.png"), ] self.ctrl_avis = MyBitmapComboBox(self.panel, listeImages=listeImages) self.label_remarques = wx.StaticText(self.panel, -1, _(u"Commentaire :")) self.ctrl_remarques = wx.TextCtrl(self.panel, -1, "", style=wx.TE_MULTILINE) self.bouton_aide = CTRL_Bouton_image.CTRL( self.panel, texte=_(u"Aide"), cheminImage=Chemins.GetStaticPath("Images/32x32/Aide.png")) self.bouton_ok = CTRL_Bouton_image.CTRL( self.panel, texte=_(u"Ok"), cheminImage=Chemins.GetStaticPath("Images/32x32/Valider.png")) self.bouton_annuler = CTRL_Bouton_image.CTRL( self.panel, texte=_(u"Annuler"), cheminImage=Chemins.GetStaticPath("Images/32x32/Annuler.png")) if self.IDentretien != None: self.Importation() self.__set_properties() self.__do_layout() 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) self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)