예제 #1
0
    def clickLogin(self, widget, data=None):
        '''
        Callback when the user clicks the login button.
        
        @param widget: Button that was clicked
        @param data:
        '''

        username = util.getUnicode(self.username.get_text())
        password = util.hashPassword(self.password.get_text())

        if (self.hostname.get_child().get_text().find(':') == -1):
            self.error(
                util.ErrorMessage(_("Hostname value must be hostname:port.")))
            return

        (host, port) = self.hostname.get_child().get_text().split(':')

        try:
            port = int(port)
        except ValueError:
            self.error(util.ErrorMessage(_("Port must be a number.")))
            return

        self.client = ScrabbleClient(host, port, self)
        self.client.login(username, password, VERSION)
        widget.set_sensitive(False)