npyscreen
npyscreen copied to clipboard
while_waiting() does not seem to work within NPSAppManaged apps.
I can get while_waiting to work on NPSApp instances but not in forms added to a NPSAppManaged instance.
i.e. If you add a while_waiting()
method to the MainForm
class in EXAMPLE-ManagedApp.py
example, it will never get called.
I know it's been a few years but I'm struggling with that problem at the moment. Any insight?
class Action(npyscreen.ActionForm):
def while_waiting(self):
print('test')
curses.beep()
def create(self):
self.date_widget = self.add(npyscreen.FixedText, value=datetime.now(), editable=False)
y, x = self.useable_space()
self.add(npyscreen.TitleSelectOne, name = "Type de l'appareil:", scroll_exit=True, max_height=5,values= APPAREILS )
obj = self.add(npyscreen.TitlePager, name="log",
custom_highlighting=False, scroll_exit=True, editable=False, values=log,
rely=y // 4, max_width=x // 2 - 5, max_height=y // 2)
def writePass(self):
self.parentApp.draginoSerial.writePass()
def afterEditing(self):
self.parentApp.setNextForm(None)
class monAppli(npyscreen.NPSAppManaged):
def onStart(self):
self.draginoSerial = draginoSerial()
self.keypress_timeout_default = 10
self.registerForm("MAIN", ChoixSerial())
self.registerForm("CONF", Action())
if __name__ == '__main__':
try:
serialPorts = serial_ports()
TA = monAppli().run()
except KeyboardInterrupt:
print('Interrupted')
try:
sys.exit(0)
except SystemExit:
os._exit(0)