From ca76028e56dd032a2ad79aafd9da88b1a1566895 Mon Sep 17 00:00:00 2001 From: Neil Date: Wed, 17 Apr 2013 11:51:53 +0200 Subject: [PATCH] Move some stuff to constants. Add QUIET flag for release --- erdslangetjie/__main__.py | 10 ++++++---- erdslangetjie/constants.py | 12 ++++++++++++ erdslangetjie/editor/editor.py | 12 +++++------- 3 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 erdslangetjie/constants.py diff --git a/erdslangetjie/__main__.py b/erdslangetjie/__main__.py index a7d594d..cd17e87 100644 --- a/erdslangetjie/__main__.py +++ b/erdslangetjie/__main__.py @@ -7,6 +7,7 @@ kivy.require('1.6.0') from kivy.app import App from kivy.core.window import Window from kivy.uix.widget import Widget +from kivy.logger import Logger, LoggerHistory from kivy.uix.relativelayout import RelativeLayout from kivy.uix.scrollview import ScrollView from kivy.graphics import Color, Rectangle @@ -14,11 +15,8 @@ from kivy.utils import platform from erdslangetjie.level import LevelList from erdslangetjie.player import ThePlayer, Nemesis +from erdslangetjie.constants import TILE_SIZE, QUIET -if platform() != 'android': - TILE_SIZE = 40 -else: - TILE_SIZE = 64 class GameWindow(RelativeLayout): @@ -255,4 +253,8 @@ class GameApp(App): def main(): """ Erdslangetjie, a maze game of eluding nemesis """ + if QUIET: + for hdlr in Logger.handlers[:]: + if not isinstance(hdlr, LoggerHistory): + Logger.removeHandler(hdlr) GameApp().run() diff --git a/erdslangetjie/constants.py b/erdslangetjie/constants.py new file mode 100644 index 0000000..fb9336b --- /dev/null +++ b/erdslangetjie/constants.py @@ -0,0 +1,12 @@ +from kivy.utils import platform +from kivy.config import Config + +QUIET = False # kivy logging - change for release + +if platform() != 'android': + TILE_SIZE = 38 + Config.set('graphics', 'width', '1026') + Config.set('graphics', 'height', '760') +else: + TILE_SIZE = 64 + Config.set('graphics', 'fullscreen', 'True') diff --git a/erdslangetjie/editor/editor.py b/erdslangetjie/editor/editor.py index 553132e..04c95d9 100644 --- a/erdslangetjie/editor/editor.py +++ b/erdslangetjie/editor/editor.py @@ -12,9 +12,7 @@ from kivy.graphics import Color, Rectangle from erdslangetjie.data import filepath, load from erdslangetjie.level import Level - - -TILE_SIZE = 24 +from erdslangetjie.constants import TILE_SIZE, QUIET class EditorWindow(FloatLayout): @@ -72,10 +70,10 @@ def main(): level = sys.argv[1] else: level = 'level1.txt' - # Uncomment to silence excessive logging - #for hdlr in Logger.handlers[:]: - # if not isinstance(hdlr, LoggerHistory): - # Logger.removeHandler(hdlr) + if QUIET: + for hdlr in Logger.handlers[:]: + if not isinstance(hdlr, LoggerHistory): + Logger.removeHandler(hdlr) EditorApp(level).run() -- 2.34.1