# eric4.UI.BrowserModel

Module implementing the browser model.

### Global Attributes

BrowserItemAttribute
BrowserItemAttributes
BrowserItemClass
BrowserItemCoding
BrowserItemDirectory
BrowserItemFile
BrowserItemMethod
BrowserItemRoot
BrowserItemSysPath

### Classes

BrowserClassAttributeItem | Class implementing the data structure for browser class attribute items.
BrowserClassAttributesItem | Class implementing the data structure for browser class attributes items.
BrowserClassItem | Class implementing the data structure for browser class items.
BrowserCodingItem | Class implementing the data structure for browser coding items.
BrowserDirectoryItem | Class implementing the data structure for browser directory items.
BrowserFileItem | Class implementing the data structure for browser file items.
BrowserItem | Class implementing the data structure for browser items.
BrowserMethodItem | Class implementing the data structure for browser method items.
BrowserModel | Class implementing the browser model.
BrowserSysPathItem | Class implementing the data structure for browser sys.path items.

### Functions

None

## BrowserClassAttributeItem

Class implementing the data structure for browser class attribute items.

### Derived from

BrowserItem

### Class Attributes

None

### Class Methods

None

### Methods

BrowserClassAttributeItem | Constructor
attributeObject | Public method returning the class object.
fileName | Public method returning the filename.
isPublic | Public method returning the public visibility status.
lessThan | Public method to check, if the item is less than the other one.
lineno | Public method returning the line number defining this object.

### Static Methods

None

#### BrowserClassAttributeItem (Constructor)

BrowserClassAttributeItem(parent, attribute, isClass=False)

Constructor

parent
  parent item
attribute
  reference to the attribute object
isClass
  flag indicating a class attribute (boolean)

#### BrowserClassAttributeItem.attributeObject

attributeObject()

Public method returning the class object.

Returns:
  reference to the class object

#### BrowserClassAttributeItem.fileName

fileName()

Public method returning the filename.

Returns:
  filename (string)

#### BrowserClassAttributeItem.isPublic

isPublic()

Public method returning the public visibility status.

Returns:
  flag indicating public visibility (boolean)

#### BrowserClassAttributeItem.lessThan

lessThan(other, column, order)

Public method to check, if the item is less than the other one.

other
  reference to item to compare against (BrowserItem)
column
  column number to use for the comparison (integer)
order
  sort order (Qt.SortOrder) (for special sorting)

Returns:
  true, if this item is less than other (boolean)

#### BrowserClassAttributeItem.lineno

lineno()

Public method returning the line number defining this object.

return line number defining the object (integer)

Up

## BrowserClassAttributesItem

Class implementing the data structure for browser class attributes items.

### Derived from

BrowserItem

### Class Attributes

None

### Class Methods

None

### Methods

BrowserClassAttributesItem | Constructor
attributes | Public method returning the attribute list.
isClassAttributes | Public method returning the attributes type.
lessThan | Public method to check, if the item is less than the other one.

### Static Methods

None

#### BrowserClassAttributesItem (Constructor)

BrowserClassAttributesItem(parent, attributes, text, isClass=False)

Constructor

parent
  parent item
attributes
  list of attributes
text
  text to be shown by this item (QString)
isClass
  flag indicating class attributes (boolean)

#### BrowserClassAttributesItem.attributes

attributes()

Public method returning the attribute list.

Returns:
  reference to the list of attributes

#### BrowserClassAttributesItem.isClassAttributes

isClassAttributes()

Public method returning the attributes type.

Returns:
  flag indicating class attributes (boolean)

#### BrowserClassAttributesItem.lessThan

lessThan(other, column, order)

Public method to check, if the item is less than the other one.

other
  reference to item to compare against (BrowserItem)
column
  column number to use for the comparison (integer)
order
  sort order (Qt.SortOrder) (for special sorting)

Returns:
  true, if this item is less than other (boolean)

Up

## BrowserClassItem

Class implementing the data structure for browser class items.

### Derived from

BrowserItem

### Class Attributes

None

### Class Methods

None

### Methods

