Python PyQt4.QtGui 模块,QCursor() 实例源码

我们从Python开源项目中,提取了以下43个代码示例,用于说明如何使用PyQt4.QtGui.QCursor()

项目:spyking-circus    作者:spyking-circus    | 项目源码 | 文件源码
def remove_templates(self, event):
        print_and_log(['Deleting templates: %s' %str(sorted(self.inspect_templates))], 'default', logger)
        self.app.setOverrideCursor(QCursor(Qt.WaitCursor))

        if len(self.inspect_templates) > 0:
            self.to_delete = numpy.concatenate((self.to_delete, self.to_consider[self.inspect_templates]))
            self.generate_data()
            self.collections        = None
            self.selected_points    = set()
            self.selected_templates = set()
            self.inspect_points     = set()
            self.inspect_templates  = set()
            self.score_ax1.clear()
            self.score_ax2.clear()
            self.score_ax3.clear()
            self.update_lag(self.use_lag)
            self.update_data_sort_order()
            self.update_detail_plot()
            self.update_waveforms()
            self.plot_scores()
            # do lengthy process
        self.app.restoreOverrideCursor()
项目:nettools    作者:germandutchwindtunnels    | 项目源码 | 文件源码
def _submit_pressed(self, row_number):
        """ Qt slot for when a submit button was pressed """
        patchData = self._get_combobox_variantdata(row_number, 0)
        vlanData = self._get_combobox_variantdata(row_number, 2)

        username = self.username
        password = self.password
        switch_hostname = patchData['hostname']
        switchport = patchData['interface']
        old_vlanid = patchData['vlanid']
        vlanid = vlanData['vlanid']

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        portconfig.configure_patchid_raw(
            username, password, switch_hostname, switchport, vlanid, old_vlanid)
        QApplication.restoreOverrideCursor()

        patchData['vlanid'] = vlanid
        self._set_combobox_variantdata(row_number, 0, QVariant(str(patchData)))
项目:Comictagger    作者:dickloraine    | 项目源码 | 文件源码
def actualIssueDataFetch( self, match ):

        # now get the particular issue data
        cv_md = None
        QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))

        try:
            comicVine = ComicVineTalker( )
            comicVine.wait_for_rate_limit = self.settings.wait_and_retry_on_rate_limit
            cv_md = comicVine.fetchIssueData( match['volume_id'],  match['issue_number'], self.settings )
        except ComicVineTalkerException:
            print "Network error while getting issue details.  Save aborted"

        if cv_md is not None:
            if self.settings.apply_cbl_transform_on_cv_import:
                cv_md = CBLTransformer( cv_md, self.settings ).apply()

        QtGui.QApplication.restoreOverrideCursor()      

        return cv_md
项目:Comictagger    作者:dickloraine    | 项目源码 | 文件源码
def saveMatch( self ):

        match = self.currentMatch()
        ca = self.current_match_set.ca

        md = ca.readMetadata( self.style )
        if md.isEmpty:
            md = ca.metadataFromFilename()      

        # now get the particular issue data
        cv_md = self.fetch_func( match )
        if cv_md is None:
            QtGui.QMessageBox.critical(self, self.tr("Network Issue"), self.tr("Could not connect to ComicVine to get issue details!"))
            return

        QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))           
        md.overlay( cv_md )
        success = ca.writeMetadata( md, self.style )
        ca.loadCache( [ MetaDataStyle.CBI, MetaDataStyle.CIX ] )

        QtGui.QApplication.restoreOverrideCursor()

        if not success:     
            QtGui.QMessageBox.warning(self, self.tr("Write Error"), self.tr("Saving the tags to the archive seemed to fail!"))
