def localCherryPickCommit(self, repository_name, commit_sha): repo = gitrepo.get_repo(repository_name, self.config) try: repo.cherryPick(commit_sha) dialog = mywid.MessageDialog('Cherry-Pick', 'Pull request cherry-picked in %s' % repo.path) min_height=8 except gitrepo.GitCheckoutError as e: dialog = mywid.MessageDialog('Error', e.msg) min_height=12 urwid.connect_signal(dialog, 'close', lambda button: self.backScreen()) self.popup(dialog, min_height=min_height)
def localCheckoutCommit(self, project_name, commit_sha): repo = gitrepo.get_repo(project_name, self.config) try: repo.checkout(commit_sha) dialog = mywid.MessageDialog( 'Checkout', 'Change checked out in %s' % repo.path) min_height = 8 except gitrepo.GitCheckoutError as e: dialog = mywid.MessageDialog('Error', e.msg) min_height = 12 urwid.connect_signal(dialog, 'close', lambda button: self.backScreen()) self.popup(dialog, min_height=min_height)
def welcome(self): text = WELCOME_TEXT dialog = mywid.MessageDialog('Welcome', text) lines = text.split('\n') total_lines = 0 for line in lines: total_lines = total_lines + 1 + int(len(line)/76) urwid.connect_signal(dialog, 'close', lambda button: self.backScreen()) self.popup(dialog, min_width=76, min_height=total_lines+4)
def error(self, message, title='Error'): dialog = mywid.MessageDialog(title, message) urwid.connect_signal(dialog, 'close', lambda button: self.backScreen()) cols, rows = self.loop.screen.get_cols_rows() cols = int(cols * .5) lines = textwrap.wrap(message, cols) min_height = max(4, len(lines) + 4) self.popup(dialog, min_height=min_height) return None
def help(self): if not hasattr(self.frame.body, 'help'): return global_help = self.getGlobalHelp() parts = [('Global Keys', global_help), ('This Screen', self.frame.body.help())] keylen = 0 for title, items in parts: for cmd, keys, text in items: keylen = max(len(keys), keylen) text = '' for title, items in parts: if text: text += '\n' text += title+'\n' text += '%s\n' % ('='*len(title),) for cmd, keys, cmdtext in items: text += '{keys:{width}} {text}\n'.format( keys=keys, width=keylen, text=cmdtext) dialog = mywid.MessageDialog('Help for %s' % version(), 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 welcome(self): text = WELCOME_TEXT 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)