snakeware

Python-based Linux distro for x86-64 and RPi
git clone git://squid-tech.com/snakeware.git
Log | Files | Refs | README

commit 92b4a791dbfd1060aa54f677e06edcedaf550c3a
parent fffa4fddfc6f994b5df5be149cd2579e58c0ce09
Author: Josh Moore <jxm5210@rit.edu>
Date:   Thu, 28 May 2020 14:23:26 -0400

Handle 'test mode' more gracefully

Diffstat:
Msnakewm/wm.py | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/snakewm/wm.py b/snakewm/wm.py @@ -2,13 +2,18 @@ Snake Window Manager """ +TESTMODE = __name__ == '__main__' + import os import sys import importlib import pygame, pygame_gui -from appmenu.appmenupanel import AppMenuPanel +if TESTMODE: + from appmenu.appmenupanel import AppMenuPanel +else: + from snakewm.appmenu.appmenupanel import AppMenuPanel class SnakeWM: SCREEN = None @@ -83,7 +88,7 @@ class SnakeWM: add the app UI to the passed UIManager object. See existing apps for examples. """ - if __name__ != '__main__': + if not TESTMODE: app = 'snakewm.' + app _app = importlib.import_module(app) @@ -159,6 +164,6 @@ class SnakeWM: self.MANAGER.draw_ui(self.SCREEN) pygame.display.update() -if __name__ == '__main__': +if TESTMODE: wm = SnakeWM() wm.run()