BrowserClassItem | Constructor
classObject | Public method returning the class object.
fileName | Public method returning the filename.
isPublic | Public method returning the public visibility status.
lessThan | Public method to check, if the item is less than the other one.
lineno | Public method returning the line number defining this object.

### Static Methods

None

#### BrowserClassItem (Constructor)

BrowserClassItem(parent, cl, filename)

Constructor

parent
  parent item
cl
  Class object to be shown
filename
  filename of the file defining this class

#### BrowserClassItem.classObject

classObject()

Public method returning the class object.

Returns:
  reference to the class object

#### BrowserClassItem.fileName

fileName()

Public method returning the filename.

Returns:
  filename (string)

#### BrowserClassItem.isPublic

isPublic()

Public method returning the public visibility status.

Returns:
  flag indicating public visibility (boolean)

#### BrowserClassItem.lessThan

lessThan(other, column, order)

Public method to check, if the item is less than the other one.

other
  reference to item to compare against (BrowserItem)
column
  column number to use for the comparison (integer)
order
  sort order (Qt.SortOrder) (for special sorting)

Returns:
  true, if this item is less than other (boolean)

#### BrowserClassItem.lineno

lineno()

Public method returning the line number defining this object.

return line number defining the object (integer)

Up

## BrowserCodingItem

Class implementing the data structure for browser coding items.

### Derived from

BrowserItem

### Class Attributes

None

### Class Methods

None

### Methods

BrowserCodingItem | Constructor
lessThan | Public method to check, if the item is less than the other one.

### Static Methods

None

#### BrowserCodingItem (Constructor)

BrowserCodingItem(parent, text)

Constructor

parent
  parent item
text
  text to be shown by this item (QString)

#### BrowserCodingItem.lessThan

lessThan(other, column, order)

Public method to check, if the item is less than the other one.

other
  reference to item to compare against (BrowserItem)
column
  column number to use for the comparison (integer)
order
  sort order (Qt.SortOrder) (for special sorting)

Returns:
  true, if this item is less than other (boolean)

Up

## BrowserDirectoryItem

Class implementing the data structure for browser directory items.

### Derived from

BrowserItem

### Class Attributes

None

### Class Methods

None

### Methods

BrowserDirectoryItem | Constructor
dirName | Public method returning the directory name.
lessThan | Public method to check, if the item is less than the other one.
name | Public method to return the name of the item.
setName | Public method to set the directory name.

### Static Methods

None

#### BrowserDirectoryItem (Constructor)

BrowserDirectoryItem(parent, dinfo, full = True)

Constructor

parent
  parent item
dinfo
  dinfo is the string for the directory (string or QString)
full
  flag indicating full pathname should be displayed (boolean)

#### BrowserDirectoryItem.dirName

dirName()

Public method returning the directory name.

Returns:
  directory name (string)

#### BrowserDirectoryItem.lessThan

lessThan(other, column, order)

Public method to check, if the item is less than the other one.

other
  reference to item to compare against (BrowserItem)
column
  column number to use for the comparison (integer)
order
  sort order (Qt.SortOrder) (for special sorting)

Returns:
  true, if this item is less than other (boolean)

#### BrowserDirectoryItem.name

name()

Public method to return the name of the item.

Returns:
  name of the item (string)

#### BrowserDirectoryItem.setName

setName(dinfo, full = True)

Public method to set the directory name.

dinfo
  dinfo is the string for the directory (string or QString)
full
  flag indicating full pathname should be displayed (boolean)

Up

## BrowserFileItem

Class implementing the data structure for browser file items.

### Derived from

BrowserItem

### Class Attributes

None

### Class Methods

None

### Methods

