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__
23 # Those are imported from `import *`
24 del pyqtSignal
, pyqtSlot
, pyqtProperty
, QT_VERSION_STR
26 from PySide2
.QtCore
import *
27 try: # may be limited to PySide-5.11a1 only
28 from PySide2
.QtGui
import QStringListModel
32 from PyQt4
.QtCore
import *
33 # Those are things we inherited from Spyder that fix crazy crashes under
34 # some specific situations. (See #34)
35 from PyQt4
.QtCore
import QCoreApplication
36 from PyQt4
.QtCore
import Qt
37 from PyQt4
.QtCore
import pyqtSignal
as Signal
38 from PyQt4
.QtCore
import pyqtSlot
as Slot
39 from PyQt4
.QtCore
import pyqtProperty
as Property
40 from PyQt4
.QtGui
import (QItemSelection
, QItemSelectionModel
,
41 QItemSelectionRange
, QSortFilterProxyModel
,
43 from PyQt4
.QtCore
import QT_VERSION_STR
as __version__
44 from PyQt4
.QtCore
import qInstallMsgHandler
as qInstallMessageHandler
46 # QDesktopServices has has been split into (QDesktopServices and
47 # QStandardPaths) in Qt5
48 # This creates a dummy class that emulates QStandardPaths
49 from PyQt4
.QtGui
import QDesktopServices
as _QDesktopServices
51 class QStandardPaths():
52 StandardLocation
= _QDesktopServices
.StandardLocation
53 displayName
= _QDesktopServices
.displayName
54 DesktopLocation
= _QDesktopServices
.DesktopLocation
55 DocumentsLocation
= _QDesktopServices
.DocumentsLocation
56 FontsLocation
= _QDesktopServices
.FontsLocation
57 ApplicationsLocation
= _QDesktopServices
.ApplicationsLocation
58 MusicLocation
= _QDesktopServices
.MusicLocation
59 MoviesLocation
= _QDesktopServices
.MoviesLocation
60 PicturesLocation
= _QDesktopServices
.PicturesLocation
61 TempLocation
= _QDesktopServices
.TempLocation
62 HomeLocation
= _QDesktopServices
.HomeLocation
63 DataLocation
= _QDesktopServices
.DataLocation
64 CacheLocation
= _QDesktopServices
.CacheLocation
65 writableLocation
= _QDesktopServices
.storageLocation
67 # Those are imported from `import *`
68 del pyqtSignal
, pyqtSlot
, pyqtProperty
, QT_VERSION_STR
, qInstallMsgHandler
70 from PySide
.QtCore
import *
71 from PySide
.QtGui
import (QItemSelection
, QItemSelectionModel
,
72 QItemSelectionRange
, QSortFilterProxyModel
,
74 from PySide
.QtCore
import qInstallMsgHandler
as qInstallMessageHandler
75 del qInstallMsgHandler
77 # QDesktopServices has has been split into (QDesktopServices and
78 # QStandardPaths) in Qt5
79 # This creates a dummy class that emulates QStandardPaths
80 from PySide
.QtGui
import QDesktopServices
as _QDesktopServices
82 class QStandardPaths():
83 StandardLocation
= _QDesktopServices
.StandardLocation
84 displayName
= _QDesktopServices
.displayName
85 DesktopLocation
= _QDesktopServices
.DesktopLocation
86 DocumentsLocation
= _QDesktopServices
.DocumentsLocation
87 FontsLocation
= _QDesktopServices
.FontsLocation
88 ApplicationsLocation
= _QDesktopServices
.ApplicationsLocation
89 MusicLocation
= _QDesktopServices
.MusicLocation
90 MoviesLocation
= _QDesktopServices
.MoviesLocation
91 PicturesLocation
= _QDesktopServices
.PicturesLocation
92 TempLocation
= _QDesktopServices
.TempLocation
93 HomeLocation
= _QDesktopServices
.HomeLocation
94 DataLocation
= _QDesktopServices
.DataLocation
95 CacheLocation
= _QDesktopServices
.CacheLocation
96 writableLocation
= _QDesktopServices
.storageLocation
99 __version__
= PySide
.QtCore
.__version
__
101 raise PythonQtError('No Qt bindings could be found')