qt.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @文件 :qt.py
  5. @时间 :2022/02/21 16:48:46
  6. @作者 :None
  7. @版本 :1.0
  8. @说明 : pyqt和pyside2兼容包
  9. '''
  10. QT_CHOSE = 0
  11. if QT_CHOSE:
  12. # PySide2
  13. from PySide2 import ( # noqa F401
  14. QtGui, QtWidgets, QtCore
  15. )
  16. from PySide2.QtWidgets import ( # noqa F401
  17. QMainWindow, QDesktopWidget, QStyleFactory, QWidget, QFrame,
  18. QApplication, QSizePolicy, QHBoxLayout, QVBoxLayout, QGridLayout,
  19. QLabel, QPushButton, QLineEdit, QProgressBar, QComboBox, QLCDNumber,
  20. QMessageBox, QFileDialog, QPlainTextEdit, QStatusBar, QGroupBox, QTabBar,
  21. QTabWidget, QTableWidget, QAbstractItemView, QCheckBox, QHeaderView,
  22. QStyle, QStyleOptionButton, QTableWidgetItem, QSpacerItem
  23. )
  24. from PySide2.QtGui import ( # noqa F401
  25. QGuiApplication, QPalette, QPainter, QColor, QPen,
  26. QLinearGradient, QFont, QBrush, QPixmap, QIcon, QRegExpValidator, QKeySequence
  27. )
  28. from PySide2.QtCore import ( # noqa F401
  29. QObject, QCoreApplication, QStandardPaths, QMetaObject, Qt,
  30. QPoint, QRect, QRectF, QPointF, QDateTime, QTimer, QSize,
  31. QThread, QMutex, QSemaphore, QRegExp, QModelIndex, Signal, Slot
  32. )
  33. from PySide2.QtCharts import QtCharts
  34. QChartView = QtCharts.QChartView
  35. QChart = QtCharts.QChart
  36. QLineSeries = QtCharts.QLineSeries
  37. QCategoryAxis = QtCharts.QCategoryAxis
  38. QValueAxis = QtCharts.QValueAxis
  39. QLegendMarker = QtCharts.QLegendMarker
  40. else:
  41. # PyQt5
  42. from PyQt5 import ( # noqa F401
  43. QtGui, QtWidgets, QtCore, QtChart
  44. )
  45. from PyQt5.QtWidgets import ( # noqa F401
  46. QMainWindow, QDesktopWidget, QStyleFactory, QWidget, QFrame,
  47. QApplication, QSizePolicy, QHBoxLayout, QVBoxLayout, QGridLayout,
  48. QLabel, QPushButton, QLineEdit, QProgressBar, QComboBox, QLCDNumber,
  49. QMessageBox, QFileDialog, QPlainTextEdit, QStatusBar, QGroupBox, QTabBar,
  50. QTabWidget, QTableWidget, QAbstractItemView, QCheckBox, QHeaderView,
  51. QStyle, QStyleOptionButton, QTableWidgetItem, QSpacerItem
  52. )
  53. from PyQt5.QtGui import ( # noqa F401
  54. QGuiApplication, QPalette, QPainter, QColor, QPen,
  55. QLinearGradient, QFont, QBrush, QPixmap, QIcon, QRegExpValidator, QKeySequence
  56. )
  57. from PyQt5.QtCore import ( # noqa F401
  58. QObject, QCoreApplication, QStandardPaths, QMetaObject, Qt, QRect, QRectF,
  59. QPoint, QPointF, QDateTime, QTimer, QSize,
  60. QThread, QMutex, QSemaphore, QRegExp, QModelIndex, pyqtSignal as Signal, pyqtSlot as Slot
  61. )
  62. from PyQt5.QtChart import ( # noqa F401
  63. QChartView, QLineSeries, QChart, QCategoryAxis, QValueAxis, QLegendMarker
  64. )