Пример #1
0
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()
Пример #2
0
    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))