BrowserFileItem | Constructor
dirName | Public method returning the directory name.
fileExt | Public method returning the file extension.
fileName | Public method returning the filename.
isDFile | Public method to check, if this file is a D file.
isDesignerFile | Public method to check, if this file is a Qt-Designer file.
isDesignerHeaderFile | Public method to check, if this file is a Qt-Designer header file.
isIdlFile | Public method to check, if this file is a CORBA IDL file.
isLinguistFile | Public method to check, if this file is a Qt-Linguist file.
isMultiProjectFile | Public method to check, if this file is an eric4 multi project file.
isPixmapFile | Public method to check, if this file is a pixmap file.
isProjectFile | Public method to check, if this file is an eric4 project file.
isPython3File | Public method to check, if this file is a Python3 script.
isPythonFile | Public method to check, if this file is a Python script.
isResourcesFile | Public method to check, if this file is a Qt-Resources file.
isRubyFile | Public method to check, if this file is a Ruby script.
isSvgFile | Public method to check, if this file is a SVG file.
lessThan | Public method to check, if the item is less than the other one.
moduleName | Public method returning the module name.
name | Public method to return the name of the item.
setName | Public method to set the directory name.

### Static Methods

None

#### BrowserFileItem (Constructor)

BrowserFileItem(parent, finfo, full = True, sourceLanguage = "")

Constructor

parent
  parent item
finfo
  the string for the file (string)
full
  flag indicating full pathname should be displayed (boolean)
sourceLanguage
  source code language of the project (string)

#### BrowserFileItem.dirName

dirName()

Public method returning the directory name.

Returns:
  directory name (string)

#### BrowserFileItem.fileExt

fileExt()

Public method returning the file extension.

Returns:
  file extension (string)

#### BrowserFileItem.fileName

fileName()

Public method returning the filename.

Returns:
  filename (string)

#### BrowserFileItem.isDFile

isDFile()

Public method to check, if this file is a D file.

Returns:
  flag indicating a D file (boolean)

#### BrowserFileItem.isDesignerFile

isDesignerFile()

Public method to check, if this file is a Qt-Designer file.

Returns:
  flag indicating a Qt-Designer file (boolean)

#### BrowserFileItem.isDesignerHeaderFile

isDesignerHeaderFile()

Public method to check, if this file is a Qt-Designer header file.

Returns:
  flag indicating a Qt-Designer header file (boolean)

#### BrowserFileItem.isIdlFile

isIdlFile()

Public method to check, if this file is a CORBA IDL file.

Returns:
  flag indicating a CORBA IDL file (boolean)

#### BrowserFileItem.isLinguistFile

isLinguistFile()

Public method to check, if this file is a Qt-Linguist file.

Returns:
  flag indicating a Qt-Linguist file (boolean)

#### BrowserFileItem.isMultiProjectFile

isMultiProjectFile()

Public method to check, if this file is an eric4 multi project file.

Returns:
  flag indicating an eric4 project file (boolean)

#### BrowserFileItem.isPixmapFile

isPixmapFile()

Public method to check, if this file is a pixmap file.

Returns:
  flag indicating a pixmap file (boolean)

#### BrowserFileItem.isProjectFile

isProjectFile()

Public method to check, if this file is an eric4 project file.

Returns:
  flag indicating an eric4 project file (boolean)

#### BrowserFileItem.isPython3File

isPython3File()

Public method to check, if this file is a Python3 script.

Returns:
  flag indicating a Python file (boolean)

#### BrowserFileItem.isPythonFile

isPythonFile()

Public method to check, if this file is a Python script.

Returns:
  flag indicating a Python file (boolean)

#### BrowserFileItem.isResourcesFile

isResourcesFile()

Public method to check, if this file is a Qt-Resources file.

Returns:
  flag indicating a Qt-Resources file (boolean)

#### BrowserFileItem.isRubyFile

isRubyFile()

Public method to check, if this file is a Ruby script.

Returns:
  flag indicating a Ruby file (boolean)

#### BrowserFileItem.isSvgFile

isSvgFile()

Public method to check, if this file is a SVG file.

Returns:
  flag indicating a SVG file (boolean)

#### BrowserFileItem.lessThan

lessThan(other, column, order)

Public method to check, if the item is less than the other one.

other
  reference to item to compare against (BrowserItem)
column
  column number to use for the comparison (integer)
order
  sort order (Qt.SortOrder) (for special sorting)

Returns:
  true, if this item is less than other (boolean)

#### BrowserFileItem.moduleName

moduleName()

Public method returning the module name.

Returns:
  module name (string)

