38 @param parent reference to the parent widget (QWidget) |
38 @param parent reference to the parent widget (QWidget) |
39 @exception ValueError raised to indicate an invalid dialog mode |
39 @exception ValueError raised to indicate an invalid dialog mode |
40 """ |
40 """ |
41 super(HgQueuesQueueManagementDialog, self).__init__(parent) |
41 super(HgQueuesQueueManagementDialog, self).__init__(parent) |
42 self.setupUi(self) |
42 self.setupUi(self) |
43 self.setWindowFlags(Qt.Window) |
43 self.setWindowFlags(Qt.WindowType.Window) |
44 |
44 |
45 if mode not in (HgQueuesQueueManagementDialog.NO_INPUT, |
45 if mode not in (HgQueuesQueueManagementDialog.NO_INPUT, |
46 HgQueuesQueueManagementDialog.NAME_INPUT, |
46 HgQueuesQueueManagementDialog.NAME_INPUT, |
47 HgQueuesQueueManagementDialog.QUEUE_INPUT): |
47 HgQueuesQueueManagementDialog.QUEUE_INPUT): |
48 raise ValueError("illegal value for mode") |
48 raise ValueError("illegal value for mode") |
55 self.inputFrame.setHidden( |
55 self.inputFrame.setHidden( |
56 mode != HgQueuesQueueManagementDialog.NAME_INPUT) |
56 mode != HgQueuesQueueManagementDialog.NAME_INPUT) |
57 self.selectLabel.setHidden( |
57 self.selectLabel.setHidden( |
58 mode != HgQueuesQueueManagementDialog.QUEUE_INPUT) |
58 mode != HgQueuesQueueManagementDialog.QUEUE_INPUT) |
59 if mode != HgQueuesQueueManagementDialog.QUEUE_INPUT: |
59 if mode != HgQueuesQueueManagementDialog.QUEUE_INPUT: |
60 self.queuesList.setSelectionMode(QAbstractItemView.NoSelection) |
60 self.queuesList.setSelectionMode( |
|
61 QAbstractItemView.SelectionMode.NoSelection) |
61 |
62 |
62 if mode == HgQueuesQueueManagementDialog.NO_INPUT: |
63 if mode == HgQueuesQueueManagementDialog.NO_INPUT: |
63 self.buttonBox.removeButton( |
64 self.buttonBox.removeButton( |
64 self.buttonBox.button(QDialogButtonBox.Ok)) |
65 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)) |
65 self.buttonBox.removeButton( |
66 self.buttonBox.removeButton( |
66 self.buttonBox.button(QDialogButtonBox.Cancel)) |
67 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel)) |
67 self.refreshButton = self.buttonBox.addButton( |
68 self.refreshButton = self.buttonBox.addButton( |
68 self.tr("Refresh"), QDialogButtonBox.ActionRole) |
69 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) |
69 self.refreshButton.setToolTip( |
70 self.refreshButton.setToolTip( |
70 self.tr("Press to refresh the queues list")) |
71 self.tr("Press to refresh the queues list")) |
71 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
72 self.buttonBox.button( |
|
73 QDialogButtonBox.StandardButton.Close).setDefault(True) |
72 else: |
74 else: |
73 self.buttonBox.removeButton( |
75 self.buttonBox.removeButton( |
74 self.buttonBox.button(QDialogButtonBox.Close)) |
76 self.buttonBox.button(QDialogButtonBox.StandardButton.Close)) |
75 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
77 self.buttonBox.button( |
|
78 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
76 self.refreshButton = None |
79 self.refreshButton = None |
77 |
80 |
78 self.setWindowTitle(title) |
81 self.setWindowTitle(title) |
79 |
82 |
80 self.show() |
83 self.show() |
117 Private slot to handle changes of the entered queue name. |
120 Private slot to handle changes of the entered queue name. |
118 |
121 |
119 @param txt text of the edit (string) |
122 @param txt text of the edit (string) |
120 """ |
123 """ |
121 if self.__mode == HgQueuesQueueManagementDialog.NAME_INPUT: |
124 if self.__mode == HgQueuesQueueManagementDialog.NAME_INPUT: |
122 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(txt != "") |
125 self.buttonBox.button( |
|
126 QDialogButtonBox.StandardButton.Ok).setEnabled(txt != "") |
123 |
127 |
124 @pyqtSlot() |
128 @pyqtSlot() |
125 def on_queuesList_itemSelectionChanged(self): |
129 def on_queuesList_itemSelectionChanged(self): |
126 """ |
130 """ |
127 Private slot to handle changes of selected queue names. |
131 Private slot to handle changes of selected queue names. |
128 """ |
132 """ |
129 if self.__mode == HgQueuesQueueManagementDialog.QUEUE_INPUT: |
133 if self.__mode == HgQueuesQueueManagementDialog.QUEUE_INPUT: |
130 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( |
134 self.buttonBox.button( |
131 len(self.queuesList.selectedItems()) > 0) |
135 QDialogButtonBox.StandardButton.Ok).setEnabled( |
|
136 len(self.queuesList.selectedItems()) > 0) |
132 |
137 |
133 @pyqtSlot(QAbstractButton) |
138 @pyqtSlot(QAbstractButton) |
134 def on_buttonBox_clicked(self, button): |
139 def on_buttonBox_clicked(self, button): |
135 """ |
140 """ |
136 Private slot called by a button of the button box clicked. |
141 Private slot called by a button of the button box clicked. |
137 |
142 |
138 @param button button that was clicked (QAbstractButton) |
143 @param button button that was clicked (QAbstractButton) |
139 """ |
144 """ |
140 if button == self.refreshButton: |
145 if button == self.refreshButton: |
141 self.refresh() |
146 self.refresh() |
142 elif button == self.buttonBox.button(QDialogButtonBox.Close): |
147 elif button == self.buttonBox.button( |
|
148 QDialogButtonBox.StandardButton.Close |
|
149 ): |
143 self.close() |
150 self.close() |
144 |
151 |
145 def refresh(self): |
152 def refresh(self): |
146 """ |
153 """ |
147 Public slot to refresh the list of queues. |
154 Public slot to refresh the list of queues. |