Ejemplo n.º 1
0
 def mousePressEvent(self, event):
     if event.button() == Qt.LeftButton:
         self.handleMouseEventPos(event.pos())
         self.fLeftClickDown = True
     else:
         self.fLeftClickDown = False
     QProgressBar.mousePressEvent(self, event)
Ejemplo n.º 2
0
    def paintEvent(self, event):
        if self.fTextCall is not None:
            self.setFormat("%s %s %s" % (self.fPreLabel, self.fTextCall(), self.fLabel))
        else:
            self.setFormat("%s %f %s" % (self.fPreLabel, self.fRealValue, self.fLabel))

        QProgressBar.paintEvent(self, event)
Ejemplo n.º 3
0
    def __init__(self):
        if not InputForm.__instance:
            InputForm.__instance = self

        super(InputForm, self).__init__()

        Global.event.task_started.connect(self._on_task_started)
        Global.event.task_completed.connect(self._on_task_completed)
        Global.event.task_progressed.connect(self._on_task_progressed)
        Global.event.task_range_progressed.connect(self._on_task_range_progressed)
        Global.event.interface_load_task_params.connect(self._on_interface_load_task_params)

        self.vl = QVBoxLayout()
        self.vl.setContentsMargins(0,0,0,0)

        self.setLayout(self.vl)
        self.setFixedWidth(290)

        self.tab = QTabWidget()
        self.vl.addWidget(self.tab)

        self.input_parameters = InputParameters()
        self.input_parameters.ranges_state_changed.connect(self._on_ranges_state_changed)
        self.tab.addTab(self.input_parameters, 'Parameters')

        self.import_parameters = ImportParameters()
        self.tab.addTab(self.import_parameters, 'Observation')

        control_buttons = QWidget()
        control_buttons.setLayout(QVBoxLayout())
        control_buttons.layout().setContentsMargins(0, 0, 0, 0)
        control_buttons.layout().setAlignment(Qt.AlignBottom)

        self._progress = QProgressBar()
        self._progress.setValue(0)
        self._progress.setTextVisible(True)
        self._progress.setAlignment(Qt.AlignCenter)
        self._progress.hide()
        control_buttons.layout().addWidget(self._progress)

        self._range_progress = QProgressBar()
        self._range_progress.setValue(0)
        self._range_progress.setTextVisible(True)
        self._range_progress.setAlignment(Qt.AlignCenter)
        self._range_progress.hide()
        control_buttons.layout().addWidget(self._range_progress)

        self._calculate = QPushButton('Calculate')
        self._calculate.clicked.connect(self._on_calculate)
        control_buttons.layout().addWidget(self._calculate)

        self._cancel = QPushButton('Cancel')
        self._cancel.hide()
        self._cancel.clicked.connect(self._on_cancel)
        control_buttons.layout().addWidget(self._cancel)

        self.vl.addWidget(control_buttons)

        if exists("./config/last-session.ini") :
            self.load_params("./config/last-session.ini")
 def _launchImport(self):
     '''
     Launch the import
     '''
     
     if not self._validateMapping():
         return
     
     qgis_layer = self.qgislayers[self.cbbLayers.currentIndex()]
     
     self.close()
     
     # Progress bar + message
     progressMessageBar = PagLuxembourg.main.qgis_interface.messageBar().createMessage(QCoreApplication.translate('ImportShpDialog','Importing {}').format(self.shplayer.source()))
     progress = QProgressBar()
     progress.setMaximum(self.shplayer.featureCount())
     progress.setAlignment(Qt.AlignLeft|Qt.AlignVCenter)
     progressMessageBar.layout().addWidget(progress)
     PagLuxembourg.main.qgis_interface.messageBar().pushWidget(progressMessageBar, QgsMessageBar.INFO)
     
     # Start import session
     self._startImportSession()
     
     # Import the layer, and get the imported extent
     self._importLayer(
                       self.shplayer, 
                       qgis_layer, 
                       self.mapping.asIndexFieldMappings(qgis_layer.dataProvider().fields(), self.shpfields),
                       progress
                       )
     
     # Commit import session
     self._commitImport()
Ejemplo n.º 5
0
    def __setup_ui(self):
        self.resize(1024, 768)
        self.__setup_menu()

        split = QSplitter()
        self.__mib_tree_widget = MibTreeWidget()
        split.addWidget(self.__mib_tree_widget)
        #
        self.__data_widget = DataWidget()
        split.addWidget(self.__data_widget)
        split.setHandleWidth(2)
        split.setStretchFactor(0, 1)
        split.setStretchFactor(1, 200)

        la = QVBoxLayout()
        self.__progress_bar = QProgressBar()
        self.__progress_bar.setValue(0)
        self.__progress_bar.setVisible(False)
        la.addWidget(self.__progress_bar, 1)
        la.addWidget(split, 1)

        cw = QWidget()
        cw.setLayout(la)

        self.setCentralWidget(cw)
Ejemplo n.º 6
0
    def setupCommandGUI(self, commands):
        for name, node in sorted(commands.items(), key=natural_keys):
            row = self.ui.gridLayout.rowCount() + 1

            label = QLabel(self.ui.groupBox)

            if not node.category:
                label.setText(('      ' * node.level) +
                              node.name.replace('___', ' '))
            else:
                label.setText(('      ' *
                               node.level) + '<b>' +
                              node.name.replace('___', ' ') + '</b>')
            label.setObjectName('lableCommand_' + node.name)

            if not node.category:
                buttonStart = QPushButton(self.ui.groupBox)
                buttonStart.setText('Start')
                buttonStart.setObjectName('pushButtonCommand_' + node.name +
                                          '_start')
                buttonStart.clicked.connect(partial(self.onStart, name))

                buttonStop = QPushButton(self.ui.groupBox)
                buttonStop.setText('Stop')
                buttonStop.setObjectName('pushButtonCommand_' + node.name +
                                         '_stop')
                buttonStop.clicked.connect(partial(self.onStop, name))

                buttonRestart = QPushButton(self.ui.groupBox)
                buttonRestart.setText('Restart')
                buttonRestart.setObjectName('pushButtonCommand_' + node.name +
                                            '_restart')
                buttonRestart.clicked.connect(partial(self.onRestart, name))

                progressBar = None
                if node.name in self.progressTopics:
                    progressBar = QProgressBar(self.ui.groupBox)
                    progressBar.setObjectName('progressBarCommand_' +
                                              node.name)
                    progressBar.setValue(0)
                    progressBar.setMaximum(100)
                    progressBar.setMaximumWidth(300)

#                 if node.level == 0 or (node.level == 1 and node.parent.category):
#                     buttonStart.setEnabled(True)
#                     buttonStop.setEnabled(True)
#                     buttonRestart.setEnabled(True)
#                 else:
#                     buttonStart.setEnabled(False)
#                     buttonStop.setEnabled(False)
#                     buttonRestart.setEnabled(False)

                self.ui.gridLayout.addWidget(buttonStart, row, 1)
                self.ui.gridLayout.addWidget(buttonStop, row, 2)
                self.ui.gridLayout.addWidget(buttonRestart, row, 3)
                if not progressBar is None:
                    self.ui.gridLayout.addWidget(progressBar, row, 4)

            self.ui.gridLayout.addWidget(label, row, 0)
            self.setupCommandGUI(node.childs)
