diff --git a/guiscrcpy/launcher.py b/guiscrcpy/launcher.py index 21487b72..92bef816 100644 --- a/guiscrcpy/launcher.py +++ b/guiscrcpy/launcher.py @@ -426,16 +426,17 @@ def start_act(self): logging.debug("CONNECTION ESTABLISHED") self.progressBar.setValue(50) logging.debug("Flags passed to scrcpy engine : " + self.options) - self.progressBar.setValue(75) + self.progressBar.setValue(60) config['extra'] = self.flaglineedit.text() - ux = UXMapper() # show subwindows - swipe_instance = SwipeUX() # Load swipe UI - panel_instance = Panel() - side_instance = InterfaceToolkit() - dimValues = adb.get_dimensions(adb.path) - + ux = UXMapper(device_id=device_id) + swipe_instance = SwipeUX(ux_wrapper=ux) # Load swipe UI + panel_instance = Panel(ux_mapper=ux) + side_instance = InterfaceToolkit(ux_mapper=ux) + dimValues = adb.get_dimensions(adb.path, device_id=device_id) + self.progressBar.setValue(70) + for instance in (swipe_instance, panel_instance, side_instance): instance.init() diff --git a/guiscrcpy/lib/toolkit.py b/guiscrcpy/lib/toolkit.py index 55903296..dd12c59d 100644 --- a/guiscrcpy/lib/toolkit.py +++ b/guiscrcpy/lib/toolkit.py @@ -87,13 +87,13 @@ def key_switch(self): def reorientP(self): logging.debug("Passing REORIENT [POTRAIT]") - adb.shell(adb.path, 'settings put system accelerometer_rotation 0') - adb.shell(adb.path, "settings put system rotation 1") + adb.shell(adb.path, 'settings put system accelerometer_rotation 0', device_id=self.deviceId) + adb.shell(adb.path, "settings put system rotation 1", device_id=self.deviceId) def reorientL(self): logging.debug("Passing REORIENT [LANDSCAPE]") - adb.shell(adb.path, 'settings put system accelerometer_rotation 0') - adb.shell(adb.path, "settings put system rotation 1") + adb.shell(adb.path, 'settings put system accelerometer_rotation 0', device_id=self.deviceId) + adb.shell(adb.path, "settings put system rotation 1", device_id=self.deviceId) def expand_notifications(self): logging.debug("Passing NOTIF EXPAND") @@ -108,7 +108,7 @@ def copy_pc2dev(self): scrcpywindow = getWindowsWithTitle("scrcpy")[0] scrcpywindow.focus() auto.hotkey("ctrl", "shift", "c") - logging.warning(" NOT SUPPORTED ON WINDOWS") + logging.warning("NOT SUPPORTED ON WINDOWS") else: os.system( "wmctrl -x -a scrcpy && xdotool key --clearmodifiers ctrl+shift+c") diff --git a/guiscrcpy/ux/panel.py b/guiscrcpy/ux/panel.py index f51cc373..7ca79d40 100644 --- a/guiscrcpy/ux/panel.py +++ b/guiscrcpy/ux/panel.py @@ -27,7 +27,7 @@ class Panel(QMainWindow, Ui_HorizontalPanel): # there was a Dialog in the bracket - def __init__(self): + def __init__(self, ux_mapper=None): QMainWindow.__init__(self) Ui_HorizontalPanel.__init__(self) self.setupUi(self) @@ -35,9 +35,12 @@ def __init__(self): self.setWindowFlags( QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint ) + if ux_mapper: + self.ux = ux_mapper + else: + self.ux = UXMapper() def init(self): - self.ux = UXMapper() self.backk.clicked.connect(self.ux.key_back) self.menuUII.clicked.connect(self.ux.key_menu) self.homee.clicked.connect(self.ux.key_home) diff --git a/guiscrcpy/ux/swipe.py b/guiscrcpy/ux/swipe.py index 03b01fa4..895c31b6 100644 --- a/guiscrcpy/ux/swipe.py +++ b/guiscrcpy/ux/swipe.py @@ -28,7 +28,7 @@ class SwipeUX(QMainWindow): - def __init__(self): + def __init__(self, ux_wrapper=None): QMainWindow.__init__(self) super(SwipeUX, self).__init__() self.oldPos = None @@ -124,8 +124,13 @@ def __init__(self): self.swilf.pressed.connect(self.swipleft) self.swirt.pressed.connect(self.swipright) + # ================= + if ux_wrapper: + self.ux = ux_wrapper + else: + self.ux = UXMapper() + def init(self): - self.ux = UXMapper() self.show() def paintEvent(self, event): diff --git a/guiscrcpy/ux/toolkit.py b/guiscrcpy/ux/toolkit.py index 93bceca7..e00c7ece 100644 --- a/guiscrcpy/ux/toolkit.py +++ b/guiscrcpy/ux/toolkit.py @@ -28,7 +28,7 @@ class InterfaceToolkit(QMainWindow, Ui_ToolbarPanel): - def __init__(self): + def __init__(self, ux_mapper=None): QMainWindow.__init__(self) Ui_ToolbarPanel.__init__(self) self.setupUi(self) @@ -37,9 +37,12 @@ def __init__(self): self.setWindowFlags( QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint ) + if ux_mapper: + self.ux = ux_mapper + else: + self.ux = UXMapper() def init(self): - self.ux = UXMapper() self.clipD2PC.clicked.connect(self.ux.copy_devpc) self.clipPC2D.clicked.connect(self.ux.copy_pc2dev) self.back.clicked.connect(self.ux.key_back)