Giter Site home page Giter Site logo

Comments (1)

xsdg avatar xsdg commented on August 17, 2024

Adding a bit more context here, since it's related to the long-term fix for #464

How this used to work is that various components around the app (including from the tray) would use preferences.ConfigSectionMap and config.config_manager, or a bare RawConfigParser (from python stdlib) to read and update preferences in close to realtime. This meant that updates would be saved to the mkchromecast config file, and then each time some code wanted to use a config value, it would generally (but not necessarily always) force its config_manager instance to re-read the on-disk config file before reading those values, which would ensure that the values were up-to-date.

The downside is that the config file would be re-parsed and re-read way more times than actually necessary (especially since we know that all configuration changes while mkchromecast is running would originate from preferences.py). Also, because this was being done independently all over the place, there was no real guarantee that every usage point was doing the same thing and would offer the same consistency guarantees.

The update in #453 got rid of ConfigSectionMap as well as all usage of the bare RawConfigParser, and encapsulated all configuration reading/updating within a new config.Config class. And because the codebase has standardized on reading settings from the __init__.Mkchromecast class, it makes sense to have Mkchromecast manage config options coming from the config file versus from cmdline arguments depending on whether we're in Tray mode, and having some kind of manually-triggered updating behavior when preferences.py causes a config update.

from mkchromecast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.