diff --git a/data/ui/SetupPerspective.ui b/data/ui/SetupPerspective.ui
index 7e4c724..a40e95a 100644
--- a/data/ui/SetupPerspective.ui
+++ b/data/ui/SetupPerspective.ui
@@ -6,7 +6,7 @@
False
Initial Device Setup
True
- center
+ center-on-parent
True
dialog
center
@@ -62,23 +62,11 @@
-
- False
- True
- 0
-
-
-
-
False
@@ -91,6 +79,7 @@
True
False
center
+ center
-
- True
- False
- vertical
- True
- bottom
-
-
- True
- False
- center
-
-
-
-
-
- True
- False
- 0
- none
-
-
- True
- False
- 12
-
-
- True
- False
- True
-
-
- True
- False
- 5
- 5
- Size
- 25
-
-
- 0
- 0
-
-
-
-
- True
- False
- 100x100mm
-
-
- 1
- 0
-
-
-
-
- True
- False
- 5
- 5
- Bluetooth Address
- 25
-
-
- 0
- 1
-
-
-
-
- True
- False
- 12:34:AB:CD:67:78
-
-
- 1
- 1
-
-
-
-
- True
- False
- 5
- 5
- Battery
-
-
- 0
- 2
-
-
-
-
- True
- False
- 55%
-
-
- 1
- 2
-
-
-
-
-
-
-
-
-
- True
- False
- Device name
-
-
-
-
-
-
-
- True
- True
- 1
-
-
-
-
-
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- Setup Complete
-
-
- False
- True
- 1
-
-
-
-
- page3
- page3
- 3
-
+
- False
+ True
True
1
diff --git a/tuhigui/setupdialog.py b/tuhigui/setupdialog.py
index 1c60473..4a87357 100644
--- a/tuhigui/setupdialog.py
+++ b/tuhigui/setupdialog.py
@@ -26,10 +26,7 @@ class SetupDialog(Gtk.Dialog):
}
stack = Gtk.Template.Child()
- device_name_p3 = Gtk.Template.Child()
- label_size = Gtk.Template.Child()
- label_btaddr = Gtk.Template.Child()
- label_battery = Gtk.Template.Child()
+ label_devicename_p1 = Gtk.Template.Child()
btn_quit = Gtk.Template.Child()
def __init__(self, tuhi, *args, **kwargs):
@@ -42,6 +39,7 @@ class SetupDialog(Gtk.Dialog):
def _on_unregistered_device(self, tuhi, device):
tuhi.disconnect(self._sig)
+ self.label_devicename_p1.set_text(f'Connecting to {device.name}')
self.stack.set_visible_child_name('page1')
self._sig = device.connect('button-press-required', self._on_button_press_required)
device.register()
@@ -54,16 +52,8 @@ class SetupDialog(Gtk.Dialog):
def _on_registered(self, tuhi, device):
tuhi.disconnect(self._sig)
-
- self.device_name_p3.set_text(device.name)
- self.stack.set_visible_child_name('page3')
- w, h = device.dimensions # in 100th of mm
- self.label_size.set_text(f'{w/100}x{h/100}mm')
- self.label_btaddr.set_text(device.address)
- self.label_battery.set_text(f'{device.battery_percent}%')
self.device = device
-
- self.btn_quit.set_label("Let's go")
+ self.response(Gtk.ResponseType.OK)
@GObject.Property
def name(self):
diff --git a/tuhigui/window.py b/tuhigui/window.py
index 8cb0d1c..2fb2cb0 100644
--- a/tuhigui/window.py
+++ b/tuhigui/window.py
@@ -113,8 +113,9 @@ class MainWindow(Gtk.ApplicationWindow):
device = dialog.device
dialog.destroy()
- if device is None:
+ if response != Gtk.ResponseType.OK or device is None:
self.destroy()
+ return
logger.debug('device was registered')
self.headerbar.set_title(f'Tuhi - {device.name}')