#### BrowserFileItem.name

name()

Public method to return the name of the item.

Returns:
  name of the item (string)

#### BrowserFileItem.setName

setName(finfo, full = True)

Public method to set the directory name.

finfo
  the string for the file (string)
full
  flag indicating full pathname should be displayed (boolean)

Up

## BrowserItem

Class implementing the data structure for browser items.

### Derived from

object

### Class Attributes

None

### Class Methods

None

### Methods

BrowserItem | Constructor.
appendChild | Public method to add a child to this item.
child | Public method to get a child id.
childCount | Public method to get the number of available child items.
children | Public method to get the ids of all child items.
columnCount | Public method to get the number of available data items.
data | Public method to get a specific data item.
getIcon | Public method to get the items icon.
isLazyPopulated | Public method to check, if this item should be populated lazyly.
isPopulated | Public method to chek, if this item is populated.
isPublic | Public method returning the public visibility status.
isSymlink | Public method to check, if the items is a symbolic link.
lessThan | Public method to check, if the item is less than the other one.
parent | Public method to get the reference to the parent item.
removeChild | Public method to remove a child.
removeChildren | Public method to remove all children.
row | Public method to get the row number of this item.
type | Public method to get the item type.

### Static Methods

None

#### BrowserItem (Constructor)

BrowserItem(parent, data)

Constructor.

parent
  reference to the parent item
data
  single data of the item

#### BrowserItem.appendChild

appendChild(child)

Public method to add a child to this item.

child
  reference to the child item to add (BrowserItem)

#### BrowserItem.child

child(row)

Public method to get a child id.

row
  number of child to get the id of (integer)
return
  reference to the child item (BrowserItem)

#### BrowserItem.childCount

childCount()

Public method to get the number of available child items.

Returns:
  number of child items (integer)

#### BrowserItem.children

children()

Public method to get the ids of all child items.

Returns:
  references to all child items (list of BrowserItem)

#### BrowserItem.columnCount

columnCount()

Public method to get the number of available data items.

Returns:
  number of data items (integer)

#### BrowserItem.data

data(column)

Public method to get a specific data item.

column
  number of the requested data item (integer)
return
  the stored data item

#### BrowserItem.getIcon

getIcon()

Public method to get the items icon.

Returns:
  the icon (QIcon)

#### BrowserItem.isLazyPopulated

isLazyPopulated()

Public method to check, if this item should be populated lazyly.

Returns:
  lazy population flag (boolean)

#### BrowserItem.isPopulated

isPopulated()

Public method to chek, if this item is populated.

Returns:
  population status (boolean)

#### BrowserItem.isPublic

isPublic()

Public method returning the public visibility status.

Returns:
  flag indicating public visibility (boolean)

#### BrowserItem.isSymlink

isSymlink()

Public method to check, if the items is a symbolic link.

Returns:
  flag indicating a symbolic link (boolean)

#### BrowserItem.lessThan

lessThan(other, column, order)

Public method to check, if the item is less than the other one.

other
  reference to item to compare against (BrowserItem)
column
  column number to use for the comparison (integer)
order
  sort order (Qt.SortOrder) (for special sorting)

Returns:
  true, if this item is less than other (boolean)

#### BrowserItem.parent

parent()

Public method to get the reference to the parent item.

Returns:
  reference to the parent item

#### BrowserItem.removeChild

removeChild(child)

Public method to remove a child.

child
  reference to the child to remove (BrowserItem)

#### BrowserItem.removeChildren

removeChildren()

Public method to remove all children.

#### BrowserItem.row

row()

Public method to get the row number of this item.

Returns:
  row number (integer)

#### BrowserItem.type

type()

Public method to get the item type.

Returns:
  type of the item

Up

## BrowserMethodItem

Class implementing the data structure for browser method items.

### Derived from

BrowserItem

### Class Attributes

None

### Class Methods

None

### Methods

BrowserMethodItem | Constructor
fileName | Public method returning the filename.
functionObject | Public method returning the function object.
isPublic | Public method returning the public visibility status.
lessThan | Public method to check, if the item is less than the other one.
lineno | Public method returning the line number defining this object.

