当前位置: 首页>>代码示例>>Python>>正文


Python QApplication.setOverrideCursor方法代码示例

本文整理汇总了Python中qtpy.QtWidgets.QApplication.setOverrideCursor方法的典型用法代码示例。如果您正苦于以下问题:Python QApplication.setOverrideCursor方法的具体用法?Python QApplication.setOverrideCursor怎么用?Python QApplication.setOverrideCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qtpy.QtWidgets.QApplication的用法示例。


在下文中一共展示了QApplication.setOverrideCursor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: eventFilter

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
    def eventFilter(self, obj, event):
        """
        Filters events on this object.

        Params
        ------
        object : QObject
            The object that is being handled.
        event : QEvent
            The event that is happening.

        Returns
        -------
        bool
            True to stop the event from being handled further; otherwise
            return false.
        """
        channel = getattr(self, 'channel', None)
        if is_channel_valid(channel):
            status = self._write_access and self._connected

            if event.type() == QEvent.Leave:
                QApplication.restoreOverrideCursor()

            if event.type() == QEvent.Enter and not status:
                QApplication.setOverrideCursor(QCursor(Qt.ForbiddenCursor))

        return PyDMWidget.eventFilter(self, obj, event)
开发者ID:slaclab,项目名称:pydm,代码行数:30,代码来源:base.py

示例2: save_data

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
    def save_data(self, filename=None):
        """Save data"""
        if filename is None:
            filename = self.filename
            if filename is None:
                filename = getcwd_or_home()
            filename, _selfilter = getsavefilename(self, _("Save data"),
                                                   filename,
                                                   iofunctions.save_filters)
            if filename:
                self.filename = filename
            else:
                return False
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        QApplication.processEvents()

        error_message = self.shellwidget.save_namespace(self.filename)
        self.shellwidget._kernel_reply = None

        QApplication.restoreOverrideCursor()
        QApplication.processEvents()
        if error_message is not None:
            QMessageBox.critical(self, _("Save data"),
                            _("<b>Unable to save current workspace</b>"
                              "<br><br>Error message:<br>%s") % error_message)
        self.save_button.setEnabled(self.filename is not None)
开发者ID:burrbull,项目名称:spyder,代码行数:28,代码来源:namespacebrowser.py

示例3: load

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
    def load(self):

        QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)

        o_table = TableRowHandler(main_window=self.parent)

        if self.parent.clear_master_table_before_loading:
            TableHandler.clear_table(self.table_ui)

        for _row, _key in enumerate(self.json.keys()):

            _entry = self.json[_key]

            run_number = _key
            title = _entry['title']
            chemical_formula = _entry['resolved_conflict']['chemical_formula']
            # geometry = _entry['resolved_conflict']['geometry']
            mass_density = _entry['resolved_conflict']['mass_density']
            # sample_env_device = _entry['resolved_conflict']['sample_env_device']

            o_table.insert_row(row=_row,
                               title=title,
                               sample_runs=run_number,
                               sample_mass_density=mass_density,
                               sample_chemical_formula=chemical_formula)

        QApplication.restoreOverrideCursor()
开发者ID:neutrons,项目名称:FastGR,代码行数:29,代码来源:load_into_master_table.py

示例4: eventFilter

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
 def eventFilter(self, obj, event):
     status = self._connected
     if event.type() == QEvent.Leave:
         QApplication.setOverrideCursor(QCursor(Qt.ArrowCursor))
     elif event.type() == QEvent.Enter and not status:
         QApplication.setOverrideCursor(QCursor(Qt.ForbiddenCursor))
     return False
开发者ID:slaclab,项目名称:pydm,代码行数:9,代码来源:waveformtable.py

示例5: save_data

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
 def save_data(self, filename=None):
     """Save data"""
     if filename is None:
         filename = self.filename
         if filename is None:
             filename = getcwd()
         filename, _selfilter = getsavefilename(self, _("Save data"),
                                                filename,
                                                iofunctions.save_filters)
         if filename:
             self.filename = filename
         else:
             return False
     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
     QApplication.processEvents()
     if self.is_internal_shell:
         wsfilter = self.get_internal_shell_filter('picklable',
                                                   check_all=True)
         namespace = wsfilter(self.shellwidget.interpreter.namespace).copy()
         error_message = iofunctions.save(namespace, filename)
     else:
         settings = self.get_view_settings()
         error_message = monitor_save_globals(self._get_sock(),
                                              settings, filename)
     QApplication.restoreOverrideCursor()
     QApplication.processEvents()
     if error_message is not None:
         QMessageBox.critical(self, _("Save data"),
                         _("<b>Unable to save current workspace</b>"
                           "<br><br>Error message:<br>%s") % error_message)
     self.save_button.setEnabled(self.filename is not None)
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:33,代码来源:namespacebrowser.py

