Ejemplo n.º 1
0
    def _handleEnter(self, inp):
        now = int(time.time() * 1000)
        val = self.entry_widget.value
        log('handleEnter', inp, val, now)
        self.entry_widget.value = ''
        self.entry_widget.clear()

        self.currentSend = CurrentSend(now, val)
        self.parent.parentApp.handleSelfEnvelope(now, self._getSelfName(), val)
        self.parent.parentApp.queue_event(npyscreen.Event("SEND"))
        self.parent.parentApp.queue_event(npyscreen.Event("RELOAD"))
Ejemplo n.º 2
0
    def update_form(self):
        global cont, ros_topics
        while not self.kill_event.isSet():

            cont += 1
            self.update_info()
            self.parentApp.queue_event(npyscreen.Event("log_update"))
            if self.parentApp.khandler.last_key in self.commands:
                self.parentApp.queue_event(
                    npyscreen.Event("event_value_edited"))
            elif self.parentApp.khandler.last_key == '-1':
                break
            time.sleep(0.1)
Ejemplo n.º 3
0
    def mode_value_edited(self, event):
        is_on = False
        is_pwm = False
        duty = 50

        if 0 in self.ModeSelect.value:
            is_on = False
            is_pwm = False
            self.frequency.hidden = True
            self.duty.hidden = True
            self.extFreq.hidden = True
        elif 1 in self.ModeSelect.value:
            is_on = False
            is_pwm = True
            duty = int(self.duty.value)
            if self.frequency.hidden:
                self.parentApp.queue_event(npyscreen.Event("freq_value_edited"))
            self.frequency.hidden = False
            self.duty.hidden = False
        elif 2 in self.ModeSelect.value:
            is_on = True
            is_pwm = False
            self.frequency.hidden = True
            self.duty.hidden = True
            self.extFreq.hidden = True

        cmd = self.build_gpio_command(is_on, is_pwm, duty)
        self.add_teminal_line(cmd)
        self.communicator.sendCommand(cmd)
        self.frequency.display()
        self.duty.display()
        self.extFreq.display()
Ejemplo n.º 4
0
 def ev_queue_album(self, event):
     passdata = []
     for song in self.AlbumList_widget.info:
         passdata.append(song)
     #self.parentApp.passinfo = passdata[0]
     self.parentApp.passinfo = self.AlbumList_widget.info
     self.parentApp.queue_event(npyscreen.Event("event_add_queue"))
Ejemplo n.º 5
0
    def button_config(self, _input):
        #self.add_teminal_line(str(_input))

        if _input == ord('0'):
            self.frequency.value = 2
            self.frequency.display()
            self.parentApp.queue_event(npyscreen.Event("freq_value_edited"))
        if _input == ord('2'):
            self.frequency.value = 3
            self.frequency.display()
            self.parentApp.queue_event(npyscreen.Event("freq_value_edited"))
        if _input == ord('5'):
            self.frequency.value = 0
            self.frequency.display()
            self.parentApp.queue_event(npyscreen.Event("freq_value_edited"))
        if _input == ord('6'):
            self.frequency.value = 1
            self.frequency.display()
            self.parentApp.queue_event(npyscreen.Event("freq_value_edited"))

        if _input == ord('s'):
            self.ModeSelect.value = 0
            self.ModeSelect.display()
            self.parentApp.queue_event(npyscreen.Event("mode_value_edited"))
        if _input == ord('d'):
            self.ModeSelect.value = 1
            self.ModeSelect.display()
            self.parentApp.queue_event(npyscreen.Event("mode_value_edited"))
        if _input == ord('f'):
            self.ModeSelect.value = 2
            self.ModeSelect.display()
            self.parentApp.queue_event(npyscreen.Event("mode_value_edited"))
Ejemplo n.º 6
0
    def doIteration(self, timeout):

        # Executing what normal reactor would do...
        self.runUntilCurrent()

        selectreactor.SelectReactor.doIteration(self, timeout)

        # push event back on the npyscreen queue
        self.npyscreenapp.queue_event(npyscreen.Event("_NPYSCREEN_REACTOR"))
Ejemplo n.º 7
0
    def run(self):
        log('daemon thread')

        state = self.app.state
        script = ['signal-cli', '-u', state.phone, 'daemon', '--json']
        #script = ['python3', 'sp.py']
        try:
            popen = execute_popen(script)
            self.app.daemonPopen = popen
            log('daemon popen')
            for line in execute(popen):
                out_file_lock.acquire()
                out_file.write(line)
                out_file.flush()
                out_file_lock.release()
                log('line:', line)
                self.app.handleDaemonLine(line)
                self.app.queue_event(npyscreen.Event("RELOAD"))
        except subprocess.CalledProcessError as e:
            if not self.app.isShuttingDown:
                log('EXCEPTION in daemon', e)
        log('daemon exit')