项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def update_cursor(self):
        if self._mode == 'Zoom':
            self.unsetCursor()
        elif self._mode == 'Pick':
            diameter = self.window.tools_settings_dialog.pick_diameter.value()
            diameter = self.width() * diameter / self.viewport_width()
            pixmap_size = ceil(diameter)
            pixmap = QtGui.QPixmap(pixmap_size, pixmap_size)
            pixmap.fill(QtCore.Qt.transparent)
            painter = QtGui.QPainter(pixmap)
            painter.setPen(QtGui.QColor('white'))
            offset = (pixmap_size - diameter) / 2
            painter.drawEllipse(offset, offset, diameter, diameter)
            painter.end()
            cursor = QtGui.QCursor(pixmap)
            self.setCursor(cursor)
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def mouseMoveEvent(self,event):
        global site
        pos = event.pos()
        #print(pos)
        if pos.x() >= 0 and pos.x()<=10:
            ui.dockWidget_3.show()
            ui.btn1.setFocus()
        elif MainWindow.isFullScreen() and not ui.tab_5.isHidden():
            ht = self.height()
            #print "height="+str(ht)
            #print "y="+str(pos.y())
            if pos.y() <= ht and pos.y()> ht - 5 and ui.frame1.isHidden():
                #ui.gridLayout.setSpacing(0)
                ui.frame1.show()
                #if Player == "mplayer":
                ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
            elif pos.y() <= ht-32 and not ui.frame1.isHidden():
                ui.frame1.hide()
                #ui.gridLayout.setSpacing(0)
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def eventFilter(self, receiver, event):
        pos = event.pos()
        print(pos)
        print("hello")
        if(event.type() == QtCore.QEvent.MouseMove):
            #MainWindow.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
                pos = event.pos()
                #print "x="+str(pos.x())
                #print pos.y()
                #widget = MainWindow.childAt(event.pos())
                #if widget:
                #   print widget.objectName()
                #print str(widget.objectName())
                print("hello")
                print(pos)
                return True
        else:
            #Call Base Class Method to Continue Normal Event Processing
            return super(MyEventFilter,self).eventFilter(receiver, event)
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def mouseMoveEvent(self,event):
        self.setFocus()
        pos = event.pos()
        #print pos.y()

        if Player == "mplayer" or Player=="mpv":
            if self.arrow_timer.isActive():
                self.arrow_timer.stop()
            self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
            self.arrow_timer.start(2000)


        if MainWindow.isFullScreen():
            ht = self.height()
            #print "height="+str(ht)
            #print "y="+str(pos.y())
            if pos.y() <= ht and pos.y()> ht - 5 and ui.frame1.isHidden():
                ui.gridLayout.setSpacing(0)
                ui.frame1.show()
                #if Player == "mplayer":
                ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
            elif pos.y() <= ht-32 and not ui.frame1.isHidden() :
                ui.frame1.hide()
                ui.gridLayout.setSpacing(10)
项目:spyking-circus    作者:spyking-circus    | 项目源码 | 文件源码
def suggest_pairs(self, event):
        self.inspect_points = set()
        indices  = numpy.where(self.score_y > numpy.maximum(0, self.score_z-self.suggest_value))[0]
        self.app.setOverrideCursor(QCursor(Qt.WaitCursor))
        self.update_inspect(indices, add_or_remove='add')
        self.app.restoreOverrideCursor()
项目:nettools    作者:germandutchwindtunnels    | 项目源码 | 文件源码
def load_patchports(self):
        """ Load all the patchports to self.patchports """
        while self.patchports is None:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            self.patchports = portconfig.get_available_patchports(
                self.hostname, 23, self.username, self.password)
            QApplication.restoreOverrideCursor()
项目:ReadManga    作者:kanishka-linux    | 项目源码 | 文件源码
def arrow_hide(self):
        self.scrollArea.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
项目:ReadManga    作者:kanishka-linux    | 项目源码 | 文件源码
def fullscreen(self):
        global fullscr
        if not MainWindow.isFullScreen():
            MainWindow.showFullScreen()
            fullscr = 1
            self.scrollArea.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
            self.frame.hide()
            self.dockWidget.hide()
        else:
            MainWindow.showMaximized()
            fullscr = 0
            self.scrollArea.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
            self.frame.show()
            self.dockWidget.show()
项目:ReadManga    作者:kanishka-linux    | 项目源码 | 文件源码
def arrow_hide(self):
        self.scrollArea.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
项目:ReadManga    作者:kanishka-linux    | 项目源码 | 文件源码
def fullscreen(self):
        global fullscr
        if not MainWindow.isFullScreen():
            MainWindow.showFullScreen()
            fullscr = 1
            self.scrollArea.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
            self.frame.hide()
            self.dockWidget.hide()
        else:
            MainWindow.showMaximized()
            fullscr = 0
            self.scrollArea.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
            self.frame.show()
            self.dockWidget.show()
