diff --git a/guiscrcpy/lib/toolkit.py b/guiscrcpy/lib/toolkit.py
index 93a4fe3d..732edd2c 100644
--- a/guiscrcpy/lib/toolkit.py
+++ b/guiscrcpy/lib/toolkit.py
@@ -31,7 +31,8 @@
import pyautogui as auto
from pygetwindow import getWindowsWithTitle
except ModuleNotFoundError as e:
- logging.debug("pygetwindow, pyautogui " "failed with error code {}".format(e))
+ logging.debug("pygetwindow, pyautogui "
+ "failed with error code {}".format(e))
auto = None
getWindowsWithTitle = None
else:
@@ -45,29 +46,26 @@ def wmctrl_xdotool_linux_send_key(key):
wmctrl = shutil.which("wmctrl")
xdotool = shutil.which("xdotool")
if not wmctrl or not xdotool:
- print(
- "E: Could not find {} on PATH. Make sure "
- "that a compatible package is installed "
- "on your system for this function"
- )
+ print("E: Could not find {} on PATH. Make sure "
+ "that a compatible package is installed "
+ "on your system for this function")
return
- _proc = subprocess.Popen(
- shlex.split("wmctrl -x -a scrcpy"), stdout=sys.stdout, stderr=sys.stderr
- )
+ _proc = subprocess.Popen(shlex.split("wmctrl -x -a scrcpy"),
+ stdout=sys.stdout,
+ stderr=sys.stderr)
if _proc.wait() == 0:
_xdotool_proc = subprocess.Popen(
- shlex.split(
- "xdotool key --clearmodifiers {}+{}".format(
- os.getenv("GUISCRCPY_MODIFIER") or "alt", key
- )
- ),
+ shlex.split("xdotool key --clearmodifiers {}+{}".format(
+ os.getenv("GUISCRCPY_MODIFIER") or "alt", key)),
stdout=sys.stdout,
stderr=sys.stderr,
)
if _xdotool_proc.wait() != 0:
- print("E (xdotool): Failed to send key {} to " "scrcpy window.".format(key))
+ print("E (xdotool): Failed to send key {} to "
+ "scrcpy window.".format(key))
else:
- print("E (wmctrl): Failed to get scrcpy window. " "(Is scrcpy running?)")
+ print("E (wmctrl): Failed to get scrcpy window. "
+ "(Is scrcpy running?)")
class UXMapper:
@@ -85,14 +83,12 @@ def __init__(self, adb, device_id=None, sha_shift=5):
logging.debug("Calculating Screen Size")
self.android_dimensions = adb.get_dimensions(device_id=device_id)
if not self.android_dimensions:
- print(
- "E: guiscrcpy has crashed because of a failure in the "
- "execution of `adb shell wm size`. This might be because "
- "of an improper connection of adb. Please reconnect your "
- "device (disconnect from WiFi / Reconnect USB) or try \n\n"
- "guiscrcpy --killserver\n\nas a command line to restart adb "
- "server"
- )
+ print("E: guiscrcpy has crashed because of a failure in the "
+ "execution of `adb shell wm size`. This might be because "
+ "of an improper connection of adb. Please reconnect your "
+ "device (disconnect from WiFi / Reconnect USB) or try \n\n"
+ "guiscrcpy --killserver\n\nas a command line to restart adb "
+ "server")
self.deviceId = device_id
# each device connected is uniquely identified by the tools by
@@ -105,7 +101,7 @@ def get_sha(self):
A method which returns the unique UUID of the the device
:return: The hexdigest of a salted hash
"""
- return self.__sha[self.sha_shift : self.sha_shift + 6]
+ return self.__sha[self.sha_shift:self.sha_shift + 6]
def do_swipe(self, x1=10, y1=10, x2=10, y2=10):
"""
@@ -116,9 +112,8 @@ def do_swipe(self, x1=10, y1=10, x2=10, y2=10):
:param y2: y2 coordinate
:return: Boolean True, in success
"""
- self.adb.shell_input(
- "swipe {} {} {} {}".format(x1, y1, x2, y2), device_id=self.deviceId
- )
+ self.adb.shell_input("swipe {} {} {} {}".format(x1, y1, x2, y2),
+ device_id=self.deviceId)
return True
def do_keyevent(self, key):
@@ -127,7 +122,8 @@ def do_keyevent(self, key):
:param key: The ADB predefined keycode
:return:
"""
- self.adb.shell_input("keyevent {}".format(key), device_id=self.deviceId)
+ self.adb.shell_input("keyevent {}".format(key),
+ device_id=self.deviceId)
return True
def copy_devpc(self):
@@ -168,17 +164,17 @@ def key_switch(self):
def reorient_portrait(self):
logging.debug("Passing REORIENT [POTRAIT]")
- self.adb.shell(
- "settings put system accelerometer_rotation 0", device_id=self.deviceId
- )
- self.adb.shell("settings put system rotation 1", device_id=self.deviceId)
+ self.adb.shell("settings put system accelerometer_rotation 0",
+ device_id=self.deviceId)
+ self.adb.shell("settings put system rotation 1",
+ device_id=self.deviceId)
def reorient_landscape(self):
logging.debug("Passing REORIENT [LANDSCAPE]")
- self.adb.shell(
- "settings put system accelerometer_rotation 0", device_id=self.deviceId
- )
- self.adb.shell("settings put system rotation 1", device_id=self.deviceId)
+ self.adb.shell("settings put system accelerometer_rotation 0",
+ device_id=self.deviceId)
+ self.adb.shell("settings put system rotation 1",
+ device_id=self.deviceId)
def expand_notifications(self):
logging.debug("Passing NOTIF EXPAND")
diff --git a/guiscrcpy/ux/toolkit.py b/guiscrcpy/ux/toolkit.py
index c352c5db..24b3ffcd 100644
--- a/guiscrcpy/ux/toolkit.py
+++ b/guiscrcpy/ux/toolkit.py
@@ -29,7 +29,11 @@
class InterfaceToolkit(QMainWindow, Ui_ToolbarPanel):
- def __init__(self, ux_mapper=None, parent=None, frame=False, always_on_top=True):
+ def __init__(self,
+ ux_mapper=None,
+ parent=None,
+ frame=False,
+ always_on_top=True):
"""
Side panel toolkit for guiscrcpy main window
:param ux_mapper:
@@ -57,11 +61,9 @@ def __init__(self, ux_mapper=None, parent=None, frame=False, always_on_top=True)
self.ux = UXMapper()
def init(self):
- if platform.system() != "Linux" or (
- shutil.which("wmctrl")
- and shutil.which("xdotool")
- and platform.system() == "Linux"
- ):
+ if platform.system() != "Linux" or (shutil.which("wmctrl")
+ and shutil.which("xdotool")
+ and platform.system() == "Linux"):
self.clipD2PC.clicked.connect(self.ux.copy_devpc)
self.clipPC2D.clicked.connect(self.ux.copy_pc2dev)
self.fullscreenUI.clicked.connect(self.ux.fullscreen)
@@ -77,8 +79,7 @@ def init(self):
'This function is disabled because "wmctrl"'
' or "xdotool" is not found on your installation.'
"Keyboard shortcut can be used instead"
- ": {}".format(helper)
- )
+ ": {}".format(helper))
self.back.clicked.connect(self.ux.key_back)
self.screenfreeze.clicked.connect(self.quit_window)
@@ -118,18 +119,13 @@ def quit_window(self):
# This method checks if we are the last member of the windows
# spawned and we ourselves are not a member of ourself by
# checking the uuid generated on creation
- if (
- not instance.isHidden()
- and instance.name != "swipe"
- and instance.uid != self.uid
- ):
+ if (not instance.isHidden() and instance.name != "swipe"
+ and instance.uid != self.uid):
self.hide()
break
else:
for instance in self.parent.child_windows: # noqa
- if (
- instance.name == "swipe"
- and instance.ux.get_sha() == self.ux.get_sha()
- ):
+ if (instance.name == "swipe"
+ and instance.ux.get_sha() == self.ux.get_sha()):
instance.hide()
self.hide()
diff --git a/setup.py b/setup.py
index ed6eb55d..9077fb7c 100755
--- a/setup.py
+++ b/setup.py
@@ -27,7 +27,8 @@
try:
this_directory = os.path.abspath(os.path.dirname(__file__))
- with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
+ with open(os.path.join(this_directory, "README.md"),
+ encoding="utf-8") as f:
long_description = f.read()
except FileNotFoundError:
long_description = "Open Source Android Screen Mirroring System by @srevinsaju"
@@ -54,13 +55,17 @@
author_email="srevin03@gmail.com",
packages=find_packages(),
data_files=data_files,
- extras_require={"pyqt5": "PyQt5", "pyside2": "PySide2"},
+ extras_require={
+ "pyqt5": "PyQt5",
+ "pyside2": "PySide2"
+ },
url="https://srevinsaju.github.io/guiscrcpy",
download_url="https://github.com/srevinsaju/guiscrcpy/archive/master.zip",
include_package_data=True,
install_requires=requirements,
scripts=["scripts/guiscrcpy"],
- entry_points={"console_scripts": ["guiscrcpy = guiscrcpy.cli:cli"]}, # noqa: E501
+ entry_points={"console_scripts":
+ ["guiscrcpy = guiscrcpy.cli:cli"]}, # noqa: E501
classifiers=[
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.7",