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

Commit ea82fbd

Browse files
authored
3.2 (#58)
* Remove unwanted fonts, add network support init * Add object type Network Manager * Add network manager window * Connect slots and signals, working Network Manager * Add network files * Add open source fonts OFL * Add wifi and settings icon * Updates settings panel * Update the list settings manager * More changes to settings API * Update setup.py * Code hierarchy * Final fix for networking and settings, connect slots etc * Fix connect signals * Update version
1 parent 0f6b5ca commit ea82fbd

29 files changed

+24141
-76840
lines changed

guiscrcpy/install/__init__.py

Whitespace-only changes.

guiscrcpy/install/installer.py

Whitespace-only changes.

guiscrcpy/launcher.py

+19-4
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
from guiscrcpy.lib.check import scrcpy
5656
from guiscrcpy.theme.style import darkstylesheet
5757
from guiscrcpy.ui.main import Ui_MainWindow
58-
from guiscrcpy.ui.toolkit import Ui_ToolbarPanel
59-
from guiscrcpy.ui.panel import Ui_HorizontalPanel
6058
from guiscrcpy.lib.toolkit import UXMapper
6159
from guiscrcpy.ux.panel import Panel
6260
from guiscrcpy.ux.swipe import SwipeUX
@@ -148,6 +146,7 @@ def __init__(self, Ui_MainWindow):
148146
Ui_MainWindow.__init__()
149147
self.setupUi(Ui_MainWindow)
150148
super(InterfaceGuiscrcpy, self).__init__()
149+
self.cmx = None
151150
logging.debug(
152151
"Options received by class are : {} {} {} {} {} ".format(
153152
config['bitrate'],
@@ -206,7 +205,6 @@ def __init__(self, Ui_MainWindow):
206205
self.swipe_instance = SwipeUX() # Load swipe UI
207206
self.panel_instance = Panel()
208207
self.side_instance = InterfaceToolkit()
209-
210208
self.quit.clicked.connect(self.quitAct)
211209
self.dimensionText.setText("DEFAULT")
212210
config['bitrate'] = int(self.dial.value())
@@ -217,6 +215,20 @@ def __init__(self, Ui_MainWindow):
217215
self.abtgit.clicked.connect(self.opengit)
218216
self.usbaud.clicked.connect(self.usbaudi)
219217
self.mapnow.clicked.connect(self.mapp)
218+
self.network_button.clicked.connect(self.network_mgr)
219+
self.settings_button.clicked.connect(self.settings_mgr)
220+
221+
def settings_mgr(self):
222+
from guiscrcpy.ux.settings import InterfaceSettings
223+
self.sm = InterfaceSettings(self)
224+
self.sm.init()
225+
self.sm.show()
226+
227+
def network_mgr(self):
228+
from guiscrcpy.ux.network import InterfaceNetwork
229+
self.nm = InterfaceNetwork(adb.path)
230+
self.nm.init()
231+
self.nm.show()
220232

221233
def mapp(self):
222234
if (os.path.exists(
@@ -419,9 +431,11 @@ def start_act(self):
419431
self.swipe_instance.init() # show Swipe UI
420432
self.panel_instance.init()
421433
self.side_instance.init()
434+
if self.cmx is not None:
435+
config['cmx'] = ' '.join(map(str, self.cmx))
422436

423437
# run scrcpy usng subprocess
424-
args = "{} {}".format(self.options, config['extra'])
438+
args = "{} {} {}".format(self.options, config['extra'], config['cmx'])
425439
scrcpy.start(scrcpy.path, args)
426440

427441
timef = time.time()
@@ -430,6 +444,7 @@ def start_act(self):
430444
self.progressBar.setValue(100)
431445

432446
# handle config files
447+
433448
cfgmgr.update_config(config)
434449
cfgmgr.write_file()
435450

guiscrcpy/lib/check.py

+10
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ def shell(path, command):
107107
)
108108
return True
109109

110+
@staticmethod
111+
def command(path, command):
112+
shellx = Popen(
113+
_("{} {}".format(path, command)),
114+
stdout=PIPE,
115+
stderr=PIPE,
116+
)
117+
return shellx
118+
119+
110120
@staticmethod
111121
def devices(increment=''):
112122
if increment is None:

guiscrcpy/lib/config.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def __init__(self, mode='w'):
4040
'bitrate': 8000,
4141
'fullscreen': False,
4242
'dispRO': False,
43-
'extra': ""
43+
'extra': "",
44+
'cmx': []
4445
}
4546
self.jsonfile = 'guiscrcpy.json'
4647
self.check_file()

guiscrcpy/lib/ver.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"""
1919

2020

21-
__version__ = '3.0-raw'
21+
__version__ = '3.2-raw'
2222
import logging
2323
try:
2424
import git

guiscrcpy/network/network.py

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
import socket
3+
import multiprocessing
4+
import subprocess
5+
import os
6+
7+
8+
class NetworkManager:
9+
10+
def __init__(self):
11+
pass
12+
13+
def pinger(self, job_q, results_q):
14+
"""
15+
Do Ping
16+
:param job_q:
17+
:param results_q:
18+
:return:
19+
"""
20+
DEVNULL = open(os.devnull, 'w')
21+
while True:
22+
23+
ip = job_q.get()
24+
25+
if ip is None:
26+
break
27+
28+
try:
29+
subprocess.check_call(['ping', '-c1', ip], stdout=DEVNULL)
30+
results_q.put(ip)
31+
except:
32+
pass
33+
34+
35+
def get_my_ip(self):
36+
"""
37+
Find my IP address
38+
:return:
39+
"""
40+
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
41+
s.connect(("8.8.8.8", 80))
42+
ip = s.getsockname()[0]
43+
s.close()
44+
return ip
45+
46+
47+
def map_network(self, pool_size=255):
48+
"""
49+
Maps the network
50+
:param pool_size: amount of parallel ping processes
51+
:return: list of valid ip addresses
52+
"""
53+
54+
ip_list = list()
55+
56+
# get my IP and compose a base like 192.168.1.xxx
57+
ip_parts = self.get_my_ip().split('.')
58+
base_ip = ip_parts[0] + '.' + ip_parts[1] + '.' + ip_parts[2] + '.'
59+
60+
# prepare the jobs queue
61+
jobs = multiprocessing.Queue()
62+
results = multiprocessing.Queue()
63+
64+
pool = [multiprocessing.Process(target=self.pinger, args=(jobs, results)) for i in range(pool_size)]
65+
66+
for p in pool:
67+
p.start()
68+
69+
# cue hte ping processes
70+
for i in range(1, 255):
71+
jobs.put(base_ip + '{0}'.format(i))
72+
73+
for p in pool:
74+
jobs.put(None)
75+
76+
for p in pool:
77+
p.join()
78+
79+
# collect he results
80+
while not results.empty():
81+
ip = results.get()
82+
ip_list.append(ip)
83+
84+
return ip_list
85+
86+
87+
if __name__ == '__main__':
88+
print('Mapping...')
89+
nm = NetworkManager()
90+
lst = nm.map_network()
91+
print(lst)

guiscrcpy/settings/__init__.py

Whitespace-only changes.

guiscrcpy/settings/settings.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
class SettingsManager:
3+
def __init__(self):
4+
pass
5+
6+
def check_updates(self):
7+
pass
8+
9+
def install_src(self):
10+
pass

guiscrcpy/ui/fonts/OFL.txt

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Copyright (c) 2009-2011 by Accademia di Belle Arti di Urbino and students of MA course of Visual design. Some rights reserved.
2+
3+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+
This license is copied below, and is also available with a FAQ at:
5+
http://scripts.sil.org/OFL
6+
7+
8+
-----------------------------------------------------------
9+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+
-----------------------------------------------------------
11+
12+
PREAMBLE
13+
The goals of the Open Font License (OFL) are to stimulate worldwide
14+
development of collaborative font projects, to support the font creation
15+
efforts of academic and linguistic communities, and to provide a free and
16+
open framework in which fonts may be shared and improved in partnership
17+
with others.
18+
19+
The OFL allows the licensed fonts to be used, studied, modified and
20+
redistributed freely as long as they are not sold by themselves. The
21+
fonts, including any derivative works, can be bundled, embedded,
22+
redistributed and/or sold with any software provided that any reserved
23+
names are not used by derivative works. The fonts and derivatives,
24+
however, cannot be released under any other type of license. The
25+
requirement for fonts to remain under this license does not apply
26+
to any document created using the fonts or their derivatives.
27+
28+
DEFINITIONS
29+
"Font Software" refers to the set of files released by the Copyright
30+
Holder(s) under this license and clearly marked as such. This may
31+
include source files, build scripts and documentation.
32+
33+
"Reserved Font Name" refers to any names specified as such after the
34+
copyright statement(s).
35+
36+
"Original Version" refers to the collection of Font Software components as
37+
distributed by the Copyright Holder(s).
38+
39+
"Modified Version" refers to any derivative made by adding to, deleting,
40+
or substituting -- in part or in whole -- any of the components of the
41+
Original Version, by changing formats or by porting the Font Software to a
42+
new environment.
43+
44+
"Author" refers to any designer, engineer, programmer, technical
45+
writer or other person who contributed to the Font Software.
46+
47+
PERMISSION & CONDITIONS
48+
Permission is hereby granted, free of charge, to any person obtaining
49+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+
redistribute, and sell modified and unmodified copies of the Font
51+
Software, subject to the following conditions:
52+
53+
1) Neither the Font Software nor any of its individual components,
54+
in Original or Modified Versions, may be sold by itself.
55+
56+
2) Original or Modified Versions of the Font Software may be bundled,
57+
redistributed and/or sold with any software, provided that each copy
58+
contains the above copyright notice and this license. These can be
59+
included either as stand-alone text files, human-readable headers or
60+
in the appropriate machine-readable metadata fields within text or
61+
binary files as long as those fields can be easily viewed by the user.
62+
63+
3) No Modified Version of the Font Software may use the Reserved Font
64+
Name(s) unless explicit written permission is granted by the corresponding
65+
Copyright Holder. This restriction only applies to the primary font name as
66+
presented to the users.
67+
68+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+
Software shall not be used to promote, endorse or advertise any
70+
Modified Version, except to acknowledge the contribution(s) of the
71+
Copyright Holder(s) and the Author(s) or with their explicit written
72+
permission.
73+
74+
5) The Font Software, modified or unmodified, in part or in whole,
75+
must be distributed entirely under this license, and must not be
76+
distributed under any other license. The requirement for fonts to
77+
remain under this license does not apply to any document created
78+
using the Font Software.
79+
80+
TERMINATION
81+
This license becomes null and void if any of the above conditions are
82+
not met.
83+
84+
DISCLAIMER
85+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+
OTHER DEALINGS IN THE FONT SOFTWARE.
52.6 KB
Binary file not shown.
56 KB
Binary file not shown.

guiscrcpy/ui/fonts/trebuc.ttf

-248 KB
Binary file not shown.

guiscrcpy/ui/fonts/trebucbd.ttf

-238 KB
Binary file not shown.

guiscrcpy/ui/fonts/trebucbi.ttf

-221 KB
Binary file not shown.

guiscrcpy/ui/fonts/trebucit.ttf

-246 KB
Binary file not shown.

guiscrcpy/ui/icons/gear.svg

+8
Loading

guiscrcpy/ui/icons/wifi.svg

+10
Loading

0 commit comments

Comments
 (0)