def system_change(self, event):

        if not monitor.last_event:
            if __debug__: print 'spurious system_change', event	# eh?
            return

        timestamp, system = monitor.last_event	# would like to use event user_data to carry this, but not accessible in Tkinter

        if self.system['text'] != system:
            self.system['text'] = system
            self.system['image'] = ''
            self.station['text'] = EDDB.system(system) and self.STATION_UNDOCKED or ''
            if config.getint('output') & config.OUT_LOG_FILE:
                flightlog.writelog(timestamp, system)
            if config.getint('output') & config.OUT_LOG_EDSM:
                try:
                    self.status['text'] = _('Sending data to EDSM...')
                    self.w.update_idletasks()
                    edsm.writelog(timestamp, system, lambda:self.edsm.lookup(system, EDDB.system(system)))	# Do EDSM lookup during EDSM export
                    self.status['text'] = strftime(_('Last updated at {HH}:{MM}:{SS}').format(HH='%H', MM='%M', SS='%S').encode('utf-8'), localtime(timestamp)).decode('utf-8')
                except Exception as e:
                    if __debug__: print_exc()
                    self.status['text'] = unicode(e)
                    if not config.getint('hotkey_mute'):
                        hotkeymgr.play_bad()
            else:
                self.edsm.link(system)
                self.status['text'] = strftime(_('Last updated at {HH}:{MM}:{SS}').format(HH='%H', MM='%M', SS='%S').encode('utf-8'), localtime(timestamp)).decode('utf-8')
            self.edsmpoll()
Ejemplo n.º 2
0
    def system_change(self, timestamp, system):

        if self.system['text'] != system:
            self.system['text'] = system

            self.system['image'] = ''
            self.station['text'] = EDDB.system(system) and self.STATION_UNDOCKED or ''

            plug.notify_system_changed(timestamp, system)

            if config.getint('output') & config.OUT_LOG_FILE:
                flightlog.writelog(timestamp, system)
            if config.getint('output') & config.OUT_LOG_EDSM:
                try:
                    self.status['text'] = _('Sending data to EDSM...')
                    self.w.update_idletasks()
                    edsm.writelog(timestamp, system, lambda:self.edsm.lookup(system, EDDB.system(system)))	# Do EDSM lookup during EDSM export
                    self.status['text'] = strftime(_('Last updated at {HH}:{MM}:{SS}').format(HH='%H', MM='%M', SS='%S').encode('utf-8'), localtime(timestamp)).decode('utf-8')
                except Exception as e:
                    if __debug__: print_exc()
                    self.status['text'] = unicode(e)
                    if not config.getint('hotkey_mute'):
                        hotkeymgr.play_bad()
            else:
                self.edsm.link(system)
                self.status['text'] = strftime(_('Last updated at {HH}:{MM}:{SS}').format(HH='%H', MM='%M', SS='%S').encode('utf-8'), localtime(timestamp)).decode('utf-8')
            self.edsmpoll()
    def system_change(self, event):

        if not monitor.last_event:
            if __debug__: print 'spurious system_change', event  # eh?
            return

        timestamp, system = monitor.last_event  # would like to use event user_data to carry this, but not accessible in Tkinter

        if self.system['text'] != system:
            self.system['text'] = system
            self.system['image'] = ''
            self.station['text'] = EDDB.system(
                system) and self.STATION_UNDOCKED or ''
            if config.getint('output') & config.OUT_LOG_FILE:
                flightlog.writelog(timestamp, system)
            if config.getint('output') & config.OUT_LOG_EDSM:
                try:
                    self.status['text'] = _('Sending data to EDSM...')
                    self.w.update_idletasks()
                    edsm.writelog(
                        timestamp, system,
                        lambda: self.edsm.lookup(system, EDDB.system(
                            system)))  # Do EDSM lookup during EDSM export
                    self.status['text'] = strftime(
                        _('Last updated at {HH}:{MM}:{SS}').format(
                            HH='%H', MM='%M', SS='%S').encode('utf-8'),
                        localtime(timestamp)).decode('utf-8')
                except Exception as e:
                    if __debug__: print_exc()
                    self.status['text'] = unicode(e)
                    if not config.getint('hotkey_mute'):
                        hotkeymgr.play_bad()
            else:
                self.edsm.link(system)
                self.status['text'] = strftime(
                    _('Last updated at {HH}:{MM}:{SS}').format(
                        HH='%H', MM='%M', SS='%S').encode('utf-8'),
                    localtime(timestamp)).decode('utf-8')
            self.edsmpoll()
Ejemplo n.º 4
0
    def system_change(self, timestamp, system):

        if self.system['text'] != system:
            self.system['text'] = system

            self.system['image'] = ''
            self.station['text'] = EDDB.system(
                system) and self.STATION_UNDOCKED or ''

            plug.notify_system_changed(timestamp, system)

            if config.getint('output') & config.OUT_LOG_FILE:
                flightlog.writelog(timestamp, system)
            if config.getint('output') & config.OUT_LOG_EDSM:
                try:
                    self.status['text'] = _('Sending data to EDSM...')
                    self.w.update_idletasks()
                    edsm.writelog(
                        timestamp, system,
                        lambda: self.edsm.lookup(system, EDDB.system(
                            system)))  # Do EDSM lookup during EDSM export
                    self.status['text'] = strftime(
                        _('Last updated at {HH}:{MM}:{SS}').format(
                            HH='%H', MM='%M', SS='%S').encode('utf-8'),
                        localtime(timestamp)).decode('utf-8')
                except Exception as e:
                    if __debug__: print_exc()
                    self.status['text'] = unicode(e)
                    if not config.getint('hotkey_mute'):
                        hotkeymgr.play_bad()
            else:
                self.edsm.link(system)
                self.status['text'] = strftime(
                    _('Last updated at {HH}:{MM}:{SS}').format(
                        HH='%H', MM='%M', SS='%S').encode('utf-8'),
                    localtime(timestamp)).decode('utf-8')
            self.edsmpoll()
    def system_change(self, timestamp, system):

        if self.system["text"] != system:
            self.system["text"] = system

            self.system["image"] = ""
            self.station["text"] = EDDB.system(system) and self.STATION_UNDOCKED or ""

            plug.notify_system_changed(timestamp, system)

            if config.getint("output") & config.OUT_LOG_FILE:
                flightlog.writelog(timestamp, system)
            if config.getint("output") & config.OUT_LOG_EDSM:
                try:
                    self.status["text"] = _("Sending data to EDSM...")
                    self.w.update_idletasks()
                    edsm.writelog(
                        timestamp, system, lambda: self.edsm.lookup(system, EDDB.system(system))
                    )  # Do EDSM lookup during EDSM export
                    self.status["text"] = strftime(
                        _("Last updated at {HH}:{MM}:{SS}").format(HH="%H", MM="%M", SS="%S").encode("utf-8"),
                        localtime(timestamp),
                    ).decode("utf-8")
                except Exception as e:
                    if __debug__:
                        print_exc()
                    self.status["text"] = unicode(e)
                    if not config.getint("hotkey_mute"):
                        hotkeymgr.play_bad()
            else:
                self.edsm.link(system)
                self.status["text"] = strftime(
                    _("Last updated at {HH}:{MM}:{SS}").format(HH="%H", MM="%M", SS="%S").encode("utf-8"),
                    localtime(timestamp),
                ).decode("utf-8")
            self.edsmpoll()