diff --git a/buffer.py b/buffer.py index 56fbd63..ed6fb9c 100644 --- a/buffer.py +++ b/buffer.py @@ -19,10 +19,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from PyQt5 import QtGui, QtCore -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QColor, QFont -from PyQt5.QtWidgets import QWidget, QLabel, QVBoxLayout +from PyQt6 import QtGui, QtCore +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QColor, QFont +from PyQt6.QtWidgets import QWidget, QLabel, QVBoxLayout from core.buffer import Buffer from core.utils import get_free_port, get_local_ip, message_to_emacs import http.server as BaseHTTPServer @@ -64,8 +64,8 @@ def __init__(self, border, width, box_size): self.width = width self.box_size = box_size size = (width + border * 2) * box_size - self._image = QtGui.QImage(size, size, QtGui.QImage.Format_RGB16) - self._image.fill(QtCore.Qt.white) + self._image = QtGui.QImage(size, size, QtGui.QImage.Format.Format_RGB16) + self._image.fill(QtCore.Qt.GlobalColor.white) def pixmap(self): return QtGui.QPixmap.fromImage(self._image) @@ -76,7 +76,7 @@ def drawrect(self, row, col): (col + self.border) * self.box_size, (row + self.border) * self.box_size, self.box_size, self.box_size, - QtCore.Qt.black) + QtCore.Qt.GlobalColor.black) def save(self, stream, kind=None): pass @@ -89,32 +89,32 @@ def __init__(self, url, foreground_color): file_path = os.path.expanduser(url) self.file_name_font = QFont() - self.file_name_font.setPointSize(24) + self.file_name_font.setPointSize(48) self.file_name_label = QLabel(self) self.file_name_label.setText(file_path) self.file_name_label.setFont(self.file_name_font) - self.file_name_label.setAlignment(Qt.AlignCenter) + self.file_name_label.setAlignment(Qt.AlignmentFlag.AlignCenter) self.file_name_label.setStyleSheet("color: {}".format(foreground_color)) self.qrcode_label = QLabel(self) self.notify_font = QFont() - self.notify_font.setPointSize(12) + self.notify_font.setPointSize(24) self.notify_label = QLabel(self) self.notify_label.setText("Scan QR code above to download this file on your smartphone.\nMake sure the smartphone is connected to the same WiFi network as this computer.") self.notify_label.setFont(self.notify_font) - self.notify_label.setAlignment(Qt.AlignCenter) + self.notify_label.setAlignment(Qt.AlignmentFlag.AlignCenter) self.notify_label.setStyleSheet("color: {}".format(foreground_color)) layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addStretch() - layout.addWidget(self.qrcode_label, 0, Qt.AlignCenter) + layout.addWidget(self.qrcode_label, 0, Qt.AlignmentFlag.AlignCenter) layout.addSpacing(20) - layout.addWidget(self.file_name_label, 0, Qt.AlignCenter) + layout.addWidget(self.file_name_label, 0, Qt.AlignmentFlag.AlignCenter) layout.addSpacing(40) - layout.addWidget(self.notify_label, 0, Qt.AlignCenter) + layout.addWidget(self.notify_label, 0, Qt.AlignmentFlag.AlignCenter) layout.addStretch() self.start_server(file_path)