def _clientLoginCallback(self, realm, username, may_save): """ Protected method called by the client to get login information. @param realm name of the realm of the requested credentials (string) @param username username as supplied by subversion (string) @param may_save flag indicating, that subversion is willing to save the answers returned (boolean) @return tuple of four values (retcode, username, password, save). Retcode should be True, if username and password should be used by subversion, username and password contain the relevant data as strings and save is a flag indicating, that username and password should be saved. """ from .SvnLoginDialog import SvnLoginDialog cursor = QApplication.overrideCursor() if cursor is not None: QApplication.restoreOverrideCursor() parent = isinstance(self, QWidget) and self or None dlg = SvnLoginDialog(realm, username, may_save, parent) res = dlg.exec_() if cursor is not None: QApplication.setOverrideCursor(Qt.WaitCursor) if res == QDialog.Accepted: loginData = dlg.getData() return (True, loginData[0], loginData[1], loginData[2]) else: return (False, "", "", False)
def _clientLoginCallback(self, realm, username, may_save): """ Protected method called by the client to get login information. @param realm name of the realm of the requested credentials (string) @param username username as supplied by subversion (string) @param may_save flag indicating, that subversion is willing to save the answers returned (boolean) @return tuple of four values (retcode, username, password, save). Retcode should be True, if username and password should be used by subversion, username and password contain the relevant data as strings and save is a flag indicating, that username and password should be saved. """ from .SvnLoginDialog import SvnLoginDialog cursor = QCursor(QApplication.overrideCursor()) if cursor is not None: QApplication.restoreOverrideCursor() parent = isinstance(self, QWidget) and self or None dlg = SvnLoginDialog(realm, username, may_save, parent) res = dlg.exec_() if cursor is not None: QApplication.setOverrideCursor(cursor) if res == QDialog.Accepted: loginData = dlg.getData() return (True, loginData[0], loginData[1], loginData[2]) else: return (False, "", "", False)
def _clientSslServerTrustPromptCallback(self, trust_dict): """ Protected method called by the client to request acceptance for a ssl server certificate. @param trust_dict dictionary containing the trust data @return tuple of three values (retcode, acceptedFailures, save). Retcode should be true, if the certificate should be accepted, acceptedFailures should indicate the accepted certificate failures and save should be True, if subversion should save the certificate. """ from E5Gui import E5MessageBox cursor = QApplication.overrideCursor() if cursor is not None: QApplication.restoreOverrideCursor() parent = isinstance(self, QWidget) and self or None msgBox = E5MessageBox.E5MessageBox( E5MessageBox.Question, self.tr("Subversion SSL Server Certificate"), self.tr("""<p>Accept the following SSL certificate?</p>""" """<table>""" """<tr><td>Realm:</td><td>{0}</td></tr>""" """<tr><td>Hostname:</td><td>{1}</td></tr>""" """<tr><td>Fingerprint:</td><td>{2}</td></tr>""" """<tr><td>Valid from:</td><td>{3}</td></tr>""" """<tr><td>Valid until:</td><td>{4}</td></tr>""" """<tr><td>Issuer name:</td><td>{5}</td></tr>""" """</table>""") .format(trust_dict["realm"], trust_dict["hostname"], trust_dict["finger_print"], trust_dict["valid_from"], trust_dict["valid_until"], trust_dict["issuer_dname"]), modal=True, parent=parent) permButton = msgBox.addButton(self.tr("&Permanent accept"), E5MessageBox.AcceptRole) tempButton = msgBox.addButton(self.tr("&Temporary accept"), E5MessageBox.AcceptRole) msgBox.addButton(self.tr("&Reject"), E5MessageBox.RejectRole) msgBox.exec_() if cursor is not None: QApplication.setOverrideCursor(Qt.WaitCursor) if msgBox.clickedButton() == permButton: return (True, trust_dict["failures"], True) elif msgBox.clickedButton() == tempButton: return (True, trust_dict["failures"], False) else: return (False, 0, False)
def _clientSslServerTrustPromptCallback(self, trust_dict): """ Protected method called by the client to request acceptance for a ssl server certificate. @param trust_dict dictionary containing the trust data @return tuple of three values (retcode, acceptedFailures, save). Retcode should be true, if the certificate should be accepted, acceptedFailures should indicate the accepted certificate failures and save should be True, if subversion should save the certificate. """ from E5Gui import E5MessageBox cursor = QCursor(QApplication.overrideCursor()) if cursor is not None: QApplication.restoreOverrideCursor() parent = isinstance(self, QWidget) and self or None msgBox = E5MessageBox.E5MessageBox( E5MessageBox.Question, self.tr("Subversion SSL Server Certificate"), self.tr("""<p>Accept the following SSL certificate?</p>""" """<table>""" """<tr><td>Realm:</td><td>{0}</td></tr>""" """<tr><td>Hostname:</td><td>{1}</td></tr>""" """<tr><td>Fingerprint:</td><td>{2}</td></tr>""" """<tr><td>Valid from:</td><td>{3}</td></tr>""" """<tr><td>Valid until:</td><td>{4}</td></tr>""" """<tr><td>Issuer name:</td><td>{5}</td></tr>""" """</table>""").format(trust_dict["realm"], trust_dict["hostname"], trust_dict["finger_print"], trust_dict["valid_from"], trust_dict["valid_until"], trust_dict["issuer_dname"]), modal=True, parent=parent) permButton = msgBox.addButton(self.tr("&Permanent accept"), E5MessageBox.AcceptRole) tempButton = msgBox.addButton(self.tr("&Temporary accept"), E5MessageBox.AcceptRole) msgBox.addButton(self.tr("&Reject"), E5MessageBox.RejectRole) msgBox.exec_() if cursor is not None: QApplication.setOverrideCursor(cursor) if msgBox.clickedButton() == permButton: return (True, trust_dict["failures"], True) elif msgBox.clickedButton() == tempButton: return (True, trust_dict["failures"], False) else: return (False, 0, False)
def exceptionHook(type, value, backtrace): from PyQt5.QtWidgets import QApplication from Koo.Common.Version import Version cursor = QApplication.overrideCursor() if cursor: QApplication.restoreOverrideCursor() from .Settings import Settings import traceback sentry_dsn = Settings.get("client.sentry_dsn") if sentry_dsn: client = Client(sentry_dsn) extra = Settings.options extra.update({"version": Version}) client.captureException(exc_info=(type, value, backtrace), extra=extra) backtrace = ''.join(traceback.format_tb(backtrace)) if Settings.value('client.debug'): from Koo.Common import Notifier Notifier.notifyError(type, value, backtrace) else: error('Error: %s\n%s\n%s' % (type, value, backtrace))
def handleCursor(self): if QApplication.overrideCursor() == Qt.ArrowCursor: QApplication.setOverrideCursor(Qt.BlankCursor) else: QApplication.setOverrideCursor(Qt.ArrowCursor)
from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QProgressBar, QApplication if __name__ == '__main__': cursor = QApplication.overrideCursor() waitCursor = (cursor is not None and cursor.shape() == Qt.WaitCursor)
def currentCursor(self): cursor = QApplication.overrideCursor() if cursor is not None: cursor = cursor.shape() return cursor
def cell_entered(self, row, column): if column != -1 and self.columns[column] in self.override_cursors: self._previous_cursor = QApplication.overrideCursor() if self._previous_cursor is None: QApplication.setOverrideCursor( self.override_cursors[self.columns[column]])