forked from winpython/winpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQtGui.py
More file actions
157 lines (145 loc) · 8.31 KB
/
QtGui.py
File metadata and controls
157 lines (145 loc) · 8.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# -*- coding: utf-8 -*-
#
# Copyright © 2014-2015 Colin Duquesnoy
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
"""
Provides QtGui classes and functions.
.. warning:: Only PyQt4/PySide QtGui classes compatible with PyQt5.QtGui are
exposed here. Therefore, you need to treat/use this package as if it were
the ``PyQt5.QtGui`` module.
"""
import warnings
from . import PYQT5, PYQT4, PYSIDE, PYSIDE2, PythonQtError
if PYQT5:
from PyQt5.QtGui import *
elif PYSIDE2:
from PySide2.QtGui import *
elif PYQT4:
try:
# Older versions of PyQt4 do not provide these
from PyQt4.QtGui import (QGlyphRun, QMatrix2x2, QMatrix2x3,
QMatrix2x4, QMatrix3x2, QMatrix3x3,
QMatrix3x4, QMatrix4x2, QMatrix4x3,
QMatrix4x4, QTouchEvent, QQuaternion,
QRadialGradient, QRawFont, QStaticText,
QVector2D, QVector3D, QVector4D,
qFuzzyCompare)
except ImportError:
pass
from PyQt4.Qt import QKeySequence, QTextCursor
from PyQt4.QtGui import (QAbstractTextDocumentLayout, QActionEvent, QBitmap,
QBrush, QClipboard, QCloseEvent, QColor,
QConicalGradient, QContextMenuEvent, QCursor,
QDoubleValidator, QDrag,
QDragEnterEvent, QDragLeaveEvent, QDragMoveEvent,
QDropEvent, QFileOpenEvent, QFocusEvent, QFont,
QFontDatabase, QFontInfo, QFontMetrics,
QFontMetricsF, QGradient, QHelpEvent,
QHideEvent, QHoverEvent, QIcon, QIconDragEvent,
QIconEngine, QImage, QImageIOHandler, QImageReader,
QImageWriter, QInputEvent, QInputMethodEvent,
QKeyEvent, QLinearGradient,
QMouseEvent, QMoveEvent, QMovie,
QPaintDevice, QPaintEngine, QPaintEngineState,
QPaintEvent, QPainter, QPainterPath,
QPainterPathStroker, QPalette, QPen, QPicture,
QPictureIO, QPixmap, QPixmapCache, QPolygon,
QPolygonF, QRegExpValidator, QRegion, QResizeEvent,
QSessionManager, QShortcutEvent, QShowEvent,
QStandardItem, QStandardItemModel,
QStatusTipEvent, QSyntaxHighlighter, QTabletEvent,
QTextBlock, QTextBlockFormat, QTextBlockGroup,
QTextBlockUserData, QTextCharFormat,
QTextDocument, QTextDocumentFragment,
QTextDocumentWriter, QTextFormat, QTextFragment,
QTextFrame, QTextFrameFormat, QTextImageFormat,
QTextInlineObject, QTextItem, QTextLayout,
QTextLength, QTextLine, QTextList, QTextListFormat,
QTextObject, QTextObjectInterface, QTextOption,
QTextTable, QTextTableCell, QTextTableCellFormat,
QTextTableFormat, QTransform,
QValidator, QWhatsThisClickedEvent, QWheelEvent,
QWindowStateChangeEvent, qAlpha, qBlue,
qGray, qGreen, qIsGray, qRed, qRgb,
qRgba, QIntValidator)
# QDesktopServices has has been split into (QDesktopServices and
# QStandardPaths) in Qt5
# It only exposes QDesktopServices that are still in pyqt5
from PyQt4.QtGui import QDesktopServices as _QDesktopServices
class QDesktopServices():
openUrl = _QDesktopServices.openUrl
setUrlHandler = _QDesktopServices.setUrlHandler
unsetUrlHandler = _QDesktopServices.unsetUrlHandler
def __getattr__(self, name):
attr = getattr(_QDesktopServices, name)
new_name = name
if name == 'storageLocation':
new_name = 'writableLocation'
warnings.warn(("Warning QDesktopServices.{} is deprecated in Qt5"
"we recommend you use QDesktopServices.{} instead").format(name, new_name),
DeprecationWarning)
return attr
QDesktopServices = QDesktopServices()
elif PYSIDE:
from PySide.QtGui import (QAbstractTextDocumentLayout, QActionEvent, QBitmap,
QBrush, QClipboard, QCloseEvent, QColor,
QConicalGradient, QContextMenuEvent, QCursor,
QDoubleValidator, QDrag,
QDragEnterEvent, QDragLeaveEvent, QDragMoveEvent,
QDropEvent, QFileOpenEvent, QFocusEvent, QFont,
QFontDatabase, QFontInfo, QFontMetrics,
QFontMetricsF, QGradient, QHelpEvent,
QHideEvent, QHoverEvent, QIcon, QIconDragEvent,
QIconEngine, QImage, QImageIOHandler, QImageReader,
QImageWriter, QInputEvent, QInputMethodEvent,
QKeyEvent, QKeySequence, QLinearGradient,
QMatrix2x2, QMatrix2x3, QMatrix2x4, QMatrix3x2,
QMatrix3x3, QMatrix3x4, QMatrix4x2, QMatrix4x3,
QMatrix4x4, QMouseEvent, QMoveEvent, QMovie,
QPaintDevice, QPaintEngine, QPaintEngineState,
QPaintEvent, QPainter, QPainterPath,
QPainterPathStroker, QPalette, QPen, QPicture,
QPictureIO, QPixmap, QPixmapCache, QPolygon,
QPolygonF, QQuaternion, QRadialGradient,
QRegExpValidator, QRegion, QResizeEvent,
QSessionManager, QShortcutEvent, QShowEvent,
QStandardItem, QStandardItemModel,
QStatusTipEvent, QSyntaxHighlighter, QTabletEvent,
QTextBlock, QTextBlockFormat, QTextBlockGroup,
QTextBlockUserData, QTextCharFormat, QTextCursor,
QTextDocument, QTextDocumentFragment,
QTextFormat, QTextFragment,
QTextFrame, QTextFrameFormat, QTextImageFormat,
QTextInlineObject, QTextItem, QTextLayout,
QTextLength, QTextLine, QTextList, QTextListFormat,
QTextObject, QTextObjectInterface, QTextOption,
QTextTable, QTextTableCell, QTextTableCellFormat,
QTextTableFormat, QTouchEvent, QTransform,
QValidator, QVector2D, QVector3D, QVector4D,
QWhatsThisClickedEvent, QWheelEvent,
QWindowStateChangeEvent, qAlpha, qBlue,
qGray, qGreen, qIsGray, qRed, qRgb, qRgba,
QIntValidator)
# QDesktopServices has has been split into (QDesktopServices and
# QStandardPaths) in Qt5
# It only exposes QDesktopServices that are still in pyqt5
from PySide.QtGui import QDesktopServices as _QDesktopServices
class QDesktopServices():
openUrl = _QDesktopServices.openUrl
setUrlHandler = _QDesktopServices.setUrlHandler
unsetUrlHandler = _QDesktopServices.unsetUrlHandler
def __getattr__(self, name):
attr = getattr(_QDesktopServices, name)
new_name = name
if name == 'storageLocation':
new_name = 'writableLocation'
warnings.warn(("Warning QDesktopServices.{} is deprecated in Qt5"
"we recommend you use QDesktopServices.{} instead").format(name, new_name),
DeprecationWarning)
return attr
QDesktopServices = QDesktopServices()
else:
raise PythonQtError('No Qt bindings could be found')