# eric4.Project.ProjectBaseBrowser

Module implementing the baseclass for the various project browsers.

### Global Attributes

None

### Classes

ProjectBaseBrowser | Baseclass implementing common functionality for the various project browsers.

### Functions

None

## ProjectBaseBrowser

Baseclass implementing common functionality for the various project browsers.

### Derived from

Browser

### Class Attributes

None

### Class Methods

None

### Methods

ProjectBaseBrowser | Constructor
__checkHookKey | Private method to check a hook key
__modelRowsInserted | Private slot called after rows have been inserted into the model.
_collapseAllDirs | Protected slot to handle the 'Collapse all directories' menu action.
_completeRepopulateItem | Protected slot to handle the completeRepopulateItem signal.
_configure | Protected method to open the configuration dialog.
_connectExpandedCollapsed | Protected method to connect the expanded and collapsed signals.
_contextMenuRequested | Protected slot to show the context menu.
_copyToClipboard | Protected method to copy the path of an entry to the clipboard.
_createPopupMenus | Protected overloaded method to generate the popup menus.
_disconnectExpandedCollapsed | Protected method to disconnect the expanded and collapsed signals.
_expandAllDirs | Protected slot to handle the 'Expand all directories' menu action.
_initHookMethods | Protected method to initialize the hooks dictionary.
_initMenusAndVcs | Protected slot to initialize the menus and the Vcs interface.
_newProject | Protected slot to handle the newProject signal.
_prepareRepopulateItem | Protected slot to handle the prepareRepopulateItem signal.
_projectClosed | Protected slot to handle the projectClosed signal.
_projectOpened | Protected slot to handle the projectOpened signal.
_removeDir | Protected method to remove a (single) directory from the project.
_removeFile | Protected method to remove a file or files from the project.
_renameFile | Protected method to rename a file of the project.
_selectEntries | Protected method to select entries based on their VCS status.
_selectSingleItem | Protected method to select a single item.
_setItemRangeSelected | Protected method to set the selection status of a range of items.
_setItemSelected | Protected method to set the selection status of an item.
_showContextMenu | Protected slot called before the context menu is shown.
_showContextMenuBack | Protected slot called before the context menu is shown.
_showContextMenuDir | Protected slot called before the context menu is shown.
_showContextMenuDirMulti | Protected slot called before the context menu is shown.
_showContextMenuMulti | Protected slot called before the context menu (multiple selections) is shown.
addHookMethod | Public method to add a hook method to the dictionary.
addHookMethodAndMenuEntry | Public method to add a hook method to the dictionary.
currentItem | Public method to get a reference to the current item.
removeHookMethod | Public method to remove a hook method from the dictionary.
selectFile | Public method to highlight a node given its filename.
selectLocalDirEntries | Public slot to handle the select local directories context menu entries
selectLocalEntries | Public slot to handle the select local files context menu entries
selectVCSDirEntries | Public slot to handle the select VCS directories context menu entries
selectVCSEntries | Public slot to handle the select VCS files context menu entries

### Static Methods

None

#### ProjectBaseBrowser (Constructor)

ProjectBaseBrowser(project, type_, parent = None)

Constructor

project
  reference to the project object
type
  project browser type (string)
parent
  parent widget of this browser

#### ProjectBaseBrowser.__checkHookKey

__checkHookKey(key)

Private method to check a hook key

#### ProjectBaseBrowser.__modelRowsInserted

__modelRowsInserted(parent, start, end)

Private slot called after rows have been inserted into the model.

parent
  parent index of inserted rows (QModelIndex)
start
  start row number (integer)
end
  end row number (integer)

#### ProjectBaseBrowser._collapseAllDirs

_collapseAllDirs()

Protected slot to handle the 'Collapse all directories' menu action.

#### ProjectBaseBrowser._completeRepopulateItem

_completeRepopulateItem(name)

Protected slot to handle the completeRepopulateItem signal.

name
  relative name of file item to be repopulated

#### ProjectBaseBrowser._configure

_configure()

Protected method to open the configuration dialog.

#### ProjectBaseBrowser._connectExpandedCollapsed

_connectExpandedCollapsed()

Protected method to connect the expanded and collapsed signals.

#### ProjectBaseBrowser._contextMenuRequested

_contextMenuRequested(coord)

Protected slot to show the context menu.

coord
  the position of the mouse pointer (QPoint)

#### ProjectBaseBrowser._copyToClipboard

_copyToClipboard()

Protected method to copy the path of an entry to the clipboard.

#### ProjectBaseBrowser._createPopupMenus

_createPopupMenus()

Protected overloaded method to generate the popup menus.

#### ProjectBaseBrowser._disconnectExpandedCollapsed

_disconnectExpandedCollapsed()

Protected method to disconnect the expanded and collapsed signals.

#### ProjectBaseBrowser._expandAllDirs

_expandAllDirs()

