Beispiel #1
0
	def __init__(
			self,
			*args: Any,
			**kwargs: Any):
		# TODO: why not super here?
		QtCore.QObject.__init__(self, *args, **kwargs)
		event.connectWithPriority('requestModuleHandler', self.requestModuleHandler, event.lowPriority)
Beispiel #2
0
    def __init__(self, *args: Any, **kwargs: Any):
        """
		Do not instantiate this!
		All parameters are passed to QObject.__init__
		"""
        QtCore.QObject.__init__(self, *args, **kwargs)
        event.connectWithPriority('requestModuleHandler',
                                  self.requestModuleHandler, event.lowPriority)
Beispiel #3
0
 def __init__(self, *args: Any, **kwargs: Any):
     super(Preloader, self).__init__(*args, **kwargs)
     self.ui = Ui_Preloader()
     self.ui.setupUi(self)
     self.timerID = None
     self.ui.progressBar.setMinimum(0)
     self.ui.progressBar.setMaximum(110)
     self.ui.progressBar.setValue(0)
     event.connectWithPriority("configDownloaded", self.configDownloaded,
                               event.lowPriority)
Beispiel #4
0
    def __init__(self, module: str, *args: Any, **kwargs: Any):
        logger.debug("module: %r, %r, %r", module, args, kwargs)
        self.module = module
        config = conf.serverConfig["modules"][module]
        descr = config.get("name", "")
        if config["icon"]:
            kwargs["icon"] = config["icon"]
        super(FileBaseHandler,
              self).__init__(lambda: FileWidget(module),
                             sortIndex=config.get("sortIndex", 0),
                             descr=descr,
                             vanishOnClose=False,
                             *args,
                             **kwargs)

        event.connectWithPriority("preloadingFinished", self.setRepos,
                                  event.lowPriority)
Beispiel #5
0
 def __init__(self, *args: Any, **kwargs: Any):
     QtWidgets.QMainWindow.__init__(self, *args, **kwargs)
     self.ui = Ui_LoginWindow()
     self.ui.setupUi(self)
     # Fix icons
     self.ui.btnLogin.setIcon(loadIcon("login"))
     self.portalWizard = None  # Reference to an add portal wizard (if any)
     self.helpBrowser = None
     self.loginTask = None
     self.isFirstShown = True  # Don't reopen the add wizard a second time if aborted
     event.connectWithPriority('resetLoginWindow', self.enableForm,
                               event.lowPriority)
     event.connectWithPriority('accountListChanged', self.loadAccounts,
                               event.lowPriority)
     self.ui.cbPortal.currentRowChanged.connect(
         self.onCbPortalCurrentRowChanged)
     self.captchaToken = None
     self.loadAccounts()
     self.overlay = Overlay(self)
     shortCut = QtWidgets.QShortcut(self)
     shortCut.setKey("Return")
     shortCut.activated.connect(self.onBtnLoginReleased)
     # Populate the language-selector
     self.langKeys = list(config.conf.availableLanguages)
     self.ui.cbLanguages.blockSignals(True)
     for k in self.langKeys:
         self.ui.cbLanguages.addItem(ISO639CODES[k])
     currentLang = "en"
     if "language" in config.conf.adminConfig:
         currentLang = config.conf.adminConfig["language"]
     if currentLang in self.langKeys:
         self.ui.cbLanguages.setCurrentIndex(
             self.langKeys.index(currentLang))
     self.ui.actionAbout.triggered.connect(self.onActionAboutTriggered)
     self.ui.actionHelp.triggered.connect(self.onActionHelpTriggered)
     self.ui.cbLanguages.blockSignals(False)
     self.ui.btnLogin.clicked.connect(self.onBtnLoginReleased)
     self.ui.cbLanguages.currentIndexChanged.connect(
         self.onCbLanguagesCurrentIndexChanged)
     self.ui.actionAddPortal.triggered.connect(self.openPortalWizard)
     self.ui.actionDeletePortal.triggered.connect(self.deletePortal)
     self.ui.actionEditPortal.triggered.connect(self.editPortal)
