def uninstall(app, resp): if resp == "Yes": app.uninstall() state.getApplicationList().reloadList() application.ui.clearChildren() loadApps(state, application) state.getNotificationQueue().push( pyos.Notification("Uninstalled", "The app " + app.title + " is gone.", image=state.getIcons().getLoadedIcon("menu")))
def connect_existing(self): try: scheme = wifi.Scheme.find("wlan0", self.cell.ssid) scheme.activate() state.getNotificationQueue().push(pyos.Notification("Connected", "Wifi: "+str(self.cell.ssid), image=state.getIcons().getLoadedIcon("wifi"), source=app)) fiapp.currentCell = self.cell app.parameters["network"] = self.cell self.refresh() except: pyos.GUI.ErrorDialog("Unable to connect to the known network "+str(self.cell.ssid)+". Perhaps the password has changed.").display()
def connect(self, pwd): self.connBtn.setText("...") pwd = pwd[0] try: scheme = wifi.Scheme.for_cell("wlan0", self.cell.ssid, self.cell, pwd) scheme.save() scheme.activate() state.getNotificationQueue().push(pyos.Notification("Connected", "Wifi: "+str(self.cell.ssid), image=state.getIcons().getLoadedIcon("wifi"), source=app)) fiapp.currentCell = self.cell app.parameters["network"] = self.cell self.refresh() except: pyos.GUI.OKDialog(str(self.cell.ssid), "Unable to connect to "+str(self.cell.ssid)+". Check the password.").display() self.connBtn.setText("Error") self.connBtn.backgroundColor = state.getColorPalette().getColor("error")
def copy(srcList, dstDir): if not pyos.os.path.isdir(dstDir): pyos.GUI.ErrorDialog("The destination you have selected is not a directory").display() return count = 0 for src in srcList: if src.isFile(): try: copy2(src.absolutePath, dstDir) count += 1 except: pyos.GUI.ErrorDialog("Failed to copy a file.").display() if src.isDir(): try: copytree(src.absolutePath, dstDir) count += 1 except: pyos.GUI.ErrorDialog("Failed to copy a folder.").display() state.getNotificationQueue().push(pyos.Notification("Copy Complete", "Finished copying "+str(count)+" items."))
def showNotification(): state.getNotificationQueue().push(pyos.Notification("Timer Expired", "The timer has stopped.", source=app, image=app.getIcon()))