python类QCursor()的实例源码

addition.py 文件源码 项目:MusicPlayer 作者: HuberTRoy 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def __init__(self, parent=None):
        super(SearchLineEdit, self).__init__()
        self.setObjectName("SearchLine")
        self.parent = parent
        self.setMinimumSize(218, 20)
        with open('QSS/searchLine.qss', 'r') as f:
            self.setStyleSheet(f.read())

        self.button = QPushButton(self)
        self.button.setMaximumSize(13, 13)
        self.button.setCursor(QCursor(Qt.PointingHandCursor))

        self.setTextMargins(3, 0, 19, 0)

        self.spaceItem = QSpacerItem(150, 10, QSizePolicy.Expanding)

        self.mainLayout = QHBoxLayout()
        self.mainLayout.addSpacerItem(self.spaceItem)
        # self.mainLayout.addStretch(1)
        self.mainLayout.addWidget(self.button)
        self.mainLayout.addSpacing(10)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.mainLayout)
gui.py 文件源码 项目:spyking-circus 作者: spyking-circus 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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()
CRIkitUI.py 文件源码 项目:CRIkit2 作者: CoherentRamanNIST 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def pointSpectrum(self):
        """
        Get spectrum of selected point.

        Note: This function just sets up the signal-slot connection for the \
        MPL window. It executes all the way through

        Action
        ------
            Left mouse-click : Select vertex point
        """
        if self.cid is None:
            self.cid = self.img_BW.mpl.mpl_connect('button_press_event',
                                                   lambda event: self._pointClick(event, self._pointSpectrumPlot))

            self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
            self.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
CRIkitUI.py 文件源码 项目:CRIkit2 作者: CoherentRamanNIST 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def subtractROIStart(self):
        """
        Acquire an average spectrum from a user-selected ROI and subtract.

        Note: This function just sets up the signal-slot connection for the \
        MPL window. It executes all the way through

        """

        if self.cid is None:
            # Updated by _roiClick
            self.x_loc_list = []
            self.y_loc_list = []


            self.cid = self.img_BW.mpl.mpl_connect('button_press_event', lambda event: self._roiClick(event, self._roiSubtract))

            self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
            self.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
CRIkitUI.py 文件源码 项目:CRIkit2 作者: CoherentRamanNIST 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def roiSpectrum(self):
        """
        Plot spectrum over selected region-of-interest (ROI).

        Note: This function just sets up the signal-slot connection for the \
        MPL window. It executes all the way through

        Action
        ------
            Left mouse-click : Select vertex point
            Right mouse-click : Close polygon
        """
        if self.cid is None:
            # Updated by _roiClick
            self.x_loc_list = []
            self.y_loc_list = []


            self.cid = self.img_BW.mpl.mpl_connect('button_press_event',
                                                   lambda event: self._roiClick(event, self._roiSpectrumPlot))

            self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
            self.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
customcompleter.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def modelFromFile(self, fileName):
        f = QFile(fileName)
        if not f.open(QFile.ReadOnly):
            return QStringListModel(self.completer)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        words = []
        while not f.atEnd():
            line = f.readLine().trimmed()
            if line.length() != 0:
                try:
                    line = str(line, encoding='ascii')
                except TypeError:
                    line = str(line)

                words.append(line)

        QApplication.restoreOverrideCursor()

        return QStringListModel(words, self.completer)
customcompleter.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def modelFromFile(self, fileName):
        f = QFile(fileName)
        if not f.open(QFile.ReadOnly):
            return QStringListModel(self.completer)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        words = []
        while not f.atEnd():
            line = f.readLine().trimmed()
            if line.length() != 0:
                try:
                    line = str(line, encoding='ascii')
                except TypeError:
                    line = str(line)

                words.append(line)

        QApplication.restoreOverrideCursor()

        return QStringListModel(words, self.completer)
widgets.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def dropEvent(self, event):
        """
        Handle 'Drop' event.
        """
        if event.mimeData().hasUrls():
            B3App.Instance().setOverrideCursor(QCursor(Qt.ArrowCursor))
            event.setDropAction(Qt.CopyAction)
            # multi-drag support
            for url in event.mimeData().urls():
                path = url.path()
                if b3.getPlatform() == 'nt':
                    # on win32 the absolute path returned for each url has a leading slash: this obviously
                    # is not correct on win32 platform when absolute url have the form C:\\Programs\\... (Qt bug?)
                    path = path.lstrip('/').lstrip('\\')
                if os.path.isfile(path):
                    self.parent().parent().make_new_process(path)
            event.accept()
        else:
            event.ignore()

    ############################################ TOOLBAR HANDLERS ######################################################