项目:Comictagger    作者:dickloraine    | 项目源码 | 文件源码
def __init__(self, parent, image_pixmap):
        super(ImagePopup, self).__init__(parent)

        uic.loadUi(ComicTaggerSettings.getUIFile('imagepopup.ui' ), self)

        QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))

        #self.setWindowModality(QtCore.Qt.WindowModal)
        self.setWindowFlags(QtCore.Qt.Popup)
        self.setWindowState(QtCore.Qt.WindowFullScreen)

        self.imagePixmap = image_pixmap

        screen_size = QtGui.QDesktopWidget().screenGeometry()
        self.resize(screen_size.width(), screen_size.height())
        self.move( 0, 0)

        # This is a total hack.  Uses a snapshot of the desktop, and overlays a
        # translucent screen over it.  Probably can do it better by setting opacity of a
        # widget
        self.desktopBg = QtGui.QPixmap.grabWindow(QtGui.QApplication.desktop ().winId(), 
            0,0, screen_size.width(), screen_size.height())
        bg = QtGui.QPixmap(ComicTaggerSettings.getGraphic('popup_bg.png')) 
        self.clientBgPixmap = bg.scaled(screen_size.width(), screen_size.height())      
        self.setMask(self.clientBgPixmap.mask())

        self.applyImagePixmap()
        self.showFullScreen()
        self.raise_(  )
        QtGui.QApplication.restoreOverrideCursor()
项目:Comictagger    作者:dickloraine    | 项目源码 | 文件源码
def commitMetadata(self):

        if ( self.metadata is not None and self.comic_archive is not None): 
            reply = QtGui.QMessageBox.question(self, 
                 self.tr("Save Tags"), 
                 self.tr("Are you sure you wish to save " +  MetaDataStyle.name[self.save_data_style] + " tags to this archive?"),
                 QtGui.QMessageBox.Yes, QtGui.QMessageBox.No )

            if reply == QtGui.QMessageBox.Yes:      
                QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
                self.formToMetadata()

                success = self.comic_archive.writeMetadata( self.metadata, self.save_data_style )
                self.comic_archive.loadCache( [ MetaDataStyle.CBI, MetaDataStyle.CIX ] )
                QtGui.QApplication.restoreOverrideCursor()

                if not success:
                    QtGui.QMessageBox.warning(self, self.tr("Save failed"), self.tr("The tag save operation seemed to fail!"))
                else:
                    self.clearDirtyFlag()
                    self.updateInfoBox()
                    self.updateMenus()
                    #QtGui.QMessageBox.information(self, self.tr("Yeah!"), self.tr("File written."))
                self.fileSelectionList.updateCurrentRow()

        else:
            QtGui.QMessageBox.information(self, self.tr("Whoops!"), self.tr("No data to commit!"))
项目:FC    作者:JanusWind    | 项目源码 | 文件源码
def resp_busy_beg( self ) :

        # Override the default cursor with the "wait" cursor.

        self.setOverrideCursor( QCursor( Qt.BusyCursor ) )

    #-----------------------------------------------------------------------
    # DEFINE THE FUNCTION FOR RESPONDING TO THE "busy_end" SIGNAL.
    #-----------------------------------------------------------------------
项目:cityscapesScripts    作者:mcordts    | 项目源码 | 文件源码
def keyPressEvent(self,e):
        # Ctrl key changes mouse cursor
        if e.key() == QtCore.Qt.Key_Control:
            QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        # Backspace deletes last point from polygon
        elif e.key() == QtCore.Qt.Key_Backspace:
            if not self.drawPolyClosed:
                del self.drawPoly[-1]
                self.update()
        # set alpha to temporary zero
        elif e.key() == QtCore.Qt.Key_0:
            self.transpTempZero = True
            self.update()
        elif e.key() == QtCore.Qt.Key_E:
            self.select_next_correction()
        elif e.key() == QtCore.Qt.Key_R:
            self.select_previous_correction()
        elif e.key() == QtCore.Qt.Key_1:
            self.modify_correction_type(CorrectionBox.types.TO_CORRECT)
        elif e.key() == QtCore.Qt.Key_2:
            self.modify_correction_type(CorrectionBox.types.TO_REVIEW)
        elif e.key() == QtCore.Qt.Key_3:
            self.modify_correction_type(CorrectionBox.types.RESOLVED)
        elif e.key() == QtCore.Qt.Key_4:
            self.modify_correction_type(CorrectionBox.types.QUESTION)
        elif e.key() == QtCore.Qt.Key_D and self.config.correctionMode:
            self.delete_selected_annotation()
        elif e.key() == QtCore.Qt.Key_M and self.config.correctionMode:
            self.modify_correction_description()

    # Key released
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self):
        pixmap = QtGui.QPixmap(local_path('magnifying-glass.png'))
        QtGui.QCursor.__init__(self, pixmap)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self):
        pixmap = QtGui.QPixmap(16, 16)
        pixmap.fill(QtCore.Qt.transparent)
        qp = QtGui.QPainter(pixmap)
        qp.setRenderHints(QtGui.QPainter.Antialiasing)
        qp.setPen(QtGui.QPen(QtCore.Qt.black, 2))
        qp.translate(.5, .5)
        qp.drawLine(0, 4, 12, 14)
        qp.end()
        QtGui.QCursor.__init__(self, pixmap, 0, 0)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self):
        pixmap = QtGui.QPixmap(16, 16)
        pixmap.fill(QtCore.Qt.transparent)
        qp = QtGui.QPainter(pixmap)
        qp.setRenderHints(QtGui.QPainter.Antialiasing)
        qp.setPen(QtGui.QPen(QtCore.Qt.black, 2))
        qp.translate(.5, .5)
        qp.drawArc(0, -7, 22, 22, 2880, 1440)
        qp.end()
        QtGui.QCursor.__init__(self, pixmap, 0, 0)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def hidePopup(self):
        if not self.view().rect().contains(self.view().mapFromGlobal(QtGui.QCursor().pos())):
            QtGui.QComboBox.hidePopup(self)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, parent, name='', cursor=QtCore.Qt.SizeAllCursor, *args, **kwargs):
        self.name = name
        self.cursor = QtGui.QCursor(cursor)
        QtGui.QWidget.__init__(self, parent)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def keyPressEvent(self, event):
        if event.modifiers() & QtCore.Qt.ControlModifier:
            self.setCursor(self.magnifying_cursor)
