eric6/ViewManager/__init__.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2005 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Package implementing the viewmanager of the eric6 IDE.
8
9 The viewmanager is responsible for the layout of the editor windows. This is
10 the central part of the IDE. In additon to this, the viewmanager provides all
11 editor related actions, menus and toolbars.
12
13 View managers are provided as plugins and loaded via the factory function. If
14 the requested view manager type is not available, tabview will be used by
15 default.
16 """
17
18 from __future__ import unicode_literals
19
20 import Preferences
21
22 ######################################################################
23 ## Below is the factory function to instantiate the appropriate
24 ## viewmanager depending on the configuration settings
25 ######################################################################
26
27
28 def factory(parent, ui, dbs, pluginManager):
29 """
30 Modul factory function to generate the right viewmanager type.
31
32 The viewmanager is instantiated depending on the data set in
33 the current preferences.
34
35 @param parent parent widget (QWidget)
36 @param ui reference to the main UI object
37 @param dbs reference to the debug server object
38 @param pluginManager reference to the plugin manager object
39 @return the instantiated viewmanager
40 @exception RuntimeError raised if no view manager could be created
41 """
42 viewManagerStr = Preferences.getViewManager()
43 vm = pluginManager.getPluginObject("viewmanager", viewManagerStr)
44 if vm is None:
45 # load tabview view manager as default
46 vm = pluginManager.getPluginObject("viewmanager", "tabview")
47 if vm is None:
48 raise RuntimeError("Could not create a viemanager object.")
49 Preferences.setViewManager("tabview")
50 vm.setReferences(ui, dbs)
51 return vm

eric ide

mercurial