customcompleter.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def modelFromFile(self, fileName):
        f = QFile(fileName)
        if not f.open(QFile.ReadOnly):
            return QStringListModel(self.completer)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        words = []
        while not f.atEnd():
            line = f.readLine().trimmed()
            if line.length() != 0:
                try:
                    line = str(line, encoding='ascii')
                except TypeError:
                    line = str(line)

                words.append(line)

        QApplication.restoreOverrideCursor()

        return QStringListModel(words, self.completer)
gui.py 文件源码 项目:spyking-circus 作者: spyking-circus 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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()
qtpropertybrowserutils.py 文件源码 项目:QtPropertyBrowserV2.6-for-pyqt5 作者: theall 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def valueToCursor(self,value):
        if value in self.m_valueToCursorShape:
            return QCursor(self.m_valueToCursorShape[value])
        return QCursor()
mangaKA.py 文件源码 项目:ReadManga 作者: kanishka-linux 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def arrow_hide(self):
        self.scrollArea.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
mangaKA.py 文件源码 项目:ReadManga 作者: kanishka-linux 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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()
optionwidgets.py 文件源码 项目:kawaii-player 作者: kanishka-linux 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, parent, uiwidget, home_dir):
        super(MySlider, self).__init__(parent)
        global home, ui
        ui = uiwidget
        home = home_dir
        self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
thumbnail.py 文件源码 项目:kawaii-player 作者: kanishka-linux 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def arrow_hide(self):
        if ui.player_val == "mplayer" or ui.player_val == "mpv":
            self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
        print("arrow hide")
kawaii_player.py 文件源码 项目:kawaii-player 作者: kanishka-linux 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def show_cursor_now(self):
        MainWindow.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
player.py 文件源码 项目:kawaii-player 作者: kanishka-linux 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def mouseMoveEvent(self, event):
        self.setFocus()
        pos = event.pos()
        if self.ui.auto_hide_dock and not self.ui.dockWidget_3.isHidden():
            self.ui.dockWidget_3.hide()
        if not self.ui.float_window.isHidden() and self.ui.new_tray_widget.remove_toolbar:
            if self.ui.float_timer.isActive():
                self.ui.float_timer.stop()
            if self.ui.new_tray_widget.cover_mode.text() == self.ui.player_buttons['up']:
                wid_height = int(self.ui.float_window.height()/3)
            else:
                wid_height = int(self.ui.float_window.height())
            self.ui.new_tray_widget.setMaximumHeight(wid_height)
            self.ui.new_tray_widget.show()
            self.ui.float_timer.start(1000)
        if (self.player_val == "mplayer" or self.player_val == "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()
            if pos.y() <= ht and pos.y() > ht - 5 and self.ui.frame1.isHidden():
                self.ui.gridLayout.setSpacing(0)
                self.ui.frame1.show()
                self.ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
            elif pos.y() <= ht-32 and not self.ui.frame1.isHidden():
                param_dict = self.ui.get_parameters_value(st='site')
                site = param_dict['site']
                if site != "Music":
                    self.ui.frame1.hide()
                self.ui.gridLayout.setSpacing(5)
FlagRegisterLabel.py 文件源码 项目:PINCE 作者: korcankaraokcu 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def enterEvent(self, QEvent):
        self.setCursor(QCursor(Qt.PointingHandCursor))
RegisterLabel.py 文件源码 项目:PINCE 作者: korcankaraokcu 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def enterEvent(self, QEvent):
        self.setCursor(QCursor(Qt.PointingHandCursor))
CRIkitUI.py 文件源码 项目:CRIkit2 作者: CoherentRamanNIST 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def nrbFromROI(self):
        """
        Acquire an average spectrum from a user-selected ROI and apply to the \
        NRB-- either as the new NRB or averaged with the existing (sender- \
        dependent)

        Note: This function just sets up the signal-slot connection for the \
        MPL window. It executes all the way through

        """

        # I found that the objectName is a better way than a reference to the
        # actual action (e.g., self.ui.action_*) as the reference may change
        # depending on the call location or how this method is called
        sender = self.sender().objectName()

        if ((sender == 'actionNRB_from_ROI') or
                (sender == 'actionAppend_NRB_from_ROI') or
                (sender == 'actionNRB_from_ROI_Left_Side') or
                (sender == 'actionNRB_from_ROI_Right_Side')):
            # Updated by _roiClick
            self.x_loc_list = []
            self.y_loc_list = []

#            print('Sender: {}'.format(sender))
#            print('Sender is actionNRB_from_ROI: {}'.format(sender == self.ui.actionNRB_from_ROI))

            # Need to send sender as the text name as the actual object
            # will change
            if self.cid is None:
                self.cid = self.img_BW.mpl.mpl_connect('button_press_event', lambda event: self._roiClick(event, self._roiNRB, sender))

                self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
                self.setCursor(_QCursor(_QtCore.Qt.CrossCursor))

        else:
            print('Unknown action send to nrbFromROI')
CRIkitUI.py 文件源码 项目:CRIkit2 作者: CoherentRamanNIST 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _pointClick(self, event, pass_fcn):
        """
        Capture single mouse click location in MPL window.

        After this function completes, it sends the data (x_pt, y_pt) on to \
        the pass_fcn function.
        """
        if event.button == 1:
            if event.inaxes == self.img_BW.mpl.ax:
                    #self.tempverts += [[event.xdata, event.ydata]]
                x_loc = event.xdata
                y_loc = event.ydata

                # Send on to a function that will use the collected data
                pass_fcn((x_loc, y_loc))

                self.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
                self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
                self.img_BW.mpl.mpl_disconnect(self.cid)
                self.cid = None
            else:  # Clicked out-of-bounds
                pass
#                print('Clicked out-of-bounds')
        else: # Right-or-middle clicked; thus, cancel
            self.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
            self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
            self.img_BW.mpl.mpl_disconnect(self.cid)
            self.cid = None
KeyboardKey.py 文件源码 项目:pyqt5 作者: yurisnm 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, style, str_icon_on, str_icon_off, auto_repeat, size,
                 receiver, key, str_key):
        super(KeyboardKey, self).__init__()
        self.__size = size
        self.__style = style
        self.__icon_on = str_icon_on
        self.__icon_off = str_icon_off
        self.__auto_repeat = auto_repeat
        self.__receiver = receiver
        self.__key = key
        self.__str_key = str_key
        self.set_up_button(style, str_icon_on, str_icon_off, auto_repeat, size,
                           receiver, key, str_key)
        self.setCursor(QCursor(Qt.PointingHandCursor))
