Пример #1
0
    def adapt(self):
        """Reimplemented to adapt the proxied object."""

        # Replace the real methods.
        self.proxied.Enable = self.update_enabled
        self.proxied.Show = self.update_visible

        return self.proxied

    def get_enabled(self):
        """Get the enabled state of the proxied object."""

        return self.proxied.IsEnabled()

    def set_enabled(self, value):
        """Set the enabled state of the proxied object."""

        wx.Window.Enable(self.proxied, value)

    def get_visible(self):
        """Get the visible state of the proxied object."""

        return self.proxied.IsShown()

    def set_visible(self, value):
        """Set the visible state of the proxied object."""

        wx.Window.Show(self.proxied, value)

AdapterBase.register_adapter(wxWindowAdapter, wx.Window)
Пример #2
0
        return self.proxied.enabled

    def set_enabled(self, value):
        """Set the enabled state of the proxied object."""

        self.proxied.enabled = value

    def get_visible(self):
        """Get the visible state of the proxied object."""

        return self.proxied.visible

    def set_visible(self, value):
        """Set the visible state of the proxied object."""

        self.proxied.visible = value

    def setattr(self, name, value):
        """Reimplemented to intercept the setting of the enabled and visible
        attributes of the proxied action.
        """

        if name == 'enabled':
            self.update_enabled(value)
        elif name == 'visible':
            self.update_visible(value)
        else:
            super(ActionAdapter, self).setattr(name, value)

AdapterBase.register_adapter(ActionAdapter, Action)
Пример #3
0
        """Reimplemented to adapt the proxied object."""

        # Replace the real methods.
        self.proxied.Enable = self.update_enabled
        self.proxied.Show = self.update_visible

        return self.proxied

    def get_enabled(self):
        """Get the enabled state of the proxied object."""

        return self.proxied.IsEnabled()

    def set_enabled(self, value):
        """Set the enabled state of the proxied object."""

        wx.Window.Enable(self.proxied, value)

    def get_visible(self):
        """Get the visible state of the proxied object."""

        return self.proxied.IsShown()

    def set_visible(self, value):
        """Set the visible state of the proxied object."""

        wx.Window.Show(self.proxied, value)


AdapterBase.register_adapter(wxWindowAdapter, wx.Window)
Пример #4
0
    def set_enabled(self, value):
        """Set the enabled state of the proxied object."""

        self.proxied.enabled = value

    def get_visible(self):
        """Get the visible state of the proxied object."""

        return self.proxied.visible

    def set_visible(self, value):
        """Set the visible state of the proxied object."""

        self.proxied.visible = value

    def setattr(self, name, value):
        """Reimplemented to intercept the setting of the enabled and visible
        attributes of the proxied action.
        """

        if name == 'enabled':
            self.update_enabled(value)
        elif name == 'visible':
            self.update_visible(value)
        else:
            super(ActionAdapter, self).setattr(name, value)


AdapterBase.register_adapter(ActionAdapter, Action)
Пример #5
0
        """Get the enabled state of the proxied object."""

        return self.proxied.isEnabled()

    def set_enabled(self, value):
        """Set the enabled state of the proxied object."""

        QtGui.QWidget.setEnabled(self.proxied, value)

    def get_visible(self):
        """Get the visible state of the proxied object."""

        return self.proxied.isVisible()

    def set_visible(self, value):
        """Set the visible state of the proxied object."""

        QtGui.QWidget.setVisible(self.proxied, value)

    def _hide(self):
        """The replacement QWidget.hide() implementation."""

        self.update_visible(False)

    def _show(self):
        """The replacement QWidget.show() implementation."""

        self.update_visible(True)

AdapterBase.register_adapter(QWidgetAdapter, QtGui.QWidget)
Пример #6
0
        return self.proxied.isEnabled()

    def set_enabled(self, value):
        """Set the enabled state of the proxied object."""

        QtGui.QWidget.setEnabled(self.proxied, value)

    def get_visible(self):
        """Get the visible state of the proxied object."""

        return self.proxied.isVisible()

    def set_visible(self, value):
        """Set the visible state of the proxied object."""

        QtGui.QWidget.setVisible(self.proxied, value)

    def _hide(self):
        """The replacement QWidget.hide() implementation."""

        self.update_visible(False)

    def _show(self):
        """The replacement QWidget.show() implementation."""

        self.update_visible(True)


AdapterBase.register_adapter(QWidgetAdapter, QtGui.QWidget)