# eric7.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.

### Signals

closeSourceWindow(str)
  emitted to close a source file

### 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.
_deleteDirectory | Protected method to delete the selected directory from the project data area.
_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.
_keyboardSearchType | Protected method to check, if the item is of the correct type.
_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.
expandItemsByName | Public method to expand items given their names.
getExpandedItemNames | Public method to get the file/directory names of all expanded items.
removeHookMethod | Public method to remove a hook method from the dictionary.
selectFile | Public method to highlight a node given its filename.
selectFileLine | 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.

key
  key of the hook to check (string)

Raises KeyError:
  raised to indicate an invalid hook

#### 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 (string)

#### 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._deleteDirectory

_deleteDirectory()

Protected method to delete the selected directory from the project data area.

#### 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._keyboardSearchType

_keyboardSearchType(item)

Protected method to check, if the item is of the correct type.

item (BrowserItem)
  reference to the item

Return:
  flag indicating a correct type

Return Type:
  bool

#### 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 (string)

#### 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, filterList=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)
filterList
  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 (QMenu)

#### ProjectBaseBrowser._showContextMenuBack

_showContextMenuBack(menu)

Protected slot called before the context menu is shown.

menu
  reference to the menu to be shown (QMenu)

#### 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 (QMenu)

#### 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 (QMenu)

#### 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 (QMenu)

#### 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 (string)

#### ProjectBaseBrowser.currentItem

currentItem()

Public method to get a reference to the current item.

Return:
  reference to the current item

#### ProjectBaseBrowser.expandItemsByName

expandItemsByName(names)

Public method to expand items given their names.

names
  list of item names to be expanded (list of string)

#### ProjectBaseBrowser.getExpandedItemNames

getExpandedItemNames()

Public method to get the file/directory names of all expanded items.

Return:
  list of expanded items names (list of string)

#### 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)

#### ProjectBaseBrowser.selectFileLine

selectFileLine(fn, lineno)

Public method to highlight a node given its filename.

fn
  filename of file to be highlighted (string)
lineno
  one based line number of the item (integer)

#### 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