Wed, 01 Sep 2010 19:24:30 +0200
Continued replacing QMessageBox methods with own methods.
UI/UserInterface.py | file | annotate | diff | comparison | revisions | |
VCS/ProjectHelper.py | file | annotate | diff | comparison | revisions |
--- a/UI/UserInterface.py Tue Aug 31 16:38:06 2010 +0200 +++ b/UI/UserInterface.py Wed Sep 01 19:24:30 2010 +0200 @@ -2999,15 +2999,12 @@ """ Private method to restart the application. """ - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Restart application"), self.trUtf8("""The application needs to be restarted. Do it now?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - - if res == QMessageBox.Yes and self.__shutdown(): + yesDefault = True) + + if res and self.__shutdown(): e5App().closeAllWindows() program = sys.executable eric5 = os.path.join(getConfig("ericDir"), "eric5.py") @@ -5523,27 +5520,21 @@ if "-snapshot-" in Version: # check snapshot version if versions[2] > Version: - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Update available"), self.trUtf8("""The update to <b>{0}</b> of eric5 is available""" """ at <b>{1}</b>. Would you like to get it?""")\ .format(versions[2], versions[3]), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - url = res == QMessageBox.Yes and versions[3] or '' + yesDefault = True) + url = res and versions[3] or '' elif versions[0] > Version: - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Update available"), self.trUtf8("""The update to <b>{0}</b> of eric5 is available""" """ at <b>{1}</b>. Would you like to get it?""")\ .format(versions[0], versions[1]), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - url = res == QMessageBox.Yes and versions[1] or '' + yesDefault = True) + url = res and versions[1] or '' else: if self.manualUpdatesCheck: E5MessageBox.information(self, @@ -5552,16 +5543,13 @@ else: # check release version if versions[0] > Version: - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Update available"), self.trUtf8("""The update to <b>{0}</b> of eric5 is available""" """ at <b>{1}</b>. Would you like to get it?""")\ .format(versions[0], versions[1]), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - url = res == QMessageBox.Yes and versions[1] or '' + yesDefault = True) + url = res and versions[1] or '' else: if self.manualUpdatesCheck: E5MessageBox.information(self, @@ -5617,17 +5605,14 @@ for err in sslErrors: errorStrings.append(err.errorString()) errorString = '.<br />'.join(errorStrings) - ret = E5MessageBox.warning(self, + ret = E5MessageBox.yesNo(self, self.trUtf8("SSL Errors"), self.trUtf8("""<p>SSL Errors:</p>""" """<p>{0}</p>""" """<p>Do you want to ignore these errors?</p>""")\ .format(errorString), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if ret == QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if ret: reply.ignoreSslErrors() else: self.__downloadCancelled = True
--- a/VCS/ProjectHelper.py Tue Aug 31 16:38:06 2010 +0200 +++ b/VCS/ProjectHelper.py Wed Sep 01 19:24:30 2010 +0200 @@ -155,14 +155,10 @@ self.project.pdata["VCS"] = [vcsSystem] self.project.vcs = self.project.initVCS(vcsSystem) # edit VCS command options - vcores = E5MessageBox.question(self.parent(), + vcores = E5MessageBox.yesNo(self.parent(), self.trUtf8("New Project"), - self.trUtf8("""Would you like to edit the VCS command options?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if vcores == QMessageBox.Yes: + self.trUtf8("""Would you like to edit the VCS command options?""")) + if vcores: codlg = vcsCommandOptionsDialog(self.project.vcs) if codlg.exec_() == QDialog.Accepted: self.project.vcs.vcsSetOptions(codlg.getOptions()) @@ -212,17 +208,14 @@ self.project.setDirty(True) self.project.saveProject() else: - res = E5MessageBox.question(self.parent(), + res = E5MessageBox.yesNo(self.parent(), self.trUtf8("New project from repository"), self.trUtf8("The project retrieved from the repository" " does not contain an eric project file" " (*.e4p *.e4pz)." " Create it?"), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - if res == QMessageBox.Yes: + yesDefault = True) + if res: self.project.ppath = projectdir self.project.opened = True @@ -243,15 +236,12 @@ self.project.saveProject() self.project.openProject(self.project.pfile) if not export: - res = E5MessageBox.question(self.parent(), + res = E5MessageBox.yesNo(self.parent(), self.trUtf8("New project from repository"), self.trUtf8("Shall the project file be added to" " the repository?"), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - if res == QMessageBox.Yes: + yesDefault = True) + if res: self.project.vcs.vcsAdd(self.project.pfile) else: E5MessageBox.critical(self.parent(), @@ -323,14 +313,10 @@ if vcsdlg.exec_() == QDialog.Accepted: vcsDataDict = vcsdlg.getData() # edit VCS command options - vcores = E5MessageBox.question(self.parent(), + vcores = E5MessageBox.yesNo(self.parent(), self.trUtf8("Import Project"), - self.trUtf8("""Would you like to edit the VCS command options?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if vcores == QMessageBox.Yes: + self.trUtf8("""Would you like to edit the VCS command options?""")) + if vcores: codlg = vcsCommandOptionsDialog(self.project.vcs) if codlg.exec_() == QDialog.Accepted: self.project.vcs.vcsSetOptions(codlg.getOptions()) @@ -356,14 +342,11 @@ """ shouldReopen = self.vcs.vcsUpdate(self.project.ppath) if shouldReopen: - res = E5MessageBox.question(self.parent(), + res = E5MessageBox.yesNo(self.parent(), self.trUtf8("Update"), self.trUtf8("""The project should be reread. Do this now?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - if res == QMessageBox.Yes: + yesDefault = True) + if res: self.project.reopenProject() def _vcsCommit(self): @@ -383,15 +366,11 @@ Depending on the parameters set in the vcs object the project may be removed from the local disk as well. """ - res = E5MessageBox.question(self.parent(), + res = E5MessageBox.yesNo(self.parent(), self.trUtf8("Remove project from repository"), self.trUtf8("Dou you really want to remove this project from" - " the repository (and disk)?"), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.Yes: + " the repository (and disk)?")) + if res: self.vcs.vcsRemove(self.project.ppath, True) self._vcsCommit() if not os.path.exists(self.project.pfile): @@ -469,4 +448,4 @@ """ info = self.vcs.vcsRepositoryInfos(self.project.ppath) dlg = VcsRepositoryInfoDialog(None, info) - dlg.exec_() \ No newline at end of file + dlg.exec_()