#            QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeAllCursor))
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def eventFilter(self, source, event):
        if source == self.gain_spin and event.type() == QtCore.QEvent.Wheel:
            if QtGui.QApplication.keyboardModifiers() == QtCore.Qt.ShiftModifier:
                self.gain_spin.setSingleStep(.01)
            else:
                self.gain_spin.setSingleStep(.1)
        elif ((event.type() == QtCore.QEvent.KeyPress and event.modifiers() & (QtCore.Qt.ShiftModifier|QtCore.Qt.ControlModifier)) or event.type() == QtCore.QEvent.KeyRelease) and self.wave_source_view.rect().contains(self.wave_source_view.mapFromGlobal(QtGui.QCursor().pos())):
            self.wave_source_view.event(event)
            return True
        return QtGui.QMainWindow.eventFilter(self, source, event)
项目:Semi-automatic-Annotation    作者:Luoyadan    | 项目源码 | 文件源码
def on_context_menu(self, event):
        if self.edit_method != "line2":
            return

        self.r_menu.popup(QtGui.QCursor.pos())
项目:Semi-automatic-Annotation    作者:Luoyadan    | 项目源码 | 文件源码
def on_context_menu(self, event):
        if self.edit_method != "line2":
            return

        self.r_menu.popup(QtGui.QCursor.pos())
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def arrow_hide(self):
        global Player
        if Player == "mplayer" or Player == "mpv":
            self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))

        print ("arrow hide")
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def __init__(self, parent):
        super(MySlider, self).__init__(parent)
        self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def mouseMoveEvent(self,event):
        global Player,fullscr,pause_indicator,site
        self.setFocus()
        pos = event.pos()
        #print pos.y()

        if (Player == "mplayer" or Player=="mpv"):
            if self.arrow_timer.isActive():
                self.arrow_timer.stop()
            self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
            self.arrow_timer.start(2000)


        if MainWindow.isFullScreen():
            ht = self.height()
            #print "height="+str(ht)
            #print "y="+str(pos.y())
            if pos.y() <= ht and pos.y()> ht - 5 and ui.frame1.isHidden():
                ui.gridLayout.setSpacing(0)
                ui.frame1.show()
                #if Player == "mplayer":
                ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
            elif pos.y() <= ht-32 and not ui.frame1.isHidden():
                if site!="Music":
                    ui.frame1.hide()

                ui.gridLayout.setSpacing(10)
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def onHelp(self, evt):
        self.helpEnable = not self.helpEnable

        if self.helpEnable:
            cursor = QtGui.QCursor(QtCore.Qt.WhatsThisCursor)
        else: 
            cursor = QtGui.QCursor(QtCore.Qt.ArrowCursor)

        self.setCursor(cursor)
    ###################################
    # Author: Lan
    # def: onResetZoomPan():201509
    # Zoom to the begining scale or the scale after trimming
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def onZoomORSelect(self, evt):
        if self.zoompanRbtn.isChecked():
            self.selectSet.hide()
            self.zoomSet.show()
            self.canvas.zoomWidget.hide()
            self.canvas.select = False
            self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))          
        else:
            self.zoomSet.hide()
            self.selectSet.show()
            self.canvas.select = True
            self.setCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def onExplain(self):
        self.helpEnable = not self.helpEnable

        if self.helpEnable:
            cursor = QtGui.QCursor(QtCore.Qt.WhatsThisCursor)
        else: 
            cursor = QtGui.QCursor(QtCore.Qt.ArrowCursor)

        self.setCursor(cursor)
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def onHelp(self, evt):
        self.helpEnable = not self.helpEnable

        if self.helpEnable:
            cursor = QtGui.QCursor(QtCore.Qt.WhatsThisCursor)
        else: 
            cursor = QtGui.QCursor(QtCore.Qt.ArrowCursor)

        self.setCursor(cursor)

    ###################################
    # Author: Lan
    # def: eventFilter(): 20151022
    # using baloon tooltip to help user understand the use of the widget (only the one install event filter)
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def onHelp(self, evt):
        self.helpEnable = not self.helpEnable
        if self.helpEnable:
            cursor = QtGui.QCursor(QtCore.Qt.WhatsThisCursor)
        else: 
            cursor = QtGui.QCursor(QtCore.Qt.ArrowCursor)

        self.setCursor(cursor)
