Пример #1
0
    def insertPage(self, pos, child, label, menu=None):
        """
        Insert a page into the notebook.

        If pos is -1, insert at the end; otherwise, insert a page at
        position pos (starting at 0).

        The page is made up of:
          child  in the body of the frame
          label  the label on the tab
           menu  the label in the pop-up menu (label is used if menu is None)

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a NotebookError if anything bad
        happens.
        """
        if menu is None:
            menu=label
        if self.delegate('will_insert_page', args=(pos, child, label, menu)):
            try:
                self._doInsertPage(pos, child, label, menu)
                self.debug ("notebook: setting %s's parent to %s" % (child, self))
                child.setParent (self)
            except:
                raise NotebookError, _("Unable to insert page")
            return True
        return False
Пример #2
0
    def setRowSpacings(self, spacing):
        """
        Set the space around every row.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a TableError if anything bad
        happens.
        """
        if self.delegate('will_set_row_spacings', args=spacing):
            try:
                self._doSetRowSpacings(spacing)
            except:
                raise TableError, _("Unable to set spacings")
            return True
        return False
Пример #3
0
    def setColSpacing(self, col, spacing):
        """
        Set the space around the specified column.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a TableError if anything bad
        happens.
        """
        if self.delegate("will_set_col_spacing", args=(col, spacing)):
            try:
                self._doSetColSpacing(col, spacing)
            except:
                raise TableError, _("Unable to set spacing")
            return True
        return False
Пример #4
0
    def prevPage(self):
        """
        Switch to the previous page, if there is one.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a NotebookError if anything bad
        happens.
        """
        if self.delegate('will_change_to_prev_page'):
            try:
                self._doPrevPage()
            except:
                raise NotebookError, _("Unable to go back to previous page")
            return True
        return False
Пример #5
0
    def nextPage(self):
        """
        Switch to the next page, if there is one.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a NotebookError if anything bad
        happens.
        """
        if self.delegate('will_change_to_next_page'):
            try:
                self._doNextPage()
            except:
                raise NotebookError, _("Unable to advance to next page")
            return True
        return False
Пример #6
0
    def changePage(self, n):
        """
        Switch to page number n.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a NotebookError if anything bad
        happens.
        """
        if self.delegate('will_change_to_page', args=n):
            try:
                self._doChangePage(n)
            except:
                raise NotebookError, _("Unable to change to page %d") % (n,)
            return True
        return False
Пример #7
0
    def popStatus(self):
        """
        Remove the last message pushed onto the status area.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a WindowError if anything bad
        happens.
        """
        if self.delegate('will_pop_status'):
            try:
                self._doPopStatus()
            except:
                raise WindowError, _("Unable to pop status")
            return True
        return False
Пример #8
0
    def setRowSpacings(self, spacing):
        """
        Set the space around every row.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a TableError if anything bad
        happens.
        """
        if self.delegate("will_set_row_spacings", args=spacing):
            try:
                self._doSetRowSpacings(spacing)
            except:
                raise TableError, _("Unable to set spacings")
            return True
        return False
Пример #9
0
    def setColSpacing(self, col, spacing):
        """
        Set the space around the specified column.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a TableError if anything bad
        happens.
        """
        if self.delegate('will_set_col_spacing', args=(col, spacing)):
            try:
                self._doSetColSpacing(col, spacing)
            except:
                raise TableError, _("Unable to set spacing")
            return True
        return False
Пример #10
0
    def removeStatus(self, msgid):
        """
        Remove a specific message from the status area.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a WindowError if anything bad
        happens.
        """
        if self.delegate('will_remove_status', args=msgid):
            try:
                self._doRemoveStatus(msgid)
            except:
                raise WindowError, _("Unable to remove status")
            return True
        return False
Пример #11
0
    def attach(self, widget, left, right, top, bottom):
        """
        Add widget to the table between left and right, and between
        top and bottom.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a TableError if anything bad
        happens.
        """
        if self.delegate("will_attach", args=(widget, left, right, top, bottom)):
            try:
                self._doAttach(widget, left, right, top, bottom)
            except:
                raise TableError, _("Unable to attach")
            return True
        return False
Пример #12
0
    def setTitle(self, title):
        """
        Set the title of the Window.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a WindowError if anything bad
        happens.
        """
        if self.delegate('will_set_title', args=title):
            try:
                title = unicode(title)
                self._doSetTitle(title)
            except:
                raise WindowError, _("Unable to set title")
            return True
        return False
