Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Patitotective/PREFS

Repository files navigation

PREFS (abandoned)

Store and manage preferences easily.

PREFS logo

Supported Python versions PREFS version Downloads Stars

Last commit Size License MIT

Made with Python Discord server

PREFS is Python library that stores preferences in a text file with a dictionary-like structure.

Installation

On Windows:
pip install PREFS

On MacOS and Linux:
pip3 install PREFS

Getting started

To initialize your preferences you will need to instance the Prefs class with the first argument as the default preferences (the ones used the first time the program runs or whenever the file gets deleted).

import prefs

default_prefs = {
  "lang": "en", 
  "theme": {
    "background": "#ffffff", 
    "font": "UbuntuMono", 
  }, 
}

my_prefs = prefs.Prefs(default_prefs)

The above code will create a file called prefs.prefs that looks like:

#PREFS
lang='en'
theme=>
  background='#ffffff' 
  font='UbuntuMono'

Then you can change values as if it were a dictionary.

my_prefs["lang"] = "es"

And now prefs.prefs will look like:

#PREFS
lang='es'
theme=>
  background='#ffffff'
  font='UbuntuMono'

You can write your own PREFS files manually as well, to manage your application's color scheme or the translations.


About

Contact me:

v1.0.0