项目:OnAirScreen    作者:saschaludwig    | 项目源码 | 文件源码
def showsettings(self):
        global app
        # un-hide mousecursor
        app.setOverrideCursor( QCursor( 0 ) );
        self.settings.showsettings()
项目:OnAirScreen    作者:saschaludwig    | 项目源码 | 文件源码
def toggleFullScreen(self):
        global app
        settings = QSettings( QSettings.UserScope, "astrastudio", "OnAirScreen")
        settings.beginGroup("General")
        if not settings.value('fullscreen', 'True').toBool():
            self.showFullScreen()
            app.setOverrideCursor( QCursor( 10 ) );
            settings.setValue('fullscreen', True)
        else:
            self.showNormal()
            app.setOverrideCursor( QCursor( 0 ) );
            settings.setValue('fullscreen', False)
        settings.endGroup()
项目:OnAirScreen    作者:saschaludwig    | 项目源码 | 文件源码
def configFinished(self):
        self.restoreSettingsFromConfig()
        global app
        # hide mousecursor if in fullscreen mode
        settings = QSettings( QSettings.UserScope, "astrastudio", "OnAirScreen")
        settings.beginGroup("General")
        if settings.value('fullscreen', 'True').toBool():
            app.setOverrideCursor( QCursor( 10 ) );
        settings.endGroup()
项目:GkukanMusiumdb    作者:matsu-reki    | 项目源码 | 文件源码
def __init__(self, canvas):
        QgsMapTool.__init__(self, canvas)

        self.canvas = canvas
        self.cursor = QCursor(QPixmap(':/icons/cursor.png'), 1, 1)

        self.rubberBand = None
        self.movedFeatures = []
项目:GkukanMusiumdb    作者:matsu-reki    | 项目源码 | 文件源码
def __init__(self, canvas):
        QgsMapTool.__init__(self, canvas)

        self.canvas = canvas
        self.cursor = QCursor(QPixmap(':/icons/cursor.png'), 1, 1)

        self.results = []
项目:GkukanMusiumdb    作者:matsu-reki    | 项目源码 | 文件源码
def __init__(self, canvas):
        QgsMapToolEmitPoint.__init__(self, canvas)

        self.canvas = canvas
        self.cursor = QCursor(QPixmap(':/icons/cursor.png'), 1, 1)
        self.geoCrs = QgsCoordinateReferenceSystem(4326)
