Add more logging to help with debugging

This commit is contained in:
Peter Hutterer 2019-07-11 20:17:38 +10:00
parent 035dd68115
commit 82f62059f0
3 changed files with 13 additions and 1 deletions

View File

@ -19,6 +19,10 @@ import json
import gi
gi.require_version("Gtk", "3.0")
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('drawingperspective')
@Gtk.Template(resource_path="/org/freedesktop/TuhiGui/ui/DrawingPerspective.ui")
class DrawingPerspective(Gtk.Stack):
@ -70,6 +74,7 @@ class DrawingPerspective(Gtk.Stack):
self._update_drawings(self.device, None)
# We always want to sync on startup
logger.debug(f'{device.name} - starting to listen')
device.start_listening()
@GObject.Property

View File

@ -303,7 +303,7 @@ class TuhiKeteManager(_DBusObject):
self._init()
def _init(self, *args, **kwargs):
logger.info('online')
logger.info('manager is online')
for objpath in self.property('Devices'):
device = TuhiKeteDevice(self, objpath)
self._devices[device.address] = device

View File

@ -18,9 +18,13 @@ from .drawingperspective import DrawingPerspective
from .errorperspective import ErrorPerspective
from .tuhi import TuhiKeteManager
import logging
import gi
gi.require_version("Gtk", "3.0")
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('window')
MENU_XML = """
<?xml version="1.0" encoding="UTF-8"?>
<interface>
@ -62,6 +66,8 @@ class MainWindow(Gtk.ApplicationWindow):
self._on_dbus_online()
def _on_dbus_online(self, *args, **kwargs):
logger.debug('dbus is online')
dp = DrawingPerspective()
self._add_perspective(dp)
@ -78,6 +84,7 @@ class MainWindow(Gtk.ApplicationWindow):
self.stack_perspectives.set_visible_child_name(active.name)
def _on_new_device_registered(self, setupperspective, device):
logger.debug('device was registered')
setupperspective.disconnect_by_func(self._on_new_device_registered)
self.headerbar.set_title(f'Tuhi - {device.name}')