Ejemplo n.º 7
0
    def __init__(self):
        """
        constructor of the main window
        """
        QWidget.__init__(self)
        self.layout = QGridLayout(self)
        self.setLayout(self.layout)
        self.edit = QLineEdit("http://en.wikipedia.org/wiki/Homomorphism",
                              self)
        self.layout.addWidget(self.edit, 0, 0, 1, 2)
        self.queue = Queue()

        self.timer = QTimer(self)
        QObject.connect(self.timer, SIGNAL("timeout()"), self.tick)
        self.timer.start(10)
        self.combo = QComboBox(self)
        self.combo.addItem("Print")
        self.combo.addItem("MediaWiki")
        self.combo.addItem("normal")
        self.layout.addWidget(self.combo, 1, 1, 1, 1)
        self.layout.addWidget(QLabel("Template Expansion"), 1, 0, 1, 1)

        self.papercombo = QComboBox(self)
        self.papercombo.addItem("A4")
        self.papercombo.addItem("A5")
        self.papercombo.addItem("B5")
        self.papercombo.addItem("letter")
        self.papercombo.addItem("legal")
        self.papercombo.addItem("executive")

        self.layout.addWidget(self.papercombo, 2, 1, 1, 1)
        self.layout.addWidget(QLabel("Paper"), 2, 0, 1, 1)

        self.rastercombo = QComboBox(self)
        self.rastercombo.addItem("Rasterize")
        self.rastercombo.addItem("Keep vector form")
        self.layout.addWidget(self.rastercombo, 3, 1, 1, 1)
        self.layout.addWidget(QLabel("Vector Graphics"), 3, 0, 1, 1)

        self.inccombo = QComboBox(self)
        if platform.system() == "Linux":
            self.inccombo.addItem("Included")
            self.inccombo.addItem("Excluded")
        else:
            self.inccombo.addItem("excluded")
        self.layout.addWidget(self.inccombo, 4, 1, 1, 1)
        self.layout.addWidget(QLabel("LaTeX Source"), 4, 0, 1, 1)

        self.button = QPushButton("Run", self)
        self.layout.addWidget(self.button, 5, 0, 1, 2)
        self.counter = 0
        QObject.connect(self.button, SIGNAL("clicked()"), self.callbackrun)

        self.pbar = QProgressBar(self)
        self.pbar.setGeometry(30, 40, 200, 25)
        self.pbar.setValue(0)
        self.layout.addWidget(self.pbar, 6, 0, 1, 2)

        self.resize(340, -1)
        self.setWindowTitle("MediaWiki to LaTeX")
Ejemplo n.º 8
0
    def startWorker(self, Folder, Stats, OutImage, NoData):

        # create a new worker instance
        worker = Worker(Folder, Stats, OutImage, NoData)

        #Create Progressbar
        qgis.utils.iface.messageBar().clearWidgets()
        progressMessageBar = qgis.utils.iface.messageBar().createMessage(
            'Calculating Statistics Image...')
        progressBar = QProgressBar()
        progressBar.setMaximum(100)
        progressMessageBar.layout().addWidget(progressBar)
        qgis.utils.iface.messageBar().pushWidget(progressMessageBar)
        self.progressMessageBar = progressMessageBar

        # start the worker in a new thread
        thread = QThread()
        worker.moveToThread(thread)
        worker.finished.connect(self.workerFinished)
        worker.error.connect(self.workerError)
        worker.progress.connect(progressBar.setValue)
        thread.started.connect(worker.StatsImage)
        thread.start()
        self.thread = thread
        self.worker = worker
        self.outImage = OutImage
Ejemplo n.º 9
0
    def handleAppletProgressImpl(self, index, percentage, cancelled):
        # No need for locking; this function is always run from the GUI thread
        with Tracer(traceLogger,
                    msg="from applet {}: {}%, cancelled={}".format(
                        index, percentage, cancelled)):
            if cancelled:
                if index in self.appletPercentages.keys():
                    del self.appletPercentages[index]
            else:
                # Take max (never go back down)
                if index in self.appletPercentages:
                    oldPercentage = self.appletPercentages[index]
                    self.appletPercentages[index] = max(
                        percentage, oldPercentage)
                # First percentage we get MUST be zero.
                # Other notifications are ignored.
                if index in self.appletPercentages or percentage == 0:
                    self.appletPercentages[index] = percentage

            numActive = len(self.appletPercentages)
            if numActive > 0:
                totalPercentage = numpy.sum(
                    self.appletPercentages.values()) / numActive

            if numActive == 0 or totalPercentage == 100:
                if self.progressBar is not None:
                    self.statusBar.removeWidget(self.progressBar)
                    self.progressBar = None
                    self.appletPercentages.clear()
            else:
                if self.progressBar is None:
                    self.progressBar = QProgressBar()
                    self.statusBar.addWidget(self.progressBar)
                self.progressBar.setValue(totalPercentage)
Ejemplo n.º 10
0
    def create_ui_components(self):
        """
        Create layouts and qt controls.
        """
        self.layout = QGridLayout()

        self.kanjiGroup = QGroupBox()
        self.kanjiLayout = QGridLayout()

        # Kanji ui group
        self.day, self.week, self.month, self.year = \
        QLabel(KANJI), QLabel(KANJI), QLabel(KANJI), QLabel(KANJI)

        self.dayLabel, self.weekLabel, self.monthLabel, self.yearLabel = \
        QLabel('<b>Day</b>'), QLabel('<b>Week</b>'), \
        QLabel('<b>Month</b>'), QLabel('<b>Year</b>')

        # Main layout
        self.showAbout = QPushButton('A&bout')
        # DB controls (top)
        self.showDB, self.availableDB, self.changeDB = \
        QPushButton('&Change DB (active:)'), QComboBox(), QPushButton('&Remap')
        # General controls (bottom)
        self.getAll, self.showStats, self.quitApp, self.authGen, self.methodCombo = \
        QPushButton('&Get all'), QPushButton('&Stats'), QPushButton('&Quit'), \
        QPushButton('&Auth'), QComboBox()
        # Notifications
        self.progressBar = QProgressBar()
        self.statusMessage = QLabel()
        # About
        self.aboutBox = QMessageBox()
Ejemplo n.º 11
0
class WideSpanVNAWidget(VNAWidget):
    def __init__(self):
        super(WideSpanVNAWidget, self).__init__()
        self.start_spin = SpinBox(value=3e9)
        self.form_layout.addRow("Start Frequency", self.start_spin)
        self.stop_spin = SpinBox(value=9e9)
        self.form_layout.addRow("Stop Frequency", self.stop_spin)
        self.step_spin = SpinBox(value=1e6)
        self.form_layout.addRow("Delta Frequency", self.step_spin)
        self.progress_bar = QProgressBar()
        self.form_layout.addRow(self.progress_bar)

    def grab_trace(self):
        vna = self.get_vna()
        n_points_per_trace = vna.get_points()
        start = self.start_spin.value()
        stop = self.stop_spin.value()
        step = self.step_spin.value()
        span = stop - start
        n_traces = int(ceil(span / (step * n_points_per_trace)))
        trace_size = span / n_traces
        trace_starts = [start + i * trace_size for i in range(n_traces)]
        trace_ends = [start + (i + 1) * trace_size for i in range(n_traces)]
        self.freqs = []
        self.mags = []
        for i, (start_f, stop_f) in enumerate(zip(trace_starts, trace_ends)):
            self.progress_bar.setValue(int((100.0 * (1 + i)) / n_traces))
            vna.set_start_freq(start_f)
            vna.set_stop_freq(stop_f)
            self.freqs.extend(vna.do_get_xaxis())
            m, _ = vna.do_get_data(opc=True)
            self.mags.extend(m)
            self.replot()
            QApplication.instance().processEvents()
        self.progress_bar.setValue(0)
Ejemplo n.º 12
0
 def _progressbar_create(self):
     self.progressMessageBar = self.iface.messageBar().createMessage("Adding elevations to layer...")
     self.progress = QProgressBar()
     self.progress.setMaximum(100)
     self.progress.setAlignment(Qt.AlignLeft|Qt.AlignVCenter)
     self.progressMessageBar.layout().addWidget(self.progress)
     self.iface.messageBar().pushWidget(self.progressMessageBar, self.iface.messageBar().INFO)
