Skip to content

Commit

Permalink
no longer need to restart after changing settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Robinson committed Apr 19, 2021
1 parent affded9 commit 1a297a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/bluetooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def device_discovered(self, device):

def scan_for_infinitime(self):
self.start_discovery()
self.set_timeout(4.5 * 1000)
self.set_timeout(4 * 1000)
self.run()


Expand Down
24 changes: 9 additions & 15 deletions src/window.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import gatt
import configparser
import urllib.request
from pathlib import Path
from gi.repository import Gtk, GObject
from .bluetooth import InfiniTimeDevice
from .ble_dfu import InfiniTimeDFU
Expand Down Expand Up @@ -44,14 +42,17 @@ def __init__(self, **kwargs):
self.conf = config()
super().__init__(**kwargs)
GObject.threads_init()
self.full_list = get_quick_deploy_list()
if self.conf.get_property("mode") == "multi":
self.auto_switch_mode = True
self.multi_device_switch.set_active(True)
if self.conf.get_property("deploy_type") == "quick":
self.full_list = get_quick_deploy_list()
else:
self.auto_switch_mode = False
if self.conf.get_property("deploy_type") == "manual":
self.auto_switch_deploy_type = True
self.deploy_type_switch.set_active(True)
else:
self.auto_switch_deploy_type = False

def depopulate_listbox(self):
children = self.multi_device_listbox.get_children()
Expand Down Expand Up @@ -170,6 +171,8 @@ def rescan_button_clicked(self, widget):
self.depopulate_listbox()
self.main_info.set_text("Rescanning...")
self.bt_spinner.set_visible(True)
self.bbox_scan_pass.set_visible(False)
self.auto_bbox_scan_pass.set_visible(False)
self.scan_fail_box.set_visible(False)
self.rescan_button.set_visible(False)
self.scan_pass_box.set_visible(False)
Expand Down Expand Up @@ -258,12 +261,7 @@ def deploy_type_toggled(self, widget):
self.conf.set_property("deploy_type", "manual")
else:
self.conf.set_property("deploy_type", "quick")
self.main_info.set_text("[WARN ] Settings changed, please restart Siglo")
self.rescan_button.set_visible(False)
self.scan_pass_box.set_visible(False)
self.depopulate_listbox()
self.scan_fail_box.set_visible(False)
self.auto_bbox_scan_pass.set_visible(False)
self.rescan_button.emit("clicked")

@Gtk.Template.Callback()
def mode_toggled(self, widget):
Expand All @@ -274,11 +272,7 @@ def mode_toggled(self, widget):
self.conf.set_property("mode", "multi")
else:
self.conf.set_property("mode", "singleton")
self.main_info.set_text("[WARN ] Settings changed, please restart Siglo")
self.rescan_button.set_visible(False)
self.scan_pass_box.set_visible(False)
self.depopulate_listbox()
self.scan_fail_box.set_visible(False)
self.rescan_button.emit("clicked")

def update_progress_bar(self):
self.dfu_progress_bar.set_fraction(
Expand Down

0 comments on commit 1a297a3

Please sign in to comment.