Esempio n. 1
0
    def apply(self):
        config.set(
            'output',
            #                   (self.out_td.get()   and config.OUT_MKT_TD) +
            #                   (self.out_csv.get()  and config.OUT_MKT_CSV) +
            (0) + (self.out_ship.get() and config.OUT_SHIP) +
            (config.getint('output') &
             (config.OUT_MKT_EDDN | config.OUT_SYS_EDDN
              | config.OUT_SYS_DELAY)))

        #print(f"output {config.getint('output')} {self.out_ship.get()}")

        config.set(
            'outdir',
            self.outdir.get().startswith('~') and join(config.home,
                                                       self.outdir.get()[2:])
            or self.outdir.get())

        lang_codes = {v: k for k, v in self.languages.items()}  # Codes by name
        config.set('language', lang_codes.get(self.lang.get()) or '')
        Translations.install(config.get('language') or None)

        config.set('always_ontop', self.always_ontop.get())
        config.set('theme', self.theme.get())
        config.set('dark_text', self.theme_colors[0])
        config.set('dark_highlight', self.theme_colors[1])
        theme.apply(self.parent)

        # Notify
        if self.callback:
            self.callback()
        plug.notify_prefs_changed(monitor.cmdr, monitor.is_beta)

        self._destroy()
Esempio n. 2
0
    def apply(self):
        credentials = (config.get('username'), config.get('password'))
        config.set('username', self.username.get().strip())
        config.set('password', self.password.get().strip())

        config.set('output', (self.out_bpc.get() and config.OUT_MKT_BPC) +
                   (self.out_td.get() and config.OUT_MKT_TD) +
                   (self.out_csv.get() and config.OUT_MKT_CSV) +
                   (config.OUT_MKT_MANUAL if not self.out_auto.get() else 0) +
                   (self.out_ship.get() and config.OUT_SHIP) +
                   (self.eddn_station.get() and config.OUT_MKT_EDDN) +
                   (self.eddn_system.get() and config.OUT_SYS_EDDN) +
                   (self.eddn_delay.get() and config.OUT_SYS_DELAY) +
                   (self.edsm_log.get() and config.OUT_SYS_EDSM))
        config.set(
            'outdir',
            self.outdir.get().startswith('~') and join(config.home,
                                                       self.outdir.get()[2:])
            or self.outdir.get())

        config.set('edsm_cmdrname', self.edsm_cmdr.get().strip())
        config.set('edsm_apikey', self.edsm_apikey.get().strip())

        logdir = self.logdir.get()
        if config.default_journal_dir and logdir.lower(
        ) == config.default_journal_dir.lower():
            config.set('journaldir', '')  # default location
        else:
            config.set('journaldir', logdir)
        if platform in ['darwin', 'win32']:
            config.set('hotkey_code', self.hotkey_code)
            config.set('hotkey_mods', self.hotkey_mods)
            config.set('hotkey_always', int(not self.hotkey_only.get()))
            config.set('hotkey_mute', int(not self.hotkey_play.get()))
        config.set('shipyard', self.shipyard.get())

        lang_codes = {v: k
                      for k, v in self.languages.iteritems()}  # Codes by name
        config.set('language', lang_codes.get(self.lang.get()) or '')
        Translations().install(config.get('language') or None)

        config.set('always_ontop', self.always_ontop.get())
        config.set('theme', self.theme.get())
        config.set('dark_text', self.theme_colors[0])
        config.set('dark_highlight', self.theme_colors[1])
        theme.apply(self.parent)

        config.set('anonymous', self.out_anon.get())

        plug.notify_prefs_changed()

        self._destroy()
        if self.callback:
            self.callback()
Esempio n. 3
0
    def apply(self):
        config.set('output', (self.out_td.get() and config.OUT_MKT_TD) +
                   (self.out_csv.get() and config.OUT_MKT_CSV) +
                   (config.OUT_MKT_MANUAL if not self.out_auto.get() else 0) +
                   (self.out_ship.get() and config.OUT_SHIP) +
                   (config.getint('output') &
                    (config.OUT_MKT_EDDN | config.OUT_SYS_EDDN
                     | config.OUT_SYS_DELAY)))
        config.set(
            'outdir',
            self.outdir.get().startswith('~') and join(config.home,
                                                       self.outdir.get()[2:])
            or self.outdir.get())

        logdir = self.logdir.get()
        if config.default_journal_dir and logdir.lower(
        ) == config.default_journal_dir.lower():
            config.set('journaldir', '')  # default location
        else:
            config.set('journaldir', logdir)

        if platform in ['darwin', 'win32']:
            config.set('hotkey_code', self.hotkey_code)
            config.set('hotkey_mods', self.hotkey_mods)
            config.set('hotkey_always', int(not self.hotkey_only.get()))
            config.set('hotkey_mute', int(not self.hotkey_play.get()))
        config.set('shipyard_provider', self.shipyard_provider.get())
        config.set('system_provider', self.system_provider.get())
        config.set('station_provider', self.station_provider.get())

        lang_codes = {v: k
                      for k, v in self.languages.iteritems()}  # Codes by name
        config.set('language', lang_codes.get(self.lang.get()) or '')
        Translations.install(config.get('language') or None)

        config.set('always_ontop', self.always_ontop.get())
        config.set('theme', self.theme.get())
        config.set('dark_text', self.theme_colors[0])
        config.set('dark_highlight', self.theme_colors[1])
        theme.apply(self.parent)

        # Notify
        if self.callback:
            self.callback()
        plug.notify_prefs_changed(monitor.cmdr, monitor.is_beta)

        self._destroy()
