示例#1
0
 def mouseReleaseEvent(self, event):
     if self._scrolling:
         QApplication.restoreOverrideCursor()
     self._scrolling = False
     self._scroll_init_y = 0
     self._scroll_init_val = 0
     event.accept()
示例#2
0
    def leaveEvent(self, event):
        """
        Overrides base QFrame leaveEvent function
        :param event: QEvent
        """

        QApplication.restoreOverrideCursor()
示例#3
0
 def wrapper(*args, **kwargs):
     cursor = QCursor(Qt.ArrowCursor)
     QApplication.setOverrideCursor(cursor)
     try:
         return fn(*args, **kwargs)
     finally:
         QApplication.restoreOverrideCursor()
示例#4
0
    def show_already_existing_dialog(self):
        """
        Shows a warning dialog if the item already exists on save
        """

        if not self.library_window():
            raise exceptions.ItemSaveError('Item already exists!')

        buttons = QDialogButtonBox.Yes | QDialogButtonBox.Cancel
        try:
            QApplication.setOverrideCursor(Qt.ArrowCursor)
            button = self.library_window().show_question_dialog(
                'Item already exists',
                'Would you like to move the existing item "{}" to trash?'.format(os.path.basename(self.path())), buttons
            )
        finally:
            QApplication.restoreOverrideCursor()

        if button == QDialogButtonBox.Yes:
            self._move_to_trash()
        elif button == QMessageBox.Cancel:
            return button
        else:
            raise exceptions.ItemSaveError('You cannot save over an existing item.')

        return button
示例#5
0
文件: utils.py 项目: iVerb/usdmanager
def overrideCursor(cursor=QtCore.Qt.WaitCursor):
    """ For use with the "with" keyword, so the override cursor is always
    restored via a try/finally block, even if the commands in-between fail.
    
    Example:
        with overrideCursor():
            # do something that may raise an error
    """
    from Qt.QtWidgets import QApplication

    QApplication.setOverrideCursor(cursor)
    try:
        yield
    finally:
        QApplication.restoreOverrideCursor()
示例#6
0
 def restoreOverrideCursor(self):
     if not self._overridden:
         return
     QApplication.restoreOverrideCursor()
     self._overridden = False
示例#7
0
 def leaveEvent(self, event):
     if self.can_scroll():
         QApplication.restoreOverrideCursor()
示例#8
0
def restore_cursor():
    """
    Restores current Qt application cursor
    """

    QApplication.restoreOverrideCursor()