def main(self) -> None: screen = Screen() screen.set_terminal_properties(colors=self.color_depth) self.loop = urwid.MainLoop(self.view, self.theme, screen=screen) self.update_pipe = self.loop.watch_pipe(self.draw_screen) # Register new ^C handler signal.signal(signal.SIGINT, self.exit_handler) try: # TODO: Enable resuming? (in which case, remove ^Z below) disabled_keys = { 'susp': 'undefined', # Disable ^Z - no suspending 'stop': 'undefined', # Disable ^S - enabling shortcut key use 'quit': 'undefined', # Disable ^\, ^4 } old_signal_list = screen.tty_signal_keys(**disabled_keys) self.loop.run() except Exception: self.restore_stdout() screen.tty_signal_keys(*old_signal_list) raise finally: self.restore_stdout() screen.tty_signal_keys(*old_signal_list)
def __init__( self, *, config_file: str, maximum_footlinks: int, theme_name: str, theme: ThemeSpec, color_depth: int, debug_path: Optional[str], in_explore_mode: bool, autohide: bool, notify: bool, ) -> None: self.theme_name = theme_name self.theme = theme self.color_depth = color_depth self.in_explore_mode = in_explore_mode self.autohide = autohide self.notify_enabled = notify self.maximum_footlinks = maximum_footlinks self.debug_path = debug_path self._editor: Optional[Any] = None self.active_conversation_info: Dict[str, Any] = {} self.is_typing_notification_in_progress = False self.show_loading() client_identifier = f"ZulipTerminal/{ZT_VERSION} {platform()}" self.client = zulip.Client(config_file=config_file, client=client_identifier) self.model = Model(self) self.view = View(self) # Start polling for events after view is rendered. self.model.poll_for_events() screen = Screen() screen.set_terminal_properties(colors=self.color_depth) self.loop = urwid.MainLoop(self.view, self.theme, screen=screen) # urwid pipe for concurrent screen update handling self._update_pipe = self.loop.watch_pipe(self._draw_screen) # data and urwid pipe for inter-thread exception handling self._exception_info: Optional[ExceptionInfo] = None self._critical_exception = False self._exception_pipe = self.loop.watch_pipe(self._raise_exception) # Register new ^C handler signal.signal(signal.SIGINT, self.exit_handler)
def main(self) -> None: screen = Screen() screen.set_terminal_properties(colors=256) self.loop = urwid.MainLoop(self.view, self.theme, screen=screen) self.update_pipe = self.loop.watch_pipe(self.draw_screen) try: # TODO: Enable resuming? (in which case, remove ^Z below) disabled_keys = { 'susp': 'undefined', # Disable ^Z for suspending 'stop': 'undefined', # Disable ^S, enabling shortcut key use } old_signal_list = screen.tty_signal_keys(**disabled_keys) self.loop.run() except Exception: self.restore_stdout() screen.tty_signal_keys(*old_signal_list) raise finally: self.restore_stdout() screen.tty_signal_keys(*old_signal_list)
def main(self) -> None: try: screen = Screen() screen.set_terminal_properties(colors=256) self.loop = urwid.MainLoop(self.view, self.view.palette[self.theme], screen=screen) self.update_pipe = self.loop.watch_pipe(self.draw_screen) except KeyError: print('Following are the themes available:') for theme in self.view.palette.keys(): print(theme, ) return try: self.loop.run() except Exception: self.restore_stdout() raise finally: self.restore_stdout()
def __init__(self, config_file: str, theme_name: str, theme: ThemeSpec, color_depth: int, in_explore_mode: bool, autohide: bool, notify: bool, footlinks: bool) -> None: self.theme_name = theme_name self.theme = theme self.color_depth = color_depth self.in_explore_mode = in_explore_mode self.autohide = autohide self.notify_enabled = notify self.footlinks_enabled = footlinks self._editor = None # type: Optional[Any] self.show_loading() self.client = zulip.Client(config_file=config_file, client='ZulipTerminal/{} {}'.format( ZT_VERSION, platform())) self.model = Model(self) self.view = View(self) # Start polling for events after view is rendered. self.model.poll_for_events() screen = Screen() screen.set_terminal_properties(colors=self.color_depth) self.loop = urwid.MainLoop(self.view, self.theme, screen=screen) # urwid pipe for concurrent screen update handling self._update_pipe = self.loop.watch_pipe(self._draw_screen) # data and urwid pipe for inter-thread exception handling self._exception_info = None # type: Optional[ExceptionInfo] self._critical_exception = False self._exception_pipe = self.loop.watch_pipe(self._raise_exception) # Register new ^C handler signal.signal(signal.SIGINT, self.exit_handler)