예제 #1
0
    def finish(self, text=None):
        """
        This is a slot. It's called when a thread emits its "finished" Signal.

        The given text is posted to the status bar.

        @param text: Text for status bar
        @type text: str
        """
        #print "in finish()"
        #logging.info("Finishing Progress Service")

        if self.progressRunning:
            with QMutexLocker(self.progressBarMutex):
                self.progressBar.hide()
        if self.throbberRunning:
            with QMutexLocker(self.throbberMutex):
                self.throbber.hide()

        if text is None:
            self.statusBarService.showMessage("Finished", 1000)
        else:
            self.statusBarService.showMessage(
                text, 3000)  # show finish message for 3 seconds

        self.thread = None  # release reference to thread
예제 #2
0
    def update(self, value, min=None, max=None, text=None):
        """
        Updates the progress bar with the given information.

        @param value: current value
        @type value: int

        @param min: Value that represents 0%
        @type min: int

        @param max: Value that represents 100%
        @type max: int

        @param text: Text to display on status bar
        @type text: str
        """
        #
        self.progressRunning = True
        with QMutexLocker(self.progressBarMutex):
            if min and max:
                self.progressBar.setRange(min, max)
            self.progressBar.setValue(value)
            self.progressBar.show()

        if text is not None:
            self.statusBarService.showMessage(text)
예제 #3
0
 def addPermanentWidget(self, widget):
     """
     Places the given widget on the wrapped QStatusBar.
     """
     with QMutexLocker(self.mutex):
         if self.statusbar:
             self.statusbar.addPermanentWidget(widget)
예제 #4
0
 def append(self, text):
     """
     Adding the text to the PlainTextEdit widget
     and setting the cursor, so that the text is visible.
     """
     with QMutexLocker(self.mutex):
         self.appendPlainText(str(text))
         self.moveCursor(QTextCursor.EndOfBlock)
         self.ensureCursorVisible()
예제 #5
0
 def showMessage(self, msg, time=5000):
     """
     Pass the given message on to the wrapped QStatusBar.
     Use a QMutex lock so that only one client of this service can write to the status bar
     at the same time.
     """
     with QMutexLocker(self.mutex):
         if self.statusbar:
             self.statusbar.showMessage(msg, time)
예제 #6
0
    def setProgressBarValue(self, value):
        """
        Uses a QMutexLocker to set the minimum value for the progress bar.

        This also implicitely "starts" the progress, e.g. show the ProgressBar.
        """
        self.progressRunning = True
        with QMutexLocker(self.progressBarMutex):
            self.progressBar.setValue(value)
            self.progressBar.show()
예제 #7
0
    def start_progress(self, text=None):
        """
        This is a slot. It starts the progress animation.

        The given text is posted to the status bar.

        @param text: Text for status bar
        @type text: str
        """
        self.progressRunning = True
        with QMutexLocker(self.progressBarMutex):
            self.progressBar.show()

        if text is None:
            self.statusBarService.showMessage("Computing...", 1000)
        else:
            self.statusBarService.showMessage(text)
예제 #8
0
    def start_throbber(self, text=None):
        """
        This is a slot. It starts (the progress-state-less) throbber
        animation.

        The given text is posted to the status bar.

        @param text: Text for status bar
        @type text: str
        """
        with QMutexLocker(self.throbberMutex):
            self.throbber.show()
            self.throbberRunning = True

        if text is None:
            self.statusBarService.showMessage("Computing...")
        else:
            self.statusBarService.showMessage(text)
예제 #9
0
 def is_stopped(self):
     with QMutexLocker(self.mutex):
         return self.stopped
예제 #10
0
 def stop(self):
     with QMutexLocker(self.mutex):
         self.stopped = True
예제 #11
0
 def emit(self, record):
     with QMutexLocker(self.mutex):
         self.widget.append(self.formatter.format(record))
예제 #12
0
 def setProgressBarMinimum(self, min):
     """
     Uses a QMutexLocker to set the minimum value for the progress bar.
     """
     with QMutexLocker(self.progressBarMutex):
         self.progressBar.setMinimum(min)