eric7.Project.ProjectBrowserModel

Module implementing the browser model.

Global Attributes

None

Classes

ProjectBrowserDirectoryItem Class implementing the data structure for project browser directory items.
ProjectBrowserFileItem Class implementing the data structure for project browser file items.
ProjectBrowserItemMixin Class implementing common methods of project browser items.
ProjectBrowserModel Class implementing the project browser model.
ProjectBrowserSimpleDirectoryItem Class implementing the data structure for project browser simple directory items.

Functions

None


ProjectBrowserDirectoryItem

Class implementing the data structure for project browser directory items.

Derived from

BrowserDirectoryItem, ProjectBrowserItemMixin

Class Attributes

None

Class Methods

None

Methods

ProjectBrowserDirectoryItem Constructor

Static Methods

None

ProjectBrowserDirectoryItem (Constructor)

ProjectBrowserDirectoryItem(parent, dinfo, projectType, full=True, bold=False)

Constructor

parent (BrowserItem)
parent item
dinfo (str)
dinfo is the string for the directory
projectType (str)
type of file/directory in the project
full (bool)
flag indicating full pathname should be displayed
bold (bool)
flag indicating a highlighted font
Up


ProjectBrowserFileItem

Class implementing the data structure for project browser file items.

Derived from

BrowserFileItem, ProjectBrowserItemMixin

Class Attributes

None

Class Methods

None

Methods

ProjectBrowserFileItem Constructor

Static Methods

None

ProjectBrowserFileItem (Constructor)

ProjectBrowserFileItem(parent, finfo, projectType, full=True, bold=False, sourceLanguage="")

Constructor

parent (BrowserItem)
parent item
finfo (str)
the string for the file
projectType (str)
type of file/directory in the project
full (bool)
flag indicating full pathname should be displayed
bold (bool)
flag indicating a highlighted font
sourceLanguage (str)
source code language of the project
Up


ProjectBrowserItemMixin

Class implementing common methods of project browser items.

It is meant to be used as a mixin class.

Derived from

None

Class Attributes

None

Class Methods

None

Methods

ProjectBrowserItemMixin Constructor
addProjectType Public method to add a type to the list.
addVcsStatus Public method to add the VCS status.
getProjectTypes Public method to get the project type.
getTextColor Public method to get the items text color.
setVcsState Public method to set the items VCS state.
setVcsStatus Public method to set the VCS status.

Static Methods

None

ProjectBrowserItemMixin (Constructor)

ProjectBrowserItemMixin(type_, bold=False)

Constructor

type_ (str)
type of file/directory in the project
bold (bool)
flag indicating a highlighted font

ProjectBrowserItemMixin.addProjectType

addProjectType(type_)

Public method to add a type to the list.

type_ (str)
type to add to the list

ProjectBrowserItemMixin.addVcsStatus

addVcsStatus(vcsStatus)

Public method to add the VCS status.

vcsStatus (str)
VCS status text

ProjectBrowserItemMixin.getProjectTypes

getProjectTypes()

Public method to get the project type.

Return:
project type
Return Type:
str

ProjectBrowserItemMixin.getTextColor

getTextColor()

Public method to get the items text color.

Return:
text color
Return Type:
QColor

ProjectBrowserItemMixin.setVcsState

setVcsState(state)

Public method to set the items VCS state.

state (str)
VCS state (one of A, C, M, U or " ")

ProjectBrowserItemMixin.setVcsStatus

setVcsStatus(vcsStatus)

Public method to set the VCS status.

vcsStatus (str)
VCS status text
Up


ProjectBrowserModel

Class implementing the project browser model.

Signals

vcsStateChanged(str)
emitted after the VCS state has changed

Derived from

BrowserModel

Class Attributes

None

Class Methods

None

Methods

ProjectBrowserModel Constructor
__addVCSStatus Private method used to set the vcs status of a node.
__changeParentsVCSState Private method to recursively change the parents VCS state.
__updateVCSStatus Private method used to update the vcs status of a node.
addNewItem Public method to add a new item to the model.
changeVCSStates Public slot to record the (non normal) VCS states.
data Public method to get data of an item.
entryCreated Public method to handle the creation of a file or directory.
entryDeleted Public method to handle the deletion of a file or directory.
findChildItem Public method to find a child item given some text.
findItem Public method to find an item given its name.
findParentItemByName Public method to find an item given its name.
itemIndexByName Public method to find an item's index given its name.
itemIndexByNameAndLine Public method to find an item's index given its name.
populateItem Public method to populate an item's subtree.
populateProjectDirectoryItem Public method to populate a directory item's subtree.
preferencesChanged Public method used to handle a change in preferences.
projectClosed Public method called after a project has been closed.
projectOpened Public method used to populate the model after a project has been opened.
projectPropertiesChanged Public method to react on a change of the project properties.
removeItem Public method to remove a named item.
renameItem Public method to rename an item.
repopulateItem Public method to repopulate an item.
setProjectBrowserReference Public method to set a reference to the project browser instance.
startFileSystemMonitoring Public method to (re)start monitoring the project file system.
stopFileSystemMonitoring Public method to stop monitoring the project file system.
updateVCSStatus Public method used to update the vcs status of a node.

Static Methods

None

ProjectBrowserModel (Constructor)

ProjectBrowserModel(parent)

Constructor

parent (Project.Project)
reference to parent object

ProjectBrowserModel.__addVCSStatus

__addVCSStatus(item, name)

Private method used to set the vcs status of a node.

item (BrowserItem)
item to work on
name (str)
filename belonging to this item

ProjectBrowserModel.__changeParentsVCSState

