class SynaptiksConfigDialog(KConfigDialog): """ Configuration dialog used by the system tray application. """ DIALOG_NAME = 'synaptiks-configuration' def __init__(self, touchpad, touchpad_manager, tray_config, parent=None): KConfigDialog.__init__(self, parent, self.DIALOG_NAME, tray_config) self.touchpad_config = TouchpadConfiguration(touchpad) self.management_config = ManagerConfiguration(touchpad_manager) self.setFaceType(self.List) self.touchpad_config_widget = TouchpadConfigurationWidget( self.touchpad_config, self) self.management_config_widget = TouchpadManagementWidget( self.management_config, self) self.config_widgets = [ self.touchpad_config_widget, self.management_config_widget ] for widget in self.config_widgets: widget.configurationChanged.connect(self.settingsChangedSlot) pages = [(self.management_config_widget, 'configure'), (self.touchpad_config_widget, 'synaptiks')] for page_widget, page_icon_name in pages: page = self.addPage(page_widget, page_widget.windowTitle()) page.setIcon(KIcon(page_icon_name)) def hasChanged(self): return (KConfigDialog.hasChanged(self) or any(w.is_configuration_changed for w in self.config_widgets)) def isDefault(self): return (KConfigDialog.isDefault(self) and any(w.shows_defaults() for w in self.config_widgets)) def updateWidgetsDefault(self): KConfigDialog.updateWidgetsDefault(self) for widget in self.config_widgets: widget.load_defaults() def updateWidgets(self): KConfigDialog.updateWidgets(self) for widget in self.config_widgets: widget.load_configuration() def updateSettings(self): KConfigDialog.updateSettings(self) for widget in self.config_widgets: widget.apply_configuration() self.touchpad_config.save() self.management_config.save()
class SynaptiksConfigDialog(KConfigDialog): """ Configuration dialog used by the system tray application. """ DIALOG_NAME = 'synaptiks-configuration' def __init__(self, touchpad, touchpad_manager, tray_config, parent=None): KConfigDialog.__init__(self, parent, self.DIALOG_NAME, tray_config) self.touchpad_config = TouchpadConfiguration(touchpad) self.management_config = ManagerConfiguration(touchpad_manager) self.setFaceType(self.List) self.touchpad_config_widget = TouchpadConfigurationWidget( self.touchpad_config, self) self.management_config_widget = TouchpadManagementWidget( self.management_config, self) self.config_widgets = [self.touchpad_config_widget, self.management_config_widget] for widget in self.config_widgets: widget.configurationChanged.connect(self.settingsChangedSlot) pages = [(self.management_config_widget, 'configure'), (self.touchpad_config_widget, 'synaptiks')] for page_widget, page_icon_name in pages: page = self.addPage(page_widget, page_widget.windowTitle()) page.setIcon(KIcon(page_icon_name)) def hasChanged(self): return (KConfigDialog.hasChanged(self) or any(w.is_configuration_changed for w in self.config_widgets)) def isDefault(self): return (KConfigDialog.isDefault(self) and any(w.shows_defaults() for w in self.config_widgets)) def updateWidgetsDefault(self): KConfigDialog.updateWidgetsDefault(self) for widget in self.config_widgets: widget.load_defaults() def updateWidgets(self): KConfigDialog.updateWidgets(self) for widget in self.config_widgets: widget.load_configuration() def updateSettings(self): KConfigDialog.updateSettings(self) for widget in self.config_widgets: widget.apply_configuration() self.touchpad_config.save() self.management_config.save()
def __init__(self, touchpad, touchpad_manager, tray_config, parent=None): KConfigDialog.__init__(self, parent, self.DIALOG_NAME, tray_config) self.touchpad_config = TouchpadConfiguration(touchpad) self.management_config = ManagerConfiguration(touchpad_manager) self.setFaceType(self.List) self.touchpad_config_widget = TouchpadConfigurationWidget( self.touchpad_config, self) self.management_config_widget = TouchpadManagementWidget( self.management_config, self) self.config_widgets = [self.touchpad_config_widget, self.management_config_widget] for widget in self.config_widgets: widget.configurationChanged.connect(self.settingsChangedSlot) pages = [(self.management_config_widget, 'configure'), (self.touchpad_config_widget, 'synaptiks')] for page_widget, page_icon_name in pages: page = self.addPage(page_widget, page_widget.windowTitle()) page.setIcon(KIcon(page_icon_name))
def setup_manager(self, touchpad): self.touchpad_manager = TouchpadManager(touchpad, self) ManagerConfiguration.load(self.touchpad_manager) # transition upon touchpad_on_action self.touchpad_manager.add_touchpad_switch_action( self.touchpad_on_action) # update checked state of touchpad_on_action self.touchpad_manager.states['on'].assignProperty( self.touchpad_on_action, 'checked', True) self.touchpad_manager.states['off'].assignProperty( self.touchpad_on_action, 'checked', False) # update the overlay icon self.touchpad_manager.states['on'].entered.connect( partial(self.setOverlayIconByName, 'touchpad-off')) self.touchpad_manager.states['on'].exited.connect( partial(self.setOverlayIconByName, '')) # only show notification if the touchpad is permanently switched # off self.touchpad_manager.states['off'].entered.connect( partial(self.notify_touchpad_state, True)) self.touchpad_manager.states['off'].exited.connect( partial(self.notify_touchpad_state, False)) # and eventually start managing the touchpad self.touchpad_manager.start()