eric6/WebBrowser/QtHelp/QtHelpDocumentationSelectionDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/WebBrowser/QtHelp/QtHelpDocumentationSelectionDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/WebBrowser/QtHelp/QtHelpDocumentationSelectionDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -46,19 +46,22 @@
         self.setupUi(self)
         
         if mode == QtHelpDocumentationSelectionDialog.AddMode:
-            self.buttonBox.button(QDialogButtonBox.Close).hide()
+            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()
         
         for category in helpDocuments:
             parentItem = QTreeWidgetItem(self.documentationList, [category])
             for document in helpDocuments[category]:
                 item = QTreeWidgetItem(parentItem,
                                        [os.path.basename(document)])
-                item.setData(0, Qt.UserRole, document)
-                parentItem.setData(0, Qt.UserRole, os.path.dirname(document))
-        self.documentationList.sortItems(0, Qt.AscendingOrder)
+                item.setData(0, Qt.ItemDataRole.UserRole, document)
+                parentItem.setData(0, Qt.ItemDataRole.UserRole,
+                                   os.path.dirname(document))
+        self.documentationList.sortItems(0, Qt.SortOrder.AscendingOrder)
         
         self.on_documentationList_itemSelectionChanged()
     
@@ -95,7 +98,7 @@
                     continue
                 
                 category = itm.parent()
-                fileName = itm.data(0, Qt.UserRole)
+                fileName = itm.data(0, Qt.ItemDataRole.UserRole)
                 try:
                     os.remove(fileName)
                 except OSError as err:
@@ -155,7 +158,7 @@
         @param category reference to the category item
         @type QTreeWidgetItem
         """
-        categoryDir = category.data(0, Qt.UserRole)
+        categoryDir = category.data(0, Qt.ItemDataRole.UserRole)
         shutil.rmtree(categoryDir, True)
         
         self.documentationList.takeTopLevelItem(
@@ -175,11 +178,11 @@
                 # it is a category item; add all files of that category
                 for childIndex in range(item.childCount()):
                     child = item.child(childIndex)
-                    fileName = child.data(0, Qt.UserRole)
+                    fileName = child.data(0, Qt.ItemDataRole.UserRole)
                     if fileName:
                         documents.add(fileName)
             else:
-                fileName = item.data(0, Qt.UserRole)
+                fileName = item.data(0, Qt.ItemDataRole.UserRole)
                 if fileName:
                     documents.add(fileName)
         return documents

eric ide

mercurial