Ejemplo n.º 13
0
    def __createLayout( self ):
        """ Creates the dialog layout """

        self.resize( 450, 20 )
        self.setSizeGripEnabled( True )

        verticalLayout = QVBoxLayout( self )

        # Info label
        self.infoLabel = QLabel( self )
        verticalLayout.addWidget( self.infoLabel )

        # Progress bar
        self.progressBar = QProgressBar( self )
        self.progressBar.setValue( 0 )
        self.progressBar.setOrientation( Qt.Horizontal )
        verticalLayout.addWidget( self.progressBar )

        # Buttons
        buttonBox = QDialogButtonBox( self )
        buttonBox.setOrientation( Qt.Horizontal )
        buttonBox.setStandardButtons( QDialogButtonBox.Close )
        verticalLayout.addWidget( buttonBox )

        buttonBox.rejected.connect( self.__onClose )
        return
Ejemplo n.º 14
0
    def on_downloaded(self):

        widget = self.iface.messageBar().createMessage(
            u"Géofoncier", u"Téléchargement du RFU.")

        progress_bar = QProgressBar()
        progress_bar.setMinimum(0)
        progress_bar.setMaximum(2)
        widget.layout().addWidget(progress_bar)

        self.iface.messageBar().pushWidget(widget, QgsMessageBar.WARNING)
        progress_bar.setValue(1)

        # https://pro.geofoncier.fr/index.php?&centre=-196406,5983255&context=metropole
        url = self.permalinkLineEdit.text()
        if not url:
            return self.abort_action(msg=u"Veuillez renseigner le permalien.")
        self.url = url

        try:
            self.download(self.url)
        except Exception as e:
            return self.abort_action(msg=e.message)

        progress_bar.setValue(2)
        self.iface.messageBar().clearWidgets()

        return
Ejemplo n.º 15
0
    def __init__(self, parent):
        VDialog.__init__(self, parent)
        self.resize(450, 150)
        self.gLayout = QGridLayout(self)
        self.pBulunan = QPushButton(self)
        self.pBulunan.setEnabled(False)
        self.pBulunan.clicked.connect(self.bulunan)
        self.gLayout.addWidget(self.pBulunan, 3, 2, 1, 1)
        self.mesaj = QLabel(self)
        self.gLayout.addWidget(self.mesaj, 0, 0, 1, 3)
        self.pBar = QProgressBar(self)
        self.pBar.setProperty("value", 0)

        self.gLayout.addWidget(self.pBar, 1, 0, 1, 3)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.gLayout.addItem(spacerItem, 3, 0, 1, 1)
        spacerItem1 = QSpacerItem(20, 20, QSizePolicy.Minimum,
                                  QSizePolicy.Fixed)
        self.gLayout.addItem(spacerItem1, 2, 0, 1, 3)

        self.setWindowTitle(u"Sistemi taramaya karar verdim...")
        self.pBulunan.setText(u"Bulunan Virüsleri Sil")
        self.mesaj.setText(u"")
        self.mesaj.setMaximumWidth(430)

        self.progress = Thread(self)
        self.progress.start()

        self.connect(self.progress, SIGNAL("setValue"), self.pBar.setValue)

        self.mesaj.setText(u"Dosya bilgileri alınıyor...")
Ejemplo n.º 16
0
    def createDialog(self):
        """
        Create qt dialog
        """
        self.setWindowTitle("%s" % self.name)
        layout = QVBoxLayout()

        self.loadingLabel = QLabel("Loading...")
        self.imageLabel = QLabel()

        layout2 = QHBoxLayout()
        layout2.addWidget(self.imageLabel)
        layout2.addWidget(self.loadingLabel)

        self.progressBar = QProgressBar(self)
        self.progressBar.setMaximum(0)
        self.progressBar.setProperty("value", 0)
        self.progressBar.setAlignment(Qt.AlignCenter)
        self.progressBar.setObjectName("progressBar")

        layout.addLayout(layout2)
        layout.addWidget(self.progressBar)

        self.setLayout(layout)

        flags = Qt.WindowFlags()
        flags |= Qt.MSWindowsFixedSizeDialogHint
        self.setWindowFlags(flags)
Ejemplo n.º 17
0
	def startWorker(self, Folder, Stats, OutImage,NoData):
			
			# create a new worker instance
			worker = Worker(Folder,Stats, OutImage,NoData)

			#Create Progressbar
			qgis.utils.iface.messageBar().clearWidgets() 
			progressMessageBar = qgis.utils.iface.messageBar().createMessage('Calculating Statistics Image...')
			progressBar = QProgressBar()
			progressBar.setMaximum(100)
			progressMessageBar.layout().addWidget(progressBar)
			qgis.utils.iface.messageBar().pushWidget(progressMessageBar)
			self.progressMessageBar = progressMessageBar

			# start the worker in a new thread
			thread = QThread()
			worker.moveToThread(thread)
			worker.finished.connect(self.workerFinished)
			worker.error.connect(self.workerError)
			worker.progress.connect(progressBar.setValue)
			thread.started.connect(worker.StatsImage)
			thread.start()
			self.thread = thread
			self.worker = worker
			self.outImage = OutImage
Ejemplo n.º 18
0
	def startWorker(self, ExtrairShape, CalcShape, OutShape, Ref, TypeUnits):
			
			# create a new worker instance
			worker = Worker(ExtrairShape, CalcShape, OutShape, Ref, TypeUnits)

			# configure the QgsMessageBar
			qgis.utils.iface.messageBar().clearWidgets() 
			progressMessageBar = qgis.utils.iface.messageBar().createMessage('Calculating area...')
			progressBar = QProgressBar()
			progressBar.setMaximum(100)
			progressMessageBar.layout().addWidget(progressBar)
			qgis.utils.iface.messageBar().pushWidget(progressMessageBar)
			self.progressMessageBar = progressMessageBar

			# start the worker in a new thread
			thread = QThread()
			worker.moveToThread(thread)
			worker.finished.connect(self.workerFinished)
			worker.error.connect(self.workerError)
			worker.progress.connect(progressBar.setValue)
			thread.started.connect(worker.runCalc)
			thread.start()
			self.thread = thread
			self.worker = worker
			self.output = OutShape
Ejemplo n.º 19
0
    def __init__(self, pixmap):
        super(SplashScreen, self).__init__(pixmap)

        self._title = QLabel(self)
        self._title.setGeometry(50 * self.width() / 100,
                                20 * self.height() / 100,
                                50 * self.width() / 100,
                                11 * self.height() / 100)
        self._title.setStyleSheet('QLabel { color : rgb(191,180,110); }')
        font = QFont('Exo 2')
        font.setPixelSize(36)
        font.setBold(True)
        font.setItalic(True)
        self._title.setFont(font)

        font = QFont('Exo 2')
        font.setPixelSize(16)
        font.setBold(False)
        font.setItalic(True)
        self.setFont(font)

        self.progressBar = QProgressBar(self)
        self.progressBar.setGeometry(self.width() / 10, 8 * self.height() / 10,
                                     8 * self.width() / 10,
                                     self.height() / 30)
