Skip to content

Commit 6bc29a2

Browse files
Port to PyQt6
1 parent 0605604 commit 6bc29a2

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.buffer import Buffer
2727
from core.utils import get_free_port, get_local_ip, message_to_emacs
2828
import http.server as BaseHTTPServer
@@ -64,8 +64,8 @@ def __init__(self, border, width, box_size):
6464
self.width = width
6565
self.box_size = box_size
6666
size = (width + border * 2) * box_size
67-
self._image = QtGui.QImage(size, size, QtGui.QImage.Format_RGB16)
68-
self._image.fill(QtCore.Qt.white)
67+
self._image = QtGui.QImage(size, size, QtGui.QImage.Format.Format_RGB16)
68+
self._image.fill(QtCore.Qt.GlobalColor.white)
6969

7070
def pixmap(self):
7171
return QtGui.QPixmap.fromImage(self._image)
@@ -76,7 +76,7 @@ def drawrect(self, row, col):
7676
(col + self.border) * self.box_size,
7777
(row + self.border) * self.box_size,
7878
self.box_size, self.box_size,
79-
QtCore.Qt.black)
79+
QtCore.Qt.GlobalColor.black)
8080

8181
def save(self, stream, kind=None):
8282
pass
@@ -89,32 +89,32 @@ def __init__(self, url, foreground_color):
8989
file_path = os.path.expanduser(url)
9090

9191
self.file_name_font = QFont()
92-
self.file_name_font.setPointSize(24)
92+
self.file_name_font.setPointSize(48)
9393

9494
self.file_name_label = QLabel(self)
9595
self.file_name_label.setText(file_path)
9696
self.file_name_label.setFont(self.file_name_font)
97-
self.file_name_label.setAlignment(Qt.AlignCenter)
97+
self.file_name_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
9898
self.file_name_label.setStyleSheet("color: {}".format(foreground_color))
9999

100100
self.qrcode_label = QLabel(self)
101101

102102
self.notify_font = QFont()
103-
self.notify_font.setPointSize(12)
103+
self.notify_font.setPointSize(24)
104104
self.notify_label = QLabel(self)
105105
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.")
106106
self.notify_label.setFont(self.notify_font)
107-
self.notify_label.setAlignment(Qt.AlignCenter)
107+
self.notify_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
108108
self.notify_label.setStyleSheet("color: {}".format(foreground_color))
109109

110110
layout = QVBoxLayout(self)
111111
layout.setContentsMargins(0, 0, 0, 0)
112112
layout.addStretch()
113-
layout.addWidget(self.qrcode_label, 0, Qt.AlignCenter)
113+
layout.addWidget(self.qrcode_label, 0, Qt.AlignmentFlag.AlignCenter)
114114
layout.addSpacing(20)
115-
layout.addWidget(self.file_name_label, 0, Qt.AlignCenter)
115+
layout.addWidget(self.file_name_label, 0, Qt.AlignmentFlag.AlignCenter)
116116
layout.addSpacing(40)
117-
layout.addWidget(self.notify_label, 0, Qt.AlignCenter)
117+
layout.addWidget(self.notify_label, 0, Qt.AlignmentFlag.AlignCenter)
118118
layout.addStretch()
119119

120120
self.start_server(file_path)

0 commit comments

Comments
 (0)