ProjectDjango/DjangoRunTestServerDataDialog.py

branch
eric7
changeset 172
ea7980ded4f3
parent 169
b8f263e05c39
child 175
30cb5e553e7e
diff -r af99f0984f20 -r ea7980ded4f3 ProjectDjango/DjangoRunTestServerDataDialog.py
--- a/ProjectDjango/DjangoRunTestServerDataDialog.py	Sat May 29 15:03:26 2021 +0200
+++ b/ProjectDjango/DjangoRunTestServerDataDialog.py	Sat May 29 18:33:03 2021 +0200
@@ -9,14 +9,13 @@
 
 import contextlib
 
-from PyQt5.QtCore import pyqtSlot
-from PyQt5.QtWidgets import QDialog, QDialogButtonBox
+from PyQt6.QtCore import pyqtSlot
+from PyQt6.QtWidgets import QDialog, QDialogButtonBox
 
-from E5Gui import E5FileDialog
+from EricWidgets.EricPathPicker import EricPathPickerModes
 
 from .Ui_DjangoRunTestServerDataDialog import Ui_DjangoRunTestServerDataDialog
 
-import Utilities
 import UI.PixmapCache
 
 
@@ -29,57 +28,51 @@
         Constructor
         
         @param project reference to the Django project object
-        @param parent reference to the parent widget (QWidget)
+        @type Project
+        @param parent reference to the parent widget
+        @type QWidget
         """
         super().__init__(parent)
         self.setupUi(self)
         
-        self.fixtureFileButton.setIcon(UI.PixmapCache.getIcon("open"))
-        
-        self.__project = project
-        
-        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
-        
-        msh = self.minimumSizeHint()
-        self.resize(max(self.width(), msh.width()), msh.height())
-    
-    @pyqtSlot(str)
-    def on_fixturesEdit_textChanged(self, txt):
-        """
-        Private slot to handle a change of the fixtures text.
-        
-        @param txt text of the line edit (string)
-        """
-        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt))
-    
-    @pyqtSlot()
-    def on_fixtureFileButton_clicked(self):
-        """
-        Private slot to select a fixture file via a file selection dialog.
-        """
         fileFilters = self.tr("JSON Files (*.json);;XML Files (*.xml);;")
         with contextlib.suppress(ImportError):
             import yaml     # __IGNORE_WARNING__
             fileFilters += self.tr("YAML Files (*.yaml);;")
         fileFilters += self.tr("All Files (*)")
         
-        fixtureFiles = E5FileDialog.getOpenFileNames(
-            self,
-            self.tr("Select fixture file"),
-            self.__project.getProjectPath(),
-            fileFilters)
+        self.fixturePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
+        self.fixturePicker.setFilters(fileFilters)
+        
+        self.fixtureFileButton.setIcon(UI.PixmapCache.getIcon("open"))
+        
+        self.__project = project
+        
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Ok).setEnabled(False)
         
-        if fixtureFiles:
-            self.fixturesEdit.setText(" ".join(
-                [Utilities.toNativeSeparators(f) for f in fixtureFiles]))
+        msh = self.minimumSizeHint()
+        self.resize(max(self.width(), msh.width()), msh.height())
+    
+    @pyqtSlot(str)
+    def on_fixturesPicker_textChanged(self, txt):
+        """
+        Private slot to handle a change of the fixtures text.
+        
+        @param txt text of the line edit
+        @type str
+        """
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt))
     
     def getData(self):
         """
         Public method to get the data entered into the dialog.
         
-        @return list of fixtures (list of strings)
+        @return list of fixtures
+        @rtype list of str
         """
-        fixturesStr = self.fixturesEdit.text()
+        fixturesStr = self.fixturePicker.text()
         fixtures = fixturesStr.split()
         
         return fixtures

eric ide

mercurial