-
Notifications
You must be signed in to change notification settings - Fork 2
/
common_compatibility.py
38 lines (33 loc) · 1.28 KB
/
common_compatibility.py
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
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2022, Grant Drake'
# Maintain backwards compatibility with older versions of Qt and calibre.
try:
from qt.core import QSizePolicy, QTextEdit, Qt
except ImportError:
from PyQt5.Qt import QSizePolicy, QTextEdit, Qt
try:
qSizePolicy_Minimum = QSizePolicy.Policy.Minimum
qSizePolicy_Maximum = QSizePolicy.Policy.Maximum
qSizePolicy_Expanding = QSizePolicy.Policy.Expanding
qSizePolicy_Preferred = QSizePolicy.Policy.Preferred
qSizePolicy_Ignored = QSizePolicy.Policy.Ignored
except:
qSizePolicy_Minimum = QSizePolicy.Minimum
qSizePolicy_Maximum = QSizePolicy.Maximum
qSizePolicy_Expanding = QSizePolicy.Expanding
qSizePolicy_Preferred = QSizePolicy.Preferred
qSizePolicy_Ignored = QSizePolicy.Ignored
try:
qTextEdit_NoWrap = QTextEdit.LineWrapMode.NoWrap
except:
qTextEdit_NoWrap = QTextEdit.NoWrap
try:
qtDropActionCopyAction = Qt.DropAction.CopyAction
qtDropActionMoveAction = Qt.DropAction.MoveAction
except:
qtDropActionCopyAction = Qt.CopyAction
qtDropActionMoveAction = Qt.MoveAction