eric6/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -42,25 +42,27 @@
         super(SvnRepoBrowserDialog, self).__init__(parent)
         self.setupUi(self)
         SvnDialogMixin.__init__(self)
-        self.setWindowFlags(Qt.Window)
+        self.setWindowFlags(Qt.WindowType.Window)
         
         self.repoTree.headerItem().setText(self.repoTree.columnCount(), "")
-        self.repoTree.header().setSortIndicator(0, Qt.AscendingOrder)
+        self.repoTree.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder)
         
         self.vcs = vcs
         self.mode = mode
         
         if self.mode == "select":
-            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
-            self.buttonBox.button(QDialogButtonBox.Close).hide()
+            self.buttonBox.button(
+                QDialogButtonBox.StandardButton.Ok).setEnabled(False)
+            self.buttonBox.button(QDialogButtonBox.StandardButton.Close).hide()
         else:
-            self.buttonBox.button(QDialogButtonBox.Ok).hide()
-            self.buttonBox.button(QDialogButtonBox.Cancel).hide()
+            self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).hide()
+            self.buttonBox.button(
+                QDialogButtonBox.StandardButton.Cancel).hide()
         
         self.__dirIcon = UI.PixmapCache.getIcon("dirClosed")
         self.__fileIcon = UI.PixmapCache.getIcon("fileMisc")
         
-        self.__urlRole = Qt.UserRole
+        self.__urlRole = Qt.ItemDataRole.UserRole
         self.__ignoreExpand = False
         
         self.client = self.vcs.getClient()
@@ -85,7 +87,8 @@
         """
         Private method to resize the tree columns.
         """
-        self.repoTree.header().resizeSections(QHeaderView.ResizeToContents)
+        self.repoTree.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.repoTree.header().setStretchLastSection(True)
     
     def __generateItem(self, parent, repopath, revision, author, size, date,
@@ -121,25 +124,26 @@
             author = ""
         
         itm = QTreeWidgetItem(parent)
-        itm.setData(0, Qt.DisplayRole, path)
-        itm.setData(1, Qt.DisplayRole, rev)
-        itm.setData(2, Qt.DisplayRole, author)
-        itm.setData(3, Qt.DisplayRole, size)
-        itm.setData(4, Qt.DisplayRole, dt)
+        itm.setData(0, Qt.ItemDataRole.DisplayRole, path)
+        itm.setData(1, Qt.ItemDataRole.DisplayRole, rev)
+        itm.setData(2, Qt.ItemDataRole.DisplayRole, author)
+        itm.setData(3, Qt.ItemDataRole.DisplayRole, size)
+        itm.setData(4, Qt.ItemDataRole.DisplayRole, dt)
         
         if nodekind == pysvn.node_kind.dir:
             itm.setIcon(0, self.__dirIcon)
-            itm.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator)
+            itm.setChildIndicatorPolicy(
+                QTreeWidgetItem.ChildIndicatorPolicy.ShowIndicator)
         elif nodekind == pysvn.node_kind.file:
             itm.setIcon(0, self.__fileIcon)
         
         itm.setData(0, self.__urlRole, url)
         
-        itm.setTextAlignment(0, Qt.AlignLeft)
-        itm.setTextAlignment(1, Qt.AlignRight)
-        itm.setTextAlignment(2, Qt.AlignLeft)
-        itm.setTextAlignment(3, Qt.AlignRight)
-        itm.setTextAlignment(4, Qt.AlignLeft)
+        itm.setTextAlignment(0, Qt.AlignmentFlag.AlignLeft)
+        itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight)
+        itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft)
+        itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight)
+        itm.setTextAlignment(4, Qt.AlignmentFlag.AlignLeft)
         
         return itm
     
@@ -230,13 +234,15 @@
         if self.urlCombo.findText(url) == -1:
             self.urlCombo.addItem(url)
     
-    @pyqtSlot(str)
-    def on_urlCombo_currentIndexChanged(self, text):
+    @pyqtSlot(int)
+    def on_urlCombo_currentIndexChanged(self, index):
         """
         Private slot called, when a new repository URL is entered or selected.
         
-        @param text the text of the current item (string)
+        @param index of the current item
+        @type int
         """
+        text = self.urlCombo.itemText(index)
         url = self.__normalizeUrl(text)
         if url != self.url:
             self.url = url
@@ -270,7 +276,8 @@
         Private slot called when the selection changes.
         """
         if self.mode == "select":
-            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True)
+            self.buttonBox.button(
+                QDialogButtonBox.StandardButton.Ok).setEnabled(True)
     
     def __showError(self, msg):
         """

eric ide

mercurial