示例#1
0
    def add_server(self):
        '''add the server with provided information'''
        self.addbutton.disabled = True
        text = self.addbutton.text
        try:
            server = ReGalData.get_sever(
                self.servertype,
                self.url,
                self.username,
                self.password)

            self.addbutton.text = 'Logging in ...'
            server.connect()

            self.addbutton.text = 'Getting Server Info ...'
            serverinfo = server.get_server_info()

            app = App.get_running_app()
            app.data.add_server(**serverinfo)

            self.manager.current = 'servers'
        except Exception as exc:
            ErrorPopup('Authentication Error', exc.message).open()
        finally:
            self.addbutton.text = text
            self.addbutton.disabled = False