From 206a84d6e1257dfa1530564b982b32080eb9264e Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 29 Aug 2014 19:14:46 -0700 Subject: [PATCH] Fix welcome screen Don't attempt to show the screen help. Display the welcome screen when there are no subscribed projects (rather than when the screen is empty, since that can now happen if there are no projects with pending reviews). Change-Id: I4c4215d61a00c303ad7480ed6c49b7bab0d36463 --- gertty/app.py | 10 ++++++++-- gertty/view/project_list.py | 5 ----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gertty/app.py b/gertty/app.py index 87aad46..9d77ed6 100644 --- a/gertty/app.py +++ b/gertty/app.py @@ -124,8 +124,14 @@ class App(object): self.status.update(title=screen.title) self.loop = urwid.MainLoop(screen, palette=self.config.palette.getPalette(), unhandled_input=self.unhandledInput) - if screen.isEmpty(): + + has_subscribed_projects = False + with self.db.getSession() as session: + if session.getProjects(subscribed=True): + has_subscribed_projects = True + if not has_subscribed_projects: self.welcome() + self.sync_pipe = self.loop.watch_pipe(self.refresh) self.loop.screen.tty_signal_keys(start='undefined', stop='undefined') #self.loop.screen.set_terminal_properties(colors=88) @@ -230,7 +236,7 @@ class App(object): self.popup(dialog, min_width=76, min_height=len(lines)+4) def welcome(self): - text = WELCOME_TEXT + self.loop.widget.help() + text = WELCOME_TEXT dialog = mywid.MessageDialog('Welcome', text) lines = text.split('\n') urwid.connect_signal(dialog, 'close', diff --git a/gertty/view/project_list.py b/gertty/view/project_list.py index 87dbceb..221bed7 100644 --- a/gertty/view/project_list.py +++ b/gertty/view/project_list.py @@ -95,11 +95,6 @@ class ProjectListView(urwid.WidgetWrap): self._w.contents.append((self.listbox, ('weight', 1))) self._w.set_focus(3) - def isEmpty(self): - if self.project_rows: - return False - return True - def refresh(self): if self.subscribed: self.title = u'Subscribed projects'