Protected slot to handle the 'Expand all directories' menu action.

#### ProjectBaseBrowser._initHookMethods

_initHookMethods()

Protected method to initialize the hooks dictionary.

This method should be overridden by subclasses. All supported hook methods should be initialized with a None value. The keys must be strings.

#### ProjectBaseBrowser._initMenusAndVcs

_initMenusAndVcs()

Protected slot to initialize the menus and the Vcs interface.

#### ProjectBaseBrowser._newProject

_newProject()

Protected slot to handle the newProject signal.

#### ProjectBaseBrowser._prepareRepopulateItem

_prepareRepopulateItem(name)

Protected slot to handle the prepareRepopulateItem signal.

name
  relative name of file item to be repopulated

#### ProjectBaseBrowser._projectClosed

_projectClosed()

Protected slot to handle the projectClosed signal.

#### ProjectBaseBrowser._projectOpened

_projectOpened()

Protected slot to handle the projectOpened signal.

#### ProjectBaseBrowser._removeDir

_removeDir()

Protected method to remove a (single) directory from the project.

#### ProjectBaseBrowser._removeFile

_removeFile()

Protected method to remove a file or files from the project.

#### ProjectBaseBrowser._renameFile

_renameFile()

Protected method to rename a file of the project.

#### ProjectBaseBrowser._selectEntries

_selectEntries(local = True, filter = None)

Protected method to select entries based on their VCS status.

local
  flag indicating local (i.e. non VCS controlled) file/directory entries should be selected (boolean)
filter
  list of classes to check against

#### ProjectBaseBrowser._selectSingleItem

_selectSingleItem(index)

Protected method to select a single item.

index
  index of item to be selected (QModelIndex)

#### ProjectBaseBrowser._setItemRangeSelected

_setItemRangeSelected(startIndex, endIndex, selected)

Protected method to set the selection status of a range of items.

startIndex
  start index of range of items to set (QModelIndex)
endIndex
  end index of range of items to set (QModelIndex)
selected
  flag giving the new selection status (boolean)

#### ProjectBaseBrowser._setItemSelected

_setItemSelected(index, selected)

Protected method to set the selection status of an item.

index
  index of item to set (QModelIndex)
selected
  flag giving the new selection status (boolean)

#### ProjectBaseBrowser._showContextMenu

_showContextMenu(menu)

Protected slot called before the context menu is shown.

It enables/disables the VCS menu entries depending on the overall VCS status and the file status.

menu
  reference to the menu to be shown

#### ProjectBaseBrowser._showContextMenuBack

_showContextMenuBack(menu)

Protected slot called before the context menu is shown.

menu
  reference to the menu to be shown

#### ProjectBaseBrowser._showContextMenuDir

_showContextMenuDir(menu)

Protected slot called before the context menu is shown.

It enables/disables the VCS menu entries depending on the overall VCS status and the directory status.

menu
  reference to the menu to be shown

#### ProjectBaseBrowser._showContextMenuDirMulti

_showContextMenuDirMulti(menu)

Protected slot called before the context menu is shown.

It enables/disables the VCS menu entries depending on the overall VCS status and the directory status.

menu
  reference to the menu to be shown

#### ProjectBaseBrowser._showContextMenuMulti

_showContextMenuMulti(menu)

Protected slot called before the context menu (multiple selections) is shown.

It enables/disables the VCS menu entries depending on the overall VCS status and the files status.

menu
  reference to the menu to be shown

#### ProjectBaseBrowser.addHookMethod

addHookMethod(key, method)

Public method to add a hook method to the dictionary.

key
  for the hook method (string)
method
  reference to the hook method (method object)

#### ProjectBaseBrowser.addHookMethodAndMenuEntry

addHookMethodAndMenuEntry(key, method, menuEntry)

Public method to add a hook method to the dictionary.

key
  for the hook method (string)
method
  reference to the hook method (method object)
menuEntry
  entry to be shown in the context menu (QString)

#### ProjectBaseBrowser.currentItem

currentItem()

Public method to get a reference to the current item.

Returns:
  reference to the current item

#### ProjectBaseBrowser.removeHookMethod

removeHookMethod(key)

Public method to remove a hook method from the dictionary.

key
  for the hook method (string)

#### ProjectBaseBrowser.selectFile

selectFile(fn)

Public method to highlight a node given its filename.

fn
  filename of file to be highlighted (string or QString)

#### ProjectBaseBrowser.selectLocalDirEntries

selectLocalDirEntries()

Public slot to handle the select local directories context menu entries

#### ProjectBaseBrowser.selectLocalEntries

selectLocalEntries()

Public slot to handle the select local files context menu entries

#### ProjectBaseBrowser.selectVCSDirEntries

selectVCSDirEntries()

Public slot to handle the select VCS directories context menu entries

#### ProjectBaseBrowser.selectVCSEntries

selectVCSEntries()

Public slot to handle the select VCS files context menu entries

Up