def __init__(self, touchpad_config, component_data, parent=None): """ Create a new synaptiks module. ``touchpad_config`` is the :class:`synaptiks.config.TouchpadConfiguration`, which is handled by this module. ``component_data`` and ``parent`` come from the ``KCModule`` constructor and are passed from the plugin entry point. """ SynaptiksKCMBase.__init__(self, component_data, parent) self.touchpad_config = touchpad_config self.setLayout(QHBoxLayout(self)) self.config_widget = TouchpadConfigurationWidget(self.touchpad_config) self.config_widget.configurationChanged.connect( self.unmanagedWidgetChangeState) self.layout().addWidget(self.config_widget)
def main(): about = KAboutData( b'synaptiks', '', ki18n('synaptiks'), str(synaptiks.__version__), ki18n('touchpad management and configuration application'), KAboutData.License_BSD, ki18n('Copyright (C) 2009, 2010 Sebastian Wiesner')) about.addAuthor(ki18n('Sebastian Wiesner'), ki18n('Maintainer'), '*****@*****.**') about.addCredit( ki18n('Valentyn Pavliuchenko'), ki18n('Debian packaging, russian translation, ' 'bug reporting and testing'), '*****@*****.**') about.setHomepage('http://synaptiks.lunaryorn.de/') about.setOrganizationDomain('synaptiks.lunaryorn.de') KCmdLineArgs.init(sys.argv, about) app = KApplication() window = KMainWindow() touchpad = Touchpad.find_first(Display.from_qt()) config = TouchpadConfiguration(touchpad) config_widget = TouchpadConfigurationWidget(config) config_widget.configurationChanged.connect( partial(print, 'config changed?')) window.setCentralWidget(config_widget) window.show() app.exec_()
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))
class TouchpadConfigurationKCM(SynaptiksKCMBase): """ Synaptiks system settings module. """ def __init__(self, touchpad_config, component_data, parent=None): """ Create a new synaptiks module. ``touchpad_config`` is the :class:`synaptiks.config.TouchpadConfiguration`, which is handled by this module. ``component_data`` and ``parent`` come from the ``KCModule`` constructor and are passed from the plugin entry point. """ SynaptiksKCMBase.__init__(self, component_data, parent) self.touchpad_config = touchpad_config self.setLayout(QHBoxLayout(self)) self.config_widget = TouchpadConfigurationWidget(self.touchpad_config) self.config_widget.configurationChanged.connect( self.unmanagedWidgetChangeState) self.layout().addWidget(self.config_widget) def defaults(self, defaults=None): """ Load the default settings into the widgets. """ self.config_widget.load_defaults() def load(self): """ Load the touchpad configuration into the widgets. """ self.config_widget.load_configuration() def save(self): """ Apply and save touchpad configuration. """ self.config_widget.apply_configuration() self.touchpad_config.save()