def Configure(self, myString=""): panel = eg.ConfigPanel() staticText1 = panel.StaticText( "This is the configuration window of Kord plugin. \n\nIf the plugin doesn't work, chances are the installation path in not found or incorrectly filled in below.\nIf the plugin still doesn't work, email the author at [email protected]" ) staticText2 = panel.StaticText( "Input the location of the Kord installation folder. The plugin needs the location to integrate with Kord." ) tcpBox1 = panel.BoxedGroup( "Kord", ("", staticText1), ("", staticText2), ) eg.EqualizeWidths(tcpBox1.GetColumnItems(0)) panel.sizer.Add(tcpBox1, 0, wx.EXPAND) textControl = panel.TextCtrl("C:/Program Files (x86)/Kord") tcpBox2 = panel.BoxedGroup( "Installation path", ("", textControl), ) eg.EqualizeWidths(tcpBox2.GetColumnItems(0)) panel.sizer.Add(tcpBox2, 0, wx.EXPAND) while panel.Affirmed(): panel.SetResult(textControl.GetValue())
def Configure(self, name='', host='', interval=5, timeout=0.25, modify=False): text = self.text panel = eg.ConfigPanel() name_st = panel.StaticText(text.name_lbl) host_st = panel.StaticText(text.host_lbl) interval_st = panel.StaticText(text.interval_lbl) timeout_st = panel.StaticText(text.timeout_lbl) modify_st = panel.StaticText(text.modify_lbl) name_ctrl = panel.TextCtrl(name) host_ctrl = panel.TextCtrl(host) interval_ctrl = panel.SpinIntCtrl(interval, min=0, max=99) timeout_ctrl = panel.SpinNumCtrl(timeout, min=0.0, max=100.0, increment=0.05) modify_ctrl = wx.CheckBox(panel, -1, '') modify_ctrl.SetValue(modify) eg.EqualizeWidths( (name_st, host_st, interval_st, timeout_st, modify_st)) eg.EqualizeWidths((name_ctrl, host_ctrl, interval_ctrl, timeout_ctrl)) def on_text(evt): def check(): clients = list(client[0] for client in Config.clients) value = name_ctrl.GetValue() modify_ctrl.Enable(value in clients) if evt is not None: evt.Skip() wx.CallAfter(check) name_ctrl.Bind(wx.EVT_CHAR, on_text) on_text(None) def add(st, ctrl): sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(st, 0, wx.EXPAND | wx.ALL, 5) sizer.Add(ctrl, 0, wx.EXPAND | wx.ALL, 5) panel.sizer.Add(sizer, 0, wx.EXPAND) add(name_st, name_ctrl) add(host_st, host_ctrl) add(interval_st, interval_ctrl) add(timeout_st, timeout_ctrl) add(modify_st, modify_ctrl) while panel.Affirmed(): panel.SetResult(name_ctrl.GetValue(), host_ctrl.GetValue(), interval_ctrl.GetValue(), timeout_ctrl.GetValue(), modify_ctrl.GetValue())
def Configure(self, *args): command_args = self.command['command']['args'] if not command_args: return eg.ActionBase.Configure(self, *args) panel = eg.ConfigPanel() controls = [] assert len(args) == 0 or len(args) == len(command_args) for i in range(len(command_args)): arg = command_args[i] if len(args) == 0: defaultValue = '' else: defaultValue = args[i] ctrl = panel.TextCtrl(defaultValue) labelText = panel.StaticText(arg['name']) descriptionText = panel.StaticText(arg['description']) controls.append((labelText, ctrl, descriptionText)) eg.EqualizeWidths([x[0] for x in controls]) commandBox = panel.BoxedGroup( Text.commandBox, *[(x[0], x[1], x[2]) for x in controls] ) panel.sizer.Add(commandBox, 0, wx.EXPAND) if 'examples' in self.command and self.command['examples']: examples = [] for example in self.command['examples']: commandText = panel.StaticText(example['command']) descriptionText = panel.StaticText(example['description']) examples.append((commandText, descriptionText)) eg.EqualizeWidths([x[0] for x in examples]) exampleBox = panel.BoxedGroup(Text.examples, *examples) panel.sizer.Add(exampleBox, 0, wx.EXPAND) while panel.Affirmed(): panel.SetResult( *[x[1].GetValue() for x in controls] )
def Configure(self, host=False, port=0, pswd=False): panel = eg.ConfigPanel() host, port, pswd = self.plugin.CONNECTION.Config(host, port, pswd) st1 = panel.TextCtrl(host) st2 = panel.SpinIntCtrl(port, max=65535) st3 = panel.TextCtrl(pswd, style=wx.TE_PASSWORD) eg.EqualizeWidths((st1, st2, st3)) box1 = panel.BoxedGroup('TCP/IP Settings', ('Host Name: ', st1), ('Port: ', st2)) box2 = panel.BoxedGroup('Security Settings', ('Password: ', st3)) panel.sizer.AddMany([ (box1, 0, wx.EXPAND), (box2, 0, wx.EXPAND), ]) while panel.Affirmed(): panel.SetResult( st1.GetValue(), st2.GetValue(), st3.GetValue(), )
def Configure(self, ip="", port="60128", timeout="1"): text = self.text panel = eg.ConfigPanel() wx_ip = panel.TextCtrl(ip) wx_port = panel.SpinIntCtrl(port, max=65535) wx_timeout = panel.TextCtrl(timeout) st_ip = panel.StaticText(text.ip) st_port = panel.StaticText(text.port) st_timeout = panel.StaticText(text.timeout) eg.EqualizeWidths((st_ip, st_port, st_timeout)) tcpBox = panel.BoxedGroup( text.tcpBox, (st_ip, wx_ip), (st_port, wx_port), (st_timeout, wx_timeout), ) panel.sizer.Add(tcpBox, 0, wx.EXPAND) while panel.Affirmed(): panel.SetResult( wx_ip.GetValue(), wx_port.GetValue(), wx_timeout.GetValue(), )
def Configure(self, host="fritz.box", port=1012, password="", prefix="FritzBox"): text = self.text panel = eg.ConfigPanel() hostCtrl = panel.TextCtrl(host) portCtrl = panel.SpinIntCtrl(port, max=65535) eventPsswrdCtrl = panel.TextCtrl(password) eventPrefixCtrl = panel.TextCtrl(prefix) st1 = panel.StaticText(text.host) st2 = panel.StaticText(text.port) st4 = panel.StaticText(text.eventPrefix) eg.EqualizeWidths((st1, st2, st4)) tcpBox = panel.BoxedGroup( text.tcpBox, (st1, hostCtrl), (st2, portCtrl), ) box3 = panel.BoxedGroup(text.eventGenerationBox, (st4, eventPrefixCtrl)) panel.sizer.Add(tcpBox, 0, wx.EXPAND) panel.sizer.Add(box3, 0, wx.TOP | wx.EXPAND, 10) while panel.Affirmed(): panel.SetResult(hostCtrl.GetValue(), portCtrl.GetValue(), eventPsswrdCtrl.GetValue(), eventPrefixCtrl.GetValue())
def Configure(self, direction=0, initSpeed = 60, maxSpeed = 7000, accelerationFactor = 3, useAlternateMethod=False): text = self.text panel = eg.ConfigPanel() direction = float(direction) valueCtrl = panel.SpinNumCtrl(float(direction), min=0, max=360) panel.AddLine(text.text1, valueCtrl, text.text2) initSpeedLabel = wx.StaticText(panel, -1, text.text3) initSpeedSpin = eg.SpinIntCtrl(panel, -1, initSpeed, 10, 2000) maxSpeedLabel = wx.StaticText(panel, -1, text.text4) maxSpeedSpin = eg.SpinIntCtrl(panel, -1, maxSpeed, 4000, 32000) accelerationFactorLabel = wx.StaticText(panel, -1, text.text5) accelerationFactorSpin = eg.SpinIntCtrl(panel, -1, accelerationFactor, 1, 200) eg.EqualizeWidths((initSpeedLabel, maxSpeedLabel, accelerationFactorLabel)) panel.AddLine(initSpeedLabel, initSpeedSpin) panel.AddLine(maxSpeedLabel, maxSpeedSpin) panel.AddLine(accelerationFactorLabel, accelerationFactorSpin) uAMCB = panel.CheckBox(useAlternateMethod, text.label_AM) panel.AddLine(uAMCB) while panel.Affirmed(): panel.SetResult( valueCtrl.GetValue(), initSpeedSpin.GetValue(), maxSpeedSpin.GetValue(), accelerationFactorSpin.GetValue(), uAMCB.GetValue(), )
def Configure(self, selector=None, power=None, color=None, brightness=None, duration=None): panel = eg.ConfigPanel(self) selectorCtrl = SelectorCtrl(panel, selector) colourPickerCtrl = ColourCtrl(self, panel) powerECtrl = panel.CheckBox(power is not None) powerCtrl = panel.Choice(SetState.pwrCh.index(power) if power is not None else 0, SetState.pwrCh) kelvinECtrl, kelvinCtrl = colourPickerCtrl.KelvinCtrl() colorECtrl, colorCtrl = colourPickerCtrl.ColourCtrl(color) brightnessECtrl = panel.CheckBox(brightness is not None) brightnessCtrl = panel.SpinNumCtrl(brightness, min=0, max=1.0, increment=0.01) durationECtrl = panel.CheckBox(duration is not None) durationCtrl = panel.SpinNumCtrl(duration) eg.EqualizeWidths((powerCtrl, kelvinCtrl, brightnessCtrl, durationCtrl)) panel.AddLine('Selector: ', selectorCtrl) panel.AddLine(' ') panel.AddLine('Use Item', 'Item Name', 'Item Value') panel.AddLine('_'*51) panel.AddLine(powerECtrl, 'Power: ', powerCtrl) panel.AddLine(colorECtrl, 'Color: ', colorCtrl) panel.AddLine(kelvinECtrl, 'Color temp (Kelvin): ', kelvinCtrl) panel.AddLine(brightnessECtrl, 'Brightness: ', brightnessCtrl) panel.AddLine(durationECtrl, 'Duration: ', durationCtrl) while panel.Affirmed(): panel.SetResult( selectorCtrl.GetValue(), SetState.pwrCh[powerCtrl.GetValue()] if powerECtrl.GetValue() else None, colourPickerCtrl.GetHTMLColour(), durationCtrl.GetValue() if durationECtrl.GetValue() else None )
def Configure(self, host=False, port=55000, remote=False, tvmodel=False, timeout=1): text = self.text panel = eg.ConfigPanel() host, port, remote, tvmodel = self.CONNECTION.Config( host, port, remote, tvmodel) st1 = panel.TextCtrl(host) st2 = panel.SpinIntCtrl(port, max=65535) st3 = panel.TextCtrl(remote) st4 = panel.TextCtrl(tvmodel) st5 = panel.SpinIntCtrl(timeout, max=10) eg.EqualizeWidths((st1, st2, st3, st4, st5)) box1 = panel.BoxedGroup(text.TCPBox, (text.HostText, st1), (text.PortText, st2)) box2 = panel.BoxedGroup(text.TVBox, (text.RemoteText, st3), (text.ModelText, st4)) box3 = panel.BoxedGroup(text.TimeoutBox, (text.TimeoutText, st5)) panel.sizer.AddMany([(box1, 0, wx.EXPAND), (box2, 0, wx.EXPAND), (box3, 0, wx.EXPAND)]) while panel.Affirmed(): panel.SetResult(st1.GetValue(), st2.GetValue(), st3.GetValue(), st4.GetValue(), st5.GetValue())
def Configure(self, button="", host="", port=0, remote="", tvmodel=""): text = self.text panel = eg.ConfigPanel() host, port, remote, tvmodel = self.plugin.CONNECTION.Config( host, port, remote, tvmodel) st1 = panel.TextCtrl(host) st2 = panel.TextCtrl(host) st3 = panel.SpinIntCtrl(port, max=65535) st4 = panel.TextCtrl(remote) st5 = panel.TextCtrl(tvmodel) eg.EqualizeWidths((st1, st2, st3, st4, st5)) box1 = panel.BoxedGroup(text.CustomBox, (text.CustomText, st1)) box2 = panel.BoxedGroup(text.TCPBox, (text.HostText, st2), (text.PortText, st3)) box3 = panel.BoxedGroup(text.TVBox, (text.RemoteText, st4), (text.ModelText, st5)) panel.sizer.AddMany([(box1, 0, wx.EXPAND), (box2, 0, wx.EXPAND), (box3, 0, wx.EXPAND)]) while panel.Affirmed(): panel.SetResult(st1.GetValue(), st2.GetValue(), st3.GetValue(), st4.GetValue(), st5.GetValue())
def Configure( self, host='192.168.32.4', port=4025, envisalinkuser='******', envisalinkpass='******', debug=False ): text = self.text panel = eg.ConfigPanel() hostCtrl = panel.TextCtrl(host) portCtrl = panel.SpinIntCtrl(port, max=65535) userCtrl = panel.TextCtrl(envisalinkuser) passCtrl = panel.TextCtrl(envisalinkpass) debugCtrl = panel.CheckBox(debug, '') tcpBox = panel.BoxedGroup( text.tcpBox, (text.hostLabel, hostCtrl), (text.portLabel, portCtrl), (text.userLabel, userCtrl), (text.passLabel, passCtrl), ('Debug', debugCtrl), ) eg.EqualizeWidths(tcpBox.GetColumnItems(0)) panel.sizer.Add(tcpBox, 0, wx.EXPAND) while panel.Affirmed(): panel.SetResult( hostCtrl.GetValue(), portCtrl.GetValue(), userCtrl.GetValue(), passCtrl.GetValue(), debugCtrl.GetValue(), )
def Configure(self, fileloadpath='', fileloadname='', filesavepath='', filesavename=''): text = self.text panel = eg.ConfigPanel() fileloadpathCtrl = panel.TextCtrl(fileloadpath) fileloadnameCtrl = panel.TextCtrl(fileloadname) filesavepathCtrl = panel.TextCtrl(filesavepath) filesavenameCtrl = panel.TextCtrl(filesavename) confBox = panel.BoxedGroup( text.confbox, (text.loadpath, fileloadpathCtrl), (text.loadname, fileloadnameCtrl), (text.savepath, filesavepathCtrl), (text.savename, filesavenameCtrl), ) eg.EqualizeWidths(confBox.GetColumnItems(0)) panel.sizer.Add(confBox, 0, wx.EXPAND) while panel.Affirmed(): panel.SetResult( fileloadpathCtrl.GetValue(), fileloadnameCtrl.GetValue(), filesavepathCtrl.GetValue(), filesavenameCtrl.GetValue(), )
def Configure(self, ip="127.0.0.1", port=3480, prefix='MiCasaVerdeVera'): text = self.text panel = eg.ConfigPanel() st1 = panel.TextCtrl(ip) st2 = panel.SpinIntCtrl(port, max=65535) st3 = panel.TextCtrl(prefix) eg.EqualizeWidths((st1, st2, st3)) box1 = panel.BoxedGroup( text.VeraBox, (text.VeraIP, st1), (text.VeraPort, st2) ) box2 = panel.BoxedGroup( text.PrefixBox, (text.Prefix,st3) ) panel.sizer.AddMany([ (box1, 0, wx.EXPAND), (box2, 0, wx.EXPAND) ]) while panel.Affirmed(): panel.SetResult( st1.GetValue(), st2.GetValue(), st3.GetValue() )
def SetDynSizer(state, bType): cNum = BOARDS[bType][1] cNum = int(cNum) if cNum != "" else 0 stateSizer.Clear(True) lbl4 = wx.StaticText(panel,-1, text.channel) lbl5 = wx.StaticText(panel,-1, text.state) stateSizer.Add(lbl4, 0, wx.TOP, 8) for i in range(8): if i < cNum: stateSizer.Add( wx.StaticText(panel, -1, str(i + 1)), 0, wx.ALIGN_CENTER|wx.TOP, 8 ) else: stateSizer.Add((24,24)) stateSizer.Add(lbl5,0,wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,30) eg.EqualizeWidths([lbl0, lbl1, lbl2, lbl3, lbl4, lbl5]) for i in range(8): if i < cNum: ctrl = StatusBitmap( panel, buttons[i], stateValues = images, tooltips = text.states[:2], state = state[i] ) stateSizer.Add(ctrl,0,wx.ALIGN_CENTER) ctrl.Bind(EVT_STATUS_BITMAP_CHANGED, OnStatusChange) else: stateSizer.Add((24,24)) panel.sizer.Layout()
def Configure(self, Command="", host="", addCommand=False, onlyIfChanged=False, keep=False): panel = eg.ConfigPanel() text = self.text st_command = panel.StaticText(text.command) wx_command = panel.TextCtrl(Command) st_host = panel.StaticText(text.hostName) wx_host = wx.Choice(panel, -1, choices=self.plugin.instances) wx_addCommand = wx.CheckBox(panel, -1, text.addCommand) wx_addCommand.SetValue(addCommand) wx_onlyIfChanged = wx.CheckBox(panel, -1, text.onlyIfChanged) wx_onlyIfChanged.SetValue(onlyIfChanged) wx_keep = wx.CheckBox(panel, -1, text.keep) wx_keep.SetValue(keep) if host in self.plugin.instances: wx_host.SetSelection(self.plugin.instances.index(host)) eg.EqualizeWidths((st_host, st_command)) panel.AddLine(st_host, wx_host) panel.AddLine(st_command, wx_command) panel.AddLine(wx_addCommand) panel.AddLine(wx_onlyIfChanged) panel.AddLine(wx_keep) while panel.Affirmed(): panel.SetResult(wx_command.GetValue(), wx_host.GetStringSelection(), wx_addCommand.GetValue(), wx_onlyIfChanged.GetValue(), wx_keep.GetValue())
def Configure(self, ip="127.0.0.1", port=3480, prefix='MiCasaVerdeVera', minimalEvents=False, genPayload=True): text = self.text panel = eg.ConfigPanel() st1 = panel.TextCtrl(ip) st2 = panel.SpinIntCtrl(port, max=65535) st3 = panel.TextCtrl(prefix) st4 = panel.CheckBox(minimalEvents) st5 = panel.CheckBox(genPayload) eg.EqualizeWidths((st1, st2, st3, st4, st5)) box1 = panel.BoxedGroup(text.VeraBox, (text.VeraIP, st1), (text.VeraPort, st2)) box2 = panel.BoxedGroup(text.PrefixBox, (text.Prefix, st3), (text.MinEvtText, st4), (text.EvtPayText, st5)) panel.sizer.AddMany([(box1, 0, wx.EXPAND), (box2, 0, wx.EXPAND)]) while panel.Affirmed(): panel.SetResult(st1.GetValue(), st2.GetValue(), st3.GetValue(), st4.GetValue(), st5.GetValue())
def Configure(self, host='192.168.32.18', database='RA2', dbuser='******', dbpass='******', debug=False): text = self.text panel = eg.ConfigPanel() hostCtrl = panel.TextCtrl(host) databaseCtrl = panel.TextCtrl(database) userCtrl = panel.TextCtrl(dbuser) passCtrl = panel.TextCtrl(dbpass) debugCtrl = panel.CheckBox(debug, '') tcpBox = panel.BoxedGroup( text.tcpBox, (text.hostLabel, hostCtrl), (text.databaseLabel, databaseCtrl), (text.userLabel, userCtrl), (text.passLabel, passCtrl), ('Debug', debugCtrl), ) eg.EqualizeWidths(tcpBox.GetColumnItems(0)) panel.sizer.Add(tcpBox, 0, wx.EXPAND) while panel.Affirmed(): panel.SetResult( hostCtrl.GetValue(), databaseCtrl.GetValue(), userCtrl.GetValue(), passCtrl.GetValue(), debugCtrl.GetValue(), )
def Configure(self, ip="", port=22, user="", pw="", host="", comm="Log", replace=True): text = self.Text panel = eg.ConfigPanel() wx_ip = panel.TextCtrl(ip) wx_port = panel.SpinIntCtrl(port, min=0, max=65535) wx_user = panel.TextCtrl(user) wx_pw = panel.TextCtrl(pw) wx_host = panel.TextCtrl(host) wx_comm = wx.Choice(panel, -1, choices=self.plugin.comms) wx_comm.SetSelection(self.plugin.comms.index(comm)) wx_replace = wx.CheckBox(panel, -1, text.replace) wx_replace.SetValue(replace) st_ip = panel.StaticText(text.ip) st_port = panel.StaticText(text.port) st_user = panel.StaticText(text.user) st_pw = panel.StaticText(text.pw) st_host = panel.StaticText(text.host) st_comm = panel.StaticText(text.comm) st_replace = panel.StaticText("") eg.EqualizeWidths( (st_ip, st_port, st_user, st_pw, st_host, st_comm, st_replace)) tcpBox = panel.BoxedGroup( text.tcpBox, (st_ip, wx_ip), (st_port, wx_port), (st_user, wx_user), (st_pw, wx_pw), ) egBox = panel.BoxedGroup( text.egBox, (st_host, wx_host), (st_replace, wx_replace), (st_comm, wx_comm), ) panel.sizer.Add(tcpBox, 0, wx.EXPAND) panel.sizer.Add(egBox, 1, wx.EXPAND) while panel.Affirmed(): host2 = wx_host.GetValue() if host2 == "": host2 = "_" panel.SetResult( wx_ip.GetValue(), wx_port.GetValue(), wx_user.GetValue(), wx_pw.GetValue(), host2, wx_comm.GetStringSelection(), wx_replace.GetValue(), )
def Configure(self, device=0, mode=0): text = self.text panel = eg.ConfigPanel() choices = ['Off', 'CoolOn', 'HeatOn', 'AutoChangeOver'] st1 = panel.SpinIntCtrl(device, max=200) st2 = panel.Choice(mode, choices=choices) eg.EqualizeWidths((st1, st2)) box1 = panel.BoxedGroup( text.OppModeBox, (text.DeviceText, st1), (text.OppModeText, st2) ) panel.sizer.Add(box1, 0, wx.EXPAND) while panel.Affirmed(): panel.SetResult( st1.GetValue(), st2.GetValue() )
def Configure(self, host="", port=1024, password="******", prefix="Android"): text = self.text panel = eg.ConfigPanel() hostCtrl = panel.TextCtrl(host) portCtrl = panel.SpinIntCtrl(port, max=65535) passwordCtrl = panel.TextCtrl(password, style=wx.TE_PASSWORD) eventPrefixCtrl = panel.TextCtrl(prefix) st1 = panel.StaticText(text.host) st2 = panel.StaticText(text.port) st3 = panel.StaticText(text.password) st4 = panel.StaticText(text.eventPrefix) eg.EqualizeWidths((st1, st2, st3, st4)) box1 = panel.BoxedGroup( text.tcpBox, (st1, hostCtrl), (st2, portCtrl), ) box2 = panel.BoxedGroup(text.securityBox, (st3, passwordCtrl)) box3 = panel.BoxedGroup(text.eventGenerationBox, (st4, eventPrefixCtrl)) panel.sizer.AddMany([ (box1, 0, wx.EXPAND), (box2, 0, wx.EXPAND | wx.TOP, 10), (box3, 0, wx.EXPAND | wx.TOP, 10), ]) while panel.Affirmed(): panel.SetResult(hostCtrl.GetValue(), portCtrl.GetValue(), passwordCtrl.GetValue(), eventPrefixCtrl.GetValue())
def Configure(self, host="127.0.0.1", port=1024, password=""): text = self.text panel = eg.ConfigPanel() hostCtrl = panel.TextCtrl(host) portCtrl = panel.SpinIntCtrl(port, max=65535) passwordCtrl = panel.TextCtrl(password, style=wx.TE_PASSWORD) st1 = panel.StaticText(text.host) st2 = panel.StaticText(text.port) st3 = panel.StaticText(text.password) eg.EqualizeWidths((st1, st2, st3)) tcpBox = panel.BoxedGroup( text.tcpBox, (st1, hostCtrl), (st2, portCtrl), ) securityBox = panel.BoxedGroup( text.securityBox, (st3, passwordCtrl), ) panel.sizer.Add(tcpBox, 0, wx.EXPAND) panel.sizer.Add(securityBox, 0, wx.TOP|wx.EXPAND, 10) while panel.Affirmed(): panel.SetResult( hostCtrl.GetValue(), portCtrl.GetValue(), passwordCtrl.GetValue() )
def Configure(self, device=0, state=0): text = self.text panel = eg.ConfigPanel() choices = ['OFF', 'ON'] st1 = panel.SpinIntCtrl(device, max=200) st2 = panel.Choice(state, choices=choices) eg.EqualizeWidths((st1, st2)) box1 = panel.BoxedGroup( text.SwitchBox, (text.DeviceText, st1), (text.StateText, st2) ) panel.sizer.Add(box1, 0, wx.EXPAND) while panel.Affirmed(): panel.SetResult( st1.GetValue(), st2.GetValue() )
def Configure(self, link=None, kind=0, gosub=False): text = self.text panel = eg.ConfigPanel() kindCtrl = panel.Choice(kind, choices=text.choices) linkCtrl = panel.MacroSelectButton( eg.text.General.choose, text.mesg1, text.mesg2, link ) gosubCtrl = panel.CheckBox(gosub, text.text3) labels = ( panel.StaticText(text.text1), panel.StaticText(text.text2), ) eg.EqualizeWidths(labels) sizer = wx.FlexGridSizer(3, 2, 15, 5) sizer.AddGrowableCol(1, 1) sizer.Add(labels[0], 0, wx.ALIGN_CENTER_VERTICAL) sizer.Add(kindCtrl) sizer.Add(labels[1], 0, wx.ALIGN_CENTER_VERTICAL) sizer.Add(linkCtrl, 1, wx.EXPAND) sizer.Add((0, 0)) sizer.Add(gosubCtrl) panel.sizer.Add(sizer, 1, wx.EXPAND, wx.ALIGN_CENTER_VERTICAL) while panel.Affirmed(): panel.SetResult( linkCtrl.GetValue(), kindCtrl.GetValue(), gosubCtrl.GetValue() )
def Configure(self, key1='', key2='', key3='', value=None): if value == None: value = "" text = self.baseText panel = eg.ConfigPanel() key1Ctrl = panel.TextCtrl(key1) key2Ctrl = panel.TextCtrl(key2) key3Ctrl = panel.TextCtrl(key3) valCtrl = panel.TextCtrl(value) addItemBox = panel.BoxedGroup( text.addbox, (text.keyword1, key1Ctrl), (text.keyword2, key2Ctrl), (text.keyword3, key3Ctrl), (text.value, valCtrl), ) eg.EqualizeWidths(addItemBox.GetColumnItems(0)) panel.sizer.Add(addItemBox, 0, wx.EXPAND) while panel.Affirmed(): panel.SetResult( key1Ctrl.GetValue(), key2Ctrl.GetValue(), key3Ctrl.GetValue(), valCtrl.GetValue(), )
def Configure(self, destIP="", destPort=1024, passwd="", data=""): text = Text panel = eg.ConfigPanel() addrCtrl = panel.TextCtrl(destIP) portCtrl = panel.SpinIntCtrl(destPort, max=65535) passwordCtrl = panel.TextCtrl(passwd, style=wx.TE_PASSWORD) dataCtrl = panel.TextCtrl(data) st1 = panel.StaticText(text.address) st2 = panel.StaticText(text.port) st3 = panel.StaticText(text.password) st4 = panel.StaticText(text.dataToReceive) eg.EqualizeWidths((st1, st2, st3, st4)) box1 = panel.BoxedGroup(text.tcpBox, (st1, addrCtrl), (st2, portCtrl)) box2 = panel.BoxedGroup(text.securityBox, (st3, passwordCtrl)) box3 = panel.BoxedGroup(text.dataBox, (st4, dataCtrl)) panel.sizer.AddMany([ (box1, 0, wx.EXPAND), (box2, 0, wx.EXPAND | wx.TOP, 10), (box3, 0, wx.EXPAND | wx.TOP, 10), ]) while panel.Affirmed(): panel.SetResult( addrCtrl.GetValue(), portCtrl.GetValue(), passwordCtrl.GetValue(), dataCtrl.GetValue(), )
def Configure(self, deviceID="Device ID", deviceName='', value=''): panel = eg.ConfigPanel() outletDict = self.plugin.outletdict deviceNameChoices = sorted(outletDict.keys()) if deviceName in deviceNameChoices: deviceSelection = deviceNameChoices.index(deviceName) deviceName = outletDict[deviceName]['deviceID'] else: deviceSelection = 0 deviceNameCtrl = panel.Choice(deviceSelection, deviceNameChoices) deviceIDCtrl = panel.TextCtrl(deviceName) deviceBox = panel.BoxedGroup("Choose Switch", ("Name: ", deviceNameCtrl), ("device ID: ", deviceIDCtrl)) def OnChoice(event): deviceIDCtrl.SetValue( outletDict[deviceNameCtrl.GetStringSelection()]['deviceID'], ) event.Skip() deviceNameCtrl.Bind(wx.EVT_CHOICE, OnChoice) eg.EqualizeWidths(tuple(deviceBox.GetColumnItems(0))) panel.sizer.Add(deviceBox, 0, wx.EXPAND | wx.ALL, 10) while panel.Affirmed(): panel.SetResult(deviceIDCtrl.GetValue(), deviceNameCtrl.GetStringSelection())
def Configure( self, host="localhost", rport=38475, prefix="AIMP", poll=2, events=7 * [False], ): text = self.text panel = eg.ConfigPanel() panel.GetParent().GetParent().SetIcon(self.info.icon.GetWxIcon()) prefix = self.name if not prefix else prefix hostCtrl = wx.TextCtrl(panel, -1, host) rportCtrl = eg.SpinIntCtrl(panel, -1, rport, max=65535) pollCtrl = eg.SpinIntCtrl(panel, -1, poll, min=1, max=99) eventPrefixCtrl = wx.TextCtrl(panel, -1, prefix) st1 = wx.StaticText(panel, -1, text.host) st2 = wx.StaticText(panel, -1, text.rport) st3 = wx.StaticText(panel, -1, text.polling) st4 = wx.StaticText(panel, -1, text.eventsLabel) st5 = wx.StaticText(panel, -1, text.eventPrefix) eg.EqualizeWidths((st1, st2)) eventsCtrl = wx.CheckListBox( panel, -1, choices=text.events, size=((-1, len(events) * (3 + st4.GetSize()[1]))), ) for i in range(len(events)): eventsCtrl.Check(i, events[i]) box1 = panel.BoxedGroup( text.tcpBox, (st1, hostCtrl), (st2, rportCtrl), ) box2 = wx.StaticBoxSizer( wx.StaticBox(panel, -1, text.eventGenerationBox), wx.HORIZONTAL) leftSizer = wx.FlexGridSizer(2, 2, 10, 5) leftSizer.Add(st5, 0, wx.TOP, 3) leftSizer.Add(eventPrefixCtrl) leftSizer.Add(st3, 0, wx.TOP, 3) leftSizer.Add(pollCtrl) rightSizer = wx.BoxSizer(wx.VERTICAL) rightSizer.Add(st4) rightSizer.Add(eventsCtrl, 0, wx.EXPAND) box2.Add(leftSizer, 0, wx.TOP, 4) box2.Add(rightSizer, 1, wx.EXPAND | wx.LEFT, 10) panel.sizer.AddMany([ (box1, 0, wx.EXPAND), (box2, 0, wx.EXPAND | wx.TOP, 10), ]) while panel.Affirmed(): tmpList = [] for i in range(len(events)): tmpList.append(eventsCtrl.IsChecked(i)) panel.SetResult(hostCtrl.GetValue(), rportCtrl.GetValue(), eventPrefixCtrl.GetValue(), pollCtrl.GetValue(), tmpList)
def Configure(self, ip="127.0.0.1", port=3480, prefix='MiCasaVerdeVera', minimalEvents=False, genPayload = True, inc=0.10, wattsFilePath='C:\\'): text = self.text panel = eg.ConfigPanel() st1 = panel.TextCtrl(ip) st2 = panel.SpinIntCtrl(port, max=65535) st3 = panel.TextCtrl(prefix) st4 = panel.CheckBox(minimalEvents) st5 = panel.CheckBox(genPayload) st6 = panel.SpinNumCtrl(inc, increment=0.05, min=0.10) st7 = panel.FileBrowseButton(wattsFilePath) eg.EqualizeWidths((st1, st2, st3, st4, st5, st6, st7)) box1 = panel.BoxedGroup( text.VeraBox, (text.VeraIPText, st1), (text.VeraPortText, st2) ) box2 = panel.BoxedGroup( text.PrefixBox, (text.PrefixText,st3), (text.MinEvtText,st4), (text.EvtPayText,st5) ) box3 = panel.BoxedGroup( text.UpdateBox, (text.UpSpeedText,st6) ) box4 = panel.BoxedGroup( text.WattsFPBox, (text.WattsFPText,st7) ) panel.sizer.AddMany([ (box1, 0, wx.EXPAND), (box2, 0, wx.EXPAND), (box3, 0, wx.EXPAND), (box4, 0, wx.EXPAND) ]) while panel.Affirmed(): panel.SetResult( st1.GetValue(), st2.GetValue(), st3.GetValue(), st4.GetValue(), st5.GetValue(), st6.GetValue(), st7.GetValue() )
def Configure(self, host=False, port=0, pswd=False, localPort=1024, localPswd="", prefix="MediaPortal", ipPrefix=False): text = self.text panel = eg.ConfigPanel() host, port, pswd = self.CONNECTION.Config(host, port, pswd) def Toggle(flag): flag = False if flag else True return flag st1 = panel.TextCtrl(host) st2 = panel.SpinIntCtrl(port, max=65535) st3 = panel.TextCtrl(pswd, style=wx.TE_PASSWORD) st4 = panel.SpinIntCtrl(localPort, max=65535) st5 = panel.TextCtrl(localPswd, style=wx.TE_PASSWORD) st6 = panel.TextCtrl(prefix) st7 = panel.CheckBox(ipPrefix) st6.Enable(Toggle(ipPrefix)) def OnCheckBox(event): st6.Enable(Toggle(st7.GetValue())) st7.Bind(wx.EVT_CHECKBOX, OnCheckBox) eg.EqualizeWidths((st1, st2, st3, st4, st5, st6, st7)) box1 = panel.BoxedGroup(text.TCPBox, (text.HostText, st1), (text.PortText, st2)) box2 = panel.BoxedGroup(text.SecurityBox, (text.PassText, st3)) box3 = panel.BoxedGroup(text.TCPBox, (text.PortText, st4)) box4 = panel.BoxedGroup(text.SecurityBox, (text.PassText, st5)) box5 = panel.BoxedGroup(text.EventBox, (text.PrefixText, st6), (text.IPPreText, st7)) box6 = panel.BoxedGroup(text.RemoteBox, box1, box2) box7 = panel.BoxedGroup(text.LocalBox, box3, box4, box5) panel.sizer.AddMany([(box6, 0, wx.EXPAND), (box7, 0, wx.EXPAND)]) while panel.Affirmed(): panel.SetResult(st1.GetValue(), st2.GetValue(), st3.GetValue(), st4.GetValue(), st5.GetValue(), st6.GetValue(), st7.GetValue())
def Configure(self, data=""): text = self.text panel = eg.ConfigPanel() data_ctrl = panel.TextCtrl(data) data_ctrl_label = panel.StaticText(text.write_string_label) result_preview_ctrl_label = panel.StaticText(text.parse_string_label) result_preview_ctrl = panel.StaticText("") eg.EqualizeWidths((data_ctrl_label, result_preview_ctrl_label)) eg.EqualizeWidths((data_ctrl, result_preview_ctrl)) Add = panel.sizer.Add Add(eg.HBoxSizer(data_ctrl_label, (5, 5), data_ctrl)) Add((5, 5)) Add( eg.HBoxSizer(result_preview_ctrl_label, (5, 5), result_preview_ctrl)) def on_data_change(event): try: temp = eg.ParseString(data_ctrl.GetValue()) temp = temp.strip() result_preview_ctrl.SetLabel(temp) panel.EnableButtons(True) except: result_preview_ctrl.SetLabel(text.parse_string_error) panel.EnableButtons(False) event.Skip() data_ctrl.Bind(wx.EVT_TEXT, on_data_change) data_ctrl.SetValue(data_ctrl.GetValue()) while panel.Affirmed(): panel.SetResult(data_ctrl.GetValue())