diff --git a/gertty/gertty.py b/gertty/gertty.py index f05de3d..563321f 100644 --- a/gertty/gertty.py +++ b/gertty/gertty.py @@ -72,6 +72,19 @@ palette=[('reversed', 'default,standout', ''), ('reversed-reviewed-change', 'dark gray,standout', ''), ] +WELCOME_TEXT = """\ +Welcome to Gertty! + +To get started, you should subscribe to some projects. Press the "l" +key to list all the projects, navigate to the ones you are interested +in, and then press "s" to subscribe to them. Gertty will +automatically sync changes in your subscribed projects. + +Press the F1 key anywhere to get help. Your terminal emulator may +require you to press function-F1 or alt-F1 instead. + +""" + class StatusHeader(urwid.WidgetWrap): def __init__(self, app): super(StatusHeader, self).__init__(urwid.Columns([])) @@ -121,6 +134,8 @@ class App(object): self.status.update(title=screen.title) self.loop = urwid.MainLoop(screen, palette=palette, unhandled_input=self.unhandledInput) + if screen.isEmpty(): + 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) @@ -183,6 +198,14 @@ class App(object): lambda button: self.backScreen()) self.popup(dialog, min_width=76, min_height=len(lines)+4) + def welcome(self): + text = WELCOME_TEXT + self.loop.widget.help + dialog = mywid.MessageDialog('Welcome', text) + lines = text.split('\n') + urwid.connect_signal(dialog, 'close', + lambda button: self.backScreen()) + self.popup(dialog, min_width=76, min_height=len(lines)+4) + def unhandledInput(self, key): if key == 'esc': self.backScreen() diff --git a/gertty/view/project_list.py b/gertty/view/project_list.py index 2a5cff3..97125fa 100644 --- a/gertty/view/project_list.py +++ b/gertty/view/project_list.py @@ -76,6 +76,11 @@ This Screen self._w.contents.append((self.listbox, ('weight', 1))) self._w.set_focus(2) + def isEmpty(self): + if self.project_rows: + return False + return True + def refresh(self): if self.subscribed: self.title = u'Subscribed Projects'