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


Python QtGui.QApplication类代码示例

本文整理汇总了Python中spyderlib.qt.QtGui.QApplication的典型用法代码示例。如果您正苦于以下问题:Python QApplication类的具体用法?Python QApplication怎么用?Python QApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: resize_to_contents

 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:wellsoftware,项目名称:spyder,代码行数:7,代码来源:arrayeditor.py

示例2: test

def test():
    from spyderlib.qt.QtGui import QApplication
    app = QApplication([])
    widget = create_widget()
    widget.show()
    # Start the application main loop.
    app.exec_()
开发者ID:jromang,项目名称:retina-old,代码行数:7,代码来源:ipython.py

示例3: starting_long_process

 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:ymarfoq,项目名称:outilACVDesagregation,代码行数:8,代码来源:__init__.py

示例4: ending_long_process

 def ending_long_process(self, message=""):
     """
     Clearing main window's status bar
     and restoring mouse cursor
     """
     QApplication.restoreOverrideCursor()
     self.show_message(message, timeout=2000)
     QApplication.processEvents()
开发者ID:ymarfoq,项目名称:outilACVDesagregation,代码行数:8,代码来源:__init__.py

示例5: _post_message

 def _post_message(self, message, timeout=60000):
     """
     Post a message to the main window status bar with a timeout in ms
     """
     if self.editor_widget:
         statusbar = self.editor_widget.window().statusBar()
         statusbar.showMessage(message, timeout)
         QApplication.processEvents()
开发者ID:ymarfoq,项目名称:outilACVDesagregation,代码行数:8,代码来源:plugin_manager.py

示例6: write_error

 def write_error(self):
     if os.name == 'nt':
         #---This is apparently necessary only on Windows (not sure though):
         #   emptying standard output buffer before writing error output
         self.process.setReadChannel(QProcess.StandardOutput)
         if self.process.waitForReadyRead(1):
             self.write_output()
     self.shell.write_error(self.get_stderr())
     QApplication.processEvents()
开发者ID:Micseb,项目名称:spyder,代码行数:9,代码来源:pythonshell.py

示例7: copy_without_prompts

 def copy_without_prompts(self):
     """Copy text to clipboard without prompts"""
     text = self.get_selected_text()
     lines = text.split(os.linesep)
     for index, line in enumerate(lines):
         if line.startswith('>>> ') or line.startswith('... '):
             lines[index] = line[4:]
     text = os.linesep.join(lines)
     QApplication.clipboard().setText(text)
开发者ID:ImadBouirmane,项目名称:spyder,代码行数:9,代码来源:shell.py

示例8: mouseMoveEvent

 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:arvindchari88,项目名称:newGitTest,代码行数:13,代码来源:mixins.py

示例9: save_data

 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:ImadBouirmane,项目名称:spyder,代码行数:31,代码来源:namespacebrowser.py

示例10: data

    def data(self, index, role=Qt.DisplayRole):
        """Qt Override."""
        row = index.row()
        if not index.isValid() or not (0 <= row < len(self.shortcuts)):
            return to_qvariant()

        shortcut = self.shortcuts[row]
        key = shortcut.key
        column = index.column()

        if role == Qt.DisplayRole:
            if column == CONTEXT:
                return to_qvariant(shortcut.context)
            elif column == NAME:
                color = self.text_color
                if self._parent == QApplication.focusWidget():
                    if self.current_index().row() == row:
                        color = self.text_color_highlight
                    else:
                        color = self.text_color
                text = self.rich_text[row]
                text = '<p style="color:{0}">{1}</p>'.format(color, text)
                return to_qvariant(text)
            elif column == SEQUENCE:
                text = QKeySequence(key).toString(QKeySequence.NativeText)
                return to_qvariant(text)
            elif column == SEARCH_SCORE:
                # Treating search scores as a table column simplifies the
                # sorting once a score for a specific string in the finder
                # has been defined. This column however should always remain
                # hidden.
                return to_qvariant(self.scores[row])
        elif role == Qt.TextAlignmentRole:
            return to_qvariant(int(Qt.AlignHCenter | Qt.AlignVCenter))
        return to_qvariant()
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:35,代码来源:shortcuts.py

示例11: mouseMoveEvent

 def mouseMoveEvent(self, event):
     """Override Qt method"""
     if event.buttons() == Qt.MouseButtons(Qt.LeftButton) and \
        (event.pos() - self.__drag_start_pos).manhattanLength() > \
             QApplication.startDragDistance():
         drag = QDrag(self)
         mimeData = QMimeData()
         # Converting id's to long to avoid an OverflowError with PySide
         if PY2:
             ancestor_id = long(id(self.ancestor))
             parent_widget_id = long(id(self.parentWidget()))
             self_id = long(id(self))
         else:
             ancestor_id = id(self.ancestor)
             parent_widget_id = id(self.parentWidget())
             self_id = id(self)
         mimeData.setData("parent-id", QByteArray.number(ancestor_id))
         mimeData.setData("tabwidget-id",
                          QByteArray.number(parent_widget_id))
         mimeData.setData("tabbar-id", QByteArray.number(self_id))
         mimeData.setData("source-index", 
                      QByteArray.number(self.tabAt(self.__drag_start_pos)))
         drag.setMimeData(mimeData)
         drag.exec_()
     QTabBar.mouseMoveEvent(self, event)
