Mon, 30 Nov 2015 19:52:30 +0100
Modified more dialogs to use the path picker widgets.
--- a/E5Gui/E5PathPicker.py Mon Nov 30 18:52:18 2015 +0100 +++ b/E5Gui/E5PathPicker.py Mon Nov 30 19:52:30 2015 +0100 @@ -37,6 +37,7 @@ SaveFileMode = 2 SaveFileEnsureExtensionMode = 3 DirectoryMode = 4 + CustomMode = 99 NoMode = 100 # TODO: Refactor the classes using a base class with common functions @@ -50,12 +51,15 @@ @signal pathSelected(path) emitted after a path has been selected via the file dialog @signal aboutToShowPathPickerDialog emitted before the file dialog is shown + @signal pickerButtonClicked emitted when the picker button was pressed and + the widget mode is custom """ DefaultMode = E5PathPickerModes.NoMode textChanged = pyqtSignal(str) pathSelected = pyqtSignal(str) aboutToShowPathPickerDialog = pyqtSignal() + pickerButtonClicked = pyqtSignal() def __init__(self, parent=None): """ @@ -369,6 +373,10 @@ if self.__mode == E5PathPickerModes.NoMode: return + if self.__mode == E5PathPickerModes.CustomMode: + self.pickerButtonClicked.emit() + return + self.aboutToShowPathPickerDialog.emit() windowTitle = self.__windowTitle @@ -457,12 +465,15 @@ @signal pathSelected(path) emitted after a path has been selected via the file dialog @signal aboutToShowPathPickerDialog emitted before the file dialog is shown + @signal pickerButtonClicked emitted when the picker button was pressed and + the widget mode is custom """ DefaultMode = E5PathPickerModes.NoMode editTextChanged = pyqtSignal(str) pathSelected = pyqtSignal(str) aboutToShowPathPickerDialog = pyqtSignal() + pickerButtonClicked = pyqtSignal() def __init__(self, parent=None): """ @@ -828,6 +839,10 @@ if self.__mode == E5PathPickerModes.NoMode: return + if self.__mode == E5PathPickerModes.CustomMode: + self.pickerButtonClicked.emit() + return + self.aboutToShowPathPickerDialog.emit() windowTitle = self.__windowTitle
--- a/Plugins/VcsPlugins/vcsPySvn/SvnCopyDialog.py Mon Nov 30 18:52:18 2015 +0100 +++ b/Plugins/VcsPlugins/vcsPySvn/SvnCopyDialog.py Mon Nov 30 19:52:30 2015 +0100 @@ -14,14 +14,10 @@ from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_SvnCopyDialog import Ui_SvnCopyDialog -import Utilities -import UI.PixmapCache - class SvnCopyDialog(QDialog, Ui_SvnCopyDialog): """ @@ -40,13 +36,11 @@ super(SvnCopyDialog, self).__init__(parent) self.setupUi(self) - self.dirButton.setIcon(UI.PixmapCache.getIcon("open.png")) - self.source = source if os.path.isdir(self.source): - self.targetCompleter = E5DirCompleter(self.targetEdit) + self.targetPicker.setMode(E5PathPickerModes.DirectoryMode) else: - self.targetCompleter = E5FileCompleter(self.targetEdit) + self.targetPicker.setMode(E5PathPickerModes.SaveFileMode) if move: self.setWindowTitle(self.tr('Subversion Move')) @@ -68,38 +62,14 @@ @return the target name (string) and a flag indicating the operation should be enforced (boolean) """ - target = self.targetEdit.text() + target = self.targetPicker.text() if not os.path.isabs(target): sourceDir = os.path.dirname(self.sourceEdit.text()) target = os.path.join(sourceDir, target) - return (Utilities.toNativeSeparators(target), - self.forceCheckBox.isChecked()) - - @pyqtSlot() - def on_dirButton_clicked(self): - """ - Private slot to handle the button press for selecting the target via a - selection dialog. - """ - if os.path.isdir(self.source): - target = E5FileDialog.getExistingDirectory( - None, - self.tr("Select target"), - self.targetEdit.text(), - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - else: - target = E5FileDialog.getSaveFileName( - None, - self.tr("Select target"), - self.targetEdit.text(), - "", - E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) - - if target: - self.targetEdit.setText(Utilities.toNativeSeparators(target)) + return (target, self.forceCheckBox.isChecked()) @pyqtSlot(str) - def on_targetEdit_textChanged(self, txt): + def on_targetPicker_textChanged(self, txt): """ Private slot to handle changes of the target.
--- a/Plugins/VcsPlugins/vcsPySvn/SvnCopyDialog.ui Mon Nov 30 18:52:18 2015 +0100 +++ b/Plugins/VcsPlugins/vcsPySvn/SvnCopyDialog.ui Mon Nov 30 19:52:30 2015 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>409</width> - <height>138</height> + <height>120</height> </rect> </property> <property name="windowTitle"> @@ -16,62 +16,56 @@ <property name="sizeGripEnabled"> <bool>true</bool> </property> - <layout class="QVBoxLayout"> - <item> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel1"> - <property name="text"> - <string>Source:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="sourceEdit"> - <property name="toolTip"> - <string>Shows the name of the source</string> - </property> - <property name="whatsThis"> - <string><b>Source name</b> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="textLabel1"> + <property name="text"> + <string>Source:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="sourceEdit"> + <property name="toolTip"> + <string>Shows the name of the source</string> + </property> + <property name="whatsThis"> + <string><b>Source name</b> <p>This field shows the name of the source.</p></string> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="targetEdit"> - <property name="toolTip"> - <string>Enter the target name</string> - </property> - <property name="whatsThis"> - <string><b>Target name</b> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="textLabel2"> + <property name="text"> + <string>Target:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5PathPicker" name="targetPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the target name</string> + </property> + <property name="whatsThis"> + <string><b>Target name</b> <p>Enter the new name in this field. The target must be the new name or an absolute path.</p></string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textLabel2"> - <property name="text"> - <string>Target:</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="dirButton"> - <property name="toolTip"> - <string>Press to open a selection dialog</string> - </property> - <property name="whatsThis"> - <string><b>Target name</b> -<p>Select the target name for the operation via a selection dialog.</p></string> - </property> - </widget> - </item> - </layout> + </property> + </widget> </item> - <item> + <item row="2" column="0" colspan="2"> <widget class="QCheckBox" name="forceCheckBox"> <property name="toolTip"> <string>Select to force the operation</string> @@ -81,7 +75,7 @@ </property> </widget> </item> - <item> + <item row="3" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -95,12 +89,18 @@ </widget> <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> - <tabstop>targetEdit</tabstop> - <tabstop>dirButton</tabstop> + <tabstop>sourceEdit</tabstop> + <tabstop>targetPicker</tabstop> <tabstop>forceCheckBox</tabstop> - <tabstop>buttonBox</tabstop> - <tabstop>sourceEdit</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.py Mon Nov 30 18:52:18 2015 +0100 +++ b/Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.py Mon Nov 30 19:52:30 2015 +0100 @@ -15,15 +15,13 @@ from PyQt5.QtCore import QDir, pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui.E5Completers import E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_SvnNewProjectOptionsDialog import Ui_SvnNewProjectOptionsDialog from .Config import ConfigSvnProtocols import Utilities import Preferences -import UI.PixmapCache class SvnNewProjectOptionsDialog(QDialog, Ui_SvnNewProjectOptionsDialog): @@ -41,17 +39,14 @@ super(SvnNewProjectOptionsDialog, self).__init__(parent) self.setupUi(self) - self.vcsUrlButton.setIcon(UI.PixmapCache.getIcon("open.png")) - self.projectDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) - - self.vcsDirectoryCompleter = E5DirCompleter(self.vcsUrlEdit) - self.vcsProjectDirCompleter = E5DirCompleter(self.vcsProjectDirEdit) + self.vcsProjectDirPicker.setMode(E5PathPickerModes.DirectoryMode) + self.vcsUrlPicker.setMode(E5PathPickerModes.DirectoryMode) self.protocolCombo.addItems(ConfigSvnProtocols) hd = Utilities.toNativeSeparators(QDir.homePath()) hd = os.path.join(hd, 'subversionroot') - self.vcsUrlEdit.setText(hd) + self.vcsUrlPicker.setText(hd) self.vcs = vcs @@ -65,8 +60,7 @@ Utilities.fromNativeSeparators(ipath), Utilities.fromNativeSeparators(ipath) + "/", ] - self.vcsProjectDirEdit.setText( - Utilities.toNativeSeparators(self.__initPaths[0])) + self.vcsProjectDirPicker.setText(self.__initPaths[0]) self.resize(self.width(), self.minimumSizeHint().height()) @@ -76,7 +70,7 @@ self.resize(max(self.width(), msh.width()), msh.height()) @pyqtSlot(str) - def on_vcsProjectDirEdit_textChanged(self, txt): + def on_vcsProjectDirPicker_textChanged(self, txt): """ Private slot to handle a change of the project directory. @@ -87,48 +81,22 @@ Utilities.fromNativeSeparators(txt) not in self.__initPaths) @pyqtSlot() - def on_vcsUrlButton_clicked(self): + def on_vcsUrlPicker_pickerButtonClicked(self): """ - Private slot to display a selection dialog. + Private slot to display a repository browser dialog. """ - if self.protocolCombo.currentText() == "file://": - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("Select Repository-Directory"), - self.vcsUrlEdit.text(), - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if directory: - self.vcsUrlEdit.setText( - Utilities.toNativeSeparators(directory)) - else: - from .SvnRepoBrowserDialog import SvnRepoBrowserDialog - dlg = SvnRepoBrowserDialog(self.vcs, mode="select", parent=self) - dlg.start( - self.protocolCombo.currentText() + self.vcsUrlEdit.text()) - if dlg.exec_() == QDialog.Accepted: - url = dlg.getSelectedUrl() - if url: - protocol = url.split("://")[0] - path = url.split("://")[1] - self.protocolCombo.setCurrentIndex( - self.protocolCombo.findText(protocol + "://")) - self.vcsUrlEdit.setText(path) - - @pyqtSlot() - def on_projectDirButton_clicked(self): - """ - Private slot to display a directory selection dialog. - """ - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("Select Project Directory"), - self.vcsProjectDirEdit.text(), - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if directory: - self.vcsProjectDirEdit.setText( - Utilities.toNativeSeparators(directory)) + from .SvnRepoBrowserDialog import SvnRepoBrowserDialog + dlg = SvnRepoBrowserDialog(self.vcs, mode="select", parent=self) + dlg.start( + self.protocolCombo.currentText() + self.vcsUrlPicker.text()) + if dlg.exec_() == QDialog.Accepted: + url = dlg.getSelectedUrl() + if url: + protocol = url.split("://")[0] + path = url.split("://")[1] + self.protocolCombo.setCurrentIndex( + self.protocolCombo.findText(protocol + "://")) + self.vcsUrlPicker.setText(path) def on_layoutCheckBox_toggled(self, checked): """ @@ -149,19 +117,21 @@ @param protocol name of the selected protocol (string) """ if protocol == "file://": - self.networkPath = self.vcsUrlEdit.text() - self.vcsUrlEdit.setText(self.localPath) + self.networkPath = self.vcsUrlPicker.text() + self.vcsUrlPicker.setText(self.localPath) self.vcsUrlLabel.setText(self.tr("Pat&h:")) self.localProtocol = True + self.vcsUrlPicker.setMode(E5PathPickerModes.DirectoryMode) else: if self.localProtocol: - self.localPath = self.vcsUrlEdit.text() - self.vcsUrlEdit.setText(self.networkPath) + self.localPath = self.vcsUrlPicker.text() + self.vcsUrlPicker.setText(self.networkPath) self.vcsUrlLabel.setText(self.tr("&URL:")) self.localProtocol = False + self.vcsUrlPicker.setMode(E5PathPickerModes.CustomMode) @pyqtSlot(str) - def on_vcsUrlEdit_textChanged(self, txt): + def on_vcsUrlPicker_textChanged(self, txt): """ Private slot to handle changes of the URL. @@ -178,10 +148,10 @@ containing the data entered. """ scheme = self.protocolCombo.currentText() - url = self.vcsUrlEdit.text() + url = self.vcsUrlPicker.text() vcsdatadict = { "url": '{0}{1}'.format(scheme, url), "tag": self.vcsTagEdit.text(), "standardLayout": self.layoutCheckBox.isChecked(), } - return (self.vcsProjectDirEdit.text(), vcsdatadict) + return (self.vcsProjectDirPicker.text(), vcsdatadict)
--- a/Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.ui Mon Nov 30 18:52:18 2015 +0100 +++ b/Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.ui Mon Nov 30 19:52:30 2015 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>562</width> - <height>200</height> + <height>170</height> </rect> </property> <property name="windowTitle"> @@ -21,122 +21,122 @@ <property name="sizeGripEnabled"> <bool>true</bool> </property> - <layout class="QVBoxLayout"> - <item> - <layout class="QGridLayout"> - <item row="2" column="1"> - <widget class="QLineEdit" name="vcsTagEdit"> - <property name="toolTip"> - <string>Enter the tag the new project should be generated from</string> - </property> - <property name="whatsThis"> - <string><b>Tag in VCS</b> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="textLabel1"> + <property name="text"> + <string>&Protocol:</string> + </property> + <property name="buddy"> + <cstring>protocolCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="protocolCombo"> + <property name="toolTip"> + <string>Select the protocol to access the repository</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="vcsUrlLabel"> + <property name="text"> + <string>&URL:</string> + </property> + <property name="buddy"> + <cstring>vcsUrlPicker</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5PathPicker" name="vcsUrlPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the url path of the module in the repository (without protocol part)</string> + </property> + <property name="whatsThis"> + <string><b>URL</b><p>Enter the URL to the module. For a repository with standard layout, this must not contain the trunk, tags or branches part.</p></string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="vcsTagLabel"> + <property name="text"> + <string>&Tag:</string> + </property> + <property name="buddy"> + <cstring>vcsTagEdit</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="vcsTagEdit"> + <property name="toolTip"> + <string>Enter the tag the new project should be generated from</string> + </property> + <property name="whatsThis"> + <string><b>Tag in VCS</b> <p>Enter the tag name the new project shall be generated from. Leave empty to retrieve the latest data from the repository.</p></string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="protocolCombo"> - <property name="toolTip"> - <string>Select the protocol to access the repository</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel1"> - <property name="text"> - <string>&Protocol:</string> - </property> - <property name="buddy"> - <cstring>protocolCombo</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="vcsUrlEdit"> - <property name="toolTip"> - <string>Enter the url path of the module in the repository (without protocol part)</string> - </property> - <property name="whatsThis"> - <string><b>URL</b><p>Enter the URL to the module. For a repository with standard layout, this must not contain the trunk, tags or branches part.</p></string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="vcsUrlLabel"> - <property name="text"> - <string>&URL:</string> - </property> - <property name="buddy"> - <cstring>vcsUrlEdit</cstring> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="vcsProjectDirEdit"> - <property name="toolTip"> - <string>Enter the directory of the new project.</string> - </property> - <property name="whatsThis"> - <string><b>Project Directory</b> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="TextLabel4"> + <property name="text"> + <string>Project &Directory:</string> + </property> + <property name="buddy"> + <cstring>vcsProjectDirPicker</cstring> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="E5PathPicker" name="vcsProjectDirPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the directory of the new project.</string> + </property> + <property name="whatsThis"> + <string><b>Project Directory</b> <p>Enter the directory of the new project. It will be retrieved from the repository and be placed in this directory.</p></string> - </property> - </widget> - </item> - <item row="4" column="0" colspan="2"> - <widget class="QCheckBox" name="layoutCheckBox"> - <property name="toolTip"> - <string>Select to indicate, that the repository has a standard layout (projectdir/trunk, projectdir/tags, projectdir/branches)</string> - </property> - <property name="text"> - <string>Repository has standard &layout</string> - </property> - <property name="shortcut"> - <string>Alt+L</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="TextLabel4"> - <property name="text"> - <string>Project &Directory:</string> - </property> - <property name="buddy"> - <cstring>vcsProjectDirEdit</cstring> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="vcsTagLabel"> - <property name="text"> - <string>&Tag:</string> - </property> - <property name="buddy"> - <cstring>vcsTagEdit</cstring> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="vcsUrlButton"> - <property name="toolTip"> - <string>Select the repository url via a directory selection dialog or the repository browser</string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QToolButton" name="projectDirButton"> - <property name="toolTip"> - <string>Select the project directory via a directory selection dialog</string> - </property> - </widget> - </item> - </layout> + </property> + </widget> </item> - <item> + <item row="4" column="0" colspan="2"> + <widget class="QCheckBox" name="layoutCheckBox"> + <property name="toolTip"> + <string>Select to indicate, that the repository has a standard layout (projectdir/trunk, projectdir/tags, projectdir/branches)</string> + </property> + <property name="text"> + <string>Repository has standard &layout</string> + </property> + <property name="shortcut"> + <string>Alt+L</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="5" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -150,13 +150,19 @@ </widget> <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> <tabstop>protocolCombo</tabstop> - <tabstop>vcsUrlEdit</tabstop> - <tabstop>vcsUrlButton</tabstop> + <tabstop>vcsUrlPicker</tabstop> <tabstop>vcsTagEdit</tabstop> - <tabstop>vcsProjectDirEdit</tabstop> - <tabstop>projectDirButton</tabstop> + <tabstop>vcsProjectDirPicker</tabstop> <tabstop>layoutCheckBox</tabstop> </tabstops> <resources/>
--- a/Plugins/VcsPlugins/vcsSubversion/SvnCopyDialog.py Mon Nov 30 18:52:18 2015 +0100 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnCopyDialog.py Mon Nov 30 19:52:30 2015 +0100 @@ -14,14 +14,10 @@ from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_SvnCopyDialog import Ui_SvnCopyDialog -import Utilities -import UI.PixmapCache - class SvnCopyDialog(QDialog, Ui_SvnCopyDialog): """ @@ -40,13 +36,11 @@ super(SvnCopyDialog, self).__init__(parent) self.setupUi(self) - self.dirButton.setIcon(UI.PixmapCache.getIcon("open.png")) - self.source = source if os.path.isdir(self.source): - self.targetCompleter = E5DirCompleter(self.targetEdit) + self.targetPicker.setMode(E5PathPickerModes.DirectoryMode) else: - self.targetCompleter = E5FileCompleter(self.targetEdit) + self.targetPicker.setMode(E5PathPickerModes.SaveFileMode) if move: self.setWindowTitle(self.tr('Subversion Move')) @@ -68,38 +62,14 @@ @return the target name (string) and a flag indicating the operation should be enforced (boolean) """ - target = self.targetEdit.text() + target = self.targetPicker.text() if not os.path.isabs(target): sourceDir = os.path.dirname(self.sourceEdit.text()) target = os.path.join(sourceDir, target) - return (Utilities.toNativeSeparators(target), - self.forceCheckBox.isChecked()) - - @pyqtSlot() - def on_dirButton_clicked(self): - """ - Private slot to handle the button press for selecting the target via a - selection dialog. - """ - if os.path.isdir(self.source): - target = E5FileDialog.getExistingDirectory( - None, - self.tr("Select target"), - self.targetEdit.text(), - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - else: - target = E5FileDialog.getSaveFileName( - None, - self.tr("Select target"), - self.targetEdit.text(), - "", - E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) - - if target: - self.targetEdit.setText(Utilities.toNativeSeparators(target)) + return (target, self.forceCheckBox.isChecked()) @pyqtSlot(str) - def on_targetEdit_textChanged(self, txt): + def on_targetPicker_textChanged(self, txt): """ Private slot to handle changes of the target.
--- a/Plugins/VcsPlugins/vcsSubversion/SvnCopyDialog.ui Mon Nov 30 18:52:18 2015 +0100 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnCopyDialog.ui Mon Nov 30 19:52:30 2015 +0100 @@ -16,62 +16,56 @@ <property name="sizeGripEnabled"> <bool>true</bool> </property> - <layout class="QVBoxLayout"> - <item> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel1"> - <property name="text"> - <string>Source:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="sourceEdit"> - <property name="toolTip"> - <string>Shows the name of the source</string> - </property> - <property name="whatsThis"> - <string><b>Source name</b> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="textLabel1"> + <property name="text"> + <string>Source:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="sourceEdit"> + <property name="toolTip"> + <string>Shows the name of the source</string> + </property> + <property name="whatsThis"> + <string><b>Source name</b> <p>This field shows the name of the source.</p></string> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="targetEdit"> - <property name="toolTip"> - <string>Enter the target name</string> - </property> - <property name="whatsThis"> - <string><b>Target name</b> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="textLabel2"> + <property name="text"> + <string>Target:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5PathPicker" name="targetPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the target name</string> + </property> + <property name="whatsThis"> + <string><b>Target name</b> <p>Enter the new name in this field. The target must be the new name or an absolute path.</p></string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textLabel2"> - <property name="text"> - <string>Target:</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="dirButton"> - <property name="toolTip"> - <string>Press to open a selection dialog</string> - </property> - <property name="whatsThis"> - <string><b>Target directory</b> -<p>Select the target name for the operation via a selection dialog.</p></string> - </property> - </widget> - </item> - </layout> + </property> + </widget> </item> - <item> + <item row="2" column="0" colspan="2"> <widget class="QCheckBox" name="forceCheckBox"> <property name="toolTip"> <string>Select to force the operation</string> @@ -81,7 +75,7 @@ </property> </widget> </item> - <item> + <item row="3" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -95,12 +89,18 @@ </widget> <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> - <tabstop>targetEdit</tabstop> - <tabstop>dirButton</tabstop> + <tabstop>sourceEdit</tabstop> + <tabstop>targetPicker</tabstop> <tabstop>forceCheckBox</tabstop> - <tabstop>buttonBox</tabstop> - <tabstop>sourceEdit</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py Mon Nov 30 18:52:18 2015 +0100 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py Mon Nov 30 19:52:30 2015 +0100 @@ -15,15 +15,13 @@ from PyQt5.QtCore import QDir, pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui.E5Completers import E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_SvnNewProjectOptionsDialog import Ui_SvnNewProjectOptionsDialog from .Config import ConfigSvnProtocols import Utilities import Preferences -import UI.PixmapCache class SvnNewProjectOptionsDialog(QDialog, Ui_SvnNewProjectOptionsDialog): @@ -41,11 +39,8 @@ super(SvnNewProjectOptionsDialog, self).__init__(parent) self.setupUi(self) - self.vcsUrlButton.setIcon(UI.PixmapCache.getIcon("open.png")) - self.projectDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) - - self.vcsDirectoryCompleter = E5DirCompleter(self.vcsUrlEdit) - self.vcsProjectDirCompleter = E5DirCompleter(self.vcsProjectDirEdit) + self.vcsProjectDirPicker.setMode(E5PathPickerModes.DirectoryMode) + self.vcsUrlPicker.setMode(E5PathPickerModes.DirectoryMode) self.protocolCombo.addItems(ConfigSvnProtocols) @@ -53,7 +48,7 @@ hd = Utilities.toNativeSeparators(QDir.homePath()) hd = os.path.join(hd, 'subversionroot') - self.vcsUrlEdit.setText(hd) + self.vcsUrlPicker.setText(hd) self.localPath = hd self.networkPath = "localhost/" @@ -65,8 +60,7 @@ Utilities.fromNativeSeparators(ipath), Utilities.fromNativeSeparators(ipath) + "/", ] - self.vcsProjectDirEdit.setText( - Utilities.toNativeSeparators(self.__initPaths[0])) + self.vcsProjectDirPicker.setText(self.__initPaths[0]) self.resize(self.width(), self.minimumSizeHint().height()) @@ -76,7 +70,7 @@ self.resize(max(self.width(), msh.width()), msh.height()) @pyqtSlot(str) - def on_vcsProjectDirEdit_textChanged(self, txt): + def on_vcsProjectDirPicker_textChanged(self, txt): """ Private slot to handle a change of the project directory. @@ -86,49 +80,22 @@ bool(txt) and Utilities.fromNativeSeparators(txt) not in self.__initPaths) - @pyqtSlot() - def on_vcsUrlButton_clicked(self): + def on_vcsUrlPicker_pickerButtonClicked(self): """ - Private slot to display a selection dialog. + Private slot to display a repository browser dialog. """ - if self.protocolCombo.currentText() == "file://": - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("Select Repository-Directory"), - self.vcsUrlEdit.text(), - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if directory: - self.vcsUrlEdit.setText( - Utilities.toNativeSeparators(directory)) - else: - from .SvnRepoBrowserDialog import SvnRepoBrowserDialog - dlg = SvnRepoBrowserDialog(self.vcs, mode="select", parent=self) - dlg.start( - self.protocolCombo.currentText() + self.vcsUrlEdit.text()) - if dlg.exec_() == QDialog.Accepted: - url = dlg.getSelectedUrl() - if url: - protocol = url.split("://")[0] - path = url.split("://")[1] - self.protocolCombo.setCurrentIndex( - self.protocolCombo.findText(protocol + "://")) - self.vcsUrlEdit.setText(path) - - @pyqtSlot() - def on_projectDirButton_clicked(self): - """ - Private slot to display a directory selection dialog. - """ - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("Select Project Directory"), - self.vcsProjectDirEdit.text(), - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if directory: - self.vcsProjectDirEdit.setText( - Utilities.toNativeSeparators(directory)) + from .SvnRepoBrowserDialog import SvnRepoBrowserDialog + dlg = SvnRepoBrowserDialog(self.vcs, mode="select", parent=self) + dlg.start( + self.protocolCombo.currentText() + self.vcsUrlPicker.text()) + if dlg.exec_() == QDialog.Accepted: + url = dlg.getSelectedUrl() + if url: + protocol = url.split("://")[0] + path = url.split("://")[1] + self.protocolCombo.setCurrentIndex( + self.protocolCombo.findText(protocol + "://")) + self.vcsUrlPicker.setText(path) def on_layoutCheckBox_toggled(self, checked): """ @@ -149,19 +116,21 @@ @param protocol selected protocol (string) """ if protocol == "file://": - self.networkPath = self.vcsUrlEdit.text() - self.vcsUrlEdit.setText(self.localPath) + self.networkPath = self.vcsUrlPicker.text() + self.vcsUrlPicker.setText(self.localPath) self.vcsUrlLabel.setText(self.tr("Pat&h:")) self.localProtocol = True + self.vcsUrlPicker.setMode(E5PathPickerModes.DirectoryMode) else: if self.localProtocol: - self.localPath = self.vcsUrlEdit.text() - self.vcsUrlEdit.setText(self.networkPath) + self.localPath = self.vcsUrlPicker.text() + self.vcsUrlPicker.setText(self.networkPath) self.vcsUrlLabel.setText(self.tr("&URL:")) self.localProtocol = False + self.vcsUrlPicker.setMode(E5PathPickerModes.CustomMode) @pyqtSlot(str) - def on_vcsUrlEdit_textChanged(self, txt): + def on_vcsUrlPicker_textChanged(self, txt): """ Private slot to handle changes of the URL. @@ -178,10 +147,10 @@ containing the data entered. """ scheme = self.protocolCombo.currentText() - url = self.vcsUrlEdit.text() + url = self.vcsUrlPicker.text() vcsdatadict = { "url": '{0}{1}'.format(scheme, url), "tag": self.vcsTagEdit.text(), "standardLayout": self.layoutCheckBox.isChecked(), } - return (self.vcsProjectDirEdit.text(), vcsdatadict) + return (self.vcsProjectDirPicker.text(), vcsdatadict)
--- a/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.ui Mon Nov 30 18:52:18 2015 +0100 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.ui Mon Nov 30 19:52:30 2015 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>562</width> - <height>201</height> + <height>170</height> </rect> </property> <property name="windowTitle"> @@ -21,118 +21,122 @@ <property name="sizeGripEnabled"> <bool>true</bool> </property> - <layout class="QVBoxLayout"> - <item> - <layout class="QGridLayout"> - <item row="2" column="1"> - <widget class="QLineEdit" name="vcsTagEdit"> - <property name="toolTip"> - <string>Enter the tag the new project should be generated from</string> - </property> - <property name="whatsThis"> - <string><b>Tag in VCS</b> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="textLabel1"> + <property name="text"> + <string>&Protocol:</string> + </property> + <property name="buddy"> + <cstring>protocolCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="protocolCombo"> + <property name="toolTip"> + <string>Select the protocol to access the repository</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="vcsUrlLabel"> + <property name="text"> + <string>&URL:</string> + </property> + <property name="buddy"> + <cstring>vcsUrlPicker</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5PathPicker" name="vcsUrlPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the url path of the module in the repository (without protocol part)</string> + </property> + <property name="whatsThis"> + <string><b>URL</b><p>Enter the URL to the module. For a repository with standard layout, this must not contain the trunk, tags or branches part.</p></string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="vcsTagLabel"> + <property name="text"> + <string>&Tag:</string> + </property> + <property name="buddy"> + <cstring>vcsTagEdit</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="vcsTagEdit"> + <property name="toolTip"> + <string>Enter the tag the new project should be generated from</string> + </property> + <property name="whatsThis"> + <string><b>Tag in VCS</b> <p>Enter the tag name the new project shall be generated from. Leave empty to retrieve the latest data from the repository.</p></string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="protocolCombo"> - <property name="toolTip"> - <string>Select the protocol to access the repository</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel1"> - <property name="text"> - <string>&Protocol:</string> - </property> - <property name="buddy"> - <cstring>protocolCombo</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="vcsUrlEdit"> - <property name="toolTip"> - <string>Enter the url path of the module in the repository (without protocol part)</string> - </property> - <property name="whatsThis"> - <string><b>URL</b><p>Enter the URL to the module. For a repository with standard layout, this must not contain the trunk, tags or branches part.</p></string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="vcsUrlLabel"> - <property name="text"> - <string>&URL:</string> - </property> - <property name="buddy"> - <cstring>vcsUrlEdit</cstring> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="vcsProjectDirEdit"> - <property name="toolTip"> - <string>Enter the directory of the new project.</string> - </property> - <property name="whatsThis"> - <string><b>Project Directory</b> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="TextLabel4"> + <property name="text"> + <string>Project &Directory:</string> + </property> + <property name="buddy"> + <cstring>vcsProjectDirPicker</cstring> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="E5PathPicker" name="vcsProjectDirPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the directory of the new project.</string> + </property> + <property name="whatsThis"> + <string><b>Project Directory</b> <p>Enter the directory of the new project. It will be retrieved from the repository and be placed in this directory.</p></string> - </property> - </widget> - </item> - <item row="4" column="0" colspan="2"> - <widget class="QCheckBox" name="layoutCheckBox"> - <property name="toolTip"> - <string>Select to indicate, that the repository has a standard layout (projectdir/trunk, projectdir/tags, projectdir/branches)</string> - </property> - <property name="text"> - <string>Repository has standard &layout</string> - </property> - <property name="shortcut"> - <string>Alt+L</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="TextLabel4"> - <property name="text"> - <string>Project &Directory:</string> - </property> - <property name="buddy"> - <cstring>vcsProjectDirEdit</cstring> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="vcsTagLabel"> - <property name="text"> - <string>&Tag:</string> - </property> - <property name="buddy"> - <cstring>vcsTagEdit</cstring> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="vcsUrlButton"> - <property name="toolTip"> - <string>Select the repository url via a directory selection dialog or the repository browser</string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QToolButton" name="projectDirButton"/> - </item> - </layout> + </property> + </widget> </item> - <item> + <item row="4" column="0" colspan="2"> + <widget class="QCheckBox" name="layoutCheckBox"> + <property name="toolTip"> + <string>Select to indicate, that the repository has a standard layout (projectdir/trunk, projectdir/tags, projectdir/branches)</string> + </property> + <property name="text"> + <string>Repository has standard &layout</string> + </property> + <property name="shortcut"> + <string>Alt+L</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="5" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -146,13 +150,19 @@ </widget> <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> <tabstop>protocolCombo</tabstop> - <tabstop>vcsUrlEdit</tabstop> - <tabstop>vcsUrlButton</tabstop> + <tabstop>vcsUrlPicker</tabstop> <tabstop>vcsTagEdit</tabstop> - <tabstop>vcsProjectDirEdit</tabstop> - <tabstop>projectDirButton</tabstop> + <tabstop>vcsProjectDirPicker</tabstop> <tabstop>layoutCheckBox</tabstop> </tabstops> <resources/>