Add a welcome screen
If gertty starts with no subscribed projects, display some help text to help the user get started. Change-Id: I1ac89321ea0e3129e00e505abfb1821d0cb28b45
This commit is contained in:
parent
0415539a9f
commit
6505505369
@ -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()
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user