# eric5.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(str)
  emitted to open a Qt-Designer file
linguistFile(str)
  emitted to open a Qt-Linguist (*.ts) file
multiProjectFile(str)
  emitted to open an eric4/5 multi project file
pixmapEditFile(str)
  emitted to edit a pixmap file
pixmapFile(str)
  emitted to open a pixmap file
projectFile(str)
  emitted to open an eric4/5 project file
sourceFile(str, int = 0, str = "")
  emitted to open a Python file at a line
svgFile(str)
  emitted to open a SVG file
trpreview(list of str, bool = False)
  emitted to preview a Qt-Linguist (*.qm) file
unittestOpen(str)
  emitted to open a Python file for a unittest

### Derived from

QTreeView

### Class Attributes

None

### Class Methods

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.
__refreshDirectory | Private slot to refresh a directory 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.
_gotoAttribute | Protected slot to handle the selection of the goto menu.
_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.
_showGotoMenu | Protected slot to prepare the goto submenu of the attribute menu.
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.
handleInterpreterChanged | Public slot to handle a change of the debug client's interpreter.
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.

### Static Methods

None

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

__refreshDirectory()

Private slot to refresh a directory 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._gotoAttribute

_gotoAttribute(act)

Protected slot to handle the selection of the goto menu.

act
  reference to the action (E5Action)

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

_showGotoMenu()

Protected slot to prepare the goto submenu of the attribute menu.

#### 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 string representation of the classes given in the filter (i.e. str(filterClass)). The dictionary contains an additional entry with key "sum", that stores the sum of all selected entries fulfilling the filter criteria.

#### Browser.handleInterpreterChanged

handleInterpreterChanged(interpreter)

Public slot to handle a change of the debug client's interpreter.

interpreter
  interpreter of the debug client (string)

#### Browser.handlePreferencesChanged

handlePreferencesChanged()

Public slot used to handle the preferencesChanged signal.

#### Browser.handleProgramChange

handleProgramChange(fn)

Public slot to handle the programChange signal.

fn
  file name (string)

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