Beispiel #6
0
 def __init__(self, *args, **kwargs):
     super(CalenderHandler, self).__init__(*args, **kwargs)
     event.connectWithPriority('requestModuleHandler',
                               self.requestModuleHandler, event.lowPriority)
Beispiel #7
0
    def __init__(self,
                 groupWhitelist=None,
                 moduleWhitelist=None,
                 *args: Any,
                 **kwargs: Any):
        super(MainWindow, self).__init__(*args, **kwargs)
        self.groupWhitelist = groupWhitelist
        self.moduleWhitelist = moduleWhitelist
        self.setObjectName("MainWindow")
        self.resize(983, 707)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":icons/viur_logo.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.setWindowIcon(icon)
        self.setIconSize(QtCore.QSize(32, 32))
        self.centralwidget = QtWidgets.QWidget(self)
        self.centralwidget.setObjectName("centralwidget")
        self.centralwidget.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.centralwidget)
        self.horizontalLayout_2.setSpacing(0)
        self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self._mainWidget = QtWidgets.QWidget(self.centralwidget)
        self._mainWidgetLayout = QtWidgets.QHBoxLayout(self._mainWidget)
        self._mainWidgetLayout.setContentsMargins(0, 0, 0, 0)
        # sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        # sizePolicy.setHorizontalStretch(0)
        # sizePolicy.setVerticalStretch(0)
        # sizePolicy.setHeightForWidth(self._mainWidget.sizePolicy().hasHeightForWidth())
        # self._mainWidget.setSizePolicy(sizePolicy)
        # self._mainWidget.setMinimumSize(QtCore.QSize(0, 100))
        # self._mainWidget.setMaximumSize(QtCore.QSize(16777215, 100))
        self._mainWidget.setObjectName("mainWindowArea")
        # self.horizontalLayout = QtWidgets.QHBoxLayout(self._mainWidget)
        # self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        # self.horizontalLayout.setObjectName("horizontalLayout")
        # self.iconLbl = QtWidgets.QLabel(self._mainWidget)
        # self.iconLbl.setObjectName("iconLbl")
        # self.horizontalLayout.addWidget(self.iconLbl)
        # self.modulLbl = QtWidgets.QLabel(self._mainWidget)
        font = QtGui.QFont()
        font.setPointSize(22)
        # font.setBold(False)
        # font.setWeight(50)
        # self.modulLbl.setFont(font)
        # self.modulLbl.setObjectName("modulLbl")
        # self.horizontalLayout.addWidget(self.modulLbl)
        # spacerItem = QtWidgets.QSpacerItem(368, 10, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        # self.horizontalLayout.addItem(spacerItem)
        self.verticalLayout.addWidget(self._mainWidget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget)
        self.stackedWidget.setObjectName("stackedWidget")
        self.stackedWidget.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.addWidget(self.stackedWidget)
        self.horizontalLayout_2.addLayout(self.verticalLayout)
        self.setCentralWidget(self.centralwidget)

        self.menubar = QtWidgets.QMenuBar(self)
        self.menubar.setEnabled(True)
        # self.menubar.setGeometry(QtCore.QRect(0, 0, 983, 19))
        self.menubar.setObjectName("menubar")
        self.menuInfo = QtWidgets.QMenu(self.menubar)
        self.menuInfo.setObjectName("menuInfo")
        self.menuErweitert = QtWidgets.QMenu(self.menubar)
        self.menuErweitert.setObjectName("menuErweitert")
        self.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(self)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)
        self.dockWidget = QtWidgets.QDockWidget(self)
        self.dockWidget.setWindowFlags(QtCore.Qt.Window)
        # self.dockWidget.setMinimumSize(QtCore.QSize(300, 35))
        self.dockWidget.setObjectName("dockWidget")
        self.treeWidget = QtWidgets.QTreeWidget(self)
        self.treeWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.treeWidget.setHorizontalScrollBarPolicy(
            QtCore.Qt.ScrollBarAsNeeded)
        self.treeWidget.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)
        self.treeWidget.setColumnCount(2)
        self.treeWidget.setObjectName("treeWidget")
        self.treeWidget.headerItem().setText(1, "2")
        self.treeWidget.header().setVisible(False)

        # for handler search
        self.handlerWidget = QtWidgets.QWidget(self)
        self.handlerLayout = QtWidgets.QVBoxLayout(self.handlerWidget)
        _translate = QtCore.QCoreApplication.translate

        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.handlerWidget.sizePolicy().hasHeightForWidth())
        self.handlerWidget.setSizePolicy(sizePolicy)
        self.handlerSearchLayout = QtWidgets.QHBoxLayout()
        self.handlerSearchLayout.setObjectName("handlerSearchLayout")
        self.moduleSearch = QtWidgets.QLineEdit(self)
        # self.moduleSearch.setMinimumSize(QtCore.QSize(0, 32))
        self.moduleSearch.setObjectName("moduleSearch")
        self.moduleSearch.textChanged.connect(self.searchHandler)
        self.handlerSearchLayout.addWidget(self.moduleSearch)
        icon = loadIcon("search")
        #icon.addPixmap(loadIcon("search")QtGui.QPixmap(":icons/actions/search.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On)
        self.searchAction = QtWidgets.QAction(
            icon, _translate("MainWindow", "Handler Search"), self)
        self.searchAction.setShortcut(QtGui.QKeySequence.Find)
        self.searchAction.triggered.connect(self.moduleSearch.setFocus)
        # self.searchBTN = QtWidgets.QPushButton(self)
        # self.searchBTN.setMinimumSize(QtCore.QSize(0, 32))
        # self.searchBTN.setIcon(icon)
        # self.searchBTN.setObjectName("searchBTN")
        # self.handlerSearchLayout.addWidget(self.searchBTN)

        self.handlerLayout.addWidget(self.treeWidget)
        self.handlerLayout.addLayout(self.handlerSearchLayout)
        self.dockWidget.setWidget(self.handlerWidget)

        self.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget)
        self.actionQuit = QtWidgets.QAction(self)
        icon = loadIcon("application-exit")
        self.actionQuit.setIcon(icon)
        self.actionQuit.setObjectName("actionQuit")
        self.actionErste_Schritte = QtWidgets.QAction(self)
        icon = loadIcon("help-contents")
        self.actionErste_Schritte.setIcon(icon)
        self.actionErste_Schritte.setObjectName("actionErste_Schritte")
        self.actionHelp = QtWidgets.QAction(self)
        icon = loadIcon("help-contents")
        self.actionHelp.setIcon(icon)
        self.actionHelp.setShortcut("")
        self.actionHelp.setObjectName("actionHelp")
        self.actionAbout = QtWidgets.QAction(self)
        icon = loadIcon("help-about")
        self.actionAbout.setIcon(icon)
        self.actionAbout.setObjectName("actionAbout")
        self.actionLogout = QtWidgets.QAction(self)
        icon = loadIcon("system-log-out")
        self.actionLogout.setIcon(icon)
        self.actionLogout.setObjectName("actionLogout")

        setActionTasks = True
        try:
            from viur_admin.module_overwrites import mainWindowTasksActionOff
            setActionTasks = mainWindowTasksActionOff
        except ImportError:
            pass

        if setActionTasks:
            self.actionTasks = QtWidgets.QAction(self)
            icon1 = QtGui.QIcon()
            icon1.addPixmap(QtGui.QPixmap(":icons/settings.svg"),
                            QtGui.QIcon.Normal, QtGui.QIcon.Off)
            self.actionTasks.setIcon(icon1)
            self.actionTasks.setObjectName("actionTasks")
            self.menuErweitert.addAction(self.actionTasks)
            self.actionTasks.setText(_translate("MainWindow", "Tasks"))
            self.actionTasks.triggered.connect(self.onActionTasksTriggered)

        self.toggleModuleViewTasks = QtWidgets.QAction(self)
        self.menuInfo.addAction(self.actionHelp)
        self.menuInfo.addSeparator()
        self.menuInfo.addAction(self.actionAbout)
        if isPyodide:
            self.menuInfo.addAction(self.actionLogout)

        self.menubar.addAction(self.menuInfo.menuAction())
        self.menubar.addAction(self.menuErweitert.menuAction())
        if not isPyodide:
            self.menuErweitert.addAction(self.searchAction)

        self.setWindowTitle(_translate("MainWindow", "ViUR Admin"))
        # self.iconLbl.setText(_translate("MainWindow", "TextLabel"))
        # self.modulLbl.setText(_translate("MainWindow", "TextLabel"))
        self.menuInfo.setTitle(_translate("MainWindow", "Info"))
        self.menuErweitert.setTitle(_translate("MainWindow", "Advanced"))
        self.dockWidget.setFeatures(self.dockWidget.NoDockWidgetFeatures)
        self.dockWidget.setFloating(False)

        self.dockWidget.setWindowTitle(_translate("MainWindow", "Modules"))
        self.treeWidget.setSortingEnabled(False)
        self.treeWidget.headerItem().setText(
            0, _translate("MainWindow", "Module"))
        self.actionQuit.setText(_translate("MainWindow", "Exit"))
        self.actionErste_Schritte.setText(
            _translate("MainWindow", "First steps"))
        self.actionHelp.setText(_translate("MainWindow", "Help"))
        self.actionAbout.setText(_translate("MainWindow", "About"))
        self.actionLogout.setText(_translate("MainWindow", "Log out"))

        self.moduleSearch.setPlaceholderText(
            _translate("MainWindow", "Handler Search"))
        self.stackedWidget.setCurrentIndex(-1)
        QtCore.QMetaObject.connectSlotsByName(self)

        self.treeWidget.setColumnWidth(0, 266)
        self.treeWidget.setColumnWidth(1, 25)
        event.connectWithPriority('loginSucceeded', self.loadConfig,
                                  event.lowPriority)
        # event.connectWithPriority( QtCore.SIGNAL('addHandler(PyQt_PyObject,PyQt_PyObject)'), self.addHandler,
        # event.lowestPriority )
        # event.connectWithPriority( QtCore.SIGNAL('stackHandler(PyQt_PyObject)'), self.stackHandler,
        # event.lowestPriority )
        # event.connectWithPriority( QtCore.SIGNAL('focusHandler(PyQt_PyObject)'), self.focusHandler, event.lowPriority )
        # event.connectWithPriority( QtCore.SIGNAL('unfocusHandler(PyQt_PyObject)'), self.unfocusHandler,
        # event.lowPriority )
        # event.connectWithPriority( QtCore.SIGNAL('removeHandler(PyQt_PyObject)'), self.removeHandler,
        # event.lowPriority )
        event.connectWithPriority('stackWidget', self.stackWidget,
                                  event.lowPriority)
        event.connectWithPriority('popWidget', self.popWidget,
                                  event.lowPriority)
        # event.connectWithPriority( QtCore.SIGNAL('addWidget(PyQt_PyObject)'), self.addWidget, event.lowPriority )
        # event.connectWithPriority( QtCore.SIGNAL('removeWidget(PyQt_PyObject)'), self.removeWidget, event.lowPriority )
        event.connectWithPriority('rebuildBreadCrumbs',
                                  self.rebuildBreadCrumbs, event.lowPriority)
        WidgetHandler.mainWindow = self
        self.actionAbout.triggered.connect(self.onActionAboutTriggered)
        self.actionHelp.triggered.connect(self.onActionHelpTriggered)
        self.actionLogout.triggered.connect(self.onActionLogoutTriggered)
        self.treeWidget.itemClicked.connect(self.onTreeWidgetItemClicked)
        if not isPyodide:
            self.menuErweitert.addAction(self.dockWidget.toggleViewAction())
        # self.searchBTN.released.connect(self.searchHandler)
        self.moduleSearch.returnPressed.connect(self.searchHandler)
        self.currentWidget = None
        self.helpBrowser = None
        self.startPage = None
        self.rebuildBreadCrumbs()
        self.setStatusBar(QtWidgets.QStatusBar())
        log.statusBarRef = self.statusBar()
        if not isPyodide:
            settings = QtCore.QSettings("Mausbrand", "ViurAdmin")
            try:
                self.restoreGeometry(settings.value("geometry"))
                self.restoreState(settings.value("windowState"))
            except Exception as err:
                # print(err)
                pass

        if self.dockWidget.isFloating():
            self.dockWidget.hide()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.loginCheck)
        self.timer.start(900000)