19
19
# You should have received a copy of the GNU General Public License
20
20
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
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
26
26
from core .buffer import Buffer
27
27
from core .utils import get_free_port , get_local_ip , message_to_emacs
28
28
import http .server as BaseHTTPServer
@@ -64,8 +64,8 @@ def __init__(self, border, width, box_size):
64
64
self .width = width
65
65
self .box_size = box_size
66
66
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 )
69
69
70
70
def pixmap (self ):
71
71
return QtGui .QPixmap .fromImage (self ._image )
@@ -76,7 +76,7 @@ def drawrect(self, row, col):
76
76
(col + self .border ) * self .box_size ,
77
77
(row + self .border ) * self .box_size ,
78
78
self .box_size , self .box_size ,
79
- QtCore .Qt .black )
79
+ QtCore .Qt .GlobalColor . black )
80
80
81
81
def save (self , stream , kind = None ):
82
82
pass
@@ -89,32 +89,32 @@ def __init__(self, url, foreground_color):
89
89
file_path = os .path .expanduser (url )
90
90
91
91
self .file_name_font = QFont ()
92
- self .file_name_font .setPointSize (24 )
92
+ self .file_name_font .setPointSize (48 )
93
93
94
94
self .file_name_label = QLabel (self )
95
95
self .file_name_label .setText (file_path )
96
96
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 )
98
98
self .file_name_label .setStyleSheet ("color: {}" .format (foreground_color ))
99
99
100
100
self .qrcode_label = QLabel (self )
101
101
102
102
self .notify_font = QFont ()
103
- self .notify_font .setPointSize (12 )
103
+ self .notify_font .setPointSize (24 )
104
104
self .notify_label = QLabel (self )
105
105
self .notify_label .setText ("Scan QR code above to download this file on your smartphone.\n Make sure the smartphone is connected to the same WiFi network as this computer." )
106
106
self .notify_label .setFont (self .notify_font )
107
- self .notify_label .setAlignment (Qt .AlignCenter )
107
+ self .notify_label .setAlignment (Qt .AlignmentFlag . AlignCenter )
108
108
self .notify_label .setStyleSheet ("color: {}" .format (foreground_color ))
109
109
110
110
layout = QVBoxLayout (self )
111
111
layout .setContentsMargins (0 , 0 , 0 , 0 )
112
112
layout .addStretch ()
113
- layout .addWidget (self .qrcode_label , 0 , Qt .AlignCenter )
113
+ layout .addWidget (self .qrcode_label , 0 , Qt .AlignmentFlag . AlignCenter )
114
114
layout .addSpacing (20 )
115
- layout .addWidget (self .file_name_label , 0 , Qt .AlignCenter )
115
+ layout .addWidget (self .file_name_label , 0 , Qt .AlignmentFlag . AlignCenter )
116
116
layout .addSpacing (40 )
117
- layout .addWidget (self .notify_label , 0 , Qt .AlignCenter )
117
+ layout .addWidget (self .notify_label , 0 , Qt .AlignmentFlag . AlignCenter )
118
118
layout .addStretch ()
119
119
120
120
self .start_server (file_path )
0 commit comments