eric6/CondaInterface/CondaPackagesWidget.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/CondaInterface/CondaPackagesWidget.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/CondaInterface/CondaPackagesWidget.py	Tue Mar 02 17:17:09 2021 +0100
@@ -31,11 +31,11 @@
     Class implementing the conda packages management widget.
     """
     # Role definition of packages list
-    PackageVersionRole = Qt.UserRole + 1
-    PackageBuildRole = Qt.UserRole + 2
+    PackageVersionRole = Qt.ItemDataRole.UserRole + 1
+    PackageBuildRole = Qt.ItemDataRole.UserRole + 2
     
     # Role definitions of search results list
-    PackageDetailedDataRole = Qt.UserRole + 1
+    PackageDetailedDataRole = Qt.ItemDataRole.UserRole + 1
     
     def __init__(self, conda, parent=None):
         """
@@ -70,9 +70,11 @@
             "conda_supermenu_button")
         self.condaMenuButton.setIcon(UI.PixmapCache.getIcon("superMenu"))
         self.condaMenuButton.setToolTip(self.tr("Conda Menu"))
-        self.condaMenuButton.setPopupMode(QToolButton.InstantPopup)
-        self.condaMenuButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
-        self.condaMenuButton.setFocusPolicy(Qt.NoFocus)
+        self.condaMenuButton.setPopupMode(
+            QToolButton.ToolButtonPopupMode.InstantPopup)
+        self.condaMenuButton.setToolButtonStyle(
+            Qt.ToolButtonStyle.ToolButtonIconOnly)
+        self.condaMenuButton.setFocusPolicy(Qt.FocusPolicy.NoFocus)
         self.condaMenuButton.setAutoRaise(True)
         self.condaMenuButton.setShowMenuInside(True)
         
@@ -241,7 +243,9 @@
                     prefix=prefix)
                 for package, version, build in updateablePackages:
                     items = self.packagesList.findItems(
-                        package, Qt.MatchExactly | Qt.MatchCaseSensitive)
+                        package,
+                        Qt.MatchFlag.MatchExactly |
+                        Qt.MatchFlag.MatchCaseSensitive)
                     if items:
                         itm = items[0]
                         itm.setText(2, version)
@@ -258,7 +262,7 @@
                                 itm.data(2, self.PackageBuildRole),
                             ))
                 
-                self.packagesList.sortItems(0, Qt.AscendingOrder)
+                self.packagesList.sortItems(0, Qt.SortOrder.AscendingOrder)
                 for col in range(self.packagesList.columnCount()):
                     self.packagesList.resizeColumnToContents(col)
                 self.packagesList.setUpdatesEnabled(True)
@@ -287,7 +291,8 @@
             self.__populateEnvironments()
             
             index = self.environmentsComboBox.findText(
-                currentEnvironment, Qt.MatchExactly | Qt.MatchCaseSensitive)
+                currentEnvironment,
+                Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive)
             if index != -1:
                 self.environmentsComboBox.setCurrentIndex(index)
         
@@ -386,7 +391,8 @@
                                 citm.setData(0, self.PackageDetailedDataRole,
                                              detail)
                     
-                        self.searchResultList.sortItems(0, Qt.AscendingOrder)
+                        self.searchResultList.sortItems(
+                            0, Qt.SortOrder.AscendingOrder)
                         self.searchResultList.resizeColumnToContents(0)
                         self.searchResultList.setUpdatesEnabled(True)
             if not ok:
@@ -511,7 +517,7 @@
         self.searchWidget.setVisible(checked)
         
         if checked:
-            self.searchEdit.setFocus(Qt.OtherFocusReason)
+            self.searchEdit.setFocus(Qt.FocusReason.OtherFocusReason)
             self.searchEdit.selectAll()
             
             self.__updateSearchActionButtons()
@@ -556,7 +562,7 @@
                 self,
                 self.tr("Install Packages"),
                 self.tr("Package Specifications (separated by whitespace):"),
-                QLineEdit.Normal,
+                QLineEdit.EchoMode.Normal,
                 minimumWidth=600)
             if ok and packageSpecs.strip():
                 packages = [p.strip() for p in packageSpecs.split()]
@@ -616,7 +622,7 @@
         if prefix:
             dlg = CondaNewEnvironmentDataDialog(self.tr("Clone Environment"),
                                                 False, self)
-            if dlg.exec() == QDialog.Accepted:
+            if dlg.exec() == QDialog.DialogCode.Accepted:
                 virtEnvName, envName, _ = dlg.getData()
                 args = [
                     "--name",
@@ -640,7 +646,7 @@
         
         dlg = CondaNewEnvironmentDataDialog(self.tr("Create Environment"),
                                             True, self)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             virtEnvName, envName, requirements = dlg.getData()
             args = [
                 "--name",

eric ide

mercurial