Пример #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"))
Пример #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)
Пример #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()
Пример #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"))
Пример #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"))
Пример #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"))
Пример #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')
Пример #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"))
Пример #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")
Пример #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"))
Пример #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"))
Пример #12
0
 def when_cursor_moved(self):
     self.parent.parentApp.queue_event(npyscreen.Event("event_messagebox_change_cursor"))
Пример #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)
Пример #14
0
 def display(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited_OP_popup"))
Пример #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"))
Пример #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)
Пример #17
0
 def stop(self):
     self.queue_event(npyscreen.Event("exit_app"))
Пример #18
0
 def whenPressed(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited_ok_clean_directories_pressed"))
Пример #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")
Пример #20
0
 def display(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited_ok_clean_directories"))
Пример #21
0
 def h_select(self, ch):
     self.value = self.cursor_line
     self.parent.parentApp.queue_event(npyscreen.Event("ev_station_select"))
Пример #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"))
Пример #23
0
 def when_value_edited(self):
     # event to change message dialog box
     self.parent.parentApp.queue_event(npyscreen.Event("event_chat_select"))
Пример #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"))
Пример #25
0
 def display(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited_OP_parallel_mode"))
Пример #26
0
 def ev_add_queue(self, event):
     #self.parentApp.passinfo = self.TrackList_widget.getSelectedSongInfo()
     self.parentApp.queue_event(npyscreen.Event("event_add_queue"))
Пример #27
0
 def while_waiting(self):
     self.queue_event(npyscreen.Event("TESTEVENT"))
Пример #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))
Пример #29
0
 def when_value_edited(self):
     self.parent.parentApp.queue_event(
         npyscreen.Event("event_value_edited"))
Пример #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"))