Plugins/VcsPlugins/vcsSubversion/SvnOptionsDialog.py

changeset 4600
fc4f447ab637
parent 4021
195a471c327b
child 4631
5c1a96925da4
diff -r 960d1e63f802 -r fc4f447ab637 Plugins/VcsPlugins/vcsSubversion/SvnOptionsDialog.py
--- a/Plugins/VcsPlugins/vcsSubversion/SvnOptionsDialog.py	Thu Dec 03 19:11:22 2015 +0100
+++ b/Plugins/VcsPlugins/vcsSubversion/SvnOptionsDialog.py	Sat Dec 05 12:23:39 2015 +0100
@@ -15,14 +15,12 @@
 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_SvnOptionsDialog import Ui_SvnOptionsDialog
 from .Config import ConfigSvnProtocols
 
 import Utilities
-import UI.PixmapCache
 
 
 class SvnOptionsDialog(QDialog, Ui_SvnOptionsDialog):
@@ -41,9 +39,7 @@
         super(SvnOptionsDialog, self).__init__(parent)
         self.setupUi(self)
         
-        self.vcsUrlButton.setIcon(UI.PixmapCache.getIcon("open.png"))
-        
-        self.vcsDirectoryCompleter = E5DirCompleter(self.vcsUrlEdit)
+        self.vcsUrlPicker.setMode(E5PathPickerModes.DirectoryMode)
         
         self.project = project
         
@@ -51,7 +47,7 @@
         
         hd = Utilities.toNativeSeparators(QDir.homePath())
         hd = os.path.join(hd, 'subversionroot')
-        self.vcsUrlEdit.setText(hd)
+        self.vcsUrlPicker.setText(hd)
         
         self.vcs = vcs
         
@@ -63,33 +59,22 @@
         self.resize(max(self.width(), msh.width()), msh.height())
         
     @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)
+        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)
         
     @pyqtSlot(str)
     def on_protocolCombo_activated(self, protocol):
@@ -99,19 +84,19 @@
         @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
         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
     
     @pyqtSlot(str)
-    def on_vcsUrlEdit_textChanged(self, txt):
+    def on_vcsUrlPicker_textChanged(self, txt):
         """
         Private slot to handle changes of the URL.
         
@@ -127,7 +112,7 @@
         @return a dictionary containing the data entered
         """
         scheme = self.protocolCombo.currentText()
-        url = self.vcsUrlEdit.text()
+        url = self.vcsUrlPicker.text()
         vcsdatadict = {
             "url": '{0}{1}'.format(scheme, url),
             "message": self.vcsLogEdit.text(),

eric ide

mercurial