|
@ -392,16 +392,20 @@ class SettingsDialog(WindowModalDialog): |
|
|
def change_homescreen(): |
|
|
def change_homescreen(): |
|
|
dialog = QFileDialog(self, _("Choose Homescreen")) |
|
|
dialog = QFileDialog(self, _("Choose Homescreen")) |
|
|
filename, __ = dialog.getOpenFileName() |
|
|
filename, __ = dialog.getOpenFileName() |
|
|
|
|
|
if not filename: |
|
|
|
|
|
return # user cancelled |
|
|
|
|
|
|
|
|
if filename.endswith('.toif'): |
|
|
if filename.endswith('.toif'): |
|
|
img = open(filename, 'rb').read() |
|
|
img = open(filename, 'rb').read() |
|
|
if img[:8] != b'TOIf\x90\x00\x90\x00': |
|
|
if img[:8] != b'TOIf\x90\x00\x90\x00': |
|
|
raise Exception('File is not a TOIF file with size of 144x144') |
|
|
handler.show_error('File is not a TOIF file with size of 144x144') |
|
|
|
|
|
return |
|
|
else: |
|
|
else: |
|
|
from PIL import Image # FIXME |
|
|
from PIL import Image # FIXME |
|
|
im = Image.open(filename) |
|
|
im = Image.open(filename) |
|
|
if im.size != (128, 64): |
|
|
if im.size != (128, 64): |
|
|
raise Exception('Image must be 128 x 64 pixels') |
|
|
handler.show_error('Image must be 128 x 64 pixels') |
|
|
|
|
|
return |
|
|
im = im.convert('1') |
|
|
im = im.convert('1') |
|
|
pix = im.load() |
|
|
pix = im.load() |
|
|
img = bytearray(1024) |
|
|
img = bytearray(1024) |
|
@ -509,8 +513,6 @@ class SettingsDialog(WindowModalDialog): |
|
|
settings_glayout.addWidget(pin_msg, 3, 1, 1, -1) |
|
|
settings_glayout.addWidget(pin_msg, 3, 1, 1, -1) |
|
|
|
|
|
|
|
|
# Settings tab - Homescreen |
|
|
# Settings tab - Homescreen |
|
|
if plugin.device != 'KeepKey': # Not yet supported by KK firmware |
|
|
|
|
|
homescreen_layout = QHBoxLayout() |
|
|
|
|
|
homescreen_label = QLabel(_("Homescreen")) |
|
|
homescreen_label = QLabel(_("Homescreen")) |
|
|
homescreen_change_button = QPushButton(_("Change...")) |
|
|
homescreen_change_button = QPushButton(_("Change...")) |
|
|
homescreen_clear_button = QPushButton(_("Reset")) |
|
|
homescreen_clear_button = QPushButton(_("Reset")) |
|
|