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"))
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)
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()
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"))
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"))
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"))
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')
def when_value_edited(self): #self.display() #self.parent.event_value_edited("change") self.parent.parentApp.queue_event( npyscreen.Event("event_value_edited"))
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")
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"))
def event_new_song_byArtist(self, event): self.parentApp.passinfo = self.ArtistList_widget.getSelectedSongInfo() self.parentApp.queue_event(npyscreen.Event("event_update_detail_form"))
def when_cursor_moved(self): self.parent.parentApp.queue_event(npyscreen.Event("event_messagebox_change_cursor"))
def when_value_edited(self): if (self.value != []): event = npyscreen.Event("event_album_selected", payload=self.value) self.parent.parentApp.queue_event(event)
def display(self): self.parent.parentApp.queue_event( npyscreen.Event("event_value_edited_OP_popup"))
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"))
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)
def stop(self): self.queue_event(npyscreen.Event("exit_app"))
def whenPressed(self): self.parent.parentApp.queue_event( npyscreen.Event("event_value_edited_ok_clean_directories_pressed"))
def ev_browse_save(self, event): self.parentApp.queue_event( npyscreen.Event("event_update_directory_form")) self.parentApp.setNextForm("DIR") self.parentApp.switchForm("DIR")
def display(self): self.parent.parentApp.queue_event( npyscreen.Event("event_value_edited_ok_clean_directories"))
def h_select(self, ch): self.value = self.cursor_line self.parent.parentApp.queue_event(npyscreen.Event("ev_station_select"))
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"))
def when_value_edited(self): # event to change message dialog box self.parent.parentApp.queue_event(npyscreen.Event("event_chat_select"))
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"))
def display(self): self.parent.parentApp.queue_event( npyscreen.Event("event_value_edited_OP_parallel_mode"))
def ev_add_queue(self, event): #self.parentApp.passinfo = self.TrackList_widget.getSelectedSongInfo() self.parentApp.queue_event(npyscreen.Event("event_add_queue"))
def while_waiting(self): self.queue_event(npyscreen.Event("TESTEVENT"))
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))
def when_value_edited(self): self.parent.parentApp.queue_event( npyscreen.Event("event_value_edited"))
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"))