Ejemplo n.º 20
0
 def synccomplete(self):
     try:
         self.iface.messageBar().popWidget(self.syncwidget)
     except RuntimeError:
         pass
     
     stylesheet = ("QgsMessageBar { background-color: rgba(239, 255, 233); border: 0px solid #b9cfe4; } "
                  "QLabel,QTextEdit { color: #057f35; } ")
     
     closebutton = self.iface.messageBar().findChildren(QToolButton)[0]
     closebutton.setVisible(True)
     closebutton.clicked.connect(functools.partial(self.report.setVisible, False))
     self.syncwidget = self.iface.messageBar().createMessage("Syncing", "Sync Complete", QIcon(":/icons/syncdone"))
     button = QPushButton(self.syncwidget)
     button.setCheckable(True)
     button.setChecked(self.report.isVisible())
     button.setText("Sync Report")
     button.setIcon(QIcon(":/icons/syncinfo"))
     button.toggled.connect(functools.partial(self.report.setVisible))      
     pro = QProgressBar()
     pro.setMaximum(100)
     pro.setValue(100)
     self.syncwidget.layout().addWidget(pro)      
     self.syncwidget.layout().addWidget(button)
     self.iface.messageBar().pushWidget(self.syncwidget)
     self.iface.messageBar().setStyleSheet(stylesheet)
     self.iface.mapCanvas().refresh()
Ejemplo n.º 21
0
    def __init__(self, base_image, size, hp=100, pos=(0, 0), parent=None):
        super().__init__(parent)
        self._base_label = QLabel(self)
        self._base_image = base_image
        self._size = size
        self._decor_label = None
        self._decor_pixmap = None
        self._hp_max = hp

        self.__pixmap = None
        """:type: PyQt4.QtGui.QPixmap"""

        self.__cord_x = pos[0]
        self.__cord_y = pos[1]
        self.__angle = 0

        self.__hp_bar = QProgressBar(self)
        self.__hp_bar.setMaximum(self._hp_max)
        self.__hp_bar.setValue(self._hp_max)
        self.__hp_bar.setTextVisible(False)
        self.__hp_bar.setMaximumSize(size[0], 5)

        self.setAlignment(Qt.AlignCenter)
        self.updatePixmap()

        if _debugging:
            self.setStyleSheet("border: 1px solid black")
Ejemplo n.º 22
0
    def __init__(self, *args):

        "Initialize a new main window."

        super(MainWindow, self).__init__(*args)
        self.cache = KPixmapCache("danbooru")
        self.preferences = preferences.Preferences()
        self.api = None
        self.__ratings = None
        self.__step = 0

        self.url_list = self.preferences.boards_list
        self.max_retrieve = self.preferences.thumbnail_no

        self.statusbar = self.statusBar()
        self.progress = QProgressBar()
        self.thumbnailarea = None
        self.tag_dock = None
        self.pool_dock = None
        self.first_fetch_widget = None

        self.progress.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)

        # FIXME: Hackish, but how to make it small otherwise?
        self.progress.setMinimumSize(100, 1)
        self.statusbar.addPermanentWidget(self.progress)
        self.progress.hide()

        self.setup_welcome_widget()
        self.setup_actions()
Ejemplo n.º 23
0
    def __init__(self, parent=None, numStages=1):
        QDialog.__init__(self, parent)

        self.currentStep = 0
        self.progress = None

        l = QVBoxLayout()
        self.setLayout(l)

        self.overallProgress = QProgressBar()
        self.overallProgress.setRange(0, numStages)
        self.overallProgress.setFormat("step %v of " + str(numStages))

        self.currentStepProgress = QProgressBar()
        self.currentStepProgress.setRange(0, 100)
        self.currentStepProgress.setFormat("%p %")

        self.overallLabel = QLabel("Overall progress")
        self.currentStepLabel = QLabel("Current step")

        l.addWidget(self.overallLabel)
        l.addWidget(self.overallProgress)
        l.addWidget(self.currentStepLabel)
        l.addWidget(self.currentStepProgress)
        l.maximumSize()

        self.update()
Ejemplo n.º 24
0
    def test_normal_case(self):
        app = QApplication([])
        from threading import Thread
        from PyQt4.QtGui import QProgressBar
        import time
        pg = QProgressBar()

        def test_thread():
            std_signal = Signal(1)
            test_built_in = Signal(2)
            std_signal.connect(pg.setValue)
            test_built_in.connect(pg.setRange)
            v_int = 0
            while True:
                v_int += 1
                std_signal.emit(v_int)
                test_built_in.emit(0, 10)
                time.sleep(0.5)
                if v_int == 5:
                    break
            pg.close()

        t = Thread(None, test_thread)
        t.start()
        pg.show()
        app.exec_()
Ejemplo n.º 25
0
 def _init_progress_dialog(self):
     """
     Initializes the progress dialog.
     """
     self.progress = QProgressBar(self)
     self.progress.resize(self.width(), 10)
     self.progress.setTextVisible(False)
Ejemplo n.º 26
0
    def startWorker(self, inFolder, OutFolder, Window, Polynomial):

        # create a new worker instance
        worker = Worker(inFolder, OutFolder, Window, Polynomial)

        #Create Progressbar
        qgis.utils.iface.messageBar().clearWidgets()
        progressMessageBar = qgis.utils.iface.messageBar().createMessage(
            'Executing Savitzky Golay Filter...')
        progressBar = QProgressBar()
        progressBar.setMaximum(100)
        progressMessageBar.layout().addWidget(progressBar)
        qgis.utils.iface.messageBar().pushWidget(progressMessageBar)
        self.progressMessageBar = progressMessageBar

        # start the worker in a new thread
        thread = QThread()
        worker.moveToThread(thread)
        worker.finished.connect(self.workerFinished)
        worker.error.connect(self.workerError)
        worker.progress.connect(progressBar.setValue)
        thread.started.connect(worker.SavitzkyGolayFilter)
        thread.start()
        self.thread = thread
        self.worker = worker
Ejemplo n.º 27
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self._options = None
        self._conf = None

        self._go = QPushButton('Go')
        self._go.setMaximumWidth(100)
        font = self._go.font()
        font.setPointSizeF(font.pointSizeF() * 2.0)
        font.setWeight(QFont.Bold)
        self._go.setFont(font)
        self._go.clicked.connect(self.go)

        self._saveLog = QPushButton('Save')
        saveLogLabel = QLabel('Log File:')
        saveLogBrowse = QPushButton('&Browse')
        saveLogBrowse.clicked.connect(self.browseSaveLog)
        self._saveLogEdit = QLineEdit('')

        gLayout = QGridLayout()
        gLayout.addWidget(saveLogLabel, 0, 0, 1, 1, Qt.AlignRight)
        gLayout.addWidget(self._saveLogEdit, 0, 1, 1, 6)
        gLayout.addWidget(saveLogBrowse, 0, 7, 1, 1)

        self._console = QTextEdit()
        self._console.setLineWrapMode(QTextEdit.NoWrap)
        self._console.setMinimumSize(800, 400)
        palette = self._console.palette()
        palette.setColor(QPalette.Base, QColor.fromRgb(255, 255,
                                                       221))  # ffffdd.
        self._console.setPalette(palette)
        font = QFont('Bitstream Vera Sans Mono',
                     self._console.font().pointSize())
        self._console.setFont(font)
        self._highlighter = Highlighter(self._console.document())

        self._progressBar = QProgressBar()
        self._progressBar.setRange(0, 100)
        self._progressBar.setTextVisible(True)

        hLayout = QHBoxLayout()
        hLayout.addStretch()
        hLayout.addWidget(self._go)
        hLayout.addStretch()
        hLayout.addWidget(self._saveLog)
        hLayout.addStretch()

        vLayout = QVBoxLayout()
        vLayout.addLayout(hLayout)
        vLayout.addLayout(gLayout)
        vLayout.addWidget(self._progressBar)
        vLayout.addWidget(self._console)
        self.setLayout(vLayout)

        self.progress.connect(self._progressBar.setValue)
        self._saveLog.clicked.connect(self.saveLog)

        self.readSettings()
        return
