From 9ded51b0052899becbdd3a26c1976a413b3a8406 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 22 Feb 2018 23:00:57 +0100 Subject: [PATCH] Cleanup, compat for IDE --- src/cadence.py | 9 +++++++-- src/cadence_aloop_daemon.py | 6 +++++- src/cadence_session_start.py | 5 ++++- src/catarina.py | 14 +++++++++----- src/claudia.py | 9 +++++++-- src/claudia_launcher.py | 9 +++++++-- src/clickablelabel.py | 8 ++++++-- src/jacksettings.py | 12 +++++++++--- src/logs.py | 11 ++++++++--- src/patchcanvas.py | 23 ++++++++++++++++------- src/patchcanvas_theme.py | 8 ++++++-- src/render.py | 9 +++++++-- src/shared.py | 12 +++++++++--- src/shared_cadence.py | 6 +++++- src/shared_canvasjack.py | 11 ++++++++--- src/shared_settings.py | 8 ++++++-- src/systray.py | 12 +++++++++--- 17 files changed, 128 insertions(+), 44 deletions(-) diff --git a/src/cadence.py b/src/cadence.py index 2e08c69..4800bcd 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -20,8 +20,13 @@ # Imports (Global) from platform import architecture -from PyQt5.QtCore import QFileSystemWatcher, QThread -from PyQt5.QtWidgets import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy + +if True: + from PyQt5.QtCore import QFileSystemWatcher, QThread + from PyQt5.QtWidgets import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy +else: + from PyQt4.QtCore import QFileSystemWatcher, QThread + from PyQt4.QtGui import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/cadence_aloop_daemon.py b/src/cadence_aloop_daemon.py index 2a627aa..c8408ef 100755 --- a/src/cadence_aloop_daemon.py +++ b/src/cadence_aloop_daemon.py @@ -23,7 +23,11 @@ import os import sys from signal import signal, SIGINT, SIGTERM from time import sleep -from PyQt5.QtCore import QProcess + +if True: + from PyQt5.QtCore import QProcess +else: + from PyQt4.QtCore import QProcess # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/cadence_session_start.py b/src/cadence_session_start.py index 135b869..6f26a70 100755 --- a/src/cadence_session_start.py +++ b/src/cadence_session_start.py @@ -3,7 +3,10 @@ # Imports (Global) import dbus, sys -from PyQt4.QtCore import QCoreApplication +if True: + from PyQt5.QtCore import QCoreApplication +else: + from PyQt4.QtCore import QCoreApplication # Imports (Custom Stuff) from shared_cadence import * diff --git a/src/catarina.py b/src/catarina.py index ddfabd6..3fff71b 100755 --- a/src/catarina.py +++ b/src/catarina.py @@ -19,11 +19,15 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, QSettings -from PyQt5.QtWidgets import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem - -# FIXME QT4 -#from PyQt5.QtXml import QDomDocument +if True: + from PyQt5.QtCore import pyqtSlot, QSettings + from PyQt5.QtWidgets import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem + # FIXME QT4 + #from PyQt5.QtXml import QDomDocument +else: + from PyQt4.QtCore import pyqtSlot, QSettings + from PyQt4.QtGui import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem + from PyQt4.QtXml import QDomDocument # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/claudia.py b/src/claudia.py index 3d241c9..2d5f1c1 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -20,8 +20,13 @@ # Imports (Global) from time import ctime -from PyQt5.QtCore import QPointF -from PyQt5.QtWidgets import QAction, QApplication, QCheckBox, QHBoxLayout, QVBoxLayout, QTableWidgetItem, QTreeWidgetItem + +if True: + from PyQt5.QtCore import QPointF + from PyQt5.QtWidgets import QAction, QApplication, QCheckBox, QHBoxLayout, QVBoxLayout, QTableWidgetItem, QTreeWidgetItem +else: + from PyQt4.QtCore import QPointF + from PyQt4.QtGui import QAction, QApplication, QCheckBox, QHBoxLayout, QVBoxLayout, QTableWidgetItem, QTreeWidgetItem # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/claudia_launcher.py b/src/claudia_launcher.py index 35578d2..5daad6c 100755 --- a/src/claudia_launcher.py +++ b/src/claudia_launcher.py @@ -19,10 +19,15 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, Qt, QTimer, QSettings -from PyQt5.QtWidgets import QMainWindow, QTableWidgetItem, QWidget from random import randint +if True: + from PyQt5.QtCore import pyqtSlot, Qt, QTimer, QSettings + from PyQt5.QtWidgets import QMainWindow, QTableWidgetItem, QWidget +else: + from PyQt4.QtCore import pyqtSlot, Qt, QTimer, QSettings + from PyQt4.QtGui import QMainWindow, QTableWidgetItem, QWidget + # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/src/clickablelabel.py b/src/clickablelabel.py index d639c5f..ef47999 100644 --- a/src/clickablelabel.py +++ b/src/clickablelabel.py @@ -19,8 +19,12 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer -from PyQt5.QtWidgets import QLabel +if True: + from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer + from PyQt5.QtWidgets import QLabel +else: + from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer + from PyQt4.QtGui import QLabel # ------------------------------------------------------------------------------------------------------------ # Widget Class diff --git a/src/jacksettings.py b/src/jacksettings.py index 039c884..013ba84 100755 --- a/src/jacksettings.py +++ b/src/jacksettings.py @@ -19,11 +19,17 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, Qt, QSettings, QTimer -from PyQt5.QtGui import QFontMetrics -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMessageBox from sys import platform, version_info +if True: + from PyQt5.QtCore import pyqtSlot, Qt, QSettings, QTimer + from PyQt5.QtGui import QFontMetrics + from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMessageBox +else: + from PyQt4.QtCore import pyqtSlot, Qt, QSettings, QTimer + from PyQt4.QtGui import QFontMetrics + from PyQt4.QtGui import QDialog, QDialogButtonBox, QMessageBox + # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/logs.py b/src/logs.py index 5c5e1f7..1909f05 100755 --- a/src/logs.py +++ b/src/logs.py @@ -19,9 +19,14 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, Qt, QFile, QIODevice, QMutex, QMutexLocker, QTextStream, QThread, QSettings -from PyQt5.QtGui import QPalette, QSyntaxHighlighter -from PyQt5.QtWidgets import QDialog +if True: + from PyQt5.QtCore import pyqtSlot, Qt, QFile, QIODevice, QMutex, QMutexLocker, QTextStream, QThread, QSettings + from PyQt5.QtGui import QPalette, QSyntaxHighlighter + from PyQt5.QtWidgets import QDialog +else: + from PyQt4.QtCore import pyqtSlot, Qt, QFile, QIODevice, QMutex, QMutexLocker, QTextStream, QThread, QSettings + from PyQt4.QtGui import QPalette, QSyntaxHighlighter + from PyQt4.QtGui import QDialog # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/patchcanvas.py b/src/patchcanvas.py index f6f4b9c..cfa8441 100644 --- a/src/patchcanvas.py +++ b/src/patchcanvas.py @@ -17,13 +17,22 @@ # For a full copy of the GNU General Public License see the GPL.txt file # Imports (Global) -from PyQt5.QtCore import pyqtSignal, pyqtSlot, qDebug, qCritical, qFatal, qWarning, Qt, QObject -from PyQt5.QtCore import QAbstractAnimation, QLineF, QPointF, QRectF, QSizeF, QSettings, QTimer -from PyQt5.QtGui import QColor, QLinearGradient, QPen, QPolygonF, QPainter, QPainterPath -from PyQt5.QtGui import QCursor, QFont, QFontMetrics -from PyQt5.QtWidgets import QGraphicsScene, QGraphicsItem, QGraphicsLineItem, QGraphicsPathItem -from PyQt5.QtWidgets import QGraphicsColorizeEffect, QGraphicsDropShadowEffect -from PyQt5.QtWidgets import QInputDialog, QLineEdit, QMenu +if True: + from PyQt5.QtCore import pyqtSignal, pyqtSlot, qDebug, qCritical, qFatal, qWarning, Qt, QObject + from PyQt5.QtCore import QAbstractAnimation, QLineF, QPointF, QRectF, QSizeF, QSettings, QTimer + from PyQt5.QtGui import QColor, QLinearGradient, QPen, QPolygonF, QPainter, QPainterPath + from PyQt5.QtGui import QCursor, QFont, QFontMetrics + from PyQt5.QtWidgets import QGraphicsScene, QGraphicsItem, QGraphicsLineItem, QGraphicsPathItem + from PyQt5.QtWidgets import QGraphicsColorizeEffect, QGraphicsDropShadowEffect + from PyQt5.QtWidgets import QInputDialog, QLineEdit, QMenu +else: + from PyQt4.QtCore import pyqtSignal, pyqtSlot, qDebug, qCritical, qFatal, qWarning, Qt, QObject + from PyQt4.QtCore import QAbstractAnimation, QLineF, QPointF, QRectF, QSizeF, QSettings, QTimer + from PyQt4.QtGui import QColor, QLinearGradient, QPen, QPolygonF, QPainter, QPainterPath + from PyQt4.QtGui import QCursor, QFont, QFontMetrics + from PyQt4.QtGui import QGraphicsScene, QGraphicsItem, QGraphicsLineItem, QGraphicsPathItem + from PyQt4.QtGui import QGraphicsColorizeEffect, QGraphicsDropShadowEffect + from PyQt4.QtGui import QInputDialog, QLineEdit, QMenu from PyQt5.QtSvg import QGraphicsSvgItem, QSvgRenderer diff --git a/src/patchcanvas_theme.py b/src/patchcanvas_theme.py index e641587..110e980 100644 --- a/src/patchcanvas_theme.py +++ b/src/patchcanvas_theme.py @@ -19,8 +19,12 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QColor, QFont, QPen, QPixmap +if True: + from PyQt5.QtCore import Qt + from PyQt5.QtGui import QColor, QFont, QPen, QPixmap +else: + from PyQt4.QtCore import Qt + from PyQt4.QtGui import QColor, QFont, QPen, QPixmap # ------------------------------------------------------------------------------------------------------------ # patchcanvas-theme.cpp diff --git a/src/render.py b/src/render.py index 8447843..0f5f8b0 100755 --- a/src/render.py +++ b/src/render.py @@ -19,10 +19,15 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, QProcess, QTime, QTimer, QSettings -from PyQt5.QtWidgets import QDialog from time import sleep +if True: + from PyQt5.QtCore import pyqtSlot, QProcess, QTime, QTimer, QSettings + from PyQt5.QtWidgets import QDialog +else: + from PyQt4.QtCore import pyqtSlot, QProcess, QTime, QTimer, QSettings + from PyQt4.QtGui import QDialog + # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/shared.py b/src/shared.py index e16d8c0..a758736 100644 --- a/src/shared.py +++ b/src/shared.py @@ -23,9 +23,15 @@ import os import sys from codecs import open as codecopen from unicodedata import normalize -from PyQt5.QtCore import pyqtSignal, qWarning -from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QApplication, QFileDialog, QMessageBox + +if True: + from PyQt5.QtCore import pyqtSignal, qWarning + from PyQt5.QtGui import QIcon + from PyQt5.QtWidgets import QApplication, QFileDialog, QMessageBox +else: + from PyQt4.QtCore import pyqtSignal, qWarning + from PyQt4.QtGui import QIcon + from PyQt4.QtGui import QApplication, QFileDialog, QMessageBox # ------------------------------------------------------------------------------------------------------------ # Set Platform diff --git a/src/shared_cadence.py b/src/shared_cadence.py index d232be2..f69abeb 100644 --- a/src/shared_cadence.py +++ b/src/shared_cadence.py @@ -19,9 +19,13 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import QProcess, QSettings from time import sleep +if True: + from PyQt5.QtCore import QProcess, QSettings +else: + from PyQt4.QtCore import QProcess, QSettings + # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/shared_canvasjack.py b/src/shared_canvasjack.py index 76c66b9..1241f3e 100644 --- a/src/shared_canvasjack.py +++ b/src/shared_canvasjack.py @@ -19,9 +19,14 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, QTimer -from PyQt5.QtGui import QCursor, QFontMetrics, QImage, QPainter -from PyQt5.QtWidgets import QMainWindow, QMenu +if True: + from PyQt5.QtCore import pyqtSlot, QTimer + from PyQt5.QtGui import QCursor, QFontMetrics, QImage, QPainter + from PyQt5.QtWidgets import QMainWindow, QMenu +else: + from PyQt4.QtCore import pyqtSlot, QTimer + from PyQt4.QtGui import QCursor, QFontMetrics, QImage, QPainter + from PyQt4.QtGui import QMainWindow, QMenu # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/shared_settings.py b/src/shared_settings.py index 5d4c823..875f042 100644 --- a/src/shared_settings.py +++ b/src/shared_settings.py @@ -19,8 +19,12 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, QSettings -from PyQt5.QtWidgets import QDialog, QDialogButtonBox +if True: + from PyQt5.QtCore import pyqtSlot, QSettings + from PyQt5.QtWidgets import QDialog, QDialogButtonBox +else: + from PyQt4.QtCore import pyqtSlot, QSettings + from PyQt4.QtGui import QDialog, QDialogButtonBox # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/systray.py b/src/systray.py index 5f65923..90f34b5 100755 --- a/src/systray.py +++ b/src/systray.py @@ -18,9 +18,15 @@ # Imports (Global) import os, sys -from PyQt5.QtCore import QTimer -from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QAction, QMainWindow, QMenu, QSystemTrayIcon + +if True: + from PyQt5.QtCore import QTimer + from PyQt5.QtGui import QIcon + from PyQt5.QtWidgets import QAction, QMainWindow, QMenu, QSystemTrayIcon +else: + from PyQt4.QtCore import QTimer + from PyQt4.QtGui import QIcon + from PyQt4.QtGui import QAction, QMainWindow, QMenu, QSystemTrayIcon try: if os.getenv("DESKTOP_SESSION") in ("ubuntu", "ubuntu-2d") and not os.path.exists("/var/cadence/no_app_indicators"):