12 import shutil |
12 import shutil |
13 |
13 |
14 from PyQt6.QtCore import pyqtSlot, Qt |
14 from PyQt6.QtCore import pyqtSlot, Qt |
15 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem |
15 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem |
16 |
16 |
17 from E5Gui import E5MessageBox |
17 from E5Gui import EricMessageBox |
18 |
18 |
19 from .Ui_QtHelpDocumentationSelectionDialog import ( |
19 from .Ui_QtHelpDocumentationSelectionDialog import ( |
20 Ui_QtHelpDocumentationSelectionDialog |
20 Ui_QtHelpDocumentationSelectionDialog |
21 ) |
21 ) |
22 |
22 |
84 @pyqtSlot() |
84 @pyqtSlot() |
85 def on_deleteButton_clicked(self): |
85 def on_deleteButton_clicked(self): |
86 """ |
86 """ |
87 Private slot to delete the selected documentation sets. |
87 Private slot to delete the selected documentation sets. |
88 """ |
88 """ |
89 yes = E5MessageBox.yesNo( |
89 yes = EricMessageBox.yesNo( |
90 self, |
90 self, |
91 self.tr("Delete Documentation Sets"), |
91 self.tr("Delete Documentation Sets"), |
92 self.tr("""Shall the selected documentation sets really be""" |
92 self.tr("""Shall the selected documentation sets really be""" |
93 """ deleted?""")) |
93 """ deleted?""")) |
94 if yes: |
94 if yes: |
100 category = itm.parent() |
100 category = itm.parent() |
101 fileName = itm.data(0, Qt.ItemDataRole.UserRole) |
101 fileName = itm.data(0, Qt.ItemDataRole.UserRole) |
102 try: |
102 try: |
103 os.remove(fileName) |
103 os.remove(fileName) |
104 except OSError as err: |
104 except OSError as err: |
105 E5MessageBox.warning( |
105 EricMessageBox.warning( |
106 self, |
106 self, |
107 self.tr("Delete Documentation Sets"), |
107 self.tr("Delete Documentation Sets"), |
108 self.tr("""<p>The documentation set <b>{0}</b> could""" |
108 self.tr("""<p>The documentation set <b>{0}</b> could""" |
109 """ not be deleted.</p><p>Reason: {1}</p>""") |
109 """ not be deleted.</p><p>Reason: {1}</p>""") |
110 .format(fileName, str(err))) |
110 .format(fileName, str(err))) |
119 @pyqtSlot() |
119 @pyqtSlot() |
120 def on_deleteCategoryButton_clicked(self): |
120 def on_deleteCategoryButton_clicked(self): |
121 """ |
121 """ |
122 Private slot to delete the selected documentation set categories. |
122 Private slot to delete the selected documentation set categories. |
123 """ |
123 """ |
124 yes = E5MessageBox.yesNo( |
124 yes = EricMessageBox.yesNo( |
125 self, |
125 self, |
126 self.tr("Delete Documentation Sets"), |
126 self.tr("Delete Documentation Sets"), |
127 self.tr("""Shall the selected documentation set categories""" |
127 self.tr("""Shall the selected documentation set categories""" |
128 """ really be deleted?""")) |
128 """ really be deleted?""")) |
129 if yes: |
129 if yes: |
137 @pyqtSlot() |
137 @pyqtSlot() |
138 def on_deleteAllButton_clicked(self): |
138 def on_deleteAllButton_clicked(self): |
139 """ |
139 """ |
140 Private slot to delete all documentation sets. |
140 Private slot to delete all documentation sets. |
141 """ |
141 """ |
142 yes = E5MessageBox.yesNo( |
142 yes = EricMessageBox.yesNo( |
143 self, |
143 self, |
144 self.tr("Delete Documentation Sets"), |
144 self.tr("Delete Documentation Sets"), |
145 self.tr("""Shall all documentation sets really be deleted?""")) |
145 self.tr("""Shall all documentation sets really be deleted?""")) |
146 if yes: |
146 if yes: |
147 categories = [] |
147 categories = [] |