Ejemplo n.º 28
0
    def progress_bar(self):
        self.completed = 0
        self.canvas = QWidget()
        self.progress = QProgressBar(self.canvas)

        while self.completed < 100:
            self.completed += 0.0001
            self.progress.setValue(self.completed)
Ejemplo n.º 29
0
 def addProgressBars(self):
     self._progresses = myWidget(self)
     self._progressFiles = QProgressBar(self._progresses)
     self._progressParagraphs = QProgressBar(self._progresses)
     self._progresses.myLayout.addRow("Dateien", self._progressFiles)
     self._progresses.myLayout.addRow("Paragraphen", self._progressParagraphs)
     self._progresses.setEnabled(False)
     self.myLayout.addRow(self._progresses)
Ejemplo n.º 30
0
 def setValue(self, p_int):
     QProgressBar.setValue(self, p_int)
     if p_int > 70:
         self.change_color('rgb(76, 175, 80)')  # Green
     elif 70 >= p_int > 50:
         self.change_color('rgb(255, 193, 7)')  # Yellow
     elif p_int <= 50:
         self.change_color('rgb(244, 67, 54)')  # Red
Ejemplo n.º 31
0
 def addLoadingMsg(self, countLayers, barText='Downloading datasets'):
     barText = self.tr(barText)
     progressMessageBar = self.iface.messageBar().createMessage(barText, '0/' + str(countLayers))
     progress = QProgressBar()
     progress.setMaximum(countLayers)
     progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
     progressMessageBar.layout().addWidget(progress)
     return progressMessageBar, progress
Ejemplo n.º 32
0
class TestWindow(QWidget):
    def __init__(self):
        super(TestWindow, self).__init__()
        self.setWindowTitle("LivePlot Example Runner")
        layout = QHBoxLayout(self)
        button_layout = QVBoxLayout()
        time_layout = QHBoxLayout()
        time_spin = QSpinBox()
        self.timer = QTimer()
        time_spin.valueChanged.connect(self.timer.setInterval)
        self.timer.timeout.connect(self.iterate)
        self.progress_bar = QProgressBar()
        time_spin.setValue(50)
        time_spin.setRange(0, 1000)
        time_layout.addWidget(QLabel("Sleep Time (ms)"))
        time_layout.addWidget(time_spin)
        button_layout.addLayout(time_layout)

        tests = {
            'plot y': test_plot_y,
            'plot xy': test_plot_xy,
            'plot parametric': test_plot_xy_parametric,
            'plot z': test_plot_z,
            'plot huge': test_plot_huge,
            'append y': test_append_y,
            'append xy': test_append_xy,
            'append z': test_append_z,
        }
        fn_text_widget = QPlainTextEdit()
        fn_text_widget.setMinimumWidth(500)

        def make_set_iterator(iter):
            def set_iterator():
                fn_text_widget.setPlainText(inspect.getsource(iter))
                QApplication.instance().processEvents()
                self.iterator = iter()
                self.timer.start()

            return set_iterator

        for name, iter in tests.items():
            button = QPushButton(name)
            button.clicked.connect(make_set_iterator(iter))
            button_layout.addWidget(button)

        layout.addLayout(button_layout)
        text_layout = QVBoxLayout()
        text_layout.addWidget(fn_text_widget)
        text_layout.addWidget(self.progress_bar)
        layout.addLayout(text_layout)

    def iterate(self):
        try:
            self.iterator.next()
            self.progress_bar.setValue(self.progress_bar.value() + 1)
        except StopIteration:
            self.timer.stop()
            self.progress_bar.setValue(0)
Ejemplo n.º 33
0
class TestWindow(QWidget):
    def __init__(self):
        super(TestWindow, self).__init__()
        self.setWindowTitle("LivePlot Example Runner")
        layout = QHBoxLayout(self)
        button_layout = QVBoxLayout()
        time_layout = QHBoxLayout()
        time_spin = QSpinBox()
        self.timer = QTimer()
        time_spin.valueChanged.connect(self.timer.setInterval)
        self.timer.timeout.connect(self.iterate)
        self.progress_bar = QProgressBar()
        time_spin.setValue(50)
        time_spin.setRange(0, 1000)
        time_layout.addWidget(QLabel("Sleep Time (ms)"))
        time_layout.addWidget(time_spin)
        button_layout.addLayout(time_layout)

        tests = {
            'plot y': test_plot_y,
            'plot xy': test_plot_xy,
            'plot parametric': test_plot_xy_parametric,
            'plot z': test_plot_z,
            'plot huge': test_plot_huge,
            'append y': test_append_y,
            'append xy': test_append_xy,
            'append z': test_append_z,
            'label': test_label,
        }
        fn_text_widget = QPlainTextEdit()
        fn_text_widget.setMinimumWidth(500)

        def make_set_iterator(iter):
            def set_iterator():
                fn_text_widget.setPlainText(inspect.getsource(iter))
                QApplication.instance().processEvents()
                self.iterator = iter()
                self.timer.start()
            return set_iterator

        for name, iter in tests.items():
            button = QPushButton(name)
            button.clicked.connect(make_set_iterator(iter))
            button_layout.addWidget(button)

        layout.addLayout(button_layout)
        text_layout = QVBoxLayout()
        text_layout.addWidget(fn_text_widget)
        text_layout.addWidget(self.progress_bar)
        layout.addLayout(text_layout)

    def iterate(self):
        try:
            self.iterator.next()
            self.progress_bar.setValue(self.progress_bar.value() + 1)
        except StopIteration:
            self.timer.stop()
            self.progress_bar.setValue(0)
Ejemplo n.º 34
0
 def make_prog_bar(self):
     progMessageBar = self.iface.messageBar().createMessage(
         "Creation in progress...")
     self.progress = QProgressBar()
     self.progress.setMaximum(10)
     self.progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
     progMessageBar.layout().addWidget(self.progress)
     self.iface.messageBar().pushWidget(progMessageBar,
                                        self.iface.messageBar().INFO)
Ejemplo n.º 35
0
 def __init__(self, algname=None):
     self.progressMessageBar = \
         iface.messageBar().createMessage(self.tr('Executing algorithm <i>{0}</i>'.format(algname if algname else '')))
     self.progress = QProgressBar()
     self.progress.setMaximum(100)
     self.progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
     self.progressMessageBar.layout().addWidget(self.progress)
     iface.messageBar().pushWidget(self.progressMessageBar,
                                   iface.messageBar().INFO)
Ejemplo n.º 36
0
 def critical_message_bar(self, message):
     self.progressMessageBar = self.iface.messageBar().createMessage(
         message)
     self.progress = QProgressBar()
     self.progress.setMaximum(19)
     self.progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
     self.progressMessageBar.layout().addWidget(self.progress)
     self.iface.messageBar().pushWidget(self.progressMessageBar,
                                        self.iface.messageBar().CRITICAL)
Ejemplo n.º 37
0
 def __init__(self):
     self.progressMessageBar = \
         iface.messageBar().createMessage(self.tr('Executing algorithm'))
     self.progress = QProgressBar()
     self.progress.setMaximum(100)
     self.progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
     self.progressMessageBar.layout().addWidget(self.progress)
     iface.messageBar().pushWidget(self.progressMessageBar,
                                   iface.messageBar().INFO)
 def initialize_progress_bar(self):
     try:
         self.progressMessageBar = self.iface.messageBar().createMessage(
             "Plugin Peregrine Falcon: Traitements en cours...")
         self.progress = QProgressBar()
         self.progress.setMaximum(19)
         self.progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
         self.progressMessageBar.layout().addWidget(self.progress)
     except:
         pass
