16 ) |
16 ) |
17 from PyQt6.QtWidgets import ( |
17 from PyQt6.QtWidgets import ( |
18 QTreeView, QApplication, QMenu, QDialog, QAbstractItemView |
18 QTreeView, QApplication, QMenu, QDialog, QAbstractItemView |
19 ) |
19 ) |
20 |
20 |
21 from E5Gui.E5Application import e5App |
21 from E5Gui.EricApplication import ericApp |
22 from E5Gui import E5MessageBox |
22 from E5Gui import EricMessageBox |
23 from E5Gui.E5OverrideCursor import E5OverrideCursor |
23 from E5Gui.EricOverrideCursor import EricOverrideCursor |
24 |
24 |
25 from UI.Browser import Browser |
25 from UI.Browser import Browser |
26 from UI.BrowserModel import BrowserDirectoryItem, BrowserFileItem |
26 from UI.BrowserModel import BrowserDirectoryItem, BrowserFileItem |
27 |
27 |
28 from .ProjectBrowserModel import ( |
28 from .ProjectBrowserModel import ( |
371 def _expandAllDirs(self): |
371 def _expandAllDirs(self): |
372 """ |
372 """ |
373 Protected slot to handle the 'Expand all directories' menu action. |
373 Protected slot to handle the 'Expand all directories' menu action. |
374 """ |
374 """ |
375 self._disconnectExpandedCollapsed() |
375 self._disconnectExpandedCollapsed() |
376 with E5OverrideCursor(): |
376 with EricOverrideCursor(): |
377 index = self.model().index(0, 0) |
377 index = self.model().index(0, 0) |
378 while index.isValid(): |
378 while index.isValid(): |
379 itm = self.model().item(index) |
379 itm = self.model().item(index) |
380 if ( |
380 if ( |
381 isinstance( |
381 isinstance( |
392 def _collapseAllDirs(self): |
392 def _collapseAllDirs(self): |
393 """ |
393 """ |
394 Protected slot to handle the 'Collapse all directories' menu action. |
394 Protected slot to handle the 'Collapse all directories' menu action. |
395 """ |
395 """ |
396 self._disconnectExpandedCollapsed() |
396 self._disconnectExpandedCollapsed() |
397 with E5OverrideCursor(): |
397 with EricOverrideCursor(): |
398 # step 1: find last valid index |
398 # step 1: find last valid index |
399 vindex = QModelIndex() |
399 vindex = QModelIndex() |
400 index = self.model().index(0, 0) |
400 index = self.model().index(0, 0) |
401 while index.isValid(): |
401 while index.isValid(): |
402 vindex = index |
402 vindex = index |
509 # expand all directories in order to iterate over all entries |
509 # expand all directories in order to iterate over all entries |
510 self._expandAllDirs() |
510 self._expandAllDirs() |
511 |
511 |
512 self.selectionModel().clear() |
512 self.selectionModel().clear() |
513 |
513 |
514 with E5OverrideCursor(): |
514 with EricOverrideCursor(): |
515 # now iterate over all entries |
515 # now iterate over all entries |
516 startIndex = None |
516 startIndex = None |
517 endIndex = None |
517 endIndex = None |
518 selectedEntries = 0 |
518 selectedEntries = 0 |
519 index = self.model().index(0, 0) |
519 index = self.model().index(0, 0) |
540 index = self.indexBelow(index) |
540 index = self.indexBelow(index) |
541 if startIndex is not None: |
541 if startIndex is not None: |
542 self._setItemRangeSelected(startIndex, endIndex, True) |
542 self._setItemRangeSelected(startIndex, endIndex, True) |
543 |
543 |
544 if selectedEntries == 0: |
544 if selectedEntries == 0: |
545 E5MessageBox.information( |
545 EricMessageBox.information( |
546 self, |
546 self, |
547 QCoreApplication.translate( |
547 QCoreApplication.translate( |
548 'ProjectBaseBrowser', "Select entries"), |
548 'ProjectBaseBrowser', "Select entries"), |
549 QCoreApplication.translate( |
549 QCoreApplication.translate( |
550 'ProjectBaseBrowser', |
550 'ProjectBaseBrowser', |