开发者ID:MarvinLiu0810,项目名称:spyder,代码行数:25,代码来源:tabs.py

示例12: paintEvent

    def paintEvent(self, event):
        """Qt Override.

        Include a validation icon to the left of the line edit.
        """
        super(IconLineEdit, self).paintEvent(event)
        painter = QPainter(self)

        rect = self.geometry()
        space = int((rect.height())/6)
        h = rect.height() - space
        w = rect.width() - h

        if self._icon_visible:
            if self._status and self._status_set:
                pixmap = self._set_icon.pixmap(h, h)
            elif self._status:
                pixmap = self._valid_icon.pixmap(h, h)
            else:
                pixmap = self._invalid_icon.pixmap(h, h)

            painter.drawPixmap(w, space, pixmap)

        application_style = QApplication.style().objectName()
        if self._application_style != application_style:
            self._application_style = application_style
            self._refresh()

        # Small hack to gurantee correct padding on Spyder start
        if self._paint_count < 5:
            self._paint_count += 1
            self._refresh()
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:32,代码来源:helperwidgets.py

示例13: paint

    def paint(self, painter, option, index):
        options = QStyleOptionViewItem(option)
        self.initStyleOption(options, index)

        style = (QApplication.style() if options.widget is None
                 else options.widget.style())

        doc = QTextDocument()
        doc.setDocumentMargin(self._margin)
        doc.setHtml(options.text)

        options.text = ""
        style.drawControl(QStyle.CE_ItemViewItem, options, painter)

        ctx = QAbstractTextDocumentLayout.PaintContext()

        textRect = style.subElementRect(QStyle.SE_ItemViewItemText, options)
        painter.save()
        if style.objectName() == 'oxygen':
            painter.translate(textRect.topLeft() + QPoint(5, -9))
        else:
            painter.translate(textRect.topLeft())
            painter.setClipRect(textRect.translated(-textRect.topLeft()))
        doc.documentLayout().draw(painter, ctx)

        painter.restore()
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:26,代码来源:helperwidgets.py

示例14: copy

 def copy(self):
     """Copy text to clipboard"""
     if not self.selectedIndexes():
         return
     (row_min, row_max,
      col_min, col_max) = get_idx_rect(self.selectedIndexes())
     index = header = False
     if col_min == 0:
         col_min = 1
         index = True
     df = self.model().df
     if col_max == 0:  # To copy indices
         contents = '\n'.join(map(str, df.index.tolist()[slice(row_min,
                                                         row_max+1)]))
     else:  # To copy DataFrame
         if (col_min == 0 or col_min == 1) and (df.shape[1] == col_max):
             header = True
         obj = df.iloc[slice(row_min, row_max+1), slice(col_min-1, col_max)]
         output = io.StringIO()
         obj.to_csv(output, sep='\t', index=index, header=header)
         if not PY2:
             contents = output.getvalue()
         else:
             contents = output.getvalue().decode('utf-8')
         output.close()
     clipboard = QApplication.clipboard()
     clipboard.setText(contents)
开发者ID:gyenney,项目名称:Tools,代码行数:27,代码来源:dataframeeditor.py

示例15: data

    def data(self, index, role=Qt.DisplayRole):
        """Qt Override"""
        if not index.isValid() or \
           not (0 <= index.row() < len(self.shortcuts)):
            return to_qvariant()

        shortcut = self.shortcuts[index.row()]
        key = shortcut.key
        column = index.column()

        if role == Qt.DisplayRole:
            if column == CONTEXT:
                return to_qvariant(shortcut.context)
            elif column == NAME:
                color = self.text_color
                if self._parent == QApplication.focusWidget():
                    if self.current_index().row() == index.row():
                        color = self.text_color_highlight
                    else:
                        color = self.text_color
                return to_qvariant(self._enrich_text(shortcut.name, color))
            elif column == SEQUENCE:
                text = QKeySequence(key).toString(QKeySequence.NativeText)
                return to_qvariant(text)
        elif role == Qt.TextAlignmentRole:
            return to_qvariant(int(Qt.AlignHCenter | Qt.AlignVCenter))
        return to_qvariant()
开发者ID:ptocca,项目名称:spyder,代码行数:27,代码来源:shortcuts.py


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