diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-12 13:53:14 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-12 13:53:48 +0200 |
commit | 5e0dc4b280187b2dd063b010a7c8c678f6398403 (patch) | |
tree | 466cacb2e1c36078a949318ed45ed415b594a14e | |
parent | dac64df84b0ed14199f41ac163d12ec20e497213 (diff) | |
download | MusicSampler-5e0dc4b280187b2dd063b010a7c8c678f6398403.tar.gz MusicSampler-5e0dc4b280187b2dd063b010a7c8c678f6398403.tar.zst MusicSampler-5e0dc4b280187b2dd063b010a7c8c678f6398403.zip |
Add config dump in debug mode
Fixes https://git.immae.eu/mantisbt/view.php?id=19
-rw-r--r-- | music_sampler/app.py | 3 | ||||
-rw-r--r-- | music_sampler/helpers.py | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/music_sampler/app.py b/music_sampler/app.py index ce84235..74f0acb 100644 --- a/music_sampler/app.py +++ b/music_sampler/app.py | |||
@@ -1,4 +1,4 @@ | |||
1 | from .helpers import parse_args, register_fonts, path | 1 | from .helpers import parse_args, dump_config, register_fonts, path |
2 | 2 | ||
3 | parse_args() | 3 | parse_args() |
4 | 4 | ||
@@ -12,6 +12,7 @@ from kivy.properties import ListProperty, StringProperty | |||
12 | from kivy.core.window import Window | 12 | from kivy.core.window import Window |
13 | from kivy.lang import Builder | 13 | from kivy.lang import Builder |
14 | 14 | ||
15 | dump_config() | ||
15 | register_fonts() | 16 | register_fonts() |
16 | 17 | ||
17 | 18 | ||
diff --git a/music_sampler/helpers.py b/music_sampler/helpers.py index 943e5a1..9403875 100644 --- a/music_sampler/helpers.py +++ b/music_sampler/helpers.py | |||
@@ -214,6 +214,15 @@ def parse_args(): | |||
214 | if not Config.music_path.endswith("/"): | 214 | if not Config.music_path.endswith("/"): |
215 | Config.music_path = Config.music_path + "/" | 215 | Config.music_path = Config.music_path + "/" |
216 | 216 | ||
217 | def dump_config(): | ||
218 | max_size = max(max(map(len, Configs_order)), len('config')) | ||
219 | info_print("{:<{}} : {}".format( | ||
220 | "config", max_size, Config.yml_file)) | ||
221 | for item in Config.__dict__: | ||
222 | if item in Configs_order: | ||
223 | info_print("{:<{}} : {}".format( | ||
224 | item, max_size, getattr(Config, item))) | ||
225 | |||
217 | def build_config(args): | 226 | def build_config(args): |
218 | stream = open(Config.yml_file, "r") | 227 | stream = open(Config.yml_file, "r") |
219 | try: | 228 | try: |
@@ -297,3 +306,10 @@ def warn_print(message, with_trace=None): | |||
297 | 306 | ||
298 | Logger.warn('MusicSampler: ' + message, exc_info=with_trace) | 307 | Logger.warn('MusicSampler: ' + message, exc_info=with_trace) |
299 | 308 | ||
309 | def info_print(message, with_trace=None): | ||
310 | if with_trace is None: | ||
311 | with_trace = (Logger.getEffectiveLevel() < logging.WARN) | ||
312 | with_trace &= (sys.exc_info()[0] is not None) | ||
313 | |||
314 | Logger.info('MusicSampler: ' + message, exc_info=with_trace) | ||
315 | |||