Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 def endOrContinue(self):
     option = npyscreen.notify_yes_no("Czy zakonczyc prace?", "Koniec")
     if option:
         exit()
     else:
         self.parent.parentApp.switchForm("MAIN")
         npyscreen.blank_terminal()
Ejemplo n.º 5
0
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()
Ejemplo n.º 6
0
    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()
Ejemplo n.º 7
0
 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')
Ejemplo n.º 8
0
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()
Ejemplo n.º 9
0
    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()
Ejemplo n.º 10
0
 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")
Ejemplo n.º 11
0
    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()
Ejemplo n.º 12
0
 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')
Ejemplo n.º 13
0
        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")
Ejemplo n.º 14
0
 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)
Ejemplo n.º 15
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
Ejemplo n.º 16
0
 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")
Ejemplo n.º 17
0
 def beforeEditing(self):
     npyscreen.blank_terminal()
Ejemplo n.º 18
0
 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)
Ejemplo n.º 19
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')
Ejemplo n.º 20
0
 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')
Ejemplo n.º 21
0
 def h_refresh(self, ch):
     npyscreen.blank_terminal()
     npy_form.edit()
Ejemplo n.º 22
0
 def activate(self):
     npyscreen.blank_terminal()
     self.color = 'STANDOUT'
     self.edit()
Ejemplo n.º 23
0
 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)
Ejemplo n.º 24
0
 def resize(self):
     npyscreen.blank_terminal()
     self.center_on_display()
Ejemplo n.º 25
0
 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)
Ejemplo n.º 26
0
 def whenPressed(self):
     npyscreen.blank_terminal()
     self.parent.parentApp.switchFormPrevious()