Ejemplo n.º 1
0
    def __init__(self, logger=None, statusbar=None, progressbar=None,
                 blinker=None):
        gobject.GObject.__init__(self)
        BaseOutputHandler.__init__(self, logger)

        self.statusbar = statusbar
        if self.statusbar:
            self.context_id = statusbar.get_context_id('progress')

            if blinker is None:
                blinker = GtkBlinker()
                statusbar.pack_end(blinker, expand=False)
                blinker.hide()
            self.connect('pulse', lambda obj, text: blinker.show())
            self.connect('pulse', lambda obj, text: blinker.pulse())
            self.connect('pulse', self._update_statusbar)

            if progressbar is None:
                progressbar = gtk.ProgressBar()
                statusbar.pack_end(progressbar)
                progressbar.hide()
            self.connect('percentage-changed',
                                lambda obj, perc: progressbar.show())
            self.connect('percentage-changed', lambda obj, value:
                            progressbar.set_text(self.percentage_fmt % value))
            self.connect('percentage-changed', lambda obj, value:
                            progressbar.set_fraction(value / 100.))
        else:
            self.context_id = None

        self.progressbar = progressbar
        self.blinker = blinker
Ejemplo n.º 2
0
    def __init__(self, logger=None, statusbar=None, progressbar=None,
                 blinker=None, parent=None, **kwargs):
        QtCore.QObject.__init__(self, parent, **kwargs)
        BaseOutputHandler.__init__(self, logger)

        self.statusbar = statusbar
        if self.statusbar:
            if blinker is None:
                blinker = Qt4Blinker()
                statusbar.addPermanentWidget(blinker)
                blinker.hide()
            self.pulse.connect(blinker.show)
            self.pulse.connect(blinker.pulse)
            self.pulse[str].connect(lambda text:
                        statusbar.showMessage(text, self._statusbar_timeout))

            if progressbar is None:
                progressbar = QtGui.QProgressBar(self.statusbar)
                progressbar.setTextVisible(True)
                statusbar.addPermanentWidget(progressbar)  # , 1) # stretch=1
                progressbar.hide()
            self.progressbar = progressbar
            #self.percentageChanged[()].connect(progressbar.show)
            self.percentageChanged.connect(progressbar.show)
            self.percentageChanged.connect(progressbar.setValue)

        self.progressbar = progressbar
        self.blinker = blinker
Ejemplo n.º 3
0
Archivo: qt.py Proyecto: giumas/gsdview
    def __init__(self,
                 logger=None,
                 statusbar=None,
                 progressbar=None,
                 blinker=None,
                 parent=None,
                 **kwargs):
        QtCore.QObject.__init__(self, parent, **kwargs)
        BaseOutputHandler.__init__(self, logger)

        self.statusbar = statusbar
        if self.statusbar:
            if blinker is None:
                blinker = QtBlinker()
                statusbar.addPermanentWidget(blinker)
                blinker.hide()
            self.pulse.connect(blinker.show)
            self.pulse.connect(blinker.pulse)
            self.pulse[str].connect(lambda text: statusbar.showMessage(
                text, self._statusbar_timeout))

            if progressbar is None:
                progressbar = QtWidgets.QProgressBar(self.statusbar)
                progressbar.setTextVisible(True)
                statusbar.addPermanentWidget(progressbar)  # , 1) # stretch=1
                progressbar.hide()
            self.progressbar = progressbar
            #self.percentageChanged[()].connect(progressbar.show)
            self.percentageChanged.connect(progressbar.show)
            self.percentageChanged.connect(progressbar.setValue)

        self.progressbar = progressbar
        self.blinker = blinker
Ejemplo n.º 4
0
    def __init__(self,
                 logger=None,
                 statusbar=None,
                 progressbar=None,
                 blinker=None):
        GObject.GObject.__init__(self)
        BaseOutputHandler.__init__(self, logger)

        self.statusbar = statusbar
        if self.statusbar:
            self.context_id = statusbar.get_context_id('progress')

            if blinker is None:
                blinker = GtkBlinker()
                statusbar.pack_end(blinker,
                                   expand=False,
                                   fill=False,
                                   padding=0)
                blinker.hide()
            self.connect('pulse', lambda obj, text: blinker.show())
            self.connect('pulse', lambda obj, text: blinker.pulse())
            self.connect('pulse', self._update_statusbar)

            if progressbar is None:
                progressbar = Gtk.ProgressBar()
                statusbar.pack_end(progressbar,
                                   expand=False,
                                   fill=False,
                                   padding=0)
                progressbar.hide()
            self.connect('percentage-changed',
                         lambda obj, perc: progressbar.show())
            self.connect(
                'percentage-changed', lambda obj, value: progressbar.set_text(
                    self.percentage_fmt % value))
            self.connect(
                'percentage-changed',
                lambda obj, value: progressbar.set_fraction(value / 100.))
        else:
            self.context_id = None

        self.progressbar = progressbar
        self.blinker = blinker