ViewManager/__init__.py

Sat, 31 Mar 2012 12:52:45 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 31 Mar 2012 12:52:45 +0200
changeset 1745
74c05a1ca2bc
parent 1509
c0b5e693b0eb
child 2302
f29e9405c851
permissions
-rw-r--r--

Fixed an issue with the new error log dialog.

# -*- coding: utf-8 -*-

# Copyright (c) 2005 - 2012 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Package implementing the viewmanager of the eric5 IDE.

The viewmanager is responsible for the layout of the editor windows. This is
the central part of the IDE. In additon to this, the viewmanager provides all
editor related actions, menus and toolbars.

View managers are provided as plugins and loaded via the factory function. If
the requested view manager type is not available, tabview will be used by
default.
"""

import Preferences

######################################################################
## Below is the factory function to instantiate the appropriate
## viewmanager depending on the configuration settings
######################################################################


def factory(parent, ui, dbs, pluginManager):
    """
    Modul factory function to generate the right viewmanager type.
    
    The viewmanager is instantiated depending on the data set in
    the current preferences.
    
    @param parent parent widget (QWidget)
    @param ui reference to the main UI object
    @param dbs reference to the debug server object
    @param pluginManager reference to the plugin manager object
    @return the instantiated viewmanager
    """
    viewManagerStr = Preferences.getViewManager()
    vm = pluginManager.getPluginObject("viewmanager", viewManagerStr)
    if vm is None:
        # load tabview view manager as default
        vm = pluginManager.getPluginObject("viewmanager", "tabview")
        if vm is None:
            raise RuntimeError("Could not create a viemanager object.")
        Preferences.setViewManager("tabview")
    vm.setReferences(ui, dbs)
    return vm

eric ide

mercurial