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

Commit

Permalink
Merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
srevinsaju committed Apr 12, 2020
2 parents 9e4a10a + 3d72598 commit d49f8a9
Show file tree
Hide file tree
Showing 12 changed files with 327 additions and 273 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/appimage.yml

This file was deleted.

18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
![Mac OS](https://github.com/srevinsaju/guiscrcpy/workflows/Mac%20OS/badge.svg)
[![Updates](https://pyup.io/repos/github/srevinsaju/guiscrcpy/shield.svg)](https://pyup.io/repos/github/srevinsaju/guiscrcpy/)
[![Python 3](https://pyup.io/repos/github/srevinsaju/guiscrcpy/python-3-shield.svg)](https://pyup.io/repos/github/srevinsaju/guiscrcpy/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/guiscrcpy?style=flat-square)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/guiscrcpy?style=flat-square)
![PyPI](https://img.shields.io/pypi/v/guiscrcpy?style=flat-square)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/guiscrcpy?style=flat-square)
![PyPI - Downloads](https://img.shields.io/pypi/dm/guiscrcpy?color=dark%20green&logo=PYPI&logoColor=Green&style=flat-square)
![AUR version](https://img.shields.io/aur/version/guiscrcpy?label=Arch%20Linux%20Package&style=flat-square)
![PyPI - Downloads](https://img.shields.io/pypi/dm/guiscrcpy?color=dark%20green&logo=PYPI&logoColor=Green&style=flat-square)](https://pypi.org/project/guiscrcpy)
[![AUR version](https://img.shields.io/aur/version/guiscrcpy?label=Arch%20Linux%20Package&style=flat-square)](https://aur.archlinux.org/packages/guiscrcpy)
[![Snap Status](https://build.snapcraft.io/badge/srevinsaju/guiscrcpy.svg)](https://build.snapcraft.io/user/srevinsaju/guiscrcpy)
![GitHub All Releases](https://img.shields.io/github/downloads/srevinsaju/guiscrcpy/total?style=flat-square)
[![GitHub All Releases](https://img.shields.io/github/downloads/srevinsaju/guiscrcpy/total?style=flat-square)](https://github.com/srevinsaju/guiscrcpy/releases)

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

![Twitter Follow](https://img.shields.io/twitter/follow/srevinsaju?style=social)
![GitHub followers](https://img.shields.io/github/followers/srevinsaju?label=srevin%20Saju&style=social)
[![Twitter Follow](https://img.shields.io/twitter/follow/srevinsaju?style=social)](https://twitter.com/srevinsaju)
[![GitHub followers](https://img.shields.io/github/followers/srevinsaju?label=srevin%20Saju&style=social)](https://github.com/srevinsaju)

> **IMPORTANT** : `guiscrcpy` is a free and open source android screen mirroring system. The work on guiscrcpy is driven by
the interest of users into it. Please feel free to let you know your thanks if this software helped you a lot, or if you like
Expand All @@ -27,12 +27,12 @@ some more features to be included, and paticularly ...
[![Become a Patron](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/srevinsaju?fan_landing=true)

For beta Windows compiled executables, click
![Windows Executable](https://github.com/srevinsaju/guiscrcpy/workflows/Windows%20Executable/badge.svg)
[![Windows Executable](https://github.com/srevinsaju/guiscrcpy/workflows/Windows%20Executable/badge.svg)](https://github.com/srevinsaju/guiscrcpy/actions?query=+event%3Apush++is%3Asuccess+branch%3Amaster+workflow%3A%22Windows+Executable%22). Select the latest commit
and download the artifact.

For beta Linux compiled AppImages, click
~~For beta Linux compiled AppImages, click
![Build AppImage](https://github.com/srevinsaju/guiscrcpy/workflows/Build%20AppImage/badge.svg)
and download the artifact.
and download the artifact.~~. See Issues for the failure of creating a AppImage

![image of guiscrcpy](https://raw.githubusercontent.com/srevinsaju/guiscrcpy-docs/master/docs/screen3.png)

Expand Down
3 changes: 2 additions & 1 deletion guiscrcpy.desktop
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[Desktop Entry]
Name=guiscrcpy
Version=3.5
Exec=python3 bin/guiscrcpy
Type=Application
Icon=guiscrcpy_logo
Terminal=false
Categories=Application;Development;
Keywords=Python;Screen;Mirroring;Android
StartupWMClass=guiscrcpy
StartupWMClass=guiscrcpy
76 changes: 41 additions & 35 deletions guiscrcpy/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,6 @@ def __init__(self):
except:
pass

# show subwindows
self.swipe_instance = SwipeUX() # Load swipe UI
self.panel_instance = Panel()
self.side_instance = InterfaceToolkit()
self.quit.clicked.connect(self.quitAct)
self.dimensionText.setText("DEFAULT")
config['bitrate'] = int(self.dial.value())
Expand Down Expand Up @@ -337,40 +333,40 @@ def start_act(self):
self.progressBar.setValue(5)

devices_list = adb.devices(adb.path)
import pdb; pdb.set_trace()
if devices_list[0] == "\n":
self.runningNot.setText("DEVICE IS NOT CONNECTED")
self.progressBar.setValue(0)
return 0
try:
exc = devices_list[1].find("device")
except IndexError:

if len(devices_list) == 0:
self.runningNot.setText("DEVICE IS NOT CONNECTED")
self.progressBar.setValue(0)
return 0

if exc > -1:
self.runningNot.setText(
"DEVICE " + str(devices_list[0]) + " IS CONNECTED")
self.progressBar.setValue(10)

elif devices_list[1][:-1] == "unauthorized":
else:
valid_devices = []
invalid_devices = []
for dev, stat in devices_list:
if stat == "unauthorized":
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")
self.runningNot.setText(
"DEVICE IS UNAUTHORIZED. PLEASE CLICK 'OK' ON DEVICE WHEN ASKED FOR"
"Connected: [{}], {}".format(valid_devices, invalid_devices)
)
self.progressBar.setValue(0)
return 0
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")
self.devices_combox.clear()
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()
else:
self.runningNot.setText(
"DEVICE CONNECTED BUT FAILED TO ESTABLISH CONNECTION"
)
self.progressBar.setValue(0)
return 0
# check if the defaultDimension is checked or not for giving signal
more_devices = False
device_id = None

ux = UXMapper()
dimValues = adb.get_dimensions(adb.path)
# check if the defaultDimension is checked or not for giving signal

self.progressBar.setValue(15)

Expand Down Expand Up @@ -432,16 +428,26 @@ def start_act(self):
logging.debug("Flags passed to scrcpy engine : " + self.options)
self.progressBar.setValue(75)
config['extra'] = self.flaglineedit.text()
self.swipe_instance.init() # show Swipe UI
self.panel_instance.init()
self.side_instance.init()

ux = UXMapper()
# show subwindows
swipe_instance = SwipeUX() # Load swipe UI
panel_instance = Panel()
side_instance = InterfaceToolkit()
dimValues = adb.get_dimensions(adb.path)

for instance in (swipe_instance, panel_instance, side_instance):
instance.init()

if self.cmx is not None:
config['cmx'] = ' '.join(map(str, self.cmx))

# run scrcpy usng subprocess
args = "{} {} {}".format(self.options, config['extra'], config['cmx'])
scrcpy.start(scrcpy.path, args)

if more_devices:
args = f"-s {device_id} " + args

scrcpy.start(scrcpy.path, args)
timef = time.time()
eta = timef - timei
print("SCRCPY is launched in", eta, "seconds")
Expand Down
52 changes: 28 additions & 24 deletions guiscrcpy/lib/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,26 @@ def check():
environment.paths()))

@staticmethod
def shell_input(path, command):
shellx = Popen(
_("{} shell input {}".format(path, command)),
stdout=PIPE,
stderr=PIPE,
)
def shell_input(path, command, device_id=None):
if device_id:
shellx = Popen(
_("{} -s {} shell input {}".format(path, device_id, command)),
stdout=PIPE,
stderr=PIPE,
)
else:
shellx = Popen(
_("{} shell input {}".format(path, command)),
stdout=PIPE,
stderr=PIPE,
)

@staticmethod
def get_dimensions(path):
shellx = Popen(
_("{} shell wm size".format(path)),
stdout=PIPE,
stderr=PIPE,
)
def get_dimensions(path, device_id=None):
if device_id:
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)
raw_dimensions = shellx.stdout.read().decode().strip('\n')
for i in ['Override size', 'Physical size']:
if i in raw_dimensions:
Expand All @@ -101,21 +107,19 @@ def get_dimensions(path):
return False

@staticmethod
def shell(path, command):
shellx = Popen(
_("{} shell {}".format(path, command)),
stdout=PIPE,
stderr=PIPE,
)
def shell(path, command, device_id=None):
if device_id:
shellx = Popen(_("{} -s {} shell {}".format(path, device_id, command)), stdout=PIPE, stderr=PIPE)
else:
shellx = Popen(_("{} shell {}".format(path, command)), stdout=PIPE, stderr=PIPE)
return True

@staticmethod
def command(path, command):
shellx = Popen(
_("{} {}".format(path, command)),
stdout=PIPE,
stderr=PIPE,
)
def command(path, command, device_id=None):
if device_id:
shellx = Popen(_("{} -s {} {}".format(path, device_id, command)), stdout=PIPE, stderr=PIPE)
else:
shellx = Popen(_("{} {}".format(path, command)), stdout=PIPE, stderr=PIPE)
return shellx

@staticmethod
Expand Down
9 changes: 5 additions & 4 deletions guiscrcpy/lib/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,19 @@


class UXMapper:
def __init__(self):
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)
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))
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))
adb.shell_input(adb.path, "keyevent {}".format(key), device_id=self.deviceId)
return True

def copy_devpc(self):
Expand Down
2 changes: 1 addition & 1 deletion guiscrcpy/lib/ver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""


__version__ = '3.7-raw'

import logging
try:
import git
Expand Down
Loading

0 comments on commit d49f8a9

Please sign in to comment.