Ejemplo n.º 8
0
 def when_value_edited(self):
     #self.display()
     #self.parent.event_value_edited("change")
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited"))
Ejemplo n.º 9
0
 def ev_selectsong(self, event):
     self.parentApp.passinfo = self.TrackList_widget.getSelectedSongInfo()
     self.parentApp.queue_event(npyscreen.Event("event_update_detail_form"))
     self.parentApp.switchForm("SECOND")
Ejemplo n.º 10
0
 def ev_add_queue(self, event):
     #npyscreen.notify("Added", title='Popup Title')
     #time.sleep(1)
     self.parentApp.passinfo = self.TrackList_widget.getSelectedSongInfo()
     self.parentApp.queue_event(npyscreen.Event("event_add_queue"))
Ejemplo n.º 11
0
 def event_new_song_byArtist(self, event):
     self.parentApp.passinfo = self.ArtistList_widget.getSelectedSongInfo()
     self.parentApp.queue_event(npyscreen.Event("event_update_detail_form"))
Ejemplo n.º 12
0
 def when_cursor_moved(self):
     self.parent.parentApp.queue_event(npyscreen.Event("event_messagebox_change_cursor"))
Ejemplo n.º 13
0
 def when_value_edited(self):
     if (self.value != []):
         event = npyscreen.Event("event_album_selected", payload=self.value)
         self.parent.parentApp.queue_event(event)
Ejemplo n.º 14
0
 def display(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited_OP_popup"))
Ejemplo n.º 15
0
 def run_shell_OP(self, _input):
     self.editing = False
     self.how_exited = 1
     self.parent.parentApp.subprocess_handling_count_OP = 1
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited_OP_popup"))
Ejemplo n.º 16
0
 def display(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_editedO4"))
     new_handlers = {curses.ascii.NL: self.switchForm}
     self.add_handlers(new_handlers)
Ejemplo n.º 17
0
 def stop(self):
     self.queue_event(npyscreen.Event("exit_app"))
Ejemplo n.º 18
0
 def whenPressed(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited_ok_clean_directories_pressed"))
Ejemplo n.º 19
0
 def ev_browse_save(self, event):
     self.parentApp.queue_event(
         npyscreen.Event("event_update_directory_form"))
     self.parentApp.setNextForm("DIR")
     self.parentApp.switchForm("DIR")
Ejemplo n.º 20
0
 def display(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited_ok_clean_directories"))
Ejemplo n.º 21
0
 def h_select(self, ch):
     self.value = self.cursor_line
     self.parent.parentApp.queue_event(npyscreen.Event("ev_station_select"))
Ejemplo n.º 22
0
 def when_value_edited(self):
     if self.value != self.prev_sent_value:
         self.prev_sent_value = self.value
         self.parent.parentApp.queue_event(npyscreen.Event("freq_value_edited"))
Ejemplo n.º 23
0
 def when_value_edited(self):
     # event to change message dialog box
     self.parent.parentApp.queue_event(npyscreen.Event("event_chat_select"))
Ejemplo n.º 24
0
 def h_decrease(self, ch):
     if (self.value - self.step >= self.lowest):
         self.value -= self.step
         self.parent.parentApp.queue_event(npyscreen.Event("ev_set_volume"))
Ejemplo n.º 25
0
 def display(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited_OP_parallel_mode"))
Ejemplo n.º 26
0
 def ev_add_queue(self, event):
     #self.parentApp.passinfo = self.TrackList_widget.getSelectedSongInfo()
     self.parentApp.queue_event(npyscreen.Event("event_add_queue"))
Ejemplo n.º 27
0
 def while_waiting(self):
     self.queue_event(npyscreen.Event("TESTEVENT"))
Ejemplo n.º 28
0
 def when_value_edited(self):
     #def when_check_value_changed(self):
     # event to change message dialog box
     self.parent.parentApp.queue_event(npyscreen.Event(self.callback))
Ejemplo n.º 29
0
 def when_value_edited(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited"))
Ejemplo n.º 30
0
 def h_increase(self, ch):
     if (self.value + self.step <= self.out_of):
         self.value += self.step
         self.parent.parentApp.queue_event(npyscreen.Event("ev_set_volume"))