def event_start_download(self, event): #self.Console_widget.log("event_start_download called") self.Queue_widget.value = 0 if len(self.queue) > 0: self.isdownloading = True else: notify("Queue is Empty", title='Warning') time.sleep(2) npyscreen.blank_terminal() self.isdownloading = False return self.current_song = self.queue[0] self.Console_widget.log("Downloading: " + self.current_song['name'] + " by " + self.current_song['artists']) #self.Console_widget.name = self.parentApp.passinfo['name'] self.Console_widget.footer = self.current_song['name'] + " | Running" executecommand = "python3 spotdlRunner.py --song " + self.current_song[ 'share'] + " --overwrite force --trim-silence -f '" + self.parentApp.save_location + "'" #executecommand = "spotdl --song " #executecommand = "sudo ls -la npyscreen >&2 " self.Console_widget.log("> " + executecommand) self.event_update_download_form("event") self.process = self.run_command(executecommand)
def h_quit(self, item=None): """ Function called when Ctrl+c pushed -> exit the program: """ npyscreen.blank_terminal() cleanup_empty_file() self.parentApp.switchForm(None)
def beforeEditing(self): """ Update the results lists based on the command received from the structuresubmenu In the case this form is being used by the query, we expected the submenucmd to be None :return: """ if self.submenucmd is None: npyscreen.blank_terminal() self.updateresults() return True elif self.submenucmd == 'BACK': return True elif self.submenucmd == 'BROWSE': self.submenu_browse() return True elif self.submenucmd == 'STRUCTURE': self.submenu_structure() return True elif self.submenucmd == 'INSERT': self.submenu_insert() return False elif self.submenucmd == 'EMPTY': self.submenu_empty() return True elif self.submenucmd == 'DROP': self.submenu_drop() return True elif self.submenucmd == 'EDIT': self.submenu_edit() return False elif self.submenucmd == 'DELETE': self.submenu_delete() return True else: return True
def endOrContinue(self): option = npyscreen.notify_yes_no("Czy zakonczyc prace?", "Koniec") if option: exit() else: self.parent.parentApp.switchForm("MAIN") npyscreen.blank_terminal()
def warning_dialog(message, title): """Produces a Warning dialog showing some text. Allows two options: Stop (to stop the full program), or Continue (to ignore the warning and keep it running). Returns a bool with the choice. """ nps.notify_confirm(message, title=title) nps.blank_terminal()
def main(self): self.frame = Form(name="sTGC monitoring", lines=20, columns=70) ll = [i for i in open("/star/u/sysuser/users/lukas/STGC/stgc.list")] self.pvs = [] for pvname in ll: self.pvs.append(pv_monit(self.frame, pvname.rstrip())) npy.blank_terminal() self.frame.edit()
def on_ok(self): npyscreen.blank_terminal() picture = convert_image(src_file=self.file.value, threshold=int(self.threshold.value), bicolor=self.bicolor.value, trsh_of=int(self.threshold_of.value), rotation=int(self.rotation.value), invert=self.invert.value) push_image(picture, swap=self.swap.value) self.parentApp.setNextForm('MAIN')
def continue_dialog(message, title): if not notify_popup(message, title=title, form_color='STANDOUT', wrap=True, editw=0, ok_label='Continue', cancel_label='Abort'): sys.exit(0) nps.blank_terminal()
def main(self): frame = npy.Form(name="EPD Alarm Limits in Slow Controls", lines=19, columns=80) imon = pv_edit(frame, "Imon high alarm", "EPD:imon_max") temp = pv_edit(frame, "Temp high alarm", "EPD:temp_max") rmon_min = pv_edit(frame, "Rmon low alarm", "EPD:rmon_min", 40, 2) rmon_max = pv_edit(frame, "Rmon high alarm", "EPD:rmon_max", 40) npy.blank_terminal() frame.edit()
def whenPressed(self): the_selected_file = npyscreen.selectFile() file = open(the_selected_file, "r") try: for line in file: line = line.strip() line = re.split("[^a-zA-Z\d@.]+", line) allDataList.append( StudentData(line[1], line[2], line[3], line[4])) finally: file.close() npyscreen.blank_terminal() self.parent.parentApp.switchForm("BASEOPTIONS")
def on_ok(self): if 0 in self.choice.value: self.parentApp.setNextForm('CONVERT') elif 1 in self.choice.value: self.parentApp.setNextForm('LOAD') elif 2 in self.choice.value: self.parentApp.setNextForm('TEXT') elif 3 in self.choice.value: npyscreen.blank_terminal() epd = epd4in2b.EPD() epd.init() epd.Clear(0xFF) epd.sleep() self.parentApp.setNextForm('MAIN')
def whenPressed(self): the_selected_file = npyscreen.selectFile() file = open(the_selected_file, "r") try: for line in file: self.dataList.append(line) line = line.strip() line = line.split(" ") allDataList.append(WorkerData(line[0], line[1])) finally: file.close() npyscreen.blank_terminal() self.parent.parentApp.switchForm("BASEOPTIONS")
def showQR(self): state = self.parentApp.state self.parentApp.setup.showingToken = True self.parentApp.tokenQR = self.getQR() self.parentApp.setup.showingToken = False npyscreen.blank_terminal() print("\r") for line in self.parentApp.tokenQR.splitlines(): print(line) print("\r", end='') print("") print("Open Signal > Settings > Linked Devices > Add and scan the QR code.\r") npyscreen.notify_confirm( self.getResponse(), title="Restart signal-curses to begin chatting") exit(0)
def event_add_queue(self, event): #self.Console_widget.log("event_add_queue called") #with open('some_file.txt', 'w') as f: # json.dump(self.parentApp.passinfo, f) if isinstance(self.parentApp.passinfo, list): self.queue.extend(self.parentApp.passinfo) else: self.queue.append(self.parentApp.passinfo) self.Queue_widget.assignvalues(self.queue) #npyscreen.notify("Queued", title='Popup Title') #npyscreen.notify_confirm("Queued", title='Popup Title', form_color='STANDOUT', editw = 5) notify("Queued", title='Notice') time.sleep( 0.5) # needed to have it show up for a visible amount of time npyscreen.blank_terminal() # needed to cleat notify form residue
def whenPressed(self): npyscreen.notify_confirm( "Linki do stron zapisane sa w pliku link.txt," + "\nktory jest w glownym katalogu programu", "Informacja") linkList = [] file = open("link.txt", "r") try: for link in file: link = link.strip() linkList.append(link) finally: file.close() npyscreen.blank_terminal() self.parent.parentApp.getForm( "LOADFROMWEB").linkToLoadData.values = [ '{}'.format(link) for link in linkList ] self.parent.parentApp.switchForm("LOADFROMWEB")
def beforeEditing(self): npyscreen.blank_terminal()
def try_exit(self): exit_confirmation = npyscreen.notify_ok_cancel( message="Really wanna exit?", title="Warning") if exit_confirmation is True: npyscreen.blank_terminal() exit(0)
def on_ok(self): npyscreen.blank_terminal() picture = load_prepared_image(file_b=self.fileb.value, file_r=self.filer.value) push_image(picture, swap=self.swap.value) self.parentApp.setNextForm('MAIN')
def on_ok(self): npyscreen.blank_terminal() picture = text_writer(text=self.text.value,size=int(self.size.value),font_file=self.font.value) push_image(picture) self.parentApp.setNextForm('MAIN')
def h_refresh(self, ch): npyscreen.blank_terminal() npy_form.edit()
def activate(self): npyscreen.blank_terminal() self.color = 'STANDOUT' self.edit()
def initiate_blanking_sequence(self, code_of_key_pressed): npyscreen.blank_terminal() time.sleep(1.5) npyscreen.notify('..and we\'re back', title='Phew') time.sleep(0.75)
def resize(self): npyscreen.blank_terminal() self.center_on_display()
def try_exit(self): exit_confirmation = npyscreen.notify_ok_cancel(message="Really wanna exit?", title="Warning") if exit_confirmation is True: npyscreen.blank_terminal() exit(0)
def whenPressed(self): npyscreen.blank_terminal() self.parent.parentApp.switchFormPrevious()