23 |
23 |
24 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor |
24 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor |
25 from eric7.EricWidgets import EricMessageBox |
25 from eric7.EricWidgets import EricMessageBox |
26 from eric7.EricWidgets.EricApplication import ericApp |
26 from eric7.EricWidgets.EricApplication import ericApp |
27 from eric7.UI.Browser import Browser |
27 from eric7.UI.Browser import Browser |
28 from eric7.UI.BrowserModel import BrowserDirectoryItem, BrowserFileItem |
28 from eric7.UI.BrowserModel import ( |
|
29 BrowserClassItem, |
|
30 BrowserDirectoryItem, |
|
31 BrowserFileItem, |
|
32 BrowserMethodItem, |
|
33 ) |
29 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
34 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
30 |
35 |
31 from .ProjectBrowserModel import ( |
36 from .ProjectBrowserModel import ( |
32 ProjectBrowserDirectoryItem, |
37 ProjectBrowserDirectoryItem, |
33 ProjectBrowserFileItem, |
38 ProjectBrowserFileItem, |
704 @return reference to the current item |
709 @return reference to the current item |
705 """ |
710 """ |
706 itm = self.model().item(self.currentIndex()) |
711 itm = self.model().item(self.currentIndex()) |
707 return itm |
712 return itm |
708 |
713 |
|
714 def currentDirectory(self, relative=False): |
|
715 """ |
|
716 Public method to determine the directory of the currently selected entry. |
|
717 |
|
718 @param relative flag indicating to return the directory as a relative path |
|
719 @type bool |
|
720 @return directory of the current entry |
|
721 @rtype str |
|
722 """ |
|
723 itm = self.model().item(self.currentIndex()) |
|
724 if isinstance( |
|
725 itm, (ProjectBrowserFileItem, BrowserClassItem, BrowserMethodItem) |
|
726 ): |
|
727 dn = os.path.dirname(itm.fileName()) |
|
728 elif isinstance( |
|
729 itm, (ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem) |
|
730 ): |
|
731 dn = itm.dirName() |
|
732 else: |
|
733 dn = "" |
|
734 |
|
735 if relative: |
|
736 dn = self.project.getRelativePath(dn) |
|
737 |
|
738 return dn |
|
739 |
709 def _keyboardSearchType(self, item): |
740 def _keyboardSearchType(self, item): |
710 """ |
741 """ |
711 Protected method to check, if the item is of the correct type. |
742 Protected method to check, if the item is of the correct type. |
712 |
743 |
713 @param item reference to the item |
744 @param item reference to the item |