def __init__(self, gpx_plugin, port=None, baudrate=None, timeout=0):
     self._logger = gpx_plugin._logger
     self._settings = gpx_plugin._settings
     self._printer = gpx_plugin._printer
     self._bot_cancelled = False
     if not gpx:
         self._logger.warn("Unable to import gpx module")
         raise ValueError("Unable to import gpx module")
     self.port = port
     self.baudrate = self._baudrate = baudrate
     self.timeout = timeout
     self._logger.info("GPXPrinter created, port: %s, baudrate: %s" %
                       (self.port, self.baudrate))
     self.outgoing = Queue.Queue()
     self.baudrateError = False
     data_folder = gpx_plugin.get_plugin_data_folder()
     self.profile_path = os.path.join(data_folder, "gpx.ini")
     log_path = self._settings.get_plugin_logfile_path()
     self._regex_linenumber = re.compile("N(\d+)")
     try:
         self._logger.debug("Calling gpx.connect")
         self._append(
             gpx.connect(port, baudrate, self.profile_path, log_path,
                         self._settings.get_boolean(["verbose"])))
         time.sleep(float(self._settings.get(["connection_pause"])))
         self._append(gpx.start())
         self._logger.info("gpx.connect succeeded")
     except Exception as e:
         self._logger.info("gpx.connect raised exception = %s" % e)
         raise
 def __init__(self, gpx_plugin, port=None, baudrate=None, timeout=0):
     self._logger = gpx_plugin._logger
     self._settings = gpx_plugin._settings
     self._printer = gpx_plugin._printer
     self._bot_cancelled = False
     if not gpx:
         self._logger.warn("Unable to import gpx module")
         raise ValueError("Unable to import gpx module")
     self.port = port
     self.baudrate = self._baudrate = baudrate
     self.timeout = timeout
     self._logger.info("GPXPrinter created, port: %s, baudrate: %s" % (self.port, self.baudrate))
     self.outgoing = Queue.Queue()
     self.baudrateError = False
     data_folder = gpx_plugin.get_plugin_data_folder()
     self.profile_path = os.path.join(data_folder, "gpx.ini")
     log_path = self._settings.get_plugin_logfile_path()
     self._regex_linenumber = re.compile("N(\d+)")
     try:
         self._logger.debug("Calling gpx.connect")
         self._append(
             gpx.connect(port, baudrate, self.profile_path, log_path, self._settings.get_boolean(["verbose"]))
         )
         time.sleep(float(self._settings.get(["connection_pause"])))
         self._append(gpx.start())
         self._logger.info("gpx.connect succeeded")
     except Exception as e:
         self._logger.info("gpx.connect raised exception = %s" % e)
         raise