Esempio n. 1
0
    def __init__(self,
                 account            = None,
                 show_authorization = False,
                 on_start           = None):
        """
        Create a new login window. All arguments are passed to the
        underlying LoginWidget.

        @type  account: Exscript.Account
        @param account: An optional account that is edited.
        @type  show_authorization: bool
        @param show_authorization: Whether to show the "Authorization" entry.
        @type  on_start: function
        @param on_start: Called when the start button is clicked.
        """
        self.widget = None
        Frame.__init__(self)
        self.pack(expand = True, fill = BOTH)

        self.widget = LoginWidget(self,
                                  account,
                                  show_authorization = show_authorization)
        self.widget.pack(expand = True, fill = BOTH, padx = 6, pady = 6)

        self.buttons = _ButtonBar(self,
                                  on_cancel = self.quit,
                                  on_start  = self._on_start)
        self.buttons.pack(expand = False, fill = X, padx = 6, pady = 3)

        self._on_start_cb = on_start
Esempio n. 2
0
class LoginWindow(Frame):
    """
    A simple TkFrame that shows a LoginWidget.
    This class supports all of the same methods that LoginWidget supports;
    any calls are proxied directly to the underlying widget.
    """

    def __init__(self,
                 account            = None,
                 show_authorization = False,
                 on_start           = None):
        """
        Create a new login window. All arguments are passed to the
        underlying LoginWidget.

        @type  account: Exscript.Account
        @param account: An optional account that is edited.
        @type  show_authorization: bool
        @param show_authorization: Whether to show the "Authorization" entry.
        @type  on_start: function
        @param on_start: Called when the start button is clicked.
        """
        self.widget = None
        Frame.__init__(self)
        self.pack(expand = True, fill = BOTH)

        self.widget = LoginWidget(self,
                                  account,
                                  show_authorization = show_authorization)
        self.widget.pack(expand = True, fill = BOTH, padx = 6, pady = 6)

        self.buttons = _ButtonBar(self,
                                  on_cancel = self.quit,
                                  on_start  = self._on_start)
        self.buttons.pack(expand = False, fill = X, padx = 6, pady = 3)

        self._on_start_cb = on_start

    def __getattr__(self, name):
        return getattr(self.widget, name)

    def _on_start(self):
        self._on_start_cb(self)