console.py 文件源码 项目:uitester 作者: IfengAutomation 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def contextMenuEvent(self, event):
        if self.menu:
            del self.menu
            self.menu = None
        self.menu = self.createStandardContextMenu()

        clear_action = QAction("Clear", self.menu)
        self.menu.addAction(clear_action)   # add clear action

        if not self.toPlainText():   # content is None
            clear_action.setDisabled(True)
        else:
            clear_action.setDisabled(False)
            clear_action.triggered.connect(self.clear_text)  # connect clear event
        self.menu.exec(QCursor().pos())
rest_reminder_popup.py 文件源码 项目:mindfulness-at-the-computer 作者: SunyataZero 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def cursor_timer_timeout(self):
        cursor = QtGui.QCursor()
        if self.geometry().contains(cursor.pos()):
            pass
        else:
            cursor.setPos(
                self.xpos_int + self.width() // 2,
                self.ypos_int + self.height() // 2
            )
            self.setCursor(cursor)
breathing_popup.py 文件源码 项目:mindfulness-at-the-computer 作者: SunyataZero 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def cursor_timer_timeout(self):
        cursor = QtGui.QCursor()
        if self.geometry().contains(cursor.pos()):
            pass
        else:
            cursor.setPos(
                self.xpos_int + self.width() // 2,
                self.ypos_int + self.height() // 2
            )
            self.setCursor(cursor)
window.py 文件源码 项目:gtrans-web-gui 作者: takiyu 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def show_at_cursor(self):
        # Get cursor position and move
        pos = QtGui.QCursor().pos()
        x, y = pos.x() + self.curpos_offset[0], pos.y() + self.curpos_offset[1]
        self.move(x, y)
        # Show
        self.show()
        self.raise_()
identifygeometry.py 文件源码 项目:go2mapillary 作者: enricofer 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, canvas, targetLayer):
        self.canvas = canvas
        self.targetLayer = targetLayer
        QgsMapToolIdentify.__init__(self, canvas)
        self.setCursor(QCursor())
widgets.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def dragEnterEvent(self, event):
        """
        Handle 'Drag Enter' event.
        """
        if event.mimeData().hasUrls():
            B3App.Instance().setOverrideCursor(QCursor(Qt.DragCopyCursor))
            event.setDropAction(Qt.CopyAction)
            event.accept()
        else:
            event.ignore()
widgets.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def dragLeaveEvent(self, event):
        """
        Handle 'Drag Leave' event.
        """
        B3App.Instance().setOverrideCursor(QCursor(Qt.ArrowCursor))
misc.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def enterEvent(self, _):
        """
        Executed when the mouse enter the Button.
        """
        B3App.Instance().setOverrideCursor(QCursor(Qt.PointingHandCursor))


问题


面经


文章

微信
公众号

扫码关注公众号