Exemplo n.º 1
0
Arquivo: app.py Projeto: hubtty/hubtty
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
Arquivo: app.py Projeto: hubtty/hubtty
 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)
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
Arquivo: app.py Projeto: hubtty/hubtty
 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)
Exemplo n.º 6
0
 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)