From: Neil Date: Wed, 17 Apr 2013 09:51:53 +0000 (+0200) Subject: Move some stuff to constants. Add QUIET flag for release X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=ca76028e56dd032a2ad79aafd9da88b1a1566895;p=erdslangetjie.git Move some stuff to constants. Add QUIET flag for release --- 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()