Exemple #1
0
    def __init__(self):
        # Super call
        super(ShovelBot, self).__init__()

        # "Public" declarations
        self.ui = ClientUi()
        self.help_dialog: typing.Optional[Help] = None
        self.request_factory: typing.Optional[requests.Factory] = None
        self.extensions: Dict[str, Union[dataclasses.ExtensionStub,
                                         dataclasses.Extension]] = {}
        self.settings: settings.Display = settings.Display()
        self.themes: List = [themes.dark, themes.high_contrast]
        self.display_timer: QtCore.QTimer = QtCore.QTimer(parent=self)
        self.base_theme: QtGui.QPalette = QtGui.QPalette(self.palette())
        self.help_engine: QtHelp.QHelpEngine = QtHelp.QHelpEngineCore(
            'resources/docs/shovelbot.qhc')
        self.command_manager: commands.Manager = commands.Manager()
        self.database: QtSql.QSqlDatabase = QtSql.QSqlDatabase.addDatabase(
            'QSQLITE')

        # "Private" attributes
        self._settings_file: typing.Optional[QtCore.QFile] = None

        # Internal calls
        self.help_engine.warning.connect(self.LOGGER.warning)

        self.database.setDatabaseName('data/shovelbot.db')
Exemple #2
0
    def __init__(self, collection_file: str, parent: QtWidgets.QWidget = None):
        # Super call
        super(Help, self).__init__(parent=parent)

        # Ui attributes
        self.tabs: typing.Optional[QtWidgets.QTabBar] = None
        self.new_tab: typing.Optional[QtWidgets.QToolButton] = None
        self.url_box: typing.Optional[QtWidgets.QLineEdit] = None
        self.back_button: typing.Optional[QtWidgets.QToolButton] = None
        self.forward_button: typing.Optional[QtWidgets.QToolButton] = None
        self.home_button: typing.Optional[QtWidgets.QToolButton] = None
        self.page_container: typing.Optional[QtWidgets.QStackedWidget] = None

        # Url attributes
        self.url_completer: typing.Optional[QtWidgets.QCompleter] = None
        self.url_validator: typing.Optional[
            QtGui.QRegularExpressionValidator] = None

        # Internal attributes
        self._engine: QtHelp.QHelpEngineCore = QtHelp.QHelpEngineCore(
            collection_file)
        self._pages: typing.Dict[str, HelpPage] = {}