示例6: save_data

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
    def save_data(self, filename=None):
        """Save data"""
        if filename is None:
            filename = self.filename
            if filename is None:
                filename = getcwd_or_home()
            filename, _selfilter = getsavefilename(self, _("Save data"),
                                                   filename,
                                                   iofunctions.save_filters)
            if filename:
                self.filename = filename
            else:
                return False
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        QApplication.processEvents()

        error_message = self.shellwidget.save_namespace(self.filename)
        self.shellwidget._kernel_reply = None

        QApplication.restoreOverrideCursor()
        QApplication.processEvents()
        if error_message is not None:
            if 'Some objects could not be saved:' in error_message:
                save_data_message = (
                    _('<b>Some objects could not be saved:</b>')
                    + '<br><br><code>{obj_list}</code>'.format(
                        obj_list=error_message.split(': ')[1]))
            else:
                save_data_message = _(
                    '<b>Unable to save current workspace</b>'
                    '<br><br>Error message:<br>') + error_message
            QMessageBox.critical(self, _("Save data"), save_data_message)
        self.save_button.setEnabled(self.filename is not None)
开发者ID:impact27,项目名称:spyder,代码行数:35,代码来源:namespacebrowser.py

示例7: resize_to_contents

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
 def resize_to_contents(self):
     """Resize cells to contents"""
     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
     self.resizeColumnsToContents()
     self.model().fetch_more(columns=True)
     self.resizeColumnsToContents()
     QApplication.restoreOverrideCursor()
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:9,代码来源:arrayeditor.py

示例8: wrapper

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
 def wrapper(*args, **kwargs):
     QApplication.setOverrideCursor(
         QCursor(Qt.WaitCursor))
     try:
         ret_val = func(*args, **kwargs)
     finally:
         QApplication.restoreOverrideCursor()
     return ret_val
开发者ID:impact27,项目名称:spyder,代码行数:10,代码来源:editor.py

示例9: starting_long_process

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
 def starting_long_process(self, message):
     """
     Showing message in main window's status bar
     and changing mouse cursor to Qt.WaitCursor
     """
     self.__show_message(message)
     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
     QApplication.processEvents()
开发者ID:DLlearn,项目名称:spyder,代码行数:10,代码来源:__init__.py

示例10: override_cursor

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
 def override_cursor(self, cursor):
     """
     Set new override cursor.
     :param cursor: New cursor.
     """
     self._override_cursor = cursor
     QApplication.restoreOverrideCursor()
     if cursor is not None:
         QApplication.setOverrideCursor(cursor)
开发者ID:mantidproject,项目名称:mantid,代码行数:11,代码来源:interactive_tool.py

示例11: from_oncat_config

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
    def from_oncat_config(self, insert_in_table=True):
        """using only the fields we are looking for (defined in the config.json file,
        this method retrieves the metadata of either the IPTS or the runs selected,
        and populate or not the Master table (if insert_in_table is True)"""

        QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)

        self.parent.list_of_runs_not_found = []
        nexus_json = self.parent.nexus_json_from_template

        if self.parent.ui.run_radio_button.isChecked():

            # remove white space to string to make ONCat happy
            str_runs = str(self.parent.ui.run_number_lineedit.text())
            str_runs = remove_white_spaces(str_runs)
            #
            # nexus_json = pyoncatGetNexus(oncat=self.parent.parent.oncat,
            #                              instrument=self.parent.parent.instrument['short_name'],
            #                              runs=str_runs,
            #                              facility=self.parent.parent.facility,
            #                              )

            result = database_utilities.get_list_of_runs_found_and_not_found(str_runs=str_runs,
                                                                             oncat_result=nexus_json)
            list_of_runs_not_found = result['not_found']
            self.parent.list_of_runs_not_found = list_of_runs_not_found
            self.parent.list_of_runs_found = result['found']

        else:
            # ipts = str(self.parent.ui.ipts_combobox.currentText())
            #
            # nexus_json = pyoncatGetRunsFromIpts(oncat=self.parent.parent.oncat,
            #                                     instrument=self.parent.parent.instrument['short_name'],
            #                                     ipts=ipts,
            #                                     facility=self.parent.parent.facility)

            result = database_utilities.get_list_of_runs_found_and_not_found(oncat_result=nexus_json,
                                                                             check_not_found=False)

            self.parent.list_of_runs_not_found = result['not_found']
            self.parent.list_of_runs_found = result['found']

        if insert_in_table:
            self.parent.insert_in_master_table(nexus_json=nexus_json)
        else:
            self.isolate_metadata(nexus_json)
            self.parent.nexus_json = nexus_json

        QApplication.restoreOverrideCursor()

        if insert_in_table:
            self.parent.close()
开发者ID:neutrons,项目名称:FastGR,代码行数:54,代码来源:import_table_from_oncat_handler.py