Пример #13
0
    def attach(self, widget, left, right, top, bottom):
        """
        Add widget to the table between left and right, and between
        top and bottom.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a TableError if anything bad
        happens.
        """
        if self.delegate('will_attach',
                         args=(widget, left, right, top, bottom)):
            try:
                self._doAttach(widget, left, right, top, bottom)
            except:
                raise TableError, _("Unable to attach")
            return True
        return False
Пример #14
0
    def setSpacing(self, spacing):
        """
        Set the number of pixels to place between children.

        Argument is an integer number (the number of pixels).

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a BoxError if anything bad
        happens.
        """
        if self.delegate('will_set_spacing', args=spacing):
            try:
                self._doSetSpacing(spacing)
            except:
                raise BoxError, _("Unable to set spacing")
            return True
        return False
Пример #15
0
    def setLabel (self, text):
        """
        Set the text of the label.

        If text is None, remove the current label.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a FrameError if anything bad
        happens.
        """
        if self.delegate ('will_set_label', args=text):
            try:
                self._doSetLabel (unicode(text))
            except:
                raise FrameError, _("Unable to set label")
            return True
        return False
Пример #16
0
    def setHomogeneous(self, homogeneous):
        """
        Set whether all cells should be equally sized.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a TableError if anything bad
        happens.
        """
        if self.delegate('will_set_homogeneous', args=homogeneous):
            try:
                self._doSetHomogeneous(homogeneous)
            except:
                if homogeneous:
                    raise TableError, _("Unable to set `homogeneous' flag")
                else:
                    raise TableError, _("Unable to clear `homogeneous' flag")
            return True
        return False
Пример #17
0
    def resize(self, rows, columns):
        """
        Resize the table to the given number of rows and columns.

        This is for performance reasons: attach() resizes on-the-fly,
        but it's expensive to do so.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a TableError if anything bad
        happens.
        """
        if self.delegate('will_resize', args=(rows, columns)):
            try:
                self._doResize(rows, columns)
            except:
                raise TableError, _("Unable to resize")
            return True
        return False
Пример #18
0
    def resize(self, rows, columns):
        """
        Resize the table to the given number of rows and columns.

        This is for performance reasons: attach() resizes on-the-fly,
        but it's expensive to do so.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a TableError if anything bad
        happens.
        """
        if self.delegate("will_resize", args=(rows, columns)):
            try:
                self._doResize(rows, columns)
            except:
                raise TableError, _("Unable to resize")
            return True
        return False
Пример #19
0
    def setHomogeneous(self, homogeneous):
        """
        Set whether all cells should be equally sized.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a TableError if anything bad
        happens.
        """
        if self.delegate("will_set_homogeneous", args=homogeneous):
            try:
                self._doSetHomogeneous(homogeneous)
            except:
                if homogeneous:
                    raise TableError, _("Unable to set `homogeneous' flag")
                else:
                    raise TableError, _("Unable to clear `homogeneous' flag")
            return True
        return False
Пример #20
0
    def delete(self):
        """
        Delete the window: hide it, and remove it from the
        application.

        This is *not* destroy().

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a WindowError if anything bad
        happens.
        """
        if self.delegate('will_delete'):
            try:
                self._doHide()
                self._doDelete()
            except:
                raise WindowError, _("Unable to delete")
            return True
        return False
Пример #21
0
    def setHomogeneous(self, homogeneous):
        """
        Set whether all child widgets use the same amount of space.

        Argument is True or False.

        Returns the result of the delegation (i.e., True if delegates
        agreed to doing it). Raises a BoxError if anything bad
        happens.
        """
        if self.delegate('will_set_homogeneous', args=homogeneous):
            try:
                self._doSetHomogeneous(homogeneous)
            except:
                if homogeneous:
                    raise BoxError, _("Unable to set `homogeneous' flag")
                else:
                    raise BoxError, _("Unable to clear `homogeneous' flag")
            return True
        return False
Пример #22
0
    def pushStatus(self, status, timeout=0, icon='ok'):
        """
        Push a message onto the status area.

        Parameters:
          message  The message to be pushed
          timeout  How many seconds to leave display it,
                   0 for 'for ever'.
          icon     If possible, give the user feedback as to the
                   nature of the message. 
                   One of "ok", "nok", "warn", and "error".


        Returns a handle that can be used to remove the message later
        on, if the delegation succeeds, and False otherwise. The
        handle is True, booleanly.
        """
        if self.delegate('will_push_status', args=(status, timeout, icon)):
            try:
                return self._doPushStatus(status, timeout, icon)
            except:
                raise WindowError, _("Unable to push status")
        return False