diff -r 96232974dcdb -r 645c12de6b0c VCS/ProjectHelper.py --- a/VCS/ProjectHelper.py Sun Mar 30 22:00:14 2014 +0200 +++ b/VCS/ProjectHelper.py Thu Apr 03 23:05:31 2014 +0200 @@ -13,7 +13,7 @@ import shutil import copy -from PyQt4.QtCore import QDir, QFileInfo, QObject +from PyQt4.QtCore import pyqtSlot, QDir, QFileInfo, QObject from PyQt4.QtGui import QDialog, QInputDialog from E5Gui.E5Action import E5Action @@ -64,47 +64,47 @@ Public method to generate the action objects. """ self.vcsNewAct = E5Action( - self.trUtf8('New from repository'), - self.trUtf8('&New from repository...'), + self.tr('New from repository'), + self.tr('&New from repository...'), 0, 0, self, 'vcs_new') - self.vcsNewAct.setStatusTip(self.trUtf8( + self.vcsNewAct.setStatusTip(self.tr( 'Create a new project from the VCS repository' )) - self.vcsNewAct.setWhatsThis(self.trUtf8( + self.vcsNewAct.setWhatsThis(self.tr( """<b>New from repository</b>""" """<p>This creates a new local project from the VCS""" """ repository.</p>""" )) - self.vcsNewAct.triggered[()].connect(self._vcsCheckout) + self.vcsNewAct.triggered.connect(self._vcsCheckout) self.actions.append(self.vcsNewAct) self.vcsExportAct = E5Action( - self.trUtf8('Export from repository'), - self.trUtf8('&Export from repository...'), + self.tr('Export from repository'), + self.tr('&Export from repository...'), 0, 0, self, 'vcs_export') - self.vcsExportAct.setStatusTip(self.trUtf8( + self.vcsExportAct.setStatusTip(self.tr( 'Export a project from the repository' )) - self.vcsExportAct.setWhatsThis(self.trUtf8( + self.vcsExportAct.setWhatsThis(self.tr( """<b>Export from repository</b>""" """<p>This exports a project from the repository.</p>""" )) - self.vcsExportAct.triggered[()].connect(self._vcsExport) + self.vcsExportAct.triggered.connect(self._vcsExport) self.actions.append(self.vcsExportAct) self.vcsAddAct = E5Action( - self.trUtf8('Add to repository'), - self.trUtf8('&Add to repository...'), + self.tr('Add to repository'), + self.tr('&Add to repository...'), 0, 0, self, 'vcs_add') - self.vcsAddAct.setStatusTip(self.trUtf8( + self.vcsAddAct.setStatusTip(self.tr( 'Add the local project to the VCS repository' )) - self.vcsAddAct.setWhatsThis(self.trUtf8( + self.vcsAddAct.setWhatsThis(self.tr( """<b>Add to repository</b>""" """<p>This adds (imports) the local project to the VCS""" """ repository.</p>""" )) - self.vcsAddAct.triggered[()].connect(self._vcsImport) + self.vcsAddAct.triggered.connect(self._vcsImport) self.actions.append(self.vcsAddAct) def initMenu(self, menu): @@ -127,7 +127,8 @@ """ if self.vcsAddAct: self.vcsAddAct.setEnabled(self.project.isOpen()) - + + @pyqtSlot() def _vcsCheckout(self, export=False): """ Protected slot used to create a local project from the repository. @@ -150,8 +151,8 @@ vcsSystemsDisplay.append(vcsSystemsDict[key]) vcsSelected, ok = QInputDialog.getItem( None, - self.trUtf8("New Project"), - self.trUtf8("Select version control system for the project"), + self.tr("New Project"), + self.tr("Select version control system for the project"), vcsSystemsDisplay, 0, False) if not ok: @@ -172,11 +173,15 @@ self.project.pdata["VCS"] = [vcsSystem] self.project.vcs = self.project.initVCS(vcsSystem) # edit VCS command options - vcores = E5MessageBox.yesNo( - self.parent(), - self.trUtf8("New Project"), - self.trUtf8( - """Would you like to edit the VCS command options?""")) + if self.project.vcs.vcsSupportCommandOptions(): + vcores = E5MessageBox.yesNo( + self.parent(), + self.tr("New Project"), + self.tr( + """Would you like to edit the VCS command""" + """ options?""")) + else: + vcores = False if vcores: from .CommandOptionsDialog import VcsCommandOptionsDialog codlg = VcsCommandOptionsDialog(self.project.vcs) @@ -190,8 +195,8 @@ except EnvironmentError: E5MessageBox.critical( self.parent(), - self.trUtf8("Create project directory"), - self.trUtf8( + self.tr("Create project directory"), + self.tr( "<p>The project directory <b>{0}</b> could not" " be created.</p>").format(projectdir)) self.project.pdata["VCS"] = ['None'] @@ -219,8 +224,8 @@ pfilenamelist = d.entryList(filters) pfilename, ok = QInputDialog.getItem( None, - self.trUtf8("New project from repository"), - self.trUtf8("Select a project file to open."), + self.tr("New project from repository"), + self.tr("Select a project file to open."), pfilenamelist, 0, False) if ok: self.project.openProject( @@ -234,8 +239,8 @@ else: res = E5MessageBox.yesNo( self.parent(), - self.trUtf8("New project from repository"), - self.trUtf8( + self.tr("New project from repository"), + self.tr( "The project retrieved from the repository" " does not contain an eric project file" " (*.e4p). Create it?"), @@ -266,9 +271,9 @@ if not export: res = E5MessageBox.yesNo( self.parent(), - self.trUtf8( + self.tr( "New project from repository"), - self.trUtf8( + self.tr( "Shall the project file be added" " to the repository?"), yesDefault=True) @@ -278,8 +283,8 @@ else: E5MessageBox.critical( self.parent(), - self.trUtf8("New project from repository"), - self.trUtf8( + self.tr("New project from repository"), + self.tr( """The project could not be retrieved from""" """ the repository.""")) self.project.pdata["VCS"] = ['None'] @@ -334,8 +339,8 @@ vcsSystemsDisplay.append(vcsSystemsDict[key]) vcsSelected, ok = QInputDialog.getItem( None, - self.trUtf8("Import Project"), - self.trUtf8("Select version control system for the project"), + self.tr("Import Project"), + self.tr("Select version control system for the project"), vcsSystemsDisplay, 0, False) if not ok: @@ -352,11 +357,15 @@ if vcsdlg.exec_() == QDialog.Accepted: vcsDataDict = vcsdlg.getData() # edit VCS command options - vcores = E5MessageBox.yesNo( - self.parent(), - self.trUtf8("Import Project"), - self.trUtf8( - """Would you like to edit the VCS command options?""")) + if self.project.vcs.vcsSupportCommandOptions(): + vcores = E5MessageBox.yesNo( + self.parent(), + self.tr("Import Project"), + self.tr( + """Would you like to edit the VCS command""" + """ options?""")) + else: + vcores = False if vcores: from .CommandOptionsDialog import VcsCommandOptionsDialog codlg = VcsCommandOptionsDialog(self.project.vcs) @@ -386,8 +395,8 @@ if shouldReopen: res = E5MessageBox.yesNo( self.parent(), - self.trUtf8("Update"), - self.trUtf8("""The project should be reread. Do this now?"""), + self.tr("Update"), + self.tr("""The project should be reread. Do this now?"""), yesDefault=True) if res: self.project.reopenProject() @@ -412,8 +421,8 @@ """ res = E5MessageBox.yesNo( self.parent(), - self.trUtf8("Remove project from repository"), - self.trUtf8( + self.tr("Remove project from repository"), + self.tr( "Dou you really want to remove this project from" " the repository (and disk)?")) if res: @@ -429,11 +438,12 @@ """ Protected slot to edit the VCS command options. """ - from .CommandOptionsDialog import VcsCommandOptionsDialog - codlg = VcsCommandOptionsDialog(self.vcs) - if codlg.exec_() == QDialog.Accepted: - self.vcs.vcsSetOptions(codlg.getOptions()) - self.project.setDirty(True) + if self.vcs.vcsSupportCommandOptions(): + from .CommandOptionsDialog import VcsCommandOptionsDialog + codlg = VcsCommandOptionsDialog(self.vcs) + if codlg.exec_() == QDialog.Accepted: + self.vcs.vcsSetOptions(codlg.getOptions()) + self.project.setDirty(True) def _vcsLog(self): """ @@ -441,6 +451,13 @@ """ self.vcs.vcsLog(self.project.ppath) + def _vcsLogBrowser(self): + """ + Protected slot used to show the log of the local project with a + log browser dialog. + """ + self.vcs.vcsLogBrowser(self.project.ppath) + def _vcsDiff(self): """ Protected slot used to show the difference of the local project to @@ -474,8 +491,8 @@ if shouldReopen: res = E5MessageBox.yesNo( self.parent(), - self.trUtf8("Switch"), - self.trUtf8("""The project should be reread. Do this now?"""), + self.tr("Switch"), + self.tr("""The project should be reread. Do this now?"""), yesDefault=True) if res: self.project.reopenProject()