comparison easyhg.py @ 426:8530c31536a7

Minor text calculation fix
author Chris Cannam
date Thu, 23 Jun 2011 20:36:09 +0100
parents 2d3f1e5d8638
children
comparison
equal deleted inserted replaced
425:ad106f5fe75f 426:8530c31536a7
55 55
56 def easyhg_prompt(self, msg, default="y"): 56 def easyhg_prompt(self, msg, default="y"):
57 if not self.interactive(): 57 if not self.interactive():
58 self.write(msg, ' ', default, "\n") 58 self.write(msg, ' ', default, "\n")
59 return default 59 return default
60 isusername = False
60 if msg == _('user:'): 61 if msg == _('user:'):
61 msg = _('Username for remote repository:') 62 msg = _('Username for remote repository:')
63 isusername = True
62 d = QtGui.QInputDialog() 64 d = QtGui.QInputDialog()
63 d.setInputMode(QtGui.QInputDialog.TextInput) 65 d.setInputMode(QtGui.QInputDialog.TextInput)
64 d.setTextEchoMode(QtGui.QLineEdit.Normal) 66 d.setTextEchoMode(QtGui.QLineEdit.Normal)
65 d.setLabelText(msg) 67 d.setLabelText(msg)
66 d.setWindowTitle(_('EasyMercurial: Information')) 68 d.setWindowTitle(_('EasyMercurial: Information'))
67 d.show() 69 d.show()
68 d.raise_() 70 d.raise_()
69 ok = d.exec_() 71 ok = d.exec_()
70 r = d.textValue() 72 r = d.textValue()
71 if not ok: 73 if not ok:
72 raise util.Abort(_('username entry cancelled')) 74 if isusername:
75 raise util.Abort(_('username entry cancelled'))
76 else:
77 raise util.Abort(_('information entry cancelled'))
73 if not r: 78 if not r:
74 return default 79 return default
75 return r 80 return r
76 81
77 def easyhg_getpass(self, prompt=None, default=None): 82 def easyhg_getpass(self, prompt=None, default=None):