src/eric7/Project/ProjectBrowserModel.py

branch
eric7
changeset 10398
ef1ea18994d5
parent 10378
cbbcecf9b25e
child 10430
e440aaf179ce
diff -r f60464a5f7ea -r ef1ea18994d5 src/eric7/Project/ProjectBrowserModel.py
--- a/src/eric7/Project/ProjectBrowserModel.py	Sun Dec 10 17:49:42 2023 +0100
+++ b/src/eric7/Project/ProjectBrowserModel.py	Mon Dec 11 10:30:24 2023 +0100
@@ -15,13 +15,13 @@
 from PyQt6.QtGui import QColor
 
 from eric7 import Preferences
-from eric7.EricGui import EricPixmapCache
 from eric7.SystemUtilities import FileSystemUtilities
 from eric7.UI.BrowserModel import (
     BrowserDirectoryItem,
     BrowserFileItem,
     BrowserItem,
     BrowserModel,
+    BrowserSimpleDirectoryItem,
 )
 from eric7.Utilities import ModuleParser
 
@@ -100,7 +100,9 @@
         self._projectTypes.append(type_)
 
 
-class ProjectBrowserSimpleDirectoryItem(BrowserItem, ProjectBrowserItemMixin):
+class ProjectBrowserSimpleDirectoryItem(
+    BrowserSimpleDirectoryItem, ProjectBrowserItemMixin
+):
     """
     Class implementing the data structure for project browser simple directory
     items.
@@ -115,61 +117,10 @@
         @param text text to be displayed (string)
         @param path path of the directory (string)
         """
-        BrowserItem.__init__(self, parent, text)
+        BrowserSimpleDirectoryItem.__init__(self, parent, text, path=path)
         ProjectBrowserItemMixin.__init__(self, projectType)
 
-        self._dirName = path
-        if not os.path.isdir(self._dirName):
-            self._dirName = os.path.dirname(self._dirName)
-
         self.type_ = ProjectBrowserItemSimpleDirectory
-        if os.path.lexists(self._dirName) and os.path.islink(self._dirName):
-            self.symlink = True
-            self.icon = EricPixmapCache.getSymlinkIcon("dirClosed")
-        else:
-            self.icon = EricPixmapCache.getIcon("dirClosed")
-
-    def setName(self, dinfo, full=True):  # noqa: U100
-        """
-        Public method to set the directory name.
-
-        @param dinfo dinfo is the string for the directory (string)
-        @param full flag indicating full path name should be displayed (boolean)
-        """
-        self._dirName = os.path.abspath(dinfo)
-        self.itemData[0] = os.path.basename(self._dirName)
-
-    def dirName(self):
-        """
-        Public method returning the directory name.
-
-        @return directory name (string)
-        """
-        return self._dirName
-
-    def name(self):
-        """
-        Public method to return the name of the item.
-
-        @return name of the item (string)
-        """
-        return self._dirName
-
-    def lessThan(self, other, column, order):
-        """
-        Public method to check, if the item is less than the other one.
-
-        @param other reference to item to compare against (BrowserItem)
-        @param column column number to use for the comparison (integer)
-        @param order sort order (Qt.SortOrder) (for special sorting)
-        @return true, if this item is less than other (boolean)
-        """
-        if issubclass(other.__class__, BrowserFileItem) and Preferences.getUI(
-            "BrowsersListFoldersFirst"
-        ):
-            return order == Qt.SortOrder.AscendingOrder
-
-        return BrowserItem.lessThan(self, other, column, order)
 
 
 class ProjectBrowserDirectoryItem(BrowserDirectoryItem, ProjectBrowserItemMixin):

eric ide

mercurial