Esempio n. 4
0
    def apply(self):
        config.set('output',
                   (self.out_td.get()   and config.OUT_MKT_TD) +
                   (self.out_csv.get()  and config.OUT_MKT_CSV) +
                   (config.OUT_MKT_MANUAL if not self.out_auto.get() else 0) +
                   (self.out_ship.get() and config.OUT_SHIP) +
                   (config.getint('output') & (config.OUT_MKT_EDDN | config.OUT_SYS_EDDN | config.OUT_SYS_DELAY)))
        config.set('outdir', self.outdir.get().startswith('~') and join(config.home, self.outdir.get()[2:]) or self.outdir.get())

        logdir = self.logdir.get()
        if config.default_journal_dir and logdir.lower() == config.default_journal_dir.lower():
            config.set('journaldir', '')	# default location
        else:
            config.set('journaldir', logdir)

        if platform in ['darwin','win32']:
            config.set('hotkey_code', self.hotkey_code)
            config.set('hotkey_mods', self.hotkey_mods)
            config.set('hotkey_always', int(not self.hotkey_only.get()))
            config.set('hotkey_mute', int(not self.hotkey_play.get()))
        config.set('shipyard_provider', self.shipyard_provider.get())
        config.set('system_provider', self.system_provider.get())
        config.set('station_provider', self.station_provider.get())

        lang_codes = { v: k for k, v in self.languages.iteritems() }	# Codes by name
        config.set('language', lang_codes.get(self.lang.get()) or '')
        Translations.install(config.get('language') or None)

        config.set('always_ontop', self.always_ontop.get())
        config.set('theme', self.theme.get())
        config.set('dark_text', self.theme_colors[0])
        config.set('dark_highlight', self.theme_colors[1])
        theme.apply(self.parent)

        # Notify
        if self.callback:
            self.callback()
        plug.notify_prefs_changed(monitor.cmdr, monitor.is_beta)

        self._destroy()
Esempio n. 5
0
    def apply(self):
        if self.cmdr:
            if self.password.get().strip():
                config.set_password(self.username.get().strip(),
                                    self.password.get().strip()
                                    )  # Can fail if keyring not unlocked
            else:
                config.delete_password(self.username.get().strip(
                ))  # user may have cleared the password field
            if not config.get('cmdrs'):
                config.set('cmdrs', [self.cmdr])
                config.set('fdev_usernames', [self.username.get().strip()])
            else:
                idx = config.get('cmdrs').index(
                    self.cmdr) if self.cmdr in config.get('cmdrs') else -1
                _putfirst('cmdrs', idx, self.cmdr)
                _putfirst('fdev_usernames', idx, self.username.get().strip())

        config.set('output', (self.out_td.get() and config.OUT_MKT_TD) +
                   (self.out_csv.get() and config.OUT_MKT_CSV) +
                   (config.OUT_MKT_MANUAL if not self.out_auto.get() else 0) +
                   (self.out_ship.get() and config.OUT_SHIP) +
                   (self.eddn_station.get() and config.OUT_MKT_EDDN) +
                   (self.eddn_system.get() and config.OUT_SYS_EDDN) +
                   (self.eddn_delay.get() and config.OUT_SYS_DELAY))
        config.set(
            'outdir',
            self.outdir.get().startswith('~') and join(config.home,
                                                       self.outdir.get()[2:])
            or self.outdir.get())

        logdir = self.logdir.get()
        if config.default_journal_dir and logdir.lower(
        ) == config.default_journal_dir.lower():
            config.set('journaldir', '')  # default location
        else:
            config.set('journaldir', logdir)

        if platform in ['darwin', 'win32']:
            config.set('hotkey_code', self.hotkey_code)
            config.set('hotkey_mods', self.hotkey_mods)
            config.set('hotkey_always', int(not self.hotkey_only.get()))
            config.set('hotkey_mute', int(not self.hotkey_play.get()))
        config.set('shipyard', self.shipyard.get())

        lang_codes = {v: k
                      for k, v in self.languages.iteritems()}  # Codes by name
        config.set('language', lang_codes.get(self.lang.get()) or '')
        Translations().install(config.get('language') or None)

        config.set('always_ontop', self.always_ontop.get())
        config.set('theme', self.theme.get())
        config.set('dark_text', self.theme_colors[0])
        config.set('dark_highlight', self.theme_colors[1])
        theme.apply(self.parent)

        config.set('anonymous', self.out_anon.get())

        plug.notify_prefs_changed(monitor.cmdr, monitor.is_beta)

        self._destroy()
        if self.callback:
            self.callback()