### Static Methods

None

#### BrowserMethodItem (Constructor)

BrowserMethodItem(parent, fn, filename)

Constructor

parent
  parent item
fn
  Function object to be shown
filename
  filename of the file defining this class

#### BrowserMethodItem.fileName

fileName()

Public method returning the filename.

Returns:
  filename (string)

#### BrowserMethodItem.functionObject

functionObject()

Public method returning the function object.

Returns:
  reference to the function object

#### BrowserMethodItem.isPublic

isPublic()

Public method returning the public visibility status.

Returns:
  flag indicating public visibility (boolean)

#### BrowserMethodItem.lessThan

lessThan(other, column, order)

Public method to check, if the item is less than the other one.

other
  reference to item to compare against (BrowserItem)
column
  column number to use for the comparison (integer)
order
  sort order (Qt.SortOrder) (for special sorting)

Returns:
  true, if this item is less than other (boolean)

#### BrowserMethodItem.lineno

lineno()

Public method returning the line number defining this object.

return line number defining the object (integer)

Up

## BrowserModel

Class implementing the browser model.

### Derived from

QAbstractItemModel

### Class Attributes

None

### Class Methods

None

### Methods

BrowserModel | Constructor
__populateModel | Private method to populate the browser model.
_addItem | Protected slot to add an item.
_addWatchedItem | Protected method to watch an item.
_removeWatchedItem | Protected method to remove a watched item.
addItem | Puplic slot to add an item.
addTopLevelDir | Public method to add a new toplevel directory.
clear | Public method to clear the model.
columnCount | Public method to get the number of columns.
data | Public method to get data of an item.
directoryChanged | Public slot to handle the directoryChanged signal of the watcher.
flags | Public method to get the item flags.
hasChildren | Public method to check for the presence of child items.
headerData | Public method to get the header data.
index | Public method to create an index.
item | Public method to get a reference to an item.
parent | Public method to get the index of the parent object.
populateClassAttributesItem | Public method to populate a class attributes item's subtree.
populateClassItem | Public method to populate a class item's subtree.
populateDirectoryItem | Public method to populate a directory item's subtree.
populateFileItem | Public method to populate a file item's subtree.
populateItem | Public method to populate an item's subtree.
populateMethodItem | Public method to populate a method item's subtree.
populateSysPathItem | Public method to populate a sys.path item's subtree.
programChange | Public method to change the entry for the directory of file being debugged.
removeToplevelDir | Public method to remove a toplevel directory.
rowCount | Public method to get the number of rows.
saveToplevelDirs | Public slot to save the toplevel directories.

### Static Methods

None

#### BrowserModel (Constructor)

BrowserModel(parent = None)

Constructor

parent
  reference to parent object (QObject)

#### BrowserModel.__populateModel

__populateModel()

Private method to populate the browser model.

#### BrowserModel._addItem

_addItem(itm, parentItem)

Protected slot to add an item.

itm
  reference to item to add (BrowserItem)
parentItem
  reference to item to add to (BrowserItem)

#### BrowserModel._addWatchedItem

_addWatchedItem(itm)

Protected method to watch an item.

itm
  item to be watched (BrowserDirectoryItem)

#### BrowserModel._removeWatchedItem

_removeWatchedItem(itm)

Protected method to remove a watched item.

itm
  item to be removed (BrowserDirectoryItem)

#### BrowserModel.addItem

addItem(itm, parent = QModelIndex())

Puplic slot to add an item.

itm
  item to add (BrowserItem)
parent
  index of parent item (QModelIndex)

#### BrowserModel.addTopLevelDir

addTopLevelDir(dirname)

Public method to add a new toplevel directory.

dirname
  name of the new toplevel directory (string or QString)

#### BrowserModel.clear

clear()

Public method to clear the model.

#### BrowserModel.columnCount

columnCount(parent=QModelIndex())

Public method to get the number of columns.

parent
  index of parent item (QModelIndex)

Returns:
  number of columns (integer)

#### BrowserModel.data

data(index, role)

Public method to get data of an item.

index
  index of the data to retrieve (QModelIndex)
