diff --git a/guiscrcpy/launcher.py b/guiscrcpy/launcher.py index df1f0fee..0b9c895f 100644 --- a/guiscrcpy/launcher.py +++ b/guiscrcpy/launcher.py @@ -336,25 +336,31 @@ def refresh_devices_combo(self): invalid_devices = [] for dev, stat in devices_list: if stat == "unauthorized": - invalid_devices.append(f"{dev} IS UNAUTHORIZED. CLICK 'ok' when asked.") + invalid_devices.append( + f"{dev} IS UNAUTHORIZED. CLICK 'ok' when asked.") elif stat == "device": valid_devices.append(dev) else: - invalid_devices.append(f"{dev} is connected. Failed to establish connection") + invalid_devices.append( + f"{dev} is connected. Failed to establish connection") self.runningNot.setText( "Connected: {};".format(', '.join(valid_devices)) ) if len(valid_devices) > 1: if self.devices_combox.currentText() == '' or self.devices_combox.currentText().isspace(): - logging.info("Found more than one device. Please select device in drop down box") - self.runningNot.setText("Found more than one device. Please select device in drop down box") + logging.info( + "Found more than one device. Please select device in drop down box") + self.runningNot.setText( + "Found more than one device. Please select device in drop down box") self.devices_combox.clear() - self.devices_combox.addItems([f"{x[0]} : {x[1]}" for x in devices_list]) + self.devices_combox.addItems( + [f"{x[0]} : {x[1]}" for x in devices_list]) return 0, else: more_devices = True - device_id = self.devices_combox.currentText().split(":")[0].strip() + device_id = self.devices_combox.currentText().split(":")[ + 0].strip() else: more_devices = False device_id = None @@ -444,7 +450,7 @@ def start_act(self): dimValues = adb.get_dimensions(adb.path, device_id=device_id) self.progressBar.setValue(70) - + swipe_instance.init() panel_instance.init() side_instance.init() diff --git a/guiscrcpy/lib/check.py b/guiscrcpy/lib/check.py index 3b4da226..7effde12 100644 --- a/guiscrcpy/lib/check.py +++ b/guiscrcpy/lib/check.py @@ -90,9 +90,11 @@ def shell_input(path, command, device_id=None): @staticmethod def get_dimensions(path, device_id=None): if device_id: - shellx = Popen(_("{} -s {} shell wm size".format(path, device_id)), stdout=PIPE, stderr=PIPE) + shellx = Popen( + _("{} -s {} shell wm size".format(path, device_id)), stdout=PIPE, stderr=PIPE) else: - shellx = Popen(_("{} shell wm size".format(path)), stdout=PIPE, stderr=PIPE) + shellx = Popen(_("{} shell wm size".format(path)), + stdout=PIPE, stderr=PIPE) raw_dimensions = shellx.stdout.read().decode().strip('\n') for i in ['Override size', 'Physical size']: if i in raw_dimensions: @@ -109,17 +111,21 @@ def get_dimensions(path, device_id=None): @staticmethod def shell(path, command, device_id=None): if device_id: - shellx = Popen(_("{} -s {} shell {}".format(path, device_id, command)), stdout=PIPE, stderr=PIPE) + shellx = Popen(_("{} -s {} shell {}".format(path, + device_id, command)), stdout=PIPE, stderr=PIPE) else: - shellx = Popen(_("{} shell {}".format(path, command)), stdout=PIPE, stderr=PIPE) + shellx = Popen(_("{} shell {}".format(path, command)), + stdout=PIPE, stderr=PIPE) return True @staticmethod def command(path, command, device_id=None): if device_id: - shellx = Popen(_("{} -s {} {}".format(path, device_id, command)), stdout=PIPE, stderr=PIPE) + shellx = Popen( + _("{} -s {} {}".format(path, device_id, command)), stdout=PIPE, stderr=PIPE) else: - shellx = Popen(_("{} {}".format(path, command)), stdout=PIPE, stderr=PIPE) + shellx = Popen(_("{} {}".format(path, command)), + stdout=PIPE, stderr=PIPE) return shellx @staticmethod @@ -128,7 +134,8 @@ def devices(increment=''): raise FileNotFoundError( "guiscrcpy couldn't find adb. Please specify path to adb in configuration file") proc = Popen(_(increment + " devices"), stdout=PIPE) - output = [[y.strip() for y in x.split('\t')] for x in decode_process(proc)[1:]][:-1] - + output = [[y.strip() for y in x.split('\t')] + for x in decode_process(proc)[1:]][:-1] + logging.debug("ADB: {}".format(output)) return output diff --git a/guiscrcpy/lib/toolkit.py b/guiscrcpy/lib/toolkit.py index dd12c59d..12b276ed 100644 --- a/guiscrcpy/lib/toolkit.py +++ b/guiscrcpy/lib/toolkit.py @@ -37,15 +37,18 @@ def __init__(self, device_id=None): logging.debug("Launching UX Mapper") self.has_modules = getWindowsWithTitle and auto logging.debug("Calculating Screen Size") - self.android_dimensions = adb.get_dimensions(adb.path, device_id=device_id) + self.android_dimensions = adb.get_dimensions( + adb.path, device_id=device_id) self.deviceId = device_id def do_swipe(self, x1=10, y1=10, x2=10, y2=10): - adb.shell_input(adb.path, "swipe {} {} {} {}".format(x1, y1, x2, y2), device_id=self.deviceId) + adb.shell_input(adb.path, "swipe {} {} {} {}".format( + x1, y1, x2, y2), device_id=self.deviceId) return True def do_keyevent(self, key): - adb.shell_input(adb.path, "keyevent {}".format(key), device_id=self.deviceId) + adb.shell_input(adb.path, "keyevent {}".format(key), + device_id=self.deviceId) return True def copy_devpc(self): @@ -87,13 +90,17 @@ def key_switch(self): def reorientP(self): logging.debug("Passing REORIENT [POTRAIT]") - 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) + 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', device_id=self.deviceId) - adb.shell(adb.path, "settings put system rotation 1", device_id=self.deviceId) + 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") diff --git a/guiscrcpy/platform/linux.py b/guiscrcpy/platform/linux.py index 4414880e..e2800ea8 100644 --- a/guiscrcpy/platform/linux.py +++ b/guiscrcpy/platform/linux.py @@ -100,7 +100,8 @@ def install_fonts(): if not os.path.exists(sys_font_dir): os.makedirs(sys_font_dir) from fontTools.ttLib import TTFont - font_dir = os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'ui', 'fonts') + font_dir = os.path.join(os.path.abspath( + os.path.dirname(os.path.dirname(__file__))), 'ui', 'fonts') try: fonts = os.listdir(font_dir) for i in fonts: @@ -109,8 +110,8 @@ def install_fonts(): return True except Exception as e: logging.error("Error Installing the fonts. " - "You might have to manually install the fonts" - "Titillium Web : https://fonts.google.com/specimen/Titillium+Web") + "You might have to manually install the fonts" + "Titillium Web : https://fonts.google.com/specimen/Titillium+Web") return False @staticmethod diff --git a/guiscrcpy/platform/windows.py b/guiscrcpy/platform/windows.py index ef1c1a22..318e6e26 100644 --- a/guiscrcpy/platform/windows.py +++ b/guiscrcpy/platform/windows.py @@ -37,7 +37,7 @@ def make_config(): except Exception as e: logging.error( "Error creating configuration file in dir {path}. Error code:{e}" - .format( + .format( path=path, e=e )) @@ -68,7 +68,8 @@ def install_fonts(self): cmd = r"""copy "{fontdir}" "%WINDIR%\Fonts" reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" / v "FontName (TrueType)" / t REG_SZ / d {font} / f """ - font_dir = os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'ui', 'fonts') + font_dir = os.path.join(os.path.abspath( + os.path.dirname(os.path.dirname(__file__))), 'ui', 'fonts') try: fonts = os.listdir(font_dir) for i in fonts: @@ -79,8 +80,8 @@ def install_fonts(self): except Exception as e: print("Installing fonts failed") logging.error("Error Installing the fonts. " - "You might have to manually install the fonts" - "Titillium Web : https://fonts.google.com/specimen/Titillium+Web") + "You might have to manually install the fonts" + "Titillium Web : https://fonts.google.com/specimen/Titillium+Web") return False def create_desktop(self): diff --git a/guiscrcpy/platform/windows_tools/tools.py b/guiscrcpy/platform/windows_tools/tools.py index d58a516f..459afdee 100644 --- a/guiscrcpy/platform/windows_tools/tools.py +++ b/guiscrcpy/platform/windows_tools/tools.py @@ -3,17 +3,18 @@ Create desktop shortcuts for Windows """ from __future__ import print_function +from win32com.shell import shell, shellcon +import win32com.client import os import sys import time from collections import namedtuple UserFolders = namedtuple("UserFolders", ("home", "desktop", "startmenu")) -import win32com.client -from win32com.shell import shell, shellcon scut_ext = 'lnk' ico_ext = 'ico' + def get_conda_active_env(): '''Return name of active conda environment or empty string''' conda_env = None @@ -24,6 +25,7 @@ def get_conda_active_env(): conda_env = "" return conda_env + # batch file to activate the environment # for Anaconda Python before running command. conda_env = get_conda_active_env() @@ -75,14 +77,15 @@ def get_folders(): """ return UserFolders(get_homedir(), get_desktop(), get_startmenu()) + def make_shortcut(): userfolders = get_folders() full_script = 'guiscrcpy' desktop, startmenu = True, True - for (create, folder) in ((desktop,userfolders.desktop), + for (create, folder) in ((desktop, userfolders.desktop), (startmenu, userfolders.startmenu)): - + if not os.path.exists(folder): os.makedirs(folder) dest = os.path.join(folder, "guiscrcpy.lnk") @@ -93,7 +96,7 @@ def make_shortcut(): wscript.WindowStyle = 0 wscript.Description = "An Open Source Android Screen Mirroring System" wscript.IconLocation = os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))), - 'ui', 'icons', 'guiscrcpy_logo_SRj_icon.ico') + 'ui', 'icons', 'guiscrcpy_logo_SRj_icon.ico') wscript.save() - return True \ No newline at end of file + return True diff --git a/guiscrcpy/ui/main.py b/guiscrcpy/ui/main.py index c9ad0daa..8a48d21f 100644 --- a/guiscrcpy/ui/main.py +++ b/guiscrcpy/ui/main.py @@ -15,7 +15,8 @@ class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(547, 549) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( @@ -181,10 +182,12 @@ def setupUi(self, MainWindow): self.gridLayout_4.setVerticalSpacing(1) self.gridLayout_4.setObjectName("gridLayout_4") self.fullscreen = QtWidgets.QCheckBox(self.frame1) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.fullscreen.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.fullscreen.sizePolicy().hasHeightForWidth()) self.fullscreen.setSizePolicy(sizePolicy) self.fullscreen.setMinimumSize(QtCore.QSize(10, 20)) font = QtGui.QFont() @@ -192,7 +195,8 @@ def setupUi(self, MainWindow): font.setPointSize(10) self.fullscreen.setFont(font) icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap(":/icons/icons/increase-size-option.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap( + ":/icons/icons/increase-size-option.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.fullscreen.setIcon(icon1) self.fullscreen.setObjectName("fullscreen") self.gridLayout_4.addWidget(self.fullscreen, 0, 4, 1, 1) @@ -216,14 +220,17 @@ def setupUi(self, MainWindow): self.showTouches.setObjectName("showTouches") self.gridLayout_4.addWidget(self.showTouches, 0, 5, 1, 1) self.settings_button = QtWidgets.QPushButton(self.frame1) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.settings_button.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.settings_button.sizePolicy().hasHeightForWidth()) self.settings_button.setSizePolicy(sizePolicy) self.settings_button.setText("") icon3 = QtGui.QIcon() - icon3.addPixmap(QtGui.QPixmap(":/icons/icons/gear.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon3.addPixmap(QtGui.QPixmap(":/icons/icons/gear.svg"), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.settings_button.setIcon(icon3) self.settings_button.setObjectName("settings_button") self.gridLayout_4.addWidget(self.settings_button, 3, 1, 1, 1) @@ -248,10 +255,12 @@ def setupUi(self, MainWindow): self.notifChecker.setObjectName("notifChecker") self.gridLayout_4.addWidget(self.notifChecker, 1, 4, 1, 1) self.displayForceOn = QtWidgets.QCheckBox(self.frame1) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.displayForceOn.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.displayForceOn.sizePolicy().hasHeightForWidth()) self.displayForceOn.setSizePolicy(sizePolicy) self.displayForceOn.setMinimumSize(QtCore.QSize(10, 20)) font = QtGui.QFont() @@ -260,15 +269,18 @@ def setupUi(self, MainWindow): self.displayForceOn.setFont(font) self.displayForceOn.setToolTipDuration(2) icon5 = QtGui.QIcon() - icon5.addPixmap(QtGui.QPixmap(":/icons/icons/bullseye.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon5.addPixmap(QtGui.QPixmap(":/icons/icons/bullseye.svg"), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.displayForceOn.setIcon(icon5) self.displayForceOn.setObjectName("displayForceOn") self.gridLayout_4.addWidget(self.displayForceOn, 1, 0, 1, 4) self.aotop = QtWidgets.QCheckBox(self.frame1) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.aotop.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.aotop.sizePolicy().hasHeightForWidth()) self.aotop.setSizePolicy(sizePolicy) self.aotop.setMinimumSize(QtCore.QSize(10, 20)) font = QtGui.QFont() @@ -277,7 +289,8 @@ def setupUi(self, MainWindow): self.aotop.setFont(font) self.aotop.setToolTipDuration(2) icon6 = QtGui.QIcon() - icon6.addPixmap(QtGui.QPixmap(":/icons/icons/fire-symbol.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon6.addPixmap(QtGui.QPixmap(":/icons/icons/fire-symbol.svg"), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.aotop.setIcon(icon6) self.aotop.setObjectName("aotop") self.gridLayout_4.addWidget(self.aotop, 0, 0, 1, 4) @@ -300,26 +313,31 @@ def setupUi(self, MainWindow): self.recScui.setFont(font) self.recScui.setToolTipDuration(2) icon7 = QtGui.QIcon() - icon7.addPixmap(QtGui.QPixmap(":/icons/icons/facetime-button.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon7.addPixmap(QtGui.QPixmap( + ":/icons/icons/facetime-button.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.recScui.setIcon(icon7) self.recScui.setObjectName("recScui") self.gridLayout_4.addWidget(self.recScui, 1, 5, 1, 1) self.checkBox = QtWidgets.QCheckBox(self.frame1) icon8 = QtGui.QIcon() - icon8.addPixmap(QtGui.QPixmap(":/icons/icons/reorder-option.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon8.addPixmap(QtGui.QPixmap( + ":/icons/icons/reorder-option.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.checkBox.setIcon(icon8) self.checkBox.setObjectName("checkBox") self.gridLayout_4.addWidget(self.checkBox, 2, 0, 1, 4) self.network_button = QtWidgets.QPushButton(self.frame1) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.network_button.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.network_button.sizePolicy().hasHeightForWidth()) self.network_button.setSizePolicy(sizePolicy) self.network_button.setToolTipDuration(2) self.network_button.setText("") icon9 = QtGui.QIcon() - icon9.addPixmap(QtGui.QPixmap(":/icons/icons/wifi.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon9.addPixmap(QtGui.QPixmap(":/icons/icons/wifi.svg"), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.network_button.setIcon(icon9) self.network_button.setObjectName("network_button") self.gridLayout_4.addWidget(self.network_button, 3, 0, 1, 1) @@ -332,10 +350,12 @@ def setupUi(self, MainWindow): self.devices_combox.setObjectName("devices_combox") self.gridLayout_4.addWidget(self.devices_combox, 3, 2, 1, 3) self.refreshdevices = QtWidgets.QPushButton(self.frame1) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.refreshdevices.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.refreshdevices.sizePolicy().hasHeightForWidth()) self.refreshdevices.setSizePolicy(sizePolicy) self.refreshdevices.setObjectName("refreshdevices") self.gridLayout_4.addWidget(self.refreshdevices, 3, 5, 1, 1) @@ -511,7 +531,8 @@ def setupUi(self, MainWindow): self.quit.setStyleSheet("") self.quit.setText("") icon10 = QtGui.QIcon() - icon10.addPixmap(QtGui.QPixmap(":/icons/icons/cross-mark-on-a-black-circle-background.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon10.addPixmap(QtGui.QPixmap( + ":/icons/icons/cross-mark-on-a-black-circle-background.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.quit.setIcon(icon10) self.quit.setObjectName("quit") self.horizontalLayout.addWidget(self.quit) @@ -543,7 +564,8 @@ def setupUi(self, MainWindow): self.abtgit.setMinimumSize(QtCore.QSize(45, 45)) self.abtgit.setText("") icon11 = QtGui.QIcon() - icon11.addPixmap(QtGui.QPixmap(":/icons/icons/github.logo.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon11.addPixmap(QtGui.QPixmap( + ":/icons/icons/github.logo.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.abtgit.setIcon(icon11) self.abtgit.setIconSize(QtCore.QSize(20, 20)) self.abtgit.setObjectName("abtgit") @@ -559,7 +581,8 @@ def setupUi(self, MainWindow): self.abtme.setMinimumSize(QtCore.QSize(33, 45)) self.abtme.setText("") icon12 = QtGui.QIcon() - icon12.addPixmap(QtGui.QPixmap(":/icons/icons/ss-branding.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon12.addPixmap(QtGui.QPixmap( + ":/icons/icons/ss-branding.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.abtme.setIcon(icon12) self.abtme.setIconSize(QtCore.QSize(20, 20)) self.abtme.setObjectName("abtme") @@ -575,7 +598,8 @@ def setupUi(self, MainWindow): self.usbaud.setMinimumSize(QtCore.QSize(45, 45)) self.usbaud.setText("") icon13 = QtGui.QIcon() - icon13.addPixmap(QtGui.QPixmap(":/icons/icons/volume-up-interface-symbol.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon13.addPixmap(QtGui.QPixmap( + ":/icons/icons/volume-up-interface-symbol.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.usbaud.setIcon(icon13) self.usbaud.setObjectName("usbaud") self.horizontalLayout.addWidget(self.usbaud) @@ -591,7 +615,8 @@ def setupUi(self, MainWindow): self.mapnow.setToolTipDuration(3) self.mapnow.setText("") icon14 = QtGui.QIcon() - icon14.addPixmap(QtGui.QPixmap(":/icons/icons/four-black-squares.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon14.addPixmap(QtGui.QPixmap( + ":/icons/icons/four-black-squares.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.mapnow.setIcon(icon14) self.mapnow.setObjectName("mapnow") self.horizontalLayout.addWidget(self.mapnow) @@ -613,7 +638,8 @@ def setupUi(self, MainWindow): self.executeaction.setFont(font) self.executeaction.setStyleSheet("") icon15 = QtGui.QIcon() - icon15.addPixmap(QtGui.QPixmap(":/icons/icons/small-rocket-ship-silhouette.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon15.addPixmap(QtGui.QPixmap( + ":/icons/icons/small-rocket-ship-silhouette.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.executeaction.setIcon(icon15) self.executeaction.setIconSize(QtCore.QSize(20, 16)) self.executeaction.setObjectName("executeaction") @@ -799,17 +825,24 @@ def retranslateUi(self, MainWindow): self.build_label.setText(_translate("MainWindow", "Build")) self.fullscreen.setText(_translate("MainWindow", "Fullscreen")) self.showTouches.setText(_translate("MainWindow", "Show touches")) - self.notifChecker.setToolTip(_translate("MainWindow", "Make guiscrcpy check for new notifications on your device. A status bar icon indicating new notifications will be visible. (Experimental)")) - self.notifChecker.setText(_translate("MainWindow", "Notification Auditor")) - self.displayForceOn.setToolTip(_translate("MainWindow", "Use your computer screen as your android device\'s HD Display")) - self.displayForceOn.setText(_translate("MainWindow", "Keep display off ")) - self.aotop.setToolTip(_translate("MainWindow", "Keep display always on top of other windows")) + self.notifChecker.setToolTip(_translate( + "MainWindow", "Make guiscrcpy check for new notifications on your device. A status bar icon indicating new notifications will be visible. (Experimental)")) + self.notifChecker.setText(_translate( + "MainWindow", "Notification Auditor")) + self.displayForceOn.setToolTip(_translate( + "MainWindow", "Use your computer screen as your android device\'s HD Display")) + self.displayForceOn.setText(_translate( + "MainWindow", "Keep display off ")) + self.aotop.setToolTip(_translate( + "MainWindow", "Keep display always on top of other windows")) self.aotop.setText(_translate("MainWindow", "Always on Top")) - self.recScui.setToolTip(_translate("MainWindow", "Record your screen mirroring to your home directory. In Linux, it is in ~guiscrcpy directory. In Windows, it is in C:Users with the date in seconds, followed by .mp4")) + self.recScui.setToolTip(_translate( + "MainWindow", "Record your screen mirroring to your home directory. In Linux, it is in ~guiscrcpy directory. In Windows, it is in C:Users with the date in seconds, followed by .mp4")) self.recScui.setStatusTip(_translate("MainWindow", "See tooltip")) self.recScui.setText(_translate("MainWindow", "Record screen")) self.checkBox.setText(_translate("MainWindow", "Side Panel")) - self.network_button.setToolTip(_translate("MainWindow", "Launch Network Manager")) + self.network_button.setToolTip(_translate( + "MainWindow", "Launch Network Manager")) self.checkBox_2.setText(_translate("MainWindow", "Bottom Panel")) self.refreshdevices.setText(_translate("MainWindow", "REFRESH")) self.bitrateText.setText(_translate("MainWindow", "8000 KB/s")) diff --git a/guiscrcpy/ui/network.py b/guiscrcpy/ui/network.py index 6d53af93..02535f66 100644 --- a/guiscrcpy/ui/network.py +++ b/guiscrcpy/ui/network.py @@ -72,11 +72,14 @@ def retranslateUi(self, NetworkUI): _translate = QtCore.QCoreApplication.translate NetworkUI.setWindowTitle(_translate("NetworkUI", "Network Manager")) self.label.setText(_translate("NetworkUI", "List of Network Devices")) - self.nm_refresh.setStatusTip(_translate("NetworkUI", "Refresh Devices list")) + self.nm_refresh.setStatusTip(_translate( + "NetworkUI", "Refresh Devices list")) self.nm_refresh.setText(_translate("NetworkUI", "REFRESH")) self.tcpip.setText(_translate("NetworkUI", "TCPIP")) self.spinBox.setToolTip(_translate("NetworkUI", "Port number")) self.spinBox.setStatusTip(_translate("NetworkUI", "Port number")) - self.nm_connect.setStatusTip(_translate("NetworkUI", "Establish connection")) + self.nm_connect.setStatusTip(_translate( + "NetworkUI", "Establish connection")) self.nm_connect.setText(_translate("NetworkUI", "CONNECT")) - self.lineEdit.setPlaceholderText(_translate("NetworkUI", "Cannot find your IP address? Enter it manually here")) + self.lineEdit.setPlaceholderText(_translate( + "NetworkUI", "Cannot find your IP address? Enter it manually here")) diff --git a/guiscrcpy/ux/network.py b/guiscrcpy/ux/network.py index 423a5383..d2295283 100644 --- a/guiscrcpy/ux/network.py +++ b/guiscrcpy/ux/network.py @@ -34,6 +34,7 @@ class InterfaceNetwork(QMainWindow, Ui_NetworkUI): Scans the open IP Addresses connected on the system, on Linux and Mac only, as far as tested Does not work satisfactorily on Windows. """ + def __init__(self, adb_path=None): QMainWindow.__init__(self) Ui_NetworkUI.__init__(self) @@ -50,7 +51,8 @@ def init(self): self.nm_connect.pressed.connect(self.connect) if self.os.system() == 'Windows': # FIXME: Port scanning is not working on Windows at the moment. - self.nm_det.setText("Enter the IP address in the text box and press connect") + self.nm_det.setText( + "Enter the IP address in the text box and press connect") self.nm_refresh.setEnabled(False) else: self.nm_refresh.pressed.connect(self.refresh) @@ -73,9 +75,11 @@ def connect(self): return else: if self.os.system() == 'Windows': - self.nm_det.setText("Please enter an IP address in the text box") + self.nm_det.setText( + "Please enter an IP address in the text box") else: - self.nm_det.setText("Please enter an IP address in the text box. / Click refresh") + self.nm_det.setText( + "Please enter an IP address in the text box. / Click refresh") return sp = adb.command(adb.path, 'connect {}:5555'.format(ip))