53 self.fileNameEdit.returnPressed.connect( |
53 self.fileNameEdit.returnPressed.connect( |
54 self.on_fileNameEdit_returnPressed) |
54 self.on_fileNameEdit_returnPressed) |
55 self.installEventFilter(self) |
55 self.installEventFilter(self) |
56 |
56 |
57 self.stopButton = self.buttonBox.addButton( |
57 self.stopButton = self.buttonBox.addButton( |
58 self.tr("Stop"), QDialogButtonBox.ActionRole) |
58 self.tr("Stop"), QDialogButtonBox.ButtonRole.ActionRole) |
59 self.project = project |
59 self.project = project |
60 |
60 |
61 def eventFilter(self, source, event): |
61 def eventFilter(self, source, event): |
62 """ |
62 """ |
63 Public method to handle event for another object. |
63 Public method to handle event for another object. |
67 @param event event to handle |
67 @param event event to handle |
68 @type QEvent |
68 @type QEvent |
69 @return flag indicating that the event was handled |
69 @return flag indicating that the event was handled |
70 @rtype bool |
70 @rtype bool |
71 """ |
71 """ |
72 if event.type() == QEvent.KeyPress: |
72 if event.type() == QEvent.Type.KeyPress: |
73 |
73 |
74 # Anywhere in the dialog, make hitting escape cancel it |
74 # Anywhere in the dialog, make hitting escape cancel it |
75 if event.key() == Qt.Key_Escape: |
75 if event.key() == Qt.Key.Key_Escape: |
76 self.close() |
76 self.close() |
77 |
77 |
78 # Anywhere in the dialog, make hitting up/down choose next item |
78 # Anywhere in the dialog, make hitting up/down choose next item |
79 # Note: This doesn't really do anything, as other than the text |
79 # Note: This doesn't really do anything, as other than the text |
80 # input there's nothing that doesn't handle up/down already. |
80 # input there's nothing that doesn't handle up/down already. |
81 elif event.key() == Qt.Key_Up or event.key() == Qt.Key_Down: |
81 elif ( |
|
82 event.key() == Qt.Key.Key_Up or |
|
83 event.key() == Qt.Key.Key_Down |
|
84 ): |
82 current = self.fileList.currentItem() |
85 current = self.fileList.currentItem() |
83 index = self.fileList.indexOfTopLevelItem(current) |
86 index = self.fileList.indexOfTopLevelItem(current) |
84 if event.key() == Qt.Key_Up: |
87 if event.key() == Qt.Key.Key_Up: |
85 if index != 0: |
88 if index != 0: |
86 self.fileList.setCurrentItem( |
89 self.fileList.setCurrentItem( |
87 self.fileList.topLevelItem(index - 1)) |
90 self.fileList.topLevelItem(index - 1)) |
88 else: |
91 else: |
89 if index < (self.fileList.topLevelItemCount() - 1): |
92 if index < (self.fileList.topLevelItemCount() - 1): |
97 |
100 |
98 @param button button that was clicked (QAbstractButton) |
101 @param button button that was clicked (QAbstractButton) |
99 """ |
102 """ |
100 if button == self.stopButton: |
103 if button == self.stopButton: |
101 self.shouldStop = True |
104 self.shouldStop = True |
102 elif button == self.buttonBox.button(QDialogButtonBox.Open): |
105 elif ( |
|
106 button == |
|
107 self.buttonBox.button(QDialogButtonBox.StandardButton.Open) |
|
108 ): |
103 self.__openFile() |
109 self.__openFile() |
104 |
110 |
105 def __openFile(self, itm=None): |
111 def __openFile(self, itm=None): |
106 """ |
112 """ |
107 Private slot to open a file. |
113 Private slot to open a file. |
220 os.path.dirname(name)]) |
226 os.path.dirname(name)]) |
221 QApplication.processEvents() |
227 QApplication.processEvents() |
222 |
228 |
223 del locations |
229 del locations |
224 self.stopButton.setEnabled(False) |
230 self.stopButton.setEnabled(False) |
225 self.fileList.header().resizeSections(QHeaderView.ResizeToContents) |
231 self.fileList.header().resizeSections( |
|
232 QHeaderView.ResizeMode.ResizeToContents) |
226 self.fileList.header().setStretchLastSection(True) |
233 self.fileList.header().setStretchLastSection(True) |
227 |
234 |
228 if found: |
235 if found: |
229 self.fileList.setCurrentItem(self.fileList.topLevelItem(0)) |
236 self.fileList.setCurrentItem(self.fileList.topLevelItem(0)) |
230 |
237 |
261 Private slot handling a change of the current item. |
268 Private slot handling a change of the current item. |
262 |
269 |
263 @param current current item (QTreeWidgetItem) |
270 @param current current item (QTreeWidgetItem) |
264 @param previous prevoius current item (QTreeWidgetItem) |
271 @param previous prevoius current item (QTreeWidgetItem) |
265 """ |
272 """ |
266 self.buttonBox.button(QDialogButtonBox.Open).setEnabled( |
273 self.buttonBox.button(QDialogButtonBox.StandardButton.Open).setEnabled( |
267 current is not None) |
274 current is not None) |
268 |
275 |
269 def show(self): |
276 def show(self): |
270 """ |
277 """ |
271 Public method to enable/disable the project checkbox. |
278 Public method to enable/disable the project checkbox. |