Mercurial > hg > easyhg
view easyhg.py @ 169:c7fa56707ae9
* Status text updates
author | Chris Cannam |
---|---|
date | Tue, 14 Dec 2010 20:36:30 +0000 |
parents | 98fa31128e9d |
children | 07b908b4fa5f |
line wrap: on
line source
# -*- coding: utf-8 -*- # # EasyMercurial # # Based on hgExplorer by Jari Korhonen # Copyright (c) 2010 Jari Korhonen # Copyright (c) 2010 Chris Cannam # Copyright (c) 2010 Queen Mary, University of London # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. See the file # COPYING included with this distribution for more information. import sys from mercurial import ui, getpass, util from mercurial.i18n import _ from PyQt4 import QtGui easyhg_qtapp = None def uisetup(ui): ui.__class__.prompt = easyhg_prompt ui.__class__.getpass = easyhg_getpass global easyhg_qtapp easyhg_qtapp = QtGui.QApplication([]) def easyhg_prompt(self, msg, default="y"): if not self.interactive(): self.write(msg, ' ', default, "\n") return default if msg == _('user:'): msg = _('User:') (r,ok) = QtGui.QInputDialog.getText(None, _('Information needed'), msg, QtGui.QLineEdit.Normal) if not ok: raise util.Abort(_('response expected')) if not r: return default return r def easyhg_getpass(self, prompt=None, default=None): if not self.interactive(): return default if not prompt or prompt == _('password:'): prompt = _('Password:'); (r,ok) = QtGui.QInputDialog.getText(None, _('Password'), prompt, QtGui.QLineEdit.Password) if not ok: raise util.Abort(_('response expected')) if not r: return default return r