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

Commit

Permalink
Connect refresh button to refresh devices function
Browse files Browse the repository at this point in the history
  • Loading branch information
srevinsaju committed Apr 12, 2020
1 parent d3d43c5 commit 3b76e79
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions guiscrcpy/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def __init__(self):
self.mapnow.clicked.connect(self.mapp)
self.network_button.clicked.connect(self.network_mgr)
self.settings_button.clicked.connect(self.settings_mgr)
self.refreshdevices.clicked.connect(self.refresh_devices_combo)

def settings_mgr(self):
from guiscrcpy.ux.settings import InterfaceSettings
Expand Down Expand Up @@ -326,18 +327,13 @@ def dial_text_refresh(self):
self.bitrateText.setText(str(config['bitrate']) + "KB/s")
pass

def start_act(self):

self.runningNot.setText("CHECKING DEVICE CONNECTION")
timei = time.time()
self.progressBar.setValue(5)

def refresh_devices_combo(self):
devices_list = adb.devices(adb.path)

if len(devices_list) == 0:
self.runningNot.setText("DEVICE IS NOT CONNECTED")
self.progressBar.setValue(0)
return 0
return 0,
else:
valid_devices = []
invalid_devices = []
Expand All @@ -357,7 +353,7 @@ def start_act(self):
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
return 0,

else:
more_devices = True
Expand All @@ -366,6 +362,20 @@ def start_act(self):
more_devices = False
device_id = None

return more_devices, device_id

def start_act(self):

self.runningNot.setText("CHECKING DEVICE CONNECTION")
timei = time.time()
self.progressBar.setValue(5)

values_devices_list = self.refresh_devices_combo()
if len(values_devices_list) != 2:
return 0
else:
more_devices, device_id = values_devices_list

# check if the defaultDimension is checked or not for giving signal

self.progressBar.setValue(15)
Expand Down Expand Up @@ -434,11 +444,13 @@ def start_act(self):
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()
swipe_instance.init()
panel_instance.init()
side_instance.init()

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

0 comments on commit 3b76e79

Please sign in to comment.