Skip to content

Commit

Permalink
Merge pull request #409 from LedgerHQ/lp/fix
Browse files Browse the repository at this point in the history
Fix faulty `QtScreenNotifier` instantiation
  • Loading branch information
lpascal-ledger authored Jul 21, 2023
2 parents 6a61aea + 67ff414 commit 1af74ce
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions speculos/mcu/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ def _redraw(self, qp):

self.update_screenshot()

def update_public_screenshot(self):
return self.fb.update_public_screenshot()

def get_public_screenshot(self):
return self.fb.get_public_screenshot()


class App(QMainWindow):
def __init__(self, qt_app: QApplication, display: DisplayArgs, server: ServerArgs) -> None:
Expand Down Expand Up @@ -198,14 +192,14 @@ def closeEvent(self, event: QEvent):


class Screen(Display):
def __init__(self, app: App, display: DisplayArgs, server: ServerArgs) -> None:
def __init__(self, display: DisplayArgs, server: ServerArgs) -> None:
super().__init__(display, server)
self.app: App
self.m = self.app.widget
self._gl: GraphicLibrary

def set_app(self, app: App) -> None:
self.app = app
self.app.set_screen(self)
model = self._display_args.model
if model != "stax":
self._gl = bagl.Bagl(app.widget, MODELS[model].screen_size, model)
Expand All @@ -215,6 +209,10 @@ def set_app(self, app: App) -> None:
model,
self._display_args.force_full_ocr)

@property
def m(self) -> QWidget:
return self.app.widget

@property
def gl(self):
return self._gl
Expand Down Expand Up @@ -250,9 +248,9 @@ def screen_update(self) -> bool:

class QtScreenNotifier(DisplayNotifier):
def __init__(self, display_args: DisplayArgs, server_args: ServerArgs) -> None:
self._qapp = QApplication([])
super().__init__(display_args, server_args)
self._set_display_class(Screen)
self._qapp = QApplication([])
self._app_widget = App(self._qapp, display_args, server_args)
assert isinstance(self.display, Screen)
self.display.set_app(self._app_widget)
Expand Down

0 comments on commit 1af74ce

Please sign in to comment.