src/eric7/ViewManager/__init__.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2005 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Package implementing the viewmanager of the eric 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 import Preferences
19
20 ######################################################################
21 ## Below is the factory function to instantiate the appropriate
22 ## viewmanager depending on the configuration settings
23 ######################################################################
24
25
26 def factory(parent, ui, dbs, pluginManager):
27 """
28 Modul factory function to generate the right viewmanager type.
29
30 The viewmanager is instantiated depending on the data set in
31 the current preferences.
32
33 @param parent parent widget (QWidget)
34 @param ui reference to the main UI object
35 @param dbs reference to the debug server object
36 @param pluginManager reference to the plugin manager object
37 @return the instantiated viewmanager
38 @exception RuntimeError raised if no view manager could be created
39 """
40 viewManagerStr = Preferences.getViewManager()
41 vm = pluginManager.getPluginObject("viewmanager", viewManagerStr)
42 if vm is None:
43 # load tabview view manager as default
44 vm = pluginManager.getPluginObject("viewmanager", "tabview")
45 if vm is None:
46 raise RuntimeError("Could not create a viemanager object.")
47 Preferences.setViewManager("tabview")
48 vm.setReferences(ui, dbs)
49 return vm

eric ide

mercurial