Esempio n. 1
0
 def on_add_clicked(self, widget):
     srvman = ServerManager()
     enteredserver = self.addentry.get_text()
     guicontroller = GuiController()
     try:
         host, port = enteredserver.split(':', 1)
         port = int(port)
         host = guicontroller.get_host_by_name(host)
         server = srvman.getServer(host, port)
     except:
         self.parent.statusbar.progressbar.set_text('Failed to add server!')
         return
     guicontroller.addFavorite(server)
     guicontroller.executeFavoritesLoading(self.parent)
     if server.isFavorite():
         self.parent.statusbar.progressbar.set_text(
             'Server successfully added')
         self.addentry.set_text('')
     else:
         self.parent.statusbar.progressbar.set_text('Failed to add server!')
Esempio n. 2
0
    def on_lookup_clicked(self, button):
        """
        Callback of the lookup button
        """
        self.lock()

        srvman = ServerManager()
        enteredserver = self.lookupentry.get_text()
        guicontroller = GuiController()
        try:
            host, port = enteredserver.split(':', 1)
            port = int(port)
            host = guicontroller.get_host_by_name(host)
            server = srvman.getServer(host, port)
        except:
            self.parent.statusbar.progressbar.set_text(
                'Failed to lookup server!')
            self.unlock()
            return
        #TODO: perform the lookup
        guicontroller.lookup_server(server, self.parenttab)