comparison easyhg.py @ 656:e34de484415c

Update for PyQt 4.5+ signal/slot connection syntax
author Chris Cannam <chris.cannam@eecs.qmul.ac.uk>
date Fri, 25 Jan 2013 15:36:27 +0000
parents 92929d26b8db
children e4d18e8ef430
comparison
equal deleted inserted replaced
655:68494beada6e 656:e34de484415c
42 # succeeded or not, so we need to ensure that Mercurial itself returns 42 # succeeded or not, so we need to ensure that Mercurial itself returns
43 # failure if it didn't. 43 # failure if it didn't.
44 # 44 #
45 easyhg_pyqt_ok = True 45 easyhg_pyqt_ok = True
46 try: 46 try:
47 from PyQt4 import Qt, QtCore, QtGui 47 from PyQt4 import QtCore, QtGui
48 except ImportError: 48 except ImportError:
49 easyhg_pyqt_ok = False 49 easyhg_pyqt_ok = False
50 easyhg_qtapp = None 50 easyhg_qtapp = None
51 51
52 # These imports are optional, we just can't use the authfile (i.e. 52 # These imports are optional, we just can't use the authfile (i.e.
261 passwd_field = QtGui.QLineEdit() 261 passwd_field = QtGui.QLineEdit()
262 passwd_field.setEchoMode(QtGui.QLineEdit.Password) 262 passwd_field.setEchoMode(QtGui.QLineEdit.Password)
263 if self.auth_store.passwd: passwd_field.setText(self.auth_store.passwd) 263 if self.auth_store.passwd: passwd_field.setText(self.auth_store.passwd)
264 layout.addWidget(QtGui.QLabel(_('Password:')), 2, 0) 264 layout.addWidget(QtGui.QLabel(_('Password:')), 2, 0)
265 layout.addWidget(passwd_field, 2, 1) 265 layout.addWidget(passwd_field, 2, 1)
266 266 user_field.textChanged.connect(passwd_field.clear)
267 user_field.connect(user_field, Qt.SIGNAL("textChanged(QString)"),
268 passwd_field, Qt.SLOT("clear()"))
269 267
270 remember_field = None 268 remember_field = None
271 if self.auth_store.use_auth_file: 269 if self.auth_store.use_auth_file:
272 remember_field = QtGui.QCheckBox() 270 remember_field = QtGui.QCheckBox()
273 remember_field.setChecked(self.auth_store.remember) 271 remember_field.setChecked(self.auth_store.remember)
274 remember_field.setText(_('Remember these details while EasyMercurial is running')) 272 remember_field.setText(_('Remember these details while EasyMercurial is running'))
275 layout.addWidget(remember_field, 3, 1) 273 layout.addWidget(remember_field, 3, 1)
276 warning_field = QtGui.QLabel() 274 warning_field = QtGui.QLabel()
277 warning_field.setText(_('<qt><i><small>Do not use this option if anyone else has access to your computer!</small></i><br></qt>')) 275 warning_field.setText(_('<qt><i><small>Do not use this option if anyone else has access to your computer!</small></i><br></qt>'))
278 warning_field.hide() 276 warning_field.hide()
279 remember_field.connect(remember_field, Qt.SIGNAL("clicked()"), 277 remember_field.clicked.connect(warning_field.show)
280 warning_field, Qt.SLOT("show()"))
281 layout.addWidget(warning_field, 4, 1, QtCore.Qt.AlignRight) 278 layout.addWidget(warning_field, 4, 1, QtCore.Qt.AlignRight)
282 279
283 bb = QtGui.QDialogButtonBox() 280 bb = QtGui.QDialogButtonBox()
284 ok = bb.addButton(bb.Ok) 281 ok = bb.addButton(bb.Ok)
285 cancel = bb.addButton(bb.Cancel) 282 cancel = bb.addButton(bb.Cancel)
286 cancel.setDefault(False) 283 cancel.setDefault(False)
287 cancel.setAutoDefault(False) 284 cancel.setAutoDefault(False)
288 ok.setDefault(True) 285 ok.setDefault(True)
289 bb.connect(ok, Qt.SIGNAL("clicked()"), dialog, Qt.SLOT("accept()")) 286 ok.clicked.connect(dialog.accept)
290 bb.connect(cancel, Qt.SIGNAL("clicked()"), dialog, Qt.SLOT("reject()")) 287 cancel.clicked.connect(dialog.reject)
291 layout.addWidget(bb, 5, 0, 1, 2) 288 layout.addWidget(bb, 5, 0, 1, 2)
292 289
293 dialog.setWindowTitle(_('EasyMercurial: Login')) 290 dialog.setWindowTitle(_('EasyMercurial: Login'))
294 dialog.show() 291 dialog.show()
295 292