File indexing completed on 2024-05-19 05:35:37

0001 # SPDX-License-Identifier: GPL-3.0-or-later
0002 # SPDX-FileCopyrightText: 2021 Anupam Basak <anupam.basak27@gmail.com>
0003 
0004 import abc
0005 import os
0006 
0007 from PySide2.QtCore import QObject, QUrl, Slot, Signal, QProcessEnvironment
0008 
0009 
0010 class Module(QObject):
0011     _filename = None
0012     __ENV__: QProcessEnvironment = QProcessEnvironment.systemEnvironment()
0013 
0014     def __init__(self, filename, parent=None):
0015         super().__init__(parent)
0016         self._filename = filename
0017 
0018     @staticmethod
0019     @abc.abstractmethod
0020     def registerTypes() -> None:
0021         pass
0022 
0023     @staticmethod
0024     @abc.abstractmethod
0025     def qmlPath() -> QUrl:
0026         pass
0027 
0028     @Slot(None, result=str)
0029     def dir(self):
0030         path, _ = os.path.split(os.path.abspath(self._filename))
0031         return path
0032 
0033     @Slot(None, result=str)
0034     def moduleName(self) -> str:
0035         pass
0036 
0037     errorOccurred = Signal(str)