eric6/Plugins/VcsPlugins/vcsSubversion/SvnRepoBrowserDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnRepoBrowserDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnRepoBrowserDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -40,10 +40,10 @@
         """
         super(SvnRepoBrowserDialog, self).__init__(parent)
         self.setupUi(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
@@ -54,16 +54,18 @@
         self.__process.readyReadStandardError.connect(self.__readStderr)
         
         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.intercept = False
         
@@ -82,7 +84,7 @@
         """
         if (
             self.__process is not None and
-            self.__process.state() != QProcess.NotRunning
+            self.__process.state() != QProcess.ProcessState.NotRunning
         ):
             self.__process.terminate()
             QTimer.singleShot(2000, self.__process.kill)
@@ -102,7 +104,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, repopath, revision, author, size, date,
@@ -131,25 +134,26 @@
             sz = int(size)
         
         itm = QTreeWidgetItem(self.parentItem)
-        itm.setData(0, Qt.DisplayRole, path)
-        itm.setData(1, Qt.DisplayRole, rev)
-        itm.setData(2, Qt.DisplayRole, author)
-        itm.setData(3, Qt.DisplayRole, sz)
-        itm.setData(4, Qt.DisplayRole, date)
+        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, sz)
+        itm.setData(4, Qt.ItemDataRole.DisplayRole, date)
         
         if nodekind == "dir":
             itm.setIcon(0, self.__dirIcon)
-            itm.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator)
+            itm.setChildIndicatorPolicy(
+                QTreeWidgetItem.ChildIndicatorPolicy.ShowIndicator)
         elif nodekind == "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
     
@@ -296,13 +300,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 index of the current item
+        @type int
         """
+        text = self.urlCombo.itemText(index)
         url = self.__normalizeUrl(text)
         if url != self.url:
             self.url = url
@@ -336,7 +342,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 accept(self):
         """
@@ -366,7 +373,7 @@
         """
         if (
             self.__process is not None and
-            self.__process.state() != QProcess.NotRunning
+            self.__process.state() != QProcess.ProcessState.NotRunning
         ):
             self.__process.terminate()
             QTimer.singleShot(2000, self.__process.kill)
@@ -395,7 +402,8 @@
         the contents pane.
         """
         if self.__process is not None:
-            self.__process.setReadChannel(QProcess.StandardOutput)
+            self.__process.setReadChannel(
+                QProcess.ProcessChannel.StandardOutput)
             
             while self.__process.canReadLine():
                 s = str(self.__process.readLine(),
@@ -452,9 +460,9 @@
         @param isOn flag indicating the status of the check box (boolean)
         """
         if isOn:
-            self.input.setEchoMode(QLineEdit.Password)
+            self.input.setEchoMode(QLineEdit.EchoMode.Password)
         else:
-            self.input.setEchoMode(QLineEdit.Normal)
+            self.input.setEchoMode(QLineEdit.EchoMode.Normal)
     
     @pyqtSlot()
     def on_sendButton_clicked(self):

eric ide

mercurial