8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtCore import pyqtSlot, Qt, QCoreApplication |
10 from PyQt6.QtCore import pyqtSlot, Qt, QCoreApplication |
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton, QListWidgetItem |
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton, QListWidgetItem |
12 |
12 |
13 from EricWidgets import EricMessageBox |
13 from eric7.EricWidgets import EricMessageBox |
14 |
14 |
15 from .Ui_HgQueuesDefineGuardsDialog import Ui_HgQueuesDefineGuardsDialog |
15 from .Ui_HgQueuesDefineGuardsDialog import Ui_HgQueuesDefineGuardsDialog |
16 |
16 |
17 import UI.PixmapCache |
17 from eric7.EricGui import EricPixmapCache |
18 |
18 |
19 |
19 |
20 class HgQueuesDefineGuardsDialog(QDialog, Ui_HgQueuesDefineGuardsDialog): |
20 class HgQueuesDefineGuardsDialog(QDialog, Ui_HgQueuesDefineGuardsDialog): |
21 """ |
21 """ |
22 Class implementing a dialog to define guards for patches. |
22 Class implementing a dialog to define guards for patches. |
40 self.__hgClient = vcs.getClient() |
40 self.__hgClient = vcs.getClient() |
41 |
41 |
42 self.__patches = patchesList[:] |
42 self.__patches = patchesList[:] |
43 self.patchSelector.addItems([""] + self.__patches) |
43 self.patchSelector.addItems([""] + self.__patches) |
44 |
44 |
45 self.plusButton.setIcon(UI.PixmapCache.getIcon("plus")) |
45 self.plusButton.setIcon(EricPixmapCache.getIcon("plus")) |
46 self.minusButton.setIcon(UI.PixmapCache.getIcon("minus")) |
46 self.minusButton.setIcon(EricPixmapCache.getIcon("minus")) |
47 |
47 |
48 self.__dirtyList = False |
48 self.__dirtyList = False |
49 self.__currentPatch = "" |
49 self.__currentPatch = "" |
50 |
50 |
51 self.show() |
51 self.show() |
128 patchName, guards = output.split(":", 1) |
128 patchName, guards = output.split(":", 1) |
129 self.patchNameLabel.setText(patchName) |
129 self.patchNameLabel.setText(patchName) |
130 guardsList = guards.strip().split() |
130 guardsList = guards.strip().split() |
131 for guard in guardsList: |
131 for guard in guardsList: |
132 if guard.startswith("+"): |
132 if guard.startswith("+"): |
133 icon = UI.PixmapCache.getIcon("plus") |
133 icon = EricPixmapCache.getIcon("plus") |
134 guard = guard[1:] |
134 guard = guard[1:] |
135 sign = "+" |
135 sign = "+" |
136 elif guard.startswith("-"): |
136 elif guard.startswith("-"): |
137 icon = UI.PixmapCache.getIcon("minus") |
137 icon = EricPixmapCache.getIcon("minus") |
138 guard = guard[1:] |
138 guard = guard[1:] |
139 sign = "-" |
139 sign = "-" |
140 else: |
140 else: |
141 continue |
141 continue |
142 itm = QListWidgetItem(icon, guard, self.guardsList) |
142 itm = QListWidgetItem(icon, guard, self.guardsList) |
179 Private slot to add a guard definition to the list or change it. |
179 Private slot to add a guard definition to the list or change it. |
180 """ |
180 """ |
181 guard = self.guardCombo.currentText() |
181 guard = self.guardCombo.currentText() |
182 if self.plusButton.isChecked(): |
182 if self.plusButton.isChecked(): |
183 sign = "+" |
183 sign = "+" |
184 icon = UI.PixmapCache.getIcon("plus") |
184 icon = EricPixmapCache.getIcon("plus") |
185 else: |
185 else: |
186 sign = "-" |
186 sign = "-" |
187 icon = UI.PixmapCache.getIcon("minus") |
187 icon = EricPixmapCache.getIcon("minus") |
188 |
188 |
189 guardItem = self.__getGuard(guard) |
189 guardItem = self.__getGuard(guard) |
190 if guardItem: |
190 if guardItem: |
191 # guard already exists, remove it first |
191 # guard already exists, remove it first |
192 row = self.guardsList.row(guardItem) |
192 row = self.guardsList.row(guardItem) |