Esempio n. 1
0
 def onProgress(self, myRequest: RequestWrapper, bytesReceived: int,
                bytesTotal: int) -> None:
     if bytesReceived == bytesTotal:
         self.progressUpdate.emit(self,
                                  self.maxQueryCount - self.queryCount,
                                  self.maxQueryCount)
     if self.runningMessage:
         logToUser(self.formatLogMessage(self.runningMessage))
Esempio n. 2
0
	def onSaveError(self, error: Any) -> None:
		"""
			Unspecified error on saving/editing
		"""
		#self.overlay.inform(
		#	self.overlay.ERROR,
		#	QtCore.QCoreApplication.translate("EditWidget", "There was an error saving your changes"))
		logToUser(QtCore.QCoreApplication.translate("EditWidget", "There was an error saving your changes"))
		self.setDisabled(False)
		return
Esempio n. 3
0
	def onSaveSuccess(self, editTaskID: int) -> None:
		"""
			Adding/editing an entry just succeeded
		"""
		logger.debug("onSaveSuccess: %r, %r", editTaskID, self.editTaskID)
		if editTaskID != self.editTaskID:  # Not our task
			return
		self.setDisabled(False)
		logToUser(QtCore.QCoreApplication.translate("EditWidget", "Entry saved"))
		#self.overlay.inform(self.overlay.SUCCESS, QtCore.QCoreApplication.translate("EditWidget", "Entry saved"))
		if self.closeOnSuccess:
			event.emit('popWidget', self)
		else:
			self.reloadData()
Esempio n. 4
0
    def recheckFinished(self) -> None:
        """Delays emitting of our onFinished signal.

		On the local server the requests could finish even before all requests have been queued.
		"""
        if self.queryCount == 0:
            self.hasFinished = True
            self.finished.emit(self)
            if self.finishedMessage:
                logToUser(self.formatLogMessage(self.finishedMessage))
            if self.progressBar:
                self.progressBar.deleteLater()
                self.progressBar = None
            self.deleteLater()
Esempio n. 5
0
    def addQuery(self, query: RequestWrapper) -> None:
        """Add an RequestWrapper to the Group
		"""

        query.setParent(self)
        query.downloadProgress.connect(self.onProgress)
        query.requestFailed.connect(self.onError)
        query.finished.connect(self.onFinished)
        self.cancel.connect(query.abort)
        self.queryCount += 1
        self.maxQueryCount += 1
        self.runningRequests += 1
        if self.progressBar:
            self.progressBar.setMaximum(self.maxQueryCount)
        if self.runningMessage:
            logToUser(self.formatLogMessage(self.runningMessage))
Esempio n. 6
0
    def addToStatusBar(self,
                       runningMessage: str,
                       finishedMessage: str,
                       cancelable=False) -> None:
        """
			Calling this method will create a progressbar in the statusbar
			:param startMessage:
			:param finishedMessage:

		"""
        self.runningMessage = runningMessage
        self.finishedMessage = finishedMessage
        self.progressBar = QtWidgets.QProgressBar()
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(self.maxQueryCount)
        getStatusBar().addWidget(self.progressBar)
        self.progressBar.show()
        logToUser(self.formatLogMessage(self.runningMessage))
Esempio n. 7
0
 def logEntryDeleted(self, req):
     logToUser("Entry %s deleted" % req.deletedKey)
Esempio n. 8
0
 def onPreloaderFinished(self) -> None:
     self.preloader.deleteLater()
     self.preloader = None
     log.logToUser("Welcome to ViUR Admin")
     self.show()