qtpy: update to spider-ide/qtpy v1.11.2
[git-cola.git] / qtpy / QtCore.py
blobd4bbd0d3eac9d3e1fcc13f49e1a111f1c2afe3bb
1 # -*- coding: utf-8 -*-
3 # Copyright © 2014-2015 Colin Duquesnoy
4 # Copyright © 2009- The Spyder Development Team
6 # Licensed under the terms of the MIT License
7 # (see LICENSE.txt for details)
9 """
10 Provides QtCore classes and functions.
11 """
13 from . import PYQT5, PYSIDE2, PYQT4, PYSIDE, PythonQtError
16 if PYQT5:
17 from PyQt5.QtCore import *
18 from PyQt5.QtCore import pyqtSignal as Signal
19 from PyQt5.QtCore import pyqtBoundSignal as SignalInstance
20 from PyQt5.QtCore import pyqtSlot as Slot
21 from PyQt5.QtCore import pyqtProperty as Property
22 from PyQt5.QtCore import QT_VERSION_STR as __version__
24 # For issue #153
25 from PyQt5.QtCore import QDateTime
26 QDateTime.toPython = QDateTime.toPyDateTime
28 # Those are imported from `import *`
29 del pyqtSignal, pyqtBoundSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR
30 elif PYSIDE2:
31 from PySide2.QtCore import *
33 try: # may be limited to PySide-5.11a1 only
34 from PySide2.QtGui import QStringListModel
35 except:
36 pass
38 import PySide2.QtCore
39 __version__ = PySide2.QtCore.__version__
40 elif PYQT4:
41 from PyQt4.QtCore import *
42 # Those are things we inherited from Spyder that fix crazy crashes under
43 # some specific situations. (See #34)
44 from PyQt4.QtCore import QCoreApplication
45 from PyQt4.QtCore import Qt
46 from PyQt4.QtCore import pyqtSignal as Signal
47 from PyQt4.QtCore import pyqtBoundSignal as SignalInstance
48 from PyQt4.QtCore import pyqtSlot as Slot
49 from PyQt4.QtCore import pyqtProperty as Property
50 from PyQt4.QtGui import (QItemSelection, QItemSelectionModel,
51 QItemSelectionRange, QSortFilterProxyModel,
52 QStringListModel)
53 from PyQt4.QtCore import QT_VERSION_STR as __version__
54 from PyQt4.QtCore import qInstallMsgHandler as qInstallMessageHandler
56 # QDesktopServices has has been split into (QDesktopServices and
57 # QStandardPaths) in Qt5
58 # This creates a dummy class that emulates QStandardPaths
59 from PyQt4.QtGui import QDesktopServices as _QDesktopServices
61 class QStandardPaths():
62 StandardLocation = _QDesktopServices.StandardLocation
63 displayName = _QDesktopServices.displayName
64 DesktopLocation = _QDesktopServices.DesktopLocation
65 DocumentsLocation = _QDesktopServices.DocumentsLocation
66 FontsLocation = _QDesktopServices.FontsLocation
67 ApplicationsLocation = _QDesktopServices.ApplicationsLocation
68 MusicLocation = _QDesktopServices.MusicLocation
69 MoviesLocation = _QDesktopServices.MoviesLocation
70 PicturesLocation = _QDesktopServices.PicturesLocation
71 TempLocation = _QDesktopServices.TempLocation
72 HomeLocation = _QDesktopServices.HomeLocation
73 DataLocation = _QDesktopServices.DataLocation
74 CacheLocation = _QDesktopServices.CacheLocation
75 writableLocation = _QDesktopServices.storageLocation
77 # Those are imported from `import *`
78 del pyqtSignal, pyqtBoundSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR, qInstallMsgHandler
79 elif PYSIDE:
80 from PySide.QtCore import *
81 from PySide.QtGui import (QItemSelection, QItemSelectionModel,
82 QItemSelectionRange, QSortFilterProxyModel,
83 QStringListModel)
84 from PySide.QtCore import qInstallMsgHandler as qInstallMessageHandler
85 del qInstallMsgHandler
87 # QDesktopServices has has been split into (QDesktopServices and
88 # QStandardPaths) in Qt5
89 # This creates a dummy class that emulates QStandardPaths
90 from PySide.QtGui import QDesktopServices as _QDesktopServices
92 class QStandardPaths():
93 StandardLocation = _QDesktopServices.StandardLocation
94 displayName = _QDesktopServices.displayName
95 DesktopLocation = _QDesktopServices.DesktopLocation
96 DocumentsLocation = _QDesktopServices.DocumentsLocation
97 FontsLocation = _QDesktopServices.FontsLocation
98 ApplicationsLocation = _QDesktopServices.ApplicationsLocation
99 MusicLocation = _QDesktopServices.MusicLocation
100 MoviesLocation = _QDesktopServices.MoviesLocation
101 PicturesLocation = _QDesktopServices.PicturesLocation
102 TempLocation = _QDesktopServices.TempLocation
103 HomeLocation = _QDesktopServices.HomeLocation
104 DataLocation = _QDesktopServices.DataLocation
105 CacheLocation = _QDesktopServices.CacheLocation
106 writableLocation = _QDesktopServices.storageLocation
108 import PySide.QtCore
109 __version__ = PySide.QtCore.__version__
110 else:
111 raise PythonQtError('No Qt bindings could be found')