#when running from py2exe, if anything is printed to stderr #then the app shows an annoying dialog when closed stream = sys.stdout logging.basicConfig( level=logging.DEBUG, format= "[%(name)-20s][%(levelname)-7s] %(message)s (%(filename)s:%(lineno)d)", stream=stream) try: import gs except ImportError: #probbably running from the source dir sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import gs import gs.groundstation as groundstation if __name__ == "__main__": parser = gs.get_default_command_line_parser(True, True, True) options, args = parser.parse_args() if gs.IS_WINDOWS: import gtk.gdk gtk.gdk.threads_enter() groundstation.Groundstation(options).main() if gs.IS_WINDOWS: import gtk.gdk gtk.gdk.threads_leave() sys.exit(0)
verb = "Sent" elif last_message == "GPGSV": self.send_gsv() verb = "Sent" elif last_message == "GPGGA": self.send_llh() verb = "Sent" print "%s Message: %s" % (verb, last_message) else: print ok self.line = "" return True if __name__ == "__main__": parser = gs.get_default_command_line_parser(False, False, False) parser.add_option("--serial-port", default="/dev/ttyUSB1", metavar="/dev/ttyUSBn", help="Serial port of GPS receiver") parser.add_option("--serial-speed", default="9600", metavar="9600", help="Serial baud of GPS receiver") parser.add_option("--groundstation-host", default="127.0.0.1", metavar="IP ADDRESS", help="IP Address of Groundstation") parser.add_option("--groundstation-port", default=str(communication.UDP_PORT), metavar="IP PORT",
#probbably running from the source dir sys.path.insert(0,os.path.dirname(os.path.abspath(__file__))) import gs import gs.groundstation as groundstation #when running from py2exe, if anything is printed to stderr then the app #shows an annoying dialog when closed if gs.IS_WINDOWS: stream = sys.stdout else: stream = sys.stderr logging.basicConfig( level=logging.DEBUG, format="[%(name)-20s][%(levelname)-7s] %(message)s (%(filename)s:%(lineno)d)", stream=stream ) if __name__ == "__main__": parser = gs.get_default_command_line_parser(True, True, True) options, args = parser.parse_args() if gs.IS_WINDOWS: import gtk.gdk gtk.gdk.threads_enter() groundstation.Groundstation(options).main() if gs.IS_WINDOWS: import gtk.gdk gtk.gdk.threads_leave() sys.exit(0)
elif last_message == "GPGSV": self.send_gsv() verb = "Sent" elif last_message == "GPGGA": self.send_llh() verb = "Sent" print "%s Message: %s" % (verb, last_message) else: print ok self.line = "" return True if __name__ == "__main__": parser = gs.get_default_command_line_parser(False, False, False) parser.add_option( "--serial-port", default="/dev/ttyUSB1", metavar="/dev/ttyUSBn", help="Serial port of GPS receiver" ) parser.add_option("--serial-speed", default="9600", metavar="9600", help="Serial baud of GPS receiver") parser.add_option( "--groundstation-host", default="127.0.0.1", metavar="IP ADDRESS", help="IP Address of Groundstation" ) parser.add_option( "--groundstation-port", default=str(communication.UDP_PORT), metavar="IP PORT", help="IP Port of Groundstation" ) options, args = parser.parse_args() Bridge(options) gobject.MainLoop().run()
b.show() page.set_data("BUTTON", b) self._notebook.append_page(page) self._bb.pack_start(b) def remove_page(self, page): i = self._notebook.page_num(page) if i == -1: LOG.critical("Could not find page to remove") return self._notebook.remove_page(i) #remove the button too b = page.get_data("BUTTON") self._bb.remove(b) page.set_data("BUTTON", None) self._notebook.set_current_page(0) if __name__ == "__main__": parser = gs.get_default_command_line_parser(True, True, True, preferences_name="tablet.ini") options, args = parser.parse_args() if gs.IS_WINDOWS: import gtk.gdk gtk.gdk.threads_enter() UI(options).main() if gs.IS_WINDOWS: import gtk.gdk gtk.gdk.threads_leave() sys.exit(1)
self._bb.pack_start(b) def remove_page(self, page): i = self._notebook.page_num(page) if i == -1: LOG.critical("Could not find page to remove") return self._notebook.remove_page(i) #remove the button too b = page.get_data("BUTTON") self._bb.remove(b) page.set_data("BUTTON", None) self._notebook.set_current_page(0) if __name__ == "__main__": parser = gs.get_default_command_line_parser(True, True, True, preferences_name="tablet.ini") options, args = parser.parse_args() if gs.IS_WINDOWS: import gtk.gdk gtk.gdk.threads_enter() UI(options).main() if gs.IS_WINDOWS: import gtk.gdk gtk.gdk.threads_leave() sys.exit(1)
def message_received(comm, msg, header, payload): print msg if msg.size: print "\t", msg.unpack_printable_values(payload, joiner=",") def uav_connected(source, connected): if connected: verb = "connected" else: verb = "disconnected" name, config = source.get_connection_parameters() print "\n%s source %s: %s\n" % (name, verb, config) if __name__ == "__main__": parser = gs.get_default_command_line_parser(True, False, True, preferences_name="console.ini") options, args = parser.parse_args() m = messages.MessagesFile(path=options.messages, debug=options.debug) m.parse() c = config.Config(filename=options.preferences) s = source.UAVSource(c, m, options) s.connect("source-connected", uav_connected) s.communication.connect("message-received", message_received) s.connect_to_uav() gobject.MainLoop().run()