Files
hacs_integration/custom_components/hacs/hacsbase/configuration.py
Joakim Sørensen 310d968427 Frontend reboot (#578)
* it's a start

* Updates

* updates

* something?

* init WS

* This **** will never work

* getting somewhere

* Use real data

* updates

* cleanup

* fail

* It's kinda working

* simplify

* Add TODO

* fix imports

* disable unused tabs

* changes

* progress

* more progres

* before router

* done

* fix header

* We have something

* Woho!

* Style

* needs cleanup

* clean

* fix redirect

* margin

* grid style

* numChange

* cleaning

* rename

* more info

* Add style

* Fix HTML render

* So close

* closer

* Fix legazy

* Limit information fetch

* Use repo logger

* Some events

* Add UI elements

* more translation stuff

* redo repo

* update

* fix loop

* Adds more stuff

* broken search

* "fix" search

* fix search

* Add experimental config option

* Not sure what I did here, but lets commit it so it does not get lost

* enough

* experimental docs

* Fix lgtm

* structure

* update .gitignore

* Adds repository note

* Add more serach filter options

* VersionSelector

* Handle spinners

* Repository fixes

* Start of settings

* Fix ext links

* spinner tweeks

* Add custom

* add placeholder

* fix lgtm

* build autofix

* Remove unused property

* update FE build

* Remove unused import
2019-10-01 20:56:38 +02:00

115 lines
3.2 KiB
Python

"""HACS Configuration."""
class Configuration:
"""Configuration class."""
def __init__(self, config, options):
"""Initialize."""
self.config = config
self.options = options
self.frontend_mode = "Grid"
self.config_type = None
self.config_entry = None
@property
def token(self):
"""GitHub Access token."""
if self.config.get("token") is not None:
return self.config["token"]
return None
@property
def sidepanel_title(self):
"""Sidepanel title."""
if self.config.get("sidepanel_title") is not None:
return self.config["sidepanel_title"]
return "Community"
@property
def sidepanel_icon(self):
"""Sidepanel icon."""
if self.config.get("sidepanel_icon") is not None:
return self.config["sidepanel_icon"]
return "mdi:alpha-c-box"
@property
def dev(self):
"""Dev mode active."""
if self.config.get("dev") is not None:
return self.config["dev"]
return False
@property
def plugin_path(self):
"""Plugin path."""
if self.config.get("plugin_path") is not None:
return self.config["plugin_path"]
return "www/community/"
@property
def appdaemon(self):
"""Enable appdaemon."""
if self.config.get("appdaemon") is not None:
return self.config["appdaemon"]
return False
@property
def appdaemon_path(self):
"""Appdaemon apps path."""
if self.config.get("appdaemon_path") is not None:
return self.config["appdaemon_path"]
return "appdaemon/apps/"
@property
def python_script(self):
"""Enable python_script."""
if self.config.get("python_script") is not None:
return self.config["python_script"]
return False
@property
def python_script_path(self):
"""python_script path."""
if self.config.get("python_script_path") is not None:
return self.config["python_script_path"]
return "python_scripts/"
@property
def theme(self):
"""Enable theme."""
if self.config.get("theme") is not None:
return self.config["theme"]
return False
@property
def theme_path(self):
"""Themes path."""
if self.config.get("theme_path") is not None:
return self.config["theme_path"]
return "themes/"
@property
def option_country(self):
"""Return the country filter (or None if blank)"""
if self.options is None:
return None
country = self.options.get("country")
if country == "ALL" or country is None:
return None
return country
@property
def release_limit(self):
"""Return release limit"""
if self.options is None:
return 5
return self.options.get("release_limit", 5)
@property
def experimental(self):
"""Return experimental"""
if self.options is None:
return False
return self.options.get("experimental", False)