__changeParentsVCSState(path, itemCache)

Private method to recursively change the parents VCS state.

path (str)
pathname of parent item
itemCache (dict)
reference to the item cache used to store references to named items

ProjectBrowserModel.__updateVCSStatus

__updateVCSStatus(item, name, recursive=True)

Private method used to update the vcs status of a node.

item (BrowserItem)
item to work on
name (str)
filename belonging to this item
recursive (bool)
flag indicating a recursive update

ProjectBrowserModel.addNewItem

addNewItem(typeString, name, additionalTypeStrings=None)

Public method to add a new item to the model.

typeString (str)
string denoting the type of the new item
name (str)
name of the new item
additionalTypeStrings (list of str)
names of additional types

ProjectBrowserModel.changeVCSStates

changeVCSStates(statesList)

Public slot to record the (non normal) VCS states.

statesList (list of str)
list of VCS state entries giving the states in the first column and the path relative to the project directory starting with the third column. The allowed status flags are:

ProjectBrowserModel.data

data(index, role)

Public method to get data of an item.

index (QModelIndex)
index of the data to retrieve
role (Qt.ItemDataRole)
role of data
Return:
requested data
Return Type:
Any

ProjectBrowserModel.entryCreated

entryCreated(path, isDir=False)

Public method to handle the creation of a file or directory.

path (str)
path of the created file or directory
isDir (bool (optional))
flag indicating a created directory (defaults to False)

ProjectBrowserModel.entryDeleted

entryDeleted(path, isDir=False)

Public method to handle the deletion of a file or directory.

path (str)
path of the deleted file or directory
isDir (bool (optional))
flag indicating a deleted directory (defaults to False)

ProjectBrowserModel.findChildItem

findChildItem(text, column, parentItem=None)

Public method to find a child item given some text.

text (str)
text to search for
column (int)
column to search in
parentItem (BrowserItem)
reference to parent item
Return:
reference to the item found
Return Type:
BrowserItem

ProjectBrowserModel.findItem

findItem(name)

Public method to find an item given its name.

name (str)
name of the item
Return:
reference to the item found
Return Type:
BrowserItem

ProjectBrowserModel.findParentItemByName

findParentItemByName(type_, name, dontSplit=False)

Public method to find an item given its name.

Note: This method creates all necessary parent items, if they don't exist.

type_ (str)
type of the item
name (str)
name of the item
dontSplit (bool)
flag indicating the name should not be split
Return:
reference to the item found and the new display name
Return Type:
str

ProjectBrowserModel.itemIndexByName

itemIndexByName(name)

Public method to find an item's index given its name.

name (str)
name of the item
Return:
index of the item found
Return Type:
QModelIndex

ProjectBrowserModel.itemIndexByNameAndLine

itemIndexByNameAndLine(name, lineno)

Public method to find an item's index given its name.

name (str)
name of the item
lineno (int)
one based line number of the item
Return:
index of the item found
Return Type:
QModelIndex

ProjectBrowserModel.populateItem

populateItem(parentItem, repopulate=False)

Public method to populate an item's subtree.

parentItem (BrowserItem)
reference to the item to be populated
repopulate (bool)
flag indicating a repopulation

ProjectBrowserModel.populateProjectDirectoryItem

populateProjectDirectoryItem(parentItem, repopulate=False)

Public method to populate a directory item's subtree.

parentItem (BrowserItem)
reference to the directory item to be populated
repopulate (bool)
flag indicating a repopulation

ProjectBrowserModel.preferencesChanged

preferencesChanged()

Public method used to handle a change in preferences.

ProjectBrowserModel.projectClosed

projectClosed()

Public method called after a project has been closed.

ProjectBrowserModel.projectOpened

projectOpened()

Public method used to populate the model after a project has been opened.

ProjectBrowserModel.projectPropertiesChanged

projectPropertiesChanged()

Public method to react on a change of the project properties.

ProjectBrowserModel.removeItem

removeItem(name)

Public method to remove a named item.

name (str)
file or directory name of the item

ProjectBrowserModel.renameItem

renameItem(name, newFilename)

Public method to rename an item.

name (str)
the old display name
newFilename (str)
new filename of the item

ProjectBrowserModel.repopulateItem

repopulateItem(name)

Public method to repopulate an item.

name (str)
name of the file relative to the project root

ProjectBrowserModel.setProjectBrowserReference

setProjectBrowserReference(projectBrowser)

Public method to set a reference to the project browser instance.

projectBrowser (ProjectBrowser)
reference to the project browser instance

ProjectBrowserModel.startFileSystemMonitoring

startFileSystemMonitoring()

Public method to (re)start monitoring the project file system.

ProjectBrowserModel.stopFileSystemMonitoring

stopFileSystemMonitoring()

Public method to stop monitoring the project file system.

ProjectBrowserModel.updateVCSStatus

updateVCSStatus(name, recursive=True)

Public method used to update the vcs status of a node.

name (str)
filename belonging to this item
recursive (bool)
flag indicating a recursive update
Up


ProjectBrowserSimpleDirectoryItem

Class implementing the data structure for project browser simple directory items.

Derived from

BrowserSimpleDirectoryItem, ProjectBrowserItemMixin

Class Attributes

None

Class Methods

None

Methods

ProjectBrowserSimpleDirectoryItem Constructor

Static Methods

None

ProjectBrowserSimpleDirectoryItem (Constructor)

ProjectBrowserSimpleDirectoryItem(parent, projectType, text, path="")

Constructor

parent (BrowserItem)
parent item
projectType (str)
type of file/directory in the project
text (str)
text to be displayed
path (str)
path of the directory
Up