Ejemplo n.º 39
0
    def setup_progressbar(self, message, maximum):
        if not SHOW_PROGRESSBAR: return

        progress_message_bar = iface.messageBar().createMessage(message)
        self.progress = QProgressBar()
        self.progress.setMaximum(maximum)
        self.progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        progress_message_bar.layout().addWidget(self.progress)
        iface.messageBar().pushWidget(progress_message_bar,
                                      iface.messageBar().INFO)
Ejemplo n.º 40
0
    def __init__(self, parent=None):
        from radiance import __version__
        self.__version = __version__
        self.parent = parent
        
        pixmap = QPixmap(QString(':/Radiance/splashscreen.png'))
        flags = Qt.WindowStaysOnTopHint
        QSplashScreen.__init__(self, pixmap, flags)
        self.setMask(pixmap.mask())
        
        # Custom progress bar stylesheet
        progressbar_stylesheet = """
        QProgressBar:horizontal {
            border: 1px solid black;
            background: white;
            padding: 1px;
        }
        QProgressBar::chunk:horizontal {
            background-color: qlineargradient(spread: pad, x1: 1, y1: 0.5, x2: 0, y2: 0.5, stop: 0 black, stop: 1 white);
        }
        """
        
        # Place progress bar to bottom of splash screen.
        progressbar = QProgressBar(self)
        progressbar.setRange(0, 0)
        progressbar.setGeometry(10, self.height() - 20, self.width() - 20, 10)
        progressbar.setTextVisible(False)
        progressbar.setStyleSheet(progressbar_stylesheet)
        self.progressbar = progressbar

        self.show()
Ejemplo n.º 41
0
    def on_downloaded(self):

        widget = self.iface.messageBar().createMessage(u"Géofoncier", u"Téléchargement du RFU.")

        progress_bar = QProgressBar()
        progress_bar.setMinimum(0)
        progress_bar.setMaximum(2)
        widget.layout().addWidget(progress_bar)

        self.iface.messageBar().pushWidget(widget, QgsMessageBar.WARNING)
        progress_bar.setValue(1)

        # https://pro.geofoncier.fr/index.php?&centre=-196406,5983255&context=metropole
        url = self.permalinkLineEdit.text()
        if not url:
            return self.abort_action(msg=u"Veuillez renseigner le permalien.")
        self.url = url

        try:
            self.download(self.url)
        except Exception as e:
            return self.abort_action(msg=e.message)

        progress_bar.setValue(2)
        self.iface.messageBar().clearWidgets()

        return
Ejemplo n.º 42
0
class ProgressWidget(QgsMessageBar):
    def __init__(self, min, max, message, parent=None, timeout = 1.5):
        """
        Constructs a progress widget
        """
        super(self.__class__, self).__init__(parent)
        self.min = min
        self.max = max
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        if parent:
            self.setMinimumSize(parent.width(),40)
        else:
            self.setMinimumSize(766,40)
        self.setSizePolicy(sizePolicy)
        self.progressBar = QProgressBar()
        self.progressBar.setMinimum(min)
        self.progressBar.setMaximum(max)
        self.msgBarItem = QgsMessageBarItem(self.tr("INFO: "), message, self.progressBar, level=QgsMessageBar.INFO, duration=timeout)
        self.pushWidget(self.msgBarItem)
    
    def initBar(self):
        """
        Initializes the progress bar
        """
        self.progressBar.setValue(0)
    
    def step(self):
        """
        Increments the progress bar
        """
        value = self.progressBar.value() + 1
        self.progressBar.setValue(value)
        if value == self.max:
            time.sleep(1)
            self.close()
Ejemplo n.º 43
0
 def __init__(self, val, max, color=None, format="%v"):
     QProgressBar.__init__(self)
     Cell.__init__(self)
     self.setFormat(format)
     self.setMinimum(0)
     self.setMaximum(max)
     self.setValue(val)
     if color:
         palette = self.palette()
         palette.setColor(QPalette.Highlight, QColor(color))
         self.setPalette(palette)
Ejemplo n.º 44
0
class ProgressDialog(QDialog):
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.resize(300, 75)
        self.setWindowTitle("Updating")
        self.vw = QWidget(self)
        self.vl = QVBoxLayout(self.vw)
        self.vl.setMargin(10)
        self.label = QLabel(self.vw)
        self.label.setText("<b>Downloading:</b> library.zip")
        self.vl.addWidget(self.label)
        self.horizontalLayoutWidget = QWidget()
        self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget)
        self.horizontalLayout.setMargin(0)
        self.progressbar = QProgressBar(self.horizontalLayoutWidget)
        self.progressbar.setFixedWidth(260)
        self.progressbar.setMinimum(0)
        self.progressbar.setMaximum(100)
        self.stopButton = QPushButton(self.horizontalLayoutWidget)
        self.stopButton.setFlat(True)
        self.stopButton.setIcon(Icons.stop)
        self.stopButton.setFixedSize(16,16)
        self.horizontalLayout.addWidget(self.progressbar)
        self.horizontalLayout.addWidget(self.stopButton)
        self.vl.addWidget(self.horizontalLayoutWidget)
        self.stopButton.clicked.connect(self.forceStop)
        
    def setValue(self,val):
        self.progressbar.setValue(val)
    def forceStop(self):
        self.emit(SIGNAL("forceStop"))
Ejemplo n.º 45
0
class SeekOverlay(Overlay):
   def __init__(self, keyPressHandler, parent = None):
      Overlay.__init__(self, keyPressHandler, parent)
      
      self.setupUI()
      
      
   def setupUI(self):
      self.layout = QHBoxLayout(self)
      
      self.timeBar = QProgressBar()
      self.layout.addWidget(self.timeBar)
      
      
   def resizeEvent(self, event):
      textHeight = event.size().height() * .4
      self.timeBar.setStyleSheet('QProgressBar {font-size: %dpt;}' % textHeight)
      
      
   def setTime(self, current, total):
      current = int(current)
      total = int(total)
      self.timeBar.setMaximum(total)
      self.timeBar.setValue(current)
      self.timeBar.setFormat(MPlayer.formatTime(current) + '/' + MPlayer.formatTime(total))
Ejemplo n.º 46
0
class ExerciseUI(QGroupBox):

  def __init__(self, exercise):
    super(ExerciseUI, self).__init__()
    self.exercise = exercise
    self.initUI()

  def initUI(self):
    self.setTitle(self.exercise.label)
    
    self.level = QLabel(QString('Lvl. %d' % self.exercise.level))

    self.progressbar = QProgressBar()
    self.progressbar.setMinimum(0)
    self.progressbar.setMaximum(100)
    self.progressbar.setValue(self.exercise.progress)

    grid = QGridLayout()
    grid.addWidget(self.level, 0, 0)
    grid.addWidget(self.progressbar, 0, 1, 1, 9)
    for (index, step) in enumerate(self.exercise.steps):
      btn = QPushButton(QString('+') + QString.number(step))
      grid.addWidget(btn, 1, index)
      btn.clicked.connect(self.buttonClicked)

    self.setLayout(grid)

  def buttonClicked(self):
    sender = self.sender()
    step = int(str(sender.text()).lstrip('+'))
    self.exercise.add(step)
    self.level.setText(QString('Lvl. %d' % self.exercise.level))
    self.progressbar.setValue(self.exercise.progress)