示例12: mouseMoveEvent

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
 def mouseMoveEvent(self, event):
     """Show Pointing Hand Cursor on error messages"""
     text = self.get_line_at(event.pos())
     if get_error_match(text):
         if not self.__cursor_changed:
             QApplication.setOverrideCursor(QCursor(Qt.PointingHandCursor))
             self.__cursor_changed = True
         event.accept()
         return
     if self.__cursor_changed:
         QApplication.restoreOverrideCursor()
         self.__cursor_changed = False
     self.QT_CLASS.mouseMoveEvent(self, event)
开发者ID:jitseniesen,项目名称:spyder,代码行数:15,代码来源:mixins.py

示例13: eventFilter

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
    def eventFilter(self, widget, event):
        """A filter to control the zooming and panning of the figure canvas."""

        # ---- Zooming
        if event.type() == QEvent.Wheel:
            modifiers = QApplication.keyboardModifiers()
            if modifiers == Qt.ControlModifier:
                if event.angleDelta().y() > 0:
                    self.zoom_in()
                else:
                    self.zoom_out()
                return True
            else:
                return False

        # ---- Panning
        # Set ClosedHandCursor:
        elif event.type() == QEvent.MouseButtonPress:
            if event.button() == Qt.LeftButton:
                QApplication.setOverrideCursor(Qt.ClosedHandCursor)
                self._ispanning = True
                self.xclick = event.globalX()
                self.yclick = event.globalY()

        # Reset Cursor:
        elif event.type() == QEvent.MouseButtonRelease:
            QApplication.restoreOverrideCursor()
            self._ispanning = False

        # Move  ScrollBar:
        elif event.type() == QEvent.MouseMove:
            if self._ispanning:
                dx = self.xclick - event.globalX()
                self.xclick = event.globalX()

                dy = self.yclick - event.globalY()
                self.yclick = event.globalY()

                scrollBarH = self.horizontalScrollBar()
                scrollBarH.setValue(scrollBarH.value() + dx)

                scrollBarV = self.verticalScrollBar()
                scrollBarV.setValue(scrollBarV.value() + dy)

        return QWidget.eventFilter(self, widget, event)
开发者ID:impact27,项目名称:spyder,代码行数:47,代码来源:figurebrowser.py

示例14: tab_moved

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
    def tab_moved(self, event):
        """Method called when a tab from a QTabBar has been moved."""
        # If the left button isn't pressed anymore then return
        if not event.buttons() & Qt.LeftButton:
            self.to_index = None
            return

        self.to_index = self.dock_tabbar.tabAt(event.pos())

        if not self.moving and self.from_index != -1 and self.to_index != -1:
            QApplication.setOverrideCursor(Qt.ClosedHandCursor)
            self.moving = True

        if self.to_index == -1:
            self.to_index = self.from_index

        from_index, to_index = self.from_index, self.to_index
        if from_index != to_index and from_index != -1 and to_index != -1:
            self.move_tab(from_index, to_index)
            self._fix_cursor(from_index, to_index)
            self.from_index = to_index
开发者ID:DLlearn,项目名称:spyder,代码行数:23,代码来源:__init__.py

示例15: mouseMoveEvent

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setOverrideCursor [as 别名]
    def mouseMoveEvent(self, event):
        """
        Detect mouser over indicator and highlight the current scope in the
        editor (up and down decoration arround the foldable text when the mouse
        is over an indicator).

        :param event: event
        """
        super(FoldingPanel, self).mouseMoveEvent(event)
        th = TextHelper(self.editor)
        line = th.line_nbr_from_position(event.pos().y())
        if line >= 0:
            block = FoldScope.find_parent_scope(
                self.editor.document().findBlockByNumber(line-1))
            if TextBlockHelper.is_fold_trigger(block):
                if self._mouse_over_line is None:
                    # mouse enter fold scope
                    QApplication.setOverrideCursor(
                        QCursor(Qt.PointingHandCursor))
                if self._mouse_over_line != block.blockNumber() and \
                        self._mouse_over_line is not None:
                    # fold scope changed, a previous block was highlighter so
                    # we quickly update our highlighting
                    self._mouse_over_line = block.blockNumber()
                    self._highlight_block(block)
                else:
                    # same fold scope, request highlight
                    self._mouse_over_line = block.blockNumber()
                    self._highlight_runner.request_job(
                        self._highlight_block, block)
                self._highight_block = block
            else:
                # no fold scope to highlight, cancel any pending requests
                self._highlight_runner.cancel_requests()
                self._mouse_over_line = None
                QApplication.restoreOverrideCursor()
            self.repaint()
开发者ID:0xBADCA7,项目名称:spyder,代码行数:39,代码来源:codefolding.py


注:本文中的qtpy.QtWidgets.QApplication.setOverrideCursor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。