role
  role of data (Qt.ItemDataRole)

Returns:
  requested data (QVariant)

#### BrowserModel.directoryChanged

directoryChanged(path)

Public slot to handle the directoryChanged signal of the watcher.

path
  path of the directory (string)

#### BrowserModel.flags

flags(index)

Public method to get the item flags.

index
  index of the data to retrieve (QModelIndex)

Returns:
  requested flags (Qt.ItemFlags)

#### BrowserModel.hasChildren

hasChildren(parent = QModelIndex())

Public method to check for the presence of child items.

We always return True for normal items in order to do lazy population of the tree.

parent
  index of parent item (QModelIndex)

Returns:
  flag indicating the presence of child items (boolean)

#### BrowserModel.headerData

headerData(section, orientation, role = Qt.DisplayRole)

Public method to get the header data.

section
  number of section to get data for (integer)
orientation
  header orientation (Qt.Orientation)
role
  role of data (Qt.ItemDataRole)

Returns:
  requested header data (QVariant)

#### BrowserModel.index

index(row, column, parent = QModelIndex())

Public method to create an index.

row
  row number of the new index (integer)
column
  column number of the new index (integer)
parent
  index of parent item (QModelIndex)

Returns:
  index object (QModelIndex)

#### BrowserModel.item

item(index)

Public method to get a reference to an item.

index
  index of the data to retrieve (QModelIndex)

Returns:
  requested item reference (BrowserItem)

#### BrowserModel.parent

parent(index)

Public method to get the index of the parent object.

index
  index of the item (QModelIndex)

Returns:
  index of parent item (QModelIndex)

#### BrowserModel.populateClassAttributesItem

populateClassAttributesItem(parentItem, repopulate = False)

Public method to populate a class attributes item's subtree.

parentItem
  reference to the class attributes item to be populated
repopulate
  flag indicating a repopulation (boolean)

#### BrowserModel.populateClassItem

populateClassItem(parentItem, repopulate = False)

Public method to populate a class item's subtree.

parentItem
  reference to the class item to be populated
repopulate
  flag indicating a repopulation (boolean)

#### BrowserModel.populateDirectoryItem

populateDirectoryItem(parentItem, repopulate = False)

Public method to populate a directory item's subtree.

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

#### BrowserModel.populateFileItem

populateFileItem(parentItem, repopulate = False)

Public method to populate a file item's subtree.

parentItem
  reference to the file item to be populated
repopulate
  flag indicating a repopulation (boolean)

#### BrowserModel.populateItem

populateItem(parentItem, repopulate = False)

Public method to populate an item's subtree.

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

#### BrowserModel.populateMethodItem

populateMethodItem(parentItem, repopulate = False)

Public method to populate a method item's subtree.

parentItem
  reference to the method item to be populated
repopulate
  flag indicating a repopulation (boolean)

#### BrowserModel.populateSysPathItem

populateSysPathItem(parentItem, repopulate = False)

Public method to populate a sys.path item's subtree.

parentItem
  reference to the sys.path item to be populated
repopulate
  flag indicating a repopulation (boolean)

#### BrowserModel.programChange

programChange(dirname)

Public method to change the entry for the directory of file being debugged.

dirname
  name of the directory containing the file (string or QString)

#### BrowserModel.removeToplevelDir

removeToplevelDir(index)

Public method to remove a toplevel directory.

index
  index of the toplevel directory to be removed (QModelIndex)

#### BrowserModel.rowCount

rowCount(parent = QModelIndex())

Public method to get the number of rows.

parent
  index of parent item (QModelIndex)

Returns:
  number of rows (integer)

#### BrowserModel.saveToplevelDirs

saveToplevelDirs()

Public slot to save the toplevel directories.

Up

## BrowserSysPathItem

Class implementing the data structure for browser sys.path items.

### Derived from

BrowserItem

### Class Attributes

None

### Class Methods

None

### Methods

BrowserSysPathItem | Constructor

### Static Methods

None

#### BrowserSysPathItem (Constructor)

BrowserSysPathItem(parent)

Constructor

parent
  parent item

Up