Ejemplo n.º 47
0
class BlockingTask(QObject):
    """
    Blocking task provides a UI wrapper for long running tasks.
    While the task is executed a modal progress dialog will be shown.
    The task can be canceled through the UI.
    """
    load_finished = pyqtSignal(scene.Scene)

    def __init__(self, scene_load_func, message, *args, **kwargs):
        super(BlockingTask, self).__init__(*args, **kwargs)
        self.scene_load_func = scene_load_func
        self.message = message

        self.progress_bar = QProgressBar()
        self.progress_bar.setRange(0, 0)
        self.worker = None

    def start_task(self):
        self._async_execute()

    def _on_load_finished(self):
        logger.debug('On task finished')
        self.scene = self.worker.result
        if self.scene is not None:
            self.load_finished.emit(self.scene)
        self.progress_dialog.hide()

    def _on_load_start(self):
        logger.debug('On task start')
        self.progress_dialog = QProgressDialog(self.message,
                                               "Abort",
                                               0,
                                               0,
                                               self.parent(),
                                               flags=Qt.CustomizeWindowHint,
                                               )
        self.progress_dialog.setWindowModality(Qt.WindowModal)
        self.progress_dialog.canceled.connect(self._abort)
        self.progress_dialog.show()

    def _abort(self):
        self.worker.terminate()

    def _async_execute(self):
        self._on_load_start()
        self.worker = TaskWorker(self.scene_load_func)
        self.worker.task_done.connect(self._on_load_finished)
        self.worker.start()
Ejemplo n.º 48
0
    def __init__(self, parent):
        VDialog.__init__(self, parent)
        self.resize(450, 150)
        self.gLayout = QGridLayout(self)
        self.pBulunan = QPushButton(self)
        self.pBulunan.setEnabled(False)
        self.pBulunan.clicked.connect(self.bulunan)
        self.gLayout.addWidget(self.pBulunan, 3, 2, 1, 1)
        self.mesaj = QLabel(self)
        self.gLayout.addWidget(self.mesaj, 0, 0, 1, 3)
        self.pBar = QProgressBar(self)
        self.pBar.setProperty("value", 0)

        self.gLayout.addWidget(self.pBar, 1, 0, 1, 3)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.gLayout.addItem(spacerItem, 3, 0, 1, 1)
        spacerItem1 = QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.gLayout.addItem(spacerItem1, 2, 0, 1, 3)

        self.setWindowTitle(u"Sistemi taramaya karar verdim...")
        self.pBulunan.setText(u"Bulunan Virüsleri Sil")
        self.mesaj.setText(u"")
        self.mesaj.setMaximumWidth(430)

        self.progress = Thread(self)
        self.progress.start()

        self.connect(self.progress, SIGNAL("setValue"), self.pBar.setValue)

        self.mesaj.setText(u"Dosya bilgileri alınıyor...")
Ejemplo n.º 49
0
    def __init__(self, parent=None):
        QProgressDialog.__init__(self, parent)

        self.progress = QProgressBar(self)
        self.progress.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)

        self.setBar(self.progress)
Ejemplo n.º 50
0
    def __init__(self, parent=None):
        super(ProgressView, self).__init__(parent)

        self._progressBar = QProgressBar()

        layout = QVBoxLayout(self)
        layout.addWidget(self._progressBar)
Ejemplo n.º 51
0
    def __init__(self, plugin):
        QFrame.__init__(self, core.workspace())
        self._mode = None
        self.plugin = plugin
        from PyQt4 import uic  # lazy import for better startup performance

        uic.loadUi(os.path.join(os.path.dirname(__file__), "SearchWidget.ui"), self)

        self.cbSearch.setCompleter(None)
        self.cbReplace.setCompleter(None)
        self.cbMask.setCompleter(None)

        self.fsModel = QDirModel(self.cbPath.lineEdit())
        self.fsModel.setFilter(QDir.AllDirs | QDir.NoDotAndDotDot)
        self.cbPath.lineEdit().setCompleter(QCompleter(self.fsModel, self.cbPath.lineEdit()))
        # TODO QDirModel is deprecated but QCompleter does not yet handle
        # QFileSystemodel - please update when possible."""
        self.cbSearch.setCompleter(None)
        self.pbSearchStop.setVisible(False)
        self.pbReplaceCheckedStop.setVisible(False)

        self._progress = QProgressBar(self)
        self._progress.setAlignment(Qt.AlignCenter)
        self._progress.setToolTip(self.tr("Search in progress..."))
        self._progress.setMaximumSize(QSize(80, 16))
        core.mainWindow().statusBar().insertPermanentWidget(1, self._progress)
        self._progress.setVisible(False)

        # cd up action
        self.tbCdUp = QToolButton(self.cbPath.lineEdit())
        self.tbCdUp.setIcon(QIcon(":/enkiicons/go-up.png"))
        self.tbCdUp.setCursor(Qt.ArrowCursor)
        self.tbCdUp.installEventFilter(self)  # for drawing button

        self.cbSearch.installEventFilter(self)  # for catching Tab and Shift+Tab
        self.cbReplace.installEventFilter(self)  # for catching Tab and Shift+Tab
        self.cbPath.installEventFilter(self)  # for catching Tab and Shift+Tab
        self.cbMask.installEventFilter(self)  # for catching Tab and Shift+Tab

        self._closeShortcut = QShortcut(QKeySequence("Esc"), self)
        self._closeShortcut.setContext(Qt.WidgetWithChildrenShortcut)
        self._closeShortcut.activated.connect(self.hide)

        # connections
        self.cbSearch.lineEdit().textChanged.connect(self._onSearchRegExpChanged)

        self.cbSearch.lineEdit().returnPressed.connect(self._onReturnPressed)
        self.cbReplace.lineEdit().returnPressed.connect(self._onReturnPressed)
        self.cbPath.lineEdit().returnPressed.connect(self._onReturnPressed)
        self.cbMask.lineEdit().returnPressed.connect(self._onReturnPressed)

        self.cbRegularExpression.stateChanged.connect(self._onSearchRegExpChanged)
        self.cbCaseSensitive.stateChanged.connect(self._onSearchRegExpChanged)

        self.tbCdUp.clicked.connect(self._onCdUpPressed)

        core.mainWindow().hideAllWindows.connect(self.hide)
        core.workspace().currentDocumentChanged.connect(
            lambda old, new: self.setVisible(self.isVisible() and new is not None)
        )