项目:spyking-circus    作者:spyking-circus    | 项目源码 | 文件源码
def finalize(self, event):


        if comm.rank == 0:
            self.app.setOverrideCursor(QCursor(Qt.WaitCursor))
            self.mpi_wait = comm.bcast(numpy.array([1], dtype=numpy.int32), root=0)

        comm.Barrier()
        self.all_merges = comm.bcast(self.all_merges, root=0)
        self.to_delete  = comm.bcast(self.to_delete, root=0)

        slice_templates(self.params, to_merge=self.all_merges, to_remove=list(self.to_delete), extension=self.ext_out)
        slice_clusters(self.params, self.clusters, to_merge=self.all_merges, to_remove=list(self.to_delete), extension=self.ext_out, light=True)

        if comm.rank == 0:
            new_result = {'spiketimes' : {}, 'amplitudes' : {}}

            to_keep = set(numpy.unique(self.indices)) - set(self.to_delete)
            to_keep = numpy.array(list(to_keep))

            for count, temp_id in enumerate(to_keep):
                key_before = 'temp_' + str(temp_id)
                key_after  = 'temp_' + str(count)
                new_result['spiketimes'][key_after] = self.result['spiketimes'].pop(key_before)
                new_result['amplitudes'][key_after] = self.result['amplitudes'].pop(key_before)

            keys = ['spiketimes', 'amplitudes']

            if self.params.getboolean('fitting', 'collect_all'):
                keys += ['gspikes']
                new_result['gspikes'] = io.get_garbage(self.params)['gspikes']

            mydata = h5py.File(self.file_out_suff + '.result%s.hdf5' %self.ext_out, 'w', libver='latest')
            for key in keys:
                mydata.create_group(key)
                for temp in new_result[key].keys():
                    tmp_path = '%s/%s' %(key, temp)
                    mydata.create_dataset(tmp_path, data=new_result[key][temp])
            mydata.close()

            mydata  = h5py.File(self.file_out_suff + '.templates%s.hdf5' %self.ext_out, 'r+', libver='latest')
            version     = mydata.create_dataset('version', data=numpy.array([circus.__version__.encode('ascii', 'ignore')]))
            maxoverlaps = mydata.create_dataset('maxoverlap', shape=(len(to_keep), len(to_keep)), dtype=numpy.float32)
            maxlag      = mydata.create_dataset('maxlag', shape=(len(to_keep), len(to_keep)), dtype=numpy.int32)
            for c, i in enumerate(to_keep):
                maxoverlaps[c, :] = self.overlap[i, to_keep]*self.shape[0] * self.shape[1]
                maxlag[c, :]      = self.lag[i, to_keep]
            mydata.close()

            self.app.restoreOverrideCursor()

        sys.exit(0)
项目:ocr-db    作者:tristancalderbank    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(500, 185)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Dialog.sizePolicy().hasHeightForWidth())
        Dialog.setSizePolicy(sizePolicy)
        Dialog.setMinimumSize(QtCore.QSize(500, 185))
        Dialog.setMaximumSize(QtCore.QSize(500, 185))
        self.verticalLayout = QtGui.QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.progressBar = QtGui.QProgressBar(Dialog)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.progressBar.sizePolicy().hasHeightForWidth())
        self.progressBar.setSizePolicy(sizePolicy)
        self.progressBar.setCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
        self.progressBar.setProperty("value", 24)
        self.progressBar.setObjectName(_fromUtf8("progressBar"))
        self.verticalLayout.addWidget(self.progressBar)
        self.currentTask = QtGui.QLabel(Dialog)
        self.currentTask.setAlignment(QtCore.Qt.AlignCenter)
        self.currentTask.setObjectName(_fromUtf8("currentTask"))
        self.verticalLayout.addWidget(self.currentTask)
        self.currentFile = QtGui.QLabel(Dialog)
        self.currentFile.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.currentFile.setObjectName(_fromUtf8("currentFile"))
        self.verticalLayout.addWidget(self.currentFile)
        self.filesProcessed = QtGui.QLabel(Dialog)
        self.filesProcessed.setObjectName(_fromUtf8("filesProcessed"))
        self.verticalLayout.addWidget(self.filesProcessed)
        self.elapsedTime = QtGui.QLabel(Dialog)
        self.elapsedTime.setObjectName(_fromUtf8("elapsedTime"))
        self.verticalLayout.addWidget(self.elapsedTime)
        self.timeRemaining = QtGui.QLabel(Dialog)
        self.timeRemaining.setObjectName(_fromUtf8("timeRemaining"))
        self.verticalLayout.addWidget(self.timeRemaining)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.stopButton = QtGui.QPushButton(Dialog)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.stopButton.sizePolicy().hasHeightForWidth())
        self.stopButton.setSizePolicy(sizePolicy)
        self.stopButton.setMinimumSize(QtCore.QSize(0, 30))
        self.stopButton.setMaximumSize(QtCore.QSize(200, 200))
        self.stopButton.setObjectName(_fromUtf8("stopButton"))
        self.horizontalLayout.addWidget(self.stopButton)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)