我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用PySide.QtGui.QCursor()。
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()
def launch(self): print self.data self.setCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) item = self.software_commands.currentItem() exe_path = self.data[item.text()]['path'] if exe_path.startswith('.'): exe_path = os.path.normpath(exe_path.replace('.', self.wrappers_dir, 1)) if exe_path.endswith('.bat') or exe_path.endswith('.cmd'): command = 'cmd /c start {0}'.format(exe_path) elif exe_path.endswith('.lnk'): command = '"{0}"'.format(os.path.normpath(exe_path)) elif exe_path.endswith('.exe'): command = '"{0}"'.format(os.path.normpath(exe_path)) else: command = 'cmd /c start "{0}"'.format(os.path.normpath(exe_path)) # logging.info(command) subprocess.Popen(command, shell=True) self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
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()
def __init__(self,dialog,size=10): peob=dialog.ob self.dialog=dialog docs().i() self.view = FreeCADGui.ActiveDocument.ActiveView self.view.viewTop() self.size=size self.stack = [] self.callback = self.view.addEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self.getpoint) self.s=None self.peob=peob self.pepo=[peob.P0,peob.P1,peob.P2,peob.P3,peob.P4,peob.P5] #peob.P6,peob.P6] # QtGui.QApplication.setOverrideCursor(QCursor(QtCore.Qt.CrossCursor))
def __init__(self,dialog,mode='l',size=10): peob=dialog.ob self.mode=mode # self.leftmode=True self.dialog=dialog FreeCADGui.ActiveDocument=docs().gi() App.ActiveDocument=docs().i() self.view = FreeCADGui.ActiveDocument.ActiveView self.view.viewTop() self.size=size self.stack = [] self.callback = self.view.addEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self.getpoint) self.s=None self.peob=peob self.pepo=[peob.P0,peob.P1,peob.P2,peob.P3,peob.P4,peob.P5] #peob.P6,peob.P6] grids=self.dialog.grids for grid in self.dialog.grids: grid.ViewObject.hide() if self.mode=='l': grids[0].ViewObject.show() grids[2].ViewObject.show() if self.mode=='r': grids[1].ViewObject.show() grids[3].ViewObject.show() if self.mode=='z': grids[4].ViewObject.show() grids[5].ViewObject.show() # QtGui.QApplication.setOverrideCursor(QCursor(QtCore.Qt.CrossCursor))
def open(filename): ''' ''' kursor = QtGui.QCursor() kursor.setShape(QtCore.Qt.ArrowCursor) QtGui.QApplication.setOverrideCursor(kursor) wersjaFormatu = wersjaFormatuF(filename) if wersjaFormatu[0]: FreeCAD.Console.PrintMessage("The file was created in {0}.\n".format(wersjaFormatu[1])) importBRD(filename, wersjaFormatu[0]) else: FreeCAD.Console.PrintError("Incompatible file format.\n") QtGui.QApplication.restoreOverrideCursor()
def __init__(self, parent=None): QtGui.QPushButton.__init__(self, parent) self.setFlat(True) self.setStyleSheet(''' QPushButton { border: 0px; margin-top: 2px; width: 15px; height: 15px; } ''') #self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
def find_item_under_mouse(self, widget): viewportPos = widget.viewport().mapFromGlobal(QtGui.QCursor.pos()) item = widget.itemAt(viewportPos) return item
def show_software_item_menu(self): item = self.find_item_under_mouse(self.software_commands) if item: popupMenu = QtGui.QMenu(self) viewFolder = self._action("Delete Current Item", self.delete_item) popupMenu.addAction(viewFolder) popupMenu.addSeparator() popupMenu.exec_(QtGui.QCursor.pos()) # return item
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)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) freecadSettings = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/PCB") # self.listaBibliotek = QtGui.QComboBox() libraryFrame = QtGui.QGroupBox(u'Library:') libraryFrameLay = QtGui.QHBoxLayout(libraryFrame) libraryFrameLay.addWidget(self.listaBibliotek) # self.listaElementow = updateObjectTable() przSelectAllT = QtGui.QPushButton('') przSelectAllT.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) przSelectAllT.setFlat(True) przSelectAllT.setIcon(QtGui.QIcon(":/data/img/checkbox_checked_16x16.png")) przSelectAllT.setToolTip('Select all') self.connect(przSelectAllT, QtCore.SIGNAL('pressed ()'), self.selectAllObj) przSelectAllTF = QtGui.QPushButton('') przSelectAllTF.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) przSelectAllTF.setFlat(True) przSelectAllTF.setIcon(QtGui.QIcon(":/data/img/checkbox_unchecked_16x16.PNG")) przSelectAllTF.setToolTip('Deselect all') self.connect(przSelectAllTF, QtCore.SIGNAL('pressed ()'), self.unselectAllObj) self.adjustParts = QtGui.QCheckBox(u'Adjust part name/value') self.adjustParts.setChecked(freecadSettings.GetBool("adjustNameValue", False)) self.groupParts = QtGui.QCheckBox(u'Group parts') self.groupParts.setChecked(freecadSettings.GetBool("groupParts", False)) self.plytkaPCB_elementyKolory = QtGui.QCheckBox(u"Colorize elements") self.plytkaPCB_elementyKolory.setChecked(freecadSettings.GetBool("partsColorize", True)) packagesFrame = QtGui.QGroupBox(u'Packages:') packagesFrameLay = QtGui.QGridLayout(packagesFrame) packagesFrameLay.addWidget(przSelectAllT, 0, 0, 1, 1) packagesFrameLay.addWidget(przSelectAllTF, 1, 0, 1, 1) packagesFrameLay.addWidget(self.listaElementow, 0, 1, 3, 1) # lay = QtGui.QVBoxLayout() lay.addWidget(libraryFrame) lay.addWidget(packagesFrame) lay.addWidget(self.adjustParts) lay.addWidget(self.groupParts) lay.addWidget(self.plytkaPCB_elementyKolory) lay.setStretch(1, 10) self.setLayout(lay) # self.readLibs()