Ejemplo n.º 52
0
    def __init__(self, parent, url, archivo_destino):
        super(Descargar, self).__init__(parent)

        self.url = url
        self.httpGetId = 0
        self.httpRequestAborted = False
        self.statusLabel = QLabel('Descargando el manual completo ...')
        self.closeButton = QPushButton("Cerrar")
        self.closeButton.setAutoDefault(False)
        self.barra = QProgressBar()

        buttonBox = QDialogButtonBox()
        buttonBox.addButton(self.closeButton, QDialogButtonBox.RejectRole)

        self.http = QHttp(self)
        self.http.requestFinished.connect(self.cuando_finalizar_request)
        self.http.dataReadProgress.connect(self.cuando_actualiza_descarga)
        self.http.responseHeaderReceived.connect(self.cuando_responder_header)
        self.closeButton.clicked.connect(self.cuando_cancela)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.statusLabel)
        mainLayout.addWidget(self.barra)
        mainLayout.addWidget(buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle('Descargando manual')
        self.downloadFile(url, archivo_destino)
Ejemplo n.º 53
0
    def _createAppUpdateWidget(self, installedVersion):
        widget = QGroupBox("Application", self)

        layout = QVBoxLayout(widget)
        versionLabel = QLabel("Installed Version: " + installedVersion)
        layout.addWidget(versionLabel, 0)

        self._appStatusLabel = QLabel(widget)
        self._appStatusLabel.setWordWrap(True)
        layout.addWidget(self._appStatusLabel, 0)

        self._progressBar = QProgressBar(widget)
        self._progressBar.setVisible(False)
        layout.addWidget(self._progressBar, 0)

        self._appCheckButton = QPushButton("Check for Update", widget)
        self._appCheckButton.clicked.connect(self.checkForAppUpdate)

        layout.addWidget(self._appCheckButton, 0)

        self._appChangeLog = QTextEdit(self)
        self._appChangeLog.setReadOnly(True)
        self._appChangeLog.setVisible(False)
        layout.addWidget(self._appChangeLog, 1)

        return widget
Ejemplo n.º 54
0
    def __init__(self, parent=None):
        super(MainWinGui, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.myName.setText(getStoredName() or "")

        self.ui.myName.textEdited.connect(self.nameChanged)

        self.communicator = Communicator(self)
        self.communicator.peersUpdated.connect(self.refreshPeers)
        self.communicator.fileReceived.connect(self.fileReceived)

        self.ui.refreshPeersButton.clicked.connect(self.discoverPeers)
        self.ui.peerList.itemClicked.connect(self.peerSelected)

        self.progressIndeterminate.connect(self.progressIndeterminateSlot)
        self.progressSet.connect(self.progressSetSlot)
        self.progressStop.connect(self.progressStopSlot)

        self.progressIndicator = QProgressBar(self.ui.statusbar)
        self.progressIndicator.setMinimumHeight(5)
        self.progressIndicator.setVisible(False)
        self.progressIndicator.setMaximum(0)
        self.progressIndicator.setMinimum(0)
        self.ui.statusbar.addWidget(self.progressIndicator)
Ejemplo n.º 55
0
    def __init__( self, web, printer , parent = None ):
        """
        @param web: La dirección web a la que apunta el reporte
        @param printer: El objeto QPrinter en el que se imprime, esto es usado por si se desea alguna configuración especifica del reporte
        """
        super( frmReportes, self ).__init__( printer, parent )

        base = Reports.url

        if base == "":
            raise UserWarning( u"No existe una configuración para el servidor de reportes" )


        self.report = base + web + "&uname=" + user.LoggedUser.user + "&hash=" + user.LoggedUser.hash
        self.webview = QWebView()
        self.setWindowFlags( self.windowFlags() | Qt.WindowMaximizeButtonHint )




        self.txtSearch = QLineEdit()

        self.loaded = False


        self.webview.load( QUrl( self.report ) )
        self.progressbar = QProgressBar( self )




        self.paintRequested[QPrinter].connect( self.reprint )
        self.webview.loadFinished[bool].connect( self.on_webview_loadFinished )
        self.webview.loadProgress[int].connect( self.on_webview_loadProgress )
Ejemplo n.º 56
0
    def __init__(self):
        super(MyCustomDialog, self).__init__()
        layout = QVBoxLayout(self)
 
        # Create a progress bar and a button and add them to the main layout
        self.progressBarUpdate = QProgressBar(self)
        self.progressBarUpdate.setAlignment(Qt.AlignCenter)
        layout.addWidget(self.progressBarUpdate)

        pushButtonUpdate = QPushButton("Start", self)
        layout.addWidget(pushButtonUpdate)
        pushButtonCancel = QPushButton("Cancel", self)
        layout.addWidget(pushButtonCancel)
 
        pushButtonUpdate.clicked.connect(self.check_folder_exists)

        # Set data for download and saving in path
        self.location = os.path.abspath(os.path.join('temp', 'example-app-0.3.win32.zip'))
        self.url = 'http://sophus.bplaced.net/download/example-app-0.3.win32.zip'
 
        self.download_task = Download_Thread(self.location, self.url)
        self.download_task.notify_progress.connect(self.on_progress)
        self.download_task.finished_thread.connect(self.on_finished)
        self.download_task.error_http.connect(self.on_HTTPError)
        self.download_task.finished_download.connect(self.on_finish_download)

        pushButtonCancel.clicked.connect(self.on_finished)
Ejemplo n.º 57
0
 def handleAppletProgressImpl(self, index, percentage, cancelled):
     # No need for locking; this function is always run from the GUI thread
     with Tracer(traceLogger, msg="from applet {}: {}%, cancelled={}".format(index, percentage, cancelled)):
         if cancelled:
             if index in self.appletPercentages.keys():
                 del self.appletPercentages[index]
         else:
             # Take max (never go back down)
             if index in self.appletPercentages:
                 oldPercentage = self.appletPercentages[index]
                 self.appletPercentages[index] = max(percentage, oldPercentage)
             # First percentage we get MUST be zero.
             # Other notifications are ignored.
             if index in self.appletPercentages or percentage == 0:
                 self.appletPercentages[index] = percentage
 
         numActive = len(self.appletPercentages)
         if numActive > 0:
             totalPercentage = numpy.sum(self.appletPercentages.values()) / numActive
         
         if numActive == 0 or totalPercentage == 100:
             if self.progressBar is not None:
                 self.statusBar.removeWidget(self.progressBar)
                 self.progressBar = None
                 self.appletPercentages.clear()
         else:
             if self.progressBar is None:
                 self.progressBar = QProgressBar()
                 self.statusBar.addWidget(self.progressBar)
             self.progressBar.setValue(totalPercentage)
Ejemplo n.º 58
0
    def __init__( self ):
        self.snapshots = snapshots.Snapshots()
        self.config = self.snapshots.config
        self.decode = None

        if len( sys.argv ) > 1:
            if not self.config.set_current_profile(sys.argv[1]):
                logger.warning("Failed to change Profile_ID %s"
                               %sys.argv[1], self)

        self.qapp = qt4tools.create_qapplication(self.config.APP_NAME)
        translator = qt4tools.get_translator()
        self.qapp.installTranslator(translator)
        self.qapp.setQuitOnLastWindowClosed(False)

        import icon
        self.icon = icon
        self.qapp.setWindowIcon(icon.BIT_LOGO)

        self.status_icon = QSystemTrayIcon(icon.BIT_LOGO)
        #self.status_icon.actionCollection().clear()
        self.contextMenu = QMenu()

        self.menuProfileName = self.contextMenu.addAction(_('Profile: "%s"') % self.config.get_profile_name())
        qt4tools.set_font_bold(self.menuProfileName)
        self.contextMenu.addSeparator()

        self.menuStatusMessage = self.contextMenu.addAction(_('Done'))
        self.menuProgress = self.contextMenu.addAction('')
        self.menuProgress.setVisible(False)
        self.contextMenu.addSeparator()

        self.btnDecode = self.contextMenu.addAction(icon.VIEW_SNAPSHOT_LOG, _('decode paths'))
        self.btnDecode.setCheckable(True)
        self.btnDecode.setVisible(self.config.get_snapshots_mode() == 'ssh_encfs')
        QObject.connect(self.btnDecode, SIGNAL('toggled(bool)'), self.onBtnDecode)

        self.openLog = self.contextMenu.addAction(icon.VIEW_LAST_LOG, _('View Last Log'))
        QObject.connect(self.openLog, SIGNAL('triggered()'), self.onOpenLog)
        self.startBIT = self.contextMenu.addAction(icon.BIT_LOGO, _('Start BackInTime'))
        QObject.connect(self.startBIT, SIGNAL('triggered()'), self.onStartBIT)
        self.status_icon.setContextMenu(self.contextMenu)

        self.pixmap = icon.BIT_LOGO.pixmap(24)
        self.progressBar = QProgressBar()
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(100)
        self.progressBar.setValue(0)
        self.progressBar.setTextVisible(False)
        self.progressBar.resize(24, 6)
        self.progressBar.render(self.pixmap, sourceRegion = QRegion(0, -14, 24, 6), flags = QWidget.RenderFlags(QWidget.DrawChildren))

        self.first_error = self.config.is_notify_enabled()
        self.popup = None
        self.last_message = None

        self.timer = QTimer()
        QObject.connect( self.timer, SIGNAL('timeout()'), self.update_info )

        self.ppid = os.getppid()