] menu = MenuWindow(menu_entries,(self.x+msg.new_x,self.y+msg.new_y),root=self) def keyboard_event(self, msg): if msg.event.action != yutani.KeyAction.ACTION_DOWN: return if msg.event.key == b'q': self.exit(None) if __name__ == '__main__': yutani.Yutani() d = yutani.Decor() # Just in case. window = ClockWindow() window.draw() fds = [yutani.yutani_ctx] while 1: # Poll for events. fd = fswait.fswait(fds,20) if fd == 0: msg = yutani.yutani_ctx.poll() yutani_mainloop.handle_event(msg) window.draw() elif fd == 1: # Tick window.draw()
DialogWindow(d,"Restart","Are you sure you want to restart?",callback=confirm,icon='exit') restart = RestartMenuWidget() restart.callback = restart_callback widgets = [LabelWidget(os.uname().nodename), FillWidget(),VolumeWidget(),NetworkWidget(),DateWidget(),ClockWidget(),restart] panel_window = PanelWindow(widgets) panel_window.draw() def input_callback(input_window): print(input_window.tr.text) input_window.close() TextInputWindow(d,"Username?","star",text="テスト",callback=input_callback) fds = [yutani.yutani_ctx] while 1: # Poll for events. fd = fswait.fswait(fds,500) maybe_animate() if fd == 0: while yutani.yutani_ctx.query(): msg = yutani.yutani_ctx.poll() if msg.type == yutani.Message.MSG_WELCOME: panel_window.resize(msg.display_width, panel_window.height) window.resize(msg.display_width, msg.display_height) else: if not yutani_mainloop.handle_event(msg): sys.exit(0)
if msg.event.key == b' ': self.page += 1 if self.page >= len(pages): self.close() sys.exit(0) self.load_page() self.draw() if __name__ == '__main__': yctx = yutani.Yutani() d = yutani.Decor() hints = HintWindow() hints.draw() window = WizardWindow(d) window.draw() subprocess.Popen(['check-updates.py']) while 1: # Poll for events. msg = yutani.yutani_ctx.poll() if msg.type == yutani.Message.MSG_WELCOME: hints.resize(msg.display_width,msg.display_height) window.center() msg.free() else: if not yutani_mainloop.handle_event(msg): break
(self.x + msg.new_x, self.y + msg.new_y), root=self) def keyboard_event(self, msg): if msg.event.action != yutani.KeyAction.ACTION_DOWN: return if msg.event.key == b'q': self.exit(None) if __name__ == '__main__': yutani.Yutani() d = yutani.Decor() # Just in case. window = ClockWindow() window.draw() fds = [yutani.yutani_ctx] while 1: # Poll for events. fd = fswait.fswait(fds, 20) if fd == 0: msg = yutani.yutani_ctx.poll() while msg: yutani_mainloop.handle_event(msg) msg = yutani.yutani_ctx.poll(False) window.draw() elif fd == 1: # Tick window.draw()