# eric4.UI.Browser

Module implementing a browser with class browsing capabilities.

### Global Attributes

None

### Classes

Browser | Class used to display a file system tree.

### Functions

None

## Browser

Class used to display a file system tree.

Via the context menu that is displayed by a right click the user can select various actions on the selected file.

#### Signals

designerFile(string)
  emitted to open a Qt-Designer file
linguistFile(string)
  emitted to open a Qt-Linguist (*.ts) file
multiProjectFile(string)
  emitted to open an eric4 multi project file
pixmapEditFile(string)
  emitted to edit a pixmap file
pixmapFile(string)
  emitted to open a pixmap file
projectFile(string)
  emitted to open an eric4 project file
sourceFile(string, int, string)
  emitted to open a Python file at a line
svgFile(string)
  emitted to open a SVG file
trpreview(string list)
  emitted to preview a Qt-Linguist (*.qm) file
unittestOpen(string)
  emitted to open a Python file for a unittest

### Derived from

QTreeView

### Class Attributes

None

### Methods

Browser | Constructor
__addAsToplevelDir | Private slot to handle the Add as toplevel directory popup menu entry.
__configure | Private method to open the configuration dialog.
__createPopupMenus | Private method to generate the various popup menus.
__findInDirectory | Private slot to handle the Find in directory popup menu entry.
__newToplevelDir | Private slot to handle the New toplevel directory popup menu entry.
__removeToplevel | Private slot to handle the Remove from toplevel popup menu entry.
__replaceInDirectory | Private slot to handle the Find&Replace in directory popup menu entry.
_contextMenuRequested | Protected slot to show the context menu of the listview.
_copyToClipboard | Protected method to copy the text shown for an entry to the clipboard.
_editPixmap | Protected slot to handle the open in icon editor popup menu entry.
_init | Protected method to perform initialization tasks common to this base class and all derived classes.
_openItem | Protected slot to handle the open popup menu entry.
_resizeColumns | Protected slot to resize the view when items get expanded or collapsed.
_resort | Protected slot to resort the tree.
getSelectedItems | Public method to get the selected items.
getSelectedItemsCount | Public method to get the count of items selected.
getSelectedItemsCountCategorized | Public method to get a categorized count of selected items.
handlePreferencesChanged | Public slot used to handle the preferencesChanged signal.
handleProgramChange | Public slot to handle the programChange signal.
handleUnittest | Public slot to handle the unittest popup menu entry.
layoutDisplay | Public slot to perform a layout operation.
mouseDoubleClickEvent | Protected method of QAbstractItemView.
saveToplevelDirs | Public slot to save the toplevel directories.
wantedItem | Public method to check type of an item.

#### Browser (Constructor)

Browser(parent = None)

Constructor

parent
  parent widget (QWidget)

#### Browser.__addAsToplevelDir

__addAsToplevelDir()

Private slot to handle the Add as toplevel directory popup menu entry.

#### Browser.__configure

__configure()

Private method to open the configuration dialog.

#### Browser.__createPopupMenus

__createPopupMenus()

Private method to generate the various popup menus.

#### Browser.__findInDirectory

__findInDirectory()

Private slot to handle the Find in directory popup menu entry.

#### Browser.__newToplevelDir

__newToplevelDir()

Private slot to handle the New toplevel directory popup menu entry.

#### Browser.__removeToplevel

__removeToplevel()

Private slot to handle the Remove from toplevel popup menu entry.

#### Browser.__replaceInDirectory

__replaceInDirectory()

Private slot to handle the Find&Replace in directory popup menu entry.

#### Browser._contextMenuRequested

_contextMenuRequested(coord)

Protected slot to show the context menu of the listview.

coord
  the position of the mouse pointer (QPoint)

#### Browser._copyToClipboard

_copyToClipboard()

Protected method to copy the text shown for an entry to the clipboard.

#### Browser._editPixmap

_editPixmap()

Protected slot to handle the open in icon editor popup menu entry.

#### Browser._init

_init()

Protected method to perform initialization tasks common to this base class and all derived classes.

#### Browser._openItem

_openItem()

Protected slot to handle the open popup menu entry.

#### Browser._resizeColumns

_resizeColumns(index)

Protected slot to resize the view when items get expanded or collapsed.

index
  index of item (QModelIndex)

#### Browser._resort

_resort()

Protected slot to resort the tree.

#### Browser.getSelectedItems

getSelectedItems(filter=None)

Public method to get the selected items.

filter
  list of classes to check against

Returns:
  list of selected items (list of BroweserItem)

#### Browser.getSelectedItemsCount

getSelectedItemsCount(filter=None)

Public method to get the count of items selected.

filter
  list of classes to check against

Returns:
  count of items selected (integer)

#### Browser.getSelectedItemsCountCategorized

getSelectedItemsCountCategorized(filter=None)

Public method to get a categorized count of selected items.

filter
  list of classes to check against

Returns:
  a dictionary containing the counts of items belonging to the individual filter classes. The keys of the dictionary are the unicode representation of the classes given in the filter (i.e. unicode(filterClass)). The dictionary contains an additional entry with key "sum", that stores the sum of all selected entries fulfilling the filter criteria.

#### Browser.handlePreferencesChanged

handlePreferencesChanged()

Public slot used to handle the preferencesChanged signal.

#### Browser.handleProgramChange

handleProgramChange(fn)

Public slot to handle the programChange signal.

#### Browser.handleUnittest

handleUnittest()

Public slot to handle the unittest popup menu entry.

#### Browser.layoutDisplay

layoutDisplay()

Public slot to perform a layout operation.

#### Browser.mouseDoubleClickEvent

mouseDoubleClickEvent(mouseEvent)

Protected method of QAbstractItemView.

Reimplemented to disable expanding/collapsing of items when double-clicking. Instead the double-clicked entry is opened.

mouseEvent
  the mouse event (QMouseEvent)

#### Browser.saveToplevelDirs

saveToplevelDirs()

Public slot to save the toplevel directories.

#### Browser.wantedItem

wantedItem(itm, filter=None)

Public method to check type of an item.

itm
  the item to check (BrowserItem)
filter
  list of classes to check against

Returns:
  flag indicating item is a valid type (boolean)

Up