def __init__(self, session, pcinfo = None, net_rpc = -1): self.skin = xpowerEdit.skin self.session = session self.pcinfo = pcinfo self.net_rpc = net_rpc Screen.__init__(self, session) HelpableScreen.__init__(self) self.mac = getConfigListEntry(_("MAC"), cfg.mac) xpowerEditconfigList = [] xpowerEditconfigList.append(getConfigListEntry(_("Name"), cfg.name)) xpowerEditconfigList.append(getConfigListEntry(_("IP"), cfg.ip)) xpowerEditconfigList.append(self.mac) xpowerEditconfigList.append(getConfigListEntry(_("System"), cfg.system)) xpowerEditconfigList.append(getConfigListEntry(_("User"),cfg.user)) xpowerEditconfigList.append(getConfigListEntry(_("Password"), cfg.passwd)) xpowerEditconfigList.append(getConfigListEntry(_("BouqDown"), cfg.bqdn)) xpowerEditconfigList.append(getConfigListEntry(_("Closing plugin"), cfg.close)) ConfigListScreen.__init__(self, xpowerEditconfigList, session=self.session, on_change = self.changedEntry) if self.pcinfo is None: self.pcinfo = { 'name': False, 'ip': False, 'mac': False, 'system': False, 'user': False, 'passwd': False, 'bqdn': False } self["key_red"] = Button(_("Cancel")) self["key_green"] = Button(_("Ok")) self["key_yellow"] = Button() self["key_blue"] = Button(_("Get MAC")) self["statusbar"] = Label() # self["statusbar"].setText(_("BouqUp for WakeUp")) self["0"] = MultiPixmap() self.remotepc = {} self["XPowerActions"] = HelpableActionMap(self, "XPowerActions", { "ok": self.ok, "cancel": self.cancel, "red": self.cancel, "green": self.ok, "blue": (self.getPcMAC, _("get MAC of running PC")), # "wakeup": (self.wakeup, _("wakeup PC")), }, -1) self.setup_title = _("XPower: %s" % (self.pcinfo['name'])) self.onChangedEntry = [] self.remotepc = ixpowerUt.getPCsList() self.fillCfg() self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.isAlive)
def showPCsList(self): oldIndex = self["config"].getIndex() oldCount = self["config"].count() list = [] remotepc = ixpowerUt.getPCsList() for name in remotepc.keys(): list.append(self.buildPCViewItem(ixpowerUt.remotepc[name])) list.sort() self["config"].setList(list) newCount = self["config"].count() newIndex = self["config"].getIndex() self.setListIndex(oldIndex, newIndex, oldCount, newCount)
def showPCsList(self): oldIndex = self["config"].getIndex() oldCount = self["config"].count() list = [] remotepc = ixpowerUt.getPCsList() for name in remotepc.keys(): list.append(self.buildPCViewItem(ixpowerUt.remotepc[name])) list.sort(key=lambda x: x[1]) self["config"].setList(list) newCount = self["config"].count() newIndex = self["config"].getIndex() self.setListIndex(oldIndex, newIndex, oldCount, newCount)
def __init__(self, session, pcinfo=None): self.skin = xpowerEdit.skin self.session = session self.pcinfo = pcinfo Screen.__init__(self, session) HelpableScreen.__init__(self) self.mac = getConfigListEntry(_("MAC"), cfg.mac) xpowerEditconfigList = [] xpowerEditconfigList.append(getConfigListEntry(_("Name"), cfg.name)) xpowerEditconfigList.append(getConfigListEntry(_("IP"), cfg.ip)) xpowerEditconfigList.append(self.mac) xpowerEditconfigList.append(getConfigListEntry(_("System"), cfg.system)) xpowerEditconfigList.append(getConfigListEntry(_("User"), cfg.user)) xpowerEditconfigList.append( getConfigListEntry(_("Password"), cfg.passwd)) xpowerEditconfigList.append(getConfigListEntry(_("BouqDown"), cfg.bqdn)) xpowerEditconfigList.append( getConfigListEntry(_("Closing plugin"), cfg.close)) ConfigListScreen.__init__(self, xpowerEditconfigList, session=self.session, on_change=self.changedEntry) if self.pcinfo is None: self.pcinfo = { 'name': False, 'ip': False, 'mac': False, 'system': False, 'user': False, 'passwd': False, 'bqdn': False } self["key_red"] = Button(_("Cancel")) self["key_green"] = Button(_("Ok")) self["key_yellow"] = Button() self["key_blue"] = Button(_("Get MAC")) self["statusbar"] = Label() # self["statusbar"].setText(_("BouqUp for WakeUp")) self["0"] = MultiPixmap() self.remotepc = {} self["XPowerActions"] = HelpableActionMap( self, "XPowerActions", { "ok": self.ok, "cancel": self.cancel, "red": self.cancel, "green": self.ok, "blue": (self.getPcMAC, _("get MAC of running PC")), # "wakeup": (self.wakeup, _("wakeup PC")), }, -1) self.setup_title = _("XPower: %s" % (self.pcinfo['name'])) self.onChangedEntry = [] self.remotepc = ixpowerUt.getPCsList() self.fillCfg() self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.isAlive)