Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Add device serial ids when execution of scrcpy and other adb processes"
Browse files Browse the repository at this point in the history
  • Loading branch information
srevinsaju committed Apr 12, 2020
1 parent d49f8a9 commit d3d43c5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
15 changes: 8 additions & 7 deletions guiscrcpy/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
10 changes: 5 additions & 5 deletions guiscrcpy/lib/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
7 changes: 5 additions & 2 deletions guiscrcpy/ux/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@

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)
self.oldpos = self.pos()
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)
Expand Down
9 changes: 7 additions & 2 deletions guiscrcpy/ux/swipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
7 changes: 5 additions & 2 deletions guiscrcpy/ux/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit d3d43c5

Please sign in to comment.