summarylogtreecommitdiffstats
path: root/0001-Replace_pyqt4_to_pyqt5_as_depends.patch
blob: 0d797b705306678d088758a471119c3709a83039 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 399c5524c76c7bf0662aa56047c4f5b686f8c669 Mon Sep 17 00:00:00 2001
From: axionl <i@axionl.me>
Date: Thu, 27 Dec 2018 23:20:02 +0900
Subject: [PATCH] Replace_pyqt4_to_pyqt5_as_depends.patch

---
 NEMbox/osdlyrics.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/NEMbox/osdlyrics.py b/NEMbox/osdlyrics.py
index ca15941..6a51996 100644
--- a/NEMbox/osdlyrics.py
+++ b/NEMbox/osdlyrics.py
@@ -17,24 +17,25 @@ log = logger.getLogger(__name__)
 config = Config()
 
 try:
-    from PyQt4 import QtGui, QtCore, QtDBus
+    from PyQt5 import QtGui, QtWidgets, QtCore, QtDBus
 
     pyqt_activity = True
 except ImportError:
     pyqt_activity = False
-    log.warn("PyQt4 module not installed.")
+    log.warn("PyQt5 module not installed.")
     log.warn("Osdlyrics Not Available.")
 
 if pyqt_activity:
 
-    class Lyrics(QtGui.QWidget):
+    class Lyrics(QtWidgets.QWidget):
         def __init__(self):
             super(Lyrics, self).__init__()
             self.__dbusAdaptor = LyricsAdapter(self)
             self.initUI()
 
         def initUI(self):
-            self.setStyleSheet("background:" + config.get("osdlyrics_background"))
+            self.setStyleSheet(
+                "background:" + config.get("osdlyrics_background"))
             if config.get("osdlyrics_transparent"):
                 self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
             self.setAttribute(QtCore.Qt.WA_ShowWithoutActivating)
@@ -51,11 +52,10 @@ if pyqt_activity:
             self.setMinimumSize(600, 50)
             osdlyrics_size = config.get("osdlyrics_size")
             self.resize(osdlyrics_size[0], osdlyrics_size[1])
-            scn = QtGui.QApplication.desktop().screenNumber(
-                QtGui.QApplication.desktop().cursor().pos()
-            )
-            bl = QtGui.QApplication.desktop().screenGeometry(scn).bottomLeft()
-            br = QtGui.QApplication.desktop().screenGeometry(scn).bottomRight()
+            scn = QtWidgets.QApplication.desktop().screenNumber(
+                QtWidgets.QApplication.desktop().cursor().pos())
+            bl = QtWidgets.QApplication.desktop().screenGeometry(scn).bottomLeft()
+            br = QtWidgets.QApplication.desktop().screenGeometry(scn).bottomRight()
             bc = (bl + br) / 2
             frameGeo = self.frameGeometry()
             frameGeo.moveCenter(bc)
@@ -117,7 +117,7 @@ if pyqt_activity:
 
     def show_lyrics():
 
-        app = QtGui.QApplication(sys.argv)
+        app = QtWidgets.QApplication(sys.argv)
         lyrics = Lyrics()
         QtDBus.QDBusConnection.sessionBus().registerService("org.musicbox.Bus")
         QtDBus.QDBusConnection.sessionBus().registerObject("/", lyrics)
-- 
2.20.1