Exemple #1
0
 def busy(self):
     """
     Same as View.busy, but for composites.
     """
     if self.delegate('will_busy'):
         try:
             self._doBusy()
             for i in self._children:
                 i.busy()
         except:
             raise CompositeViewError, _("Unable to busy")
         return True
     return False
Exemple #2
0
 def idle(self):
     """
     Same as View.idle, but for composites.
     """
     if self.delegate('will_idle'):
         try:
             self._doIdle()
             for i in self._children:
                 i.idle()
         except:
             raise CompositeViewError, _("Unable to idle")
         return True
     return False
    def reset(self):
        """
        Resets the StatefulControl's value to its initial value.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a ControlError if anything bad
        happens.
        """
        if self.delegate('will_reset'):
            try:
                self.setValue(self.getDefaultValue())
            except:
                raise ControlError, _("Unable to reset the value")
            return True
        return False
    def reset(self):
        """
        Resets the StatefulControl's value to its initial value.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a ControlError if anything bad
        happens.
        """
        if self.delegate('will_reset'):
            try:
                self.setValue(self.getDefaultValue())
            except:
                raise ControlError, _("Unable to reset the value")
            return True
        return False
    def submit(self):
        """
        Saves the Control's value in the Model.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a ControlError if anything bad
        happens.
        """
        if self.delegate('will_submit'):
            try:
                self.doAction()
            except:
                raise ControlError, _("Unable to save the value in the Model")
            return True
        return False
    def submit(self):
        """
        Saves the Control's value in the Model.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a ControlError if anything bad
        happens.
        """
        if self.delegate('will_submit'):
            try:
                self.doAction()
            except:
                raise ControlError, _("Unable to save the value in the Model")
            return True
        return False
    def update(self):
        """
        Reloads the Control's value from the Model.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a ControlError if anything bad
        happens.
        """
        if self.delegate('will_update'):
            try:
                value = self.loadValue()
            except:
                raise ControlError, _("Unable to reload the value from the Model")
            self.setValue(value)
            return True
        return False
    def update(self):
        """
        Reloads the Control's value from the Model.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a ControlError if anything bad
        happens.
        """
        if self.delegate('will_update'):
            try:
                value = self.loadValue()
            except:
                raise ControlError, _(
                    "Unable to reload the value from the Model")
            self.setValue(value)
            return True
        return False
    def setAlign(self, *align):
        """
        Sets the alignment of the widget.

        one arg, a tuple, (xalign, yalign):
          xalign: the horizontal alignment, from 0 (left) to 1 (right).
          yalign: the vertical alignment, from 0 (top) to 1 (bottom).
        """
        try:
            xalign, yalign = align
        except ValueError:
            xalign, yalign = align[0]
        if self.delegate('will_align', args=(xalign, yalign)):
            try:
                self._doSetAlign(xalign, yalign)
            except:
                raise MiscError, _("Unable to set alignment")
            return True
        return False
Exemple #10
0
    def setAlign(self, *align):
        """
        Sets the alignment of the widget.

        one arg, a tuple, (xalign, yalign):
          xalign: the horizontal alignment, from 0 (left) to 1 (right).
          yalign: the vertical alignment, from 0 (top) to 1 (bottom).
        """
        try:
            xalign, yalign = align
        except ValueError:
            xalign, yalign = align[0]
        if self.delegate('will_align', args=(xalign, yalign)):
            try:
                self._doSetAlign(xalign, yalign)
            except:
                raise MiscError, _("Unable to set alignment")
            return True
        return False
Exemple #11
0
    def setPadding(self, *pad):
        """
        Sets the amount of space to add around the widget.

        one optional arg, a tuple (xpad, ypad):
          xpad: the amount of space to add on the left and right of the widget,
                in pixels.
          ypad: the amount of space to add on the top and bottom of the widget,
                in pixels.

        """
        try:
            xpad, ypad = pad
        except ValueError:
            xpad, ypad = pad[0]
        if self.delegate('will_pad', args=(xpad, ypad)):
            try:
                self._doSetPadding(xpad, ypad)
            except:
                raise MiscError, _("Unable to set padding")
            return True
        return False
Exemple #12
0
    def setBorderWidth(self, width):
        """
        Set the border width of the CompositeView.

        The border width of a CompositeView is the amount of space to
        leave around the outside of the container. The only exception
        to this is Window; because toplevel windows can't leave space
        outside, they leave the space inside. The border is added on
        all sides of the container.
        

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a CompositeViewError if anything
        bad happens.
        """
        if self.delegate('will_set_border_width', args=width):
            try:
                self._doSetBorderWidth(width)
            except:
                raise CompositeViewError, _("Unable to set border width")
            return True
        return False
Exemple #13
0
    def setPadding(self, *pad):
        """
        Sets the amount of space to add around the widget.

        one optional arg, a tuple (xpad, ypad):
          xpad: the amount of space to add on the left and right of the widget,
                in pixels.
          ypad: the amount of space to add on the top and bottom of the widget,
                in pixels.

        """
        try:
            xpad, ypad = pad
        except ValueError:
            xpad, ypad = pad[0]
        if self.delegate('will_pad', args=(xpad, ypad)):
            try:
                self._doSetPadding(xpad, ypad)
            except:
                raise MiscError, _("Unable to set padding")
            return True
        return False