17 |
17 |
18 class HgQueuesListGuardsDialog(QDialog, Ui_HgQueuesListGuardsDialog): |
18 class HgQueuesListGuardsDialog(QDialog, Ui_HgQueuesListGuardsDialog): |
19 """ |
19 """ |
20 Class implementing a dialog to show the guards of a selected patch. |
20 Class implementing a dialog to show the guards of a selected patch. |
21 """ |
21 """ |
|
22 |
22 def __init__(self, vcs, patchesList, parent=None): |
23 def __init__(self, vcs, patchesList, parent=None): |
23 """ |
24 """ |
24 Constructor |
25 Constructor |
25 |
26 |
26 @param vcs reference to the vcs object |
27 @param vcs reference to the vcs object |
27 @param patchesList list of patches (list of strings) |
28 @param patchesList list of patches (list of strings) |
28 @param parent reference to the parent widget (QWidget) |
29 @param parent reference to the parent widget (QWidget) |
29 """ |
30 """ |
30 super().__init__(parent) |
31 super().__init__(parent) |
31 self.setupUi(self) |
32 self.setupUi(self) |
32 self.setWindowFlags(Qt.WindowType.Window) |
33 self.setWindowFlags(Qt.WindowType.Window) |
33 |
34 |
34 self.vcs = vcs |
35 self.vcs = vcs |
35 self.__hgClient = vcs.getClient() |
36 self.__hgClient = vcs.getClient() |
36 |
37 |
37 self.patchSelector.addItems([""] + patchesList) |
38 self.patchSelector.addItems([""] + patchesList) |
38 |
39 |
39 self.show() |
40 self.show() |
40 QCoreApplication.processEvents() |
41 QCoreApplication.processEvents() |
41 |
42 |
42 def closeEvent(self, e): |
43 def closeEvent(self, e): |
43 """ |
44 """ |
44 Protected slot implementing a close event handler. |
45 Protected slot implementing a close event handler. |
45 |
46 |
46 @param e close event (QCloseEvent) |
47 @param e close event (QCloseEvent) |
47 """ |
48 """ |
48 if self.__hgClient.isExecuting(): |
49 if self.__hgClient.isExecuting(): |
49 self.__hgClient.cancel() |
50 self.__hgClient.cancel() |
50 |
51 |
51 e.accept() |
52 e.accept() |
52 |
53 |
53 def start(self): |
54 def start(self): |
54 """ |
55 """ |
55 Public slot to start the list command. |
56 Public slot to start the list command. |
56 """ |
57 """ |
57 self.on_patchSelector_activated(0) |
58 self.on_patchSelector_activated(0) |
58 |
59 |
59 @pyqtSlot(int) |
60 @pyqtSlot(int) |
60 def on_patchSelector_activated(self, index): |
61 def on_patchSelector_activated(self, index): |
61 """ |
62 """ |
62 Private slot to get the list of guards for the given patch name. |
63 Private slot to get the list of guards for the given patch name. |
63 |
64 |
64 @param index index of the selected entry |
65 @param index index of the selected entry |
65 @type int |
66 @type int |
66 """ |
67 """ |
67 patch = self.patchSelector.itemText(index) |
68 patch = self.patchSelector.itemText(index) |
68 self.guardsList.clear() |
69 self.guardsList.clear() |
69 self.patchNameLabel.setText("") |
70 self.patchNameLabel.setText("") |
70 |
71 |
71 args = self.vcs.initCommand("qguard") |
72 args = self.vcs.initCommand("qguard") |
72 if patch: |
73 if patch: |
73 args.append(patch) |
74 args.append(patch) |
74 |
75 |
75 output = self.__hgClient.runcommand(args)[0].strip() |
76 output = self.__hgClient.runcommand(args)[0].strip() |
76 |
77 |
77 if output: |
78 if output: |
78 patchName, guards = output.split(":", 1) |
79 patchName, guards = output.split(":", 1) |
79 self.patchNameLabel.setText(patchName) |
80 self.patchNameLabel.setText(patchName) |
80 guardsList = guards.strip().split() |
81 guardsList = guards.strip().split() |
81 for guard in guardsList: |
82 for guard in guardsList: |