10 import copy |
10 import copy |
11 |
11 |
12 from PyQt6.QtCore import Qt, pyqtSlot |
12 from PyQt6.QtCore import Qt, pyqtSlot |
13 from PyQt6.QtWidgets import QDialog |
13 from PyQt6.QtWidgets import QDialog |
14 |
14 |
15 from E5Gui import E5MessageBox |
15 from E5Gui import EricMessageBox |
16 |
16 |
17 from .Ui_ToolGroupConfigurationDialog import Ui_ToolGroupConfigurationDialog |
17 from .Ui_ToolGroupConfigurationDialog import Ui_ToolGroupConfigurationDialog |
18 |
18 |
19 |
19 |
20 class ToolGroupConfigurationDialog(QDialog, Ui_ToolGroupConfigurationDialog): |
20 class ToolGroupConfigurationDialog(QDialog, Ui_ToolGroupConfigurationDialog): |
54 Private slot to add a new entry. |
54 Private slot to add a new entry. |
55 """ |
55 """ |
56 groupName = self.nameEdit.text() |
56 groupName = self.nameEdit.text() |
57 |
57 |
58 if not groupName: |
58 if not groupName: |
59 E5MessageBox.critical( |
59 EricMessageBox.critical( |
60 self, |
60 self, |
61 self.tr("Add tool group entry"), |
61 self.tr("Add tool group entry"), |
62 self.tr("You have to give a name for the group to add.")) |
62 self.tr("You have to give a name for the group to add.")) |
63 return |
63 return |
64 |
64 |
65 if len(self.groupsList.findItems( |
65 if len(self.groupsList.findItems( |
66 groupName, Qt.MatchFlag.MatchExactly)): |
66 groupName, Qt.MatchFlag.MatchExactly)): |
67 E5MessageBox.critical( |
67 EricMessageBox.critical( |
68 self, |
68 self, |
69 self.tr("Add tool group entry"), |
69 self.tr("Add tool group entry"), |
70 self.tr("An entry for the group name {0} already exists.") |
70 self.tr("An entry for the group name {0} already exists.") |
71 .format(groupName)) |
71 .format(groupName)) |
72 return |
72 return |
84 return |
84 return |
85 |
85 |
86 groupName = self.nameEdit.text() |
86 groupName = self.nameEdit.text() |
87 |
87 |
88 if not groupName: |
88 if not groupName: |
89 E5MessageBox.critical( |
89 EricMessageBox.critical( |
90 self, |
90 self, |
91 self.tr("Add tool group entry"), |
91 self.tr("Add tool group entry"), |
92 self.tr("You have to give a name for the group to add.")) |
92 self.tr("You have to give a name for the group to add.")) |
93 return |
93 return |
94 |
94 |
95 if len(self.groupsList.findItems( |
95 if len(self.groupsList.findItems( |
96 groupName, Qt.MatchFlag.MatchExactly)): |
96 groupName, Qt.MatchFlag.MatchExactly)): |
97 E5MessageBox.critical( |
97 EricMessageBox.critical( |
98 self, |
98 self, |
99 self.tr("Add tool group entry"), |
99 self.tr("Add tool group entry"), |
100 self.tr("An entry for the group name {0} already exists.") |
100 self.tr("An entry for the group name {0} already exists.") |
101 .format(groupName)) |
101 .format(groupName)) |
102 return |
102 return |
111 """ |
111 """ |
112 row = self.groupsList.currentRow() |
112 row = self.groupsList.currentRow() |
113 if row < 0: |
113 if row < 0: |
114 return |
114 return |
115 |
115 |
116 res = E5MessageBox.yesNo( |
116 res = EricMessageBox.yesNo( |
117 self, |
117 self, |
118 self.tr("Delete tool group entry"), |
118 self.tr("Delete tool group entry"), |
119 self.tr("""<p>Do you really want to delete the tool group""" |
119 self.tr("""<p>Do you really want to delete the tool group""" |
120 """ <b>"{0}"</b>?</p>""") |
120 """ <b>"{0}"</b>?</p>""") |
121 .format(self.groupsList.currentItem().text()), |
121 .format(self.groupsList.currentItem().text()), |
122 icon=E5MessageBox.Warning) |
122 icon=EricMessageBox.Warning) |
123 if not res: |
123 if not res: |
124 return |
124 return |
125 |
125 |
126 if row == self.currentGroup: |
126 if row == self.currentGroup: |
127 # set to default group if current group gets deleted |
127 # set to default group if current group gets deleted |