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)
10 Provides QtCore classes and functions.
13 from . import PYQT5
, PYSIDE2
, PYQT4
, PYSIDE
, PythonQtError
17 from PyQt5
.QtCore
import *
18 from PyQt5
.QtCore
import pyqtSignal
as Signal
19 from PyQt5
.QtCore
import pyqtSlot
as Slot
20 from PyQt5
.QtCore
import pyqtProperty
as Property
21 from PyQt5
.QtCore
import QT_VERSION_STR
as __version__
24 from PyQt5
.QtCore
import QDateTime
25 QDateTime
.toPython
= QDateTime
.toPyDateTime
27 # Those are imported from `import *`
28 del pyqtSignal
, pyqtSlot
, pyqtProperty
, QT_VERSION_STR
30 from PySide2
.QtCore
import *
32 try: # may be limited to PySide-5.11a1 only
33 from PySide2
.QtGui
import QStringListModel
38 __version__
= PySide2
.QtCore
.__version
__
40 from PyQt4
.QtCore
import *
41 # Those are things we inherited from Spyder that fix crazy crashes under
42 # some specific situations. (See #34)
43 from PyQt4
.QtCore
import QCoreApplication
44 from PyQt4
.QtCore
import Qt
45 from PyQt4
.QtCore
import pyqtSignal
as Signal
46 from PyQt4
.QtCore
import pyqtSlot
as Slot
47 from PyQt4
.QtCore
import pyqtProperty
as Property
48 from PyQt4
.QtGui
import (QItemSelection
, QItemSelectionModel
,
49 QItemSelectionRange
, QSortFilterProxyModel
,
51 from PyQt4
.QtCore
import QT_VERSION_STR
as __version__
52 from PyQt4
.QtCore
import qInstallMsgHandler
as qInstallMessageHandler
54 # QDesktopServices has has been split into (QDesktopServices and
55 # QStandardPaths) in Qt5
56 # This creates a dummy class that emulates QStandardPaths
57 from PyQt4
.QtGui
import QDesktopServices
as _QDesktopServices
59 class QStandardPaths():
60 StandardLocation
= _QDesktopServices
.StandardLocation
61 displayName
= _QDesktopServices
.displayName
62 DesktopLocation
= _QDesktopServices
.DesktopLocation
63 DocumentsLocation
= _QDesktopServices
.DocumentsLocation
64 FontsLocation
= _QDesktopServices
.FontsLocation
65 ApplicationsLocation
= _QDesktopServices
.ApplicationsLocation
66 MusicLocation
= _QDesktopServices
.MusicLocation
67 MoviesLocation
= _QDesktopServices
.MoviesLocation
68 PicturesLocation
= _QDesktopServices
.PicturesLocation
69 TempLocation
= _QDesktopServices
.TempLocation
70 HomeLocation
= _QDesktopServices
.HomeLocation
71 DataLocation
= _QDesktopServices
.DataLocation
72 CacheLocation
= _QDesktopServices
.CacheLocation
73 writableLocation
= _QDesktopServices
.storageLocation
75 # Those are imported from `import *`
76 del pyqtSignal
, pyqtSlot
, pyqtProperty
, QT_VERSION_STR
, qInstallMsgHandler
78 from PySide
.QtCore
import *
79 from PySide
.QtGui
import (QItemSelection
, QItemSelectionModel
,
80 QItemSelectionRange
, QSortFilterProxyModel
,
82 from PySide
.QtCore
import qInstallMsgHandler
as qInstallMessageHandler
83 del qInstallMsgHandler
85 # QDesktopServices has has been split into (QDesktopServices and
86 # QStandardPaths) in Qt5
87 # This creates a dummy class that emulates QStandardPaths
88 from PySide
.QtGui
import QDesktopServices
as _QDesktopServices
90 class QStandardPaths():
91 StandardLocation
= _QDesktopServices
.StandardLocation
92 displayName
= _QDesktopServices
.displayName
93 DesktopLocation
= _QDesktopServices
.DesktopLocation
94 DocumentsLocation
= _QDesktopServices
.DocumentsLocation
95 FontsLocation
= _QDesktopServices
.FontsLocation
96 ApplicationsLocation
= _QDesktopServices
.ApplicationsLocation
97 MusicLocation
= _QDesktopServices
.MusicLocation
98 MoviesLocation
= _QDesktopServices
.MoviesLocation
99 PicturesLocation
= _QDesktopServices
.PicturesLocation
100 TempLocation
= _QDesktopServices
.TempLocation
101 HomeLocation
= _QDesktopServices
.HomeLocation
102 DataLocation
= _QDesktopServices
.DataLocation
103 CacheLocation
= _QDesktopServices
.CacheLocation
104 writableLocation
= _QDesktopServices
.storageLocation
107 __version__
= PySide
.QtCore
.__version
__
109 raise PythonQtError('No Qt bindings could be found')