Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py

changeset 4593
cc745fa6c914
parent 4021
195a471c327b
child 4631
5c1a96925da4
diff -r 9fdd473c68fb -r cc745fa6c914 Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py
--- a/Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py	Sun Nov 29 17:25:42 2015 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py	Sun Nov 29 19:29:34 2015 +0100
@@ -12,14 +12,10 @@
 from PyQt5.QtCore import pyqtSlot, QDateTime
 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
 
-from E5Gui import E5FileDialog
-from E5Gui.E5Completers import E5FileCompleter
+from E5Gui.E5PathPicker import E5PathPickerModes
 
 from .Ui_HgImportDialog import Ui_HgImportDialog
 
-import Utilities
-import UI.PixmapCache
-
 
 class HgImportDialog(QDialog, Ui_HgImportDialog):
     """
@@ -34,12 +30,12 @@
         super(HgImportDialog, self).__init__(parent)
         self.setupUi(self)
         
-        self.patchFileButton.setIcon(UI.PixmapCache.getIcon("open.png"))
+        self.patchFilePicker.setMode(E5PathPickerModes.OpenFileMode)
+        self.patchFilePicker.setFilters(self.tr(
+            "Patch Files (*.diff *.patch);;All Files (*)"))
         
         self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
         
-        self.__patchFileCompleter = E5FileCompleter(self.patchFileEdit)
-        
         self.__initDateTime = QDateTime.currentDateTime()
         self.dateEdit.setDateTime(self.__initDateTime)
     
@@ -48,13 +44,13 @@
         Private slot to update the OK button.
         """
         enabled = True
-        if self.patchFileEdit.text() == "":
+        if self.patchFilePicker.text() == "":
             enabled = False
         
         self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled)
     
     @pyqtSlot(str)
-    def on_patchFileEdit_textChanged(self, txt):
+    def on_patchFilePicker_textChanged(self, txt):
         """
         Private slot to react on changes of the patch file edit.
         
@@ -62,20 +58,6 @@
         """
         self.__updateOK()
     
-    @pyqtSlot()
-    def on_patchFileButton_clicked(self):
-        """
-        Private slot called by pressing the file selection button.
-        """
-        fn = E5FileDialog.getOpenFileName(
-            self,
-            self.tr("Select patch file"),
-            self.patchFileEdit.text(),
-            self.tr("Patch Files (*.diff *.patch);;All Files (*)"))
-        
-        if fn:
-            self.patchFileEdit.setText(Utilities.toNativeSeparators(fn))
-    
     def getParameters(self):
         """
         Public method to retrieve the import data.
@@ -90,6 +72,6 @@
         else:
             date = ""
         
-        return (self.patchFileEdit.text(), self.noCommitCheckBox.isChecked(),
+        return (self.patchFilePicker.text(), self.noCommitCheckBox.isChecked(),
                 self.messageEdit.toPlainText(), date, self.userEdit.text(),
                 self.stripSpinBox.value(), self.forceCheckBox.isChecked())

eric ide

mercurial