Ejemplo n.º 1
0
def main():
    try:
        client = RemoteClient()

        try:
            client.connect()
        except errors.PortNameRequired, e:
            ports = client.facade.get_ports()
            if not ports:
                logging.critical('No tty to connect to')
            tty = common.pick_one(ports, "Select a port to connect:")

            logging.info('Using serial port %s' % tty)

            client.connect(tty=tty)

        bot = client.bot
Ejemplo n.º 2
0

log = logging.getLogger(__name__)


class Dummy(object):
    def __getattr__(self, key):
        return self

    def __call__(self, *args, **kwargs):
        return self

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)

    client = RemoteClient()
    try:
        client.connect()
    except Exception, ex:
        #traceback.print_exc()
        pass

    if client.bot:
        client.bot.Control()
    else:
        client.bot = Dummy()
        log.critical('Could not connect to roomba. runnin offline')
        client.bot = LocalBot()
    win = MainWindow(client.bot)
    win.show()
    status = app.exec_()