Skip to content

Commit e3860cd

Browse files
Port to PyQt6
1 parent 48f497e commit e3860cd

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

buffer.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
# You should have received a copy of the GNU General Public License
2020
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121

22-
from PyQt5 import QtGui, QtCore
23-
from PyQt5.QtCore import Qt
24-
from PyQt5.QtGui import QColor, QFont
25-
from PyQt5.QtWidgets import QWidget, QLabel, QVBoxLayout
22+
from PyQt6 import QtGui, QtCore
23+
from PyQt6.QtCore import Qt
24+
from PyQt6.QtGui import QColor, QFont
25+
from PyQt6.QtWidgets import QWidget, QLabel, QVBoxLayout
2626
from core.utils import get_local_ip, get_free_port, message_to_emacs
2727
import subprocess
2828
import os
@@ -52,8 +52,8 @@ def __init__(self, border, width, box_size):
5252
self.width = width
5353
self.box_size = box_size
5454
size = (width + border * 2) * box_size
55-
self._image = QtGui.QImage(size, size, QtGui.QImage.Format_RGB16)
56-
self._image.fill(QtCore.Qt.white)
55+
self._image = QtGui.QImage(size, size, QtGui.QImage.Format.Format_RGB16)
56+
self._image.fill(QtCore.Qt.GlobalColor.white)
5757

5858
def pixmap(self):
5959
return QtGui.QPixmap.fromImage(self._image)
@@ -64,7 +64,7 @@ def drawrect(self, row, col):
6464
(col + self.border) * self.box_size,
6565
(row + self.border) * self.box_size,
6666
self.box_size, self.box_size,
67-
QtCore.Qt.black)
67+
QtCore.Qt.GlobalColor.black)
6868

6969
def save(self, stream, kind=None):
7070
pass
@@ -78,32 +78,32 @@ def __init__(self, url, background_color, foreground_color):
7878
self.url = os.path.expanduser(url)
7979

8080
self.file_name_font = QFont()
81-
self.file_name_font.setPointSize(24)
81+
self.file_name_font.setPointSize(48)
8282

8383
self.file_name_label = QLabel()
8484
self.file_name_label.setText("Your smartphone file will be shared at\n{0}".format(url))
8585
self.file_name_label.setFont(self.file_name_font)
86-
self.file_name_label.setAlignment(Qt.AlignCenter)
86+
self.file_name_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
8787
self.file_name_label.setStyleSheet("color: {}".format(foreground_color))
8888

8989
self.qrcode_label = QLabel()
9090

9191
self.notify_font = QFont()
92-
self.notify_font.setPointSize(12)
92+
self.notify_font.setPointSize(24)
9393
self.notify_label = QLabel()
9494
self.notify_label.setText("Scan the QR code above to upload a file from your smartphone.\nMake sure the smartphone is connected to the same WiFi network as this computer.")
9595
self.notify_label.setFont(self.notify_font)
96-
self.notify_label.setAlignment(Qt.AlignCenter)
96+
self.notify_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
9797
self.notify_label.setStyleSheet("color: {}".format(foreground_color))
9898

9999
layout = QVBoxLayout(self)
100100
layout.setContentsMargins(0, 0, 0, 0)
101101
layout.addStretch()
102-
layout.addWidget(self.qrcode_label, 0, Qt.AlignCenter)
102+
layout.addWidget(self.qrcode_label, 0, Qt.AlignmentFlag.AlignCenter)
103103
layout.addSpacing(20)
104-
layout.addWidget(self.file_name_label, 0, Qt.AlignCenter)
104+
layout.addWidget(self.file_name_label, 0, Qt.AlignmentFlag.AlignCenter)
105105
layout.addSpacing(40)
106-
layout.addWidget(self.notify_label, 0, Qt.AlignCenter)
106+
layout.addWidget(self.notify_label, 0, Qt.AlignmentFlag.AlignCenter)
107107
layout.addStretch()
108108

109109
self.port = get_free_port()

0 commit comments

Comments
 (0)