1# -*- coding: utf-8 -*-
2
3# Copyright (c) 2007 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4#
5
6"""
7Module implementing the Tabview view manager plugin.
8"""
9
10import os
11
12from PyQt5.QtCore import QT_TRANSLATE_NOOP, QObject
13from PyQt5.QtGui import QPixmap
14
15import UI.Info
16
17# Start-Of-Header
18name = "Listspace Plugin"
19author = "Detlev Offenbach <detlev@die-offenbachs.de>"
20autoactivate = False
21deactivateable = False
22version = UI.Info.VersionOnly
23pluginType = "viewmanager"
24pluginTypename = "listspace"
25displayString = QT_TRANSLATE_NOOP('VmListspacePlugin', 'Listspace')
26className = "VmListspacePlugin"
27packageName = "__core__"
28shortDescription = "Implements the Listspace view manager."
29longDescription = """This plugin provides the listspace view manager."""
30pyqtApi = 2
31# End-Of-Header
32
33error = ""
34
35
36def previewPix():
37    """
38    Module function to return a preview pixmap.
39
40    @return preview pixmap (QPixmap)
41    """
42    fname = os.path.join(os.path.dirname(__file__),
43                         "ViewManagerPlugins", "Listspace", "preview.png")
44    return QPixmap(fname)
45
46
47class VmListspacePlugin(QObject):
48    """
49    Class implementing the Listspace view manager plugin.
50    """
51    def __init__(self, ui):
52        """
53        Constructor
54
55        @param ui reference to the user interface object (UI.UserInterface)
56        """
57        super().__init__(ui)
58        self.__ui = ui
59
60    def activate(self):
61        """
62        Public method to activate this plugin.
63
64        @return tuple of reference to instantiated viewmanager and
65            activation status (boolean)
66        """
67        from ViewManagerPlugins.Listspace.Listspace import Listspace
68        self.__object = Listspace(self.__ui)
69        return self.__object, True
70
71    def deactivate(self):
72        """
73        Public method to deactivate this plugin.
74        """
75        # do nothing for the moment
76        pass
77