ya2 · news · projects · code · about

some cleaning
authorFlavio Calva <f.calva@gmail.com>
Tue, 28 Jun 2022 18:40:50 +0000 (19:40 +0100)
committerFlavio Calva <f.calva@gmail.com>
Tue, 28 Jun 2022 18:40:50 +0000 (19:40 +0100)
18 files changed:
audio/music.py
gui/menu.py
ya2/build/blend2gltf.py
ya2/build/build.py
ya2/build/images.py
ya2/build/lang.py
ya2/build/models.py
ya2/build/screenshots.py
ya2/p3d/gfx.py
ya2/p3d/gui.py
ya2/p3d/p3d.py
ya2/patterns/gameobject.py
ya2/patterns/observer.py
ya2/utils/cursor.py
ya2/utils/dictfile.py
ya2/utils/functional.py
ya2/utils/lang.py
ya2/utils/log.py

index cf6c0c9bb3207d6d51eadcb49e2a52ee7456eefa..47779a2dcd695bf96a8323ce00f94a13c2b896b3 100644 (file)
@@ -1,4 +1,4 @@
-from os.path import dirname, exists, basename
+from os.path import exists, basename
 from platform import system
 from glob import glob
 from pathlib import Path
@@ -46,9 +46,12 @@ class MusicMgr:
 
     def _on_frame(self, task):
         if self._music.status() == AudioSound.READY:
-            oggs = Filename(self.curr_path + 'assets/audio/music/*.ogg').to_os_specific()
+            oggs = Filename(
+                self.curr_path + 'assets/audio/music/*.ogg').to_os_specific()
             files = glob(oggs)
-            rm_music = Filename(self.curr_path + 'assets/audio/music/' + basename(self._music.get_name())).to_os_specific()
+            rm_music = Filename(
+                self.curr_path + 'assets/audio/music/' +
+                basename(self._music.get_name())).to_os_specific()
             # basename is needed in windows
             files.remove(rm_music)
             self._start_music(files)
index 335fadec4c061f61e97bccf8d8c3984e17f53db6..ab2248f8bb81b4ee6034a579578219de0bd4fabb 100644 (file)
@@ -1,27 +1,23 @@
 from logging import info, debug
 from sys import platform, exit
 from os import environ, system
-from glob import glob
-from importlib import import_module
-from inspect import isclass
 from webbrowser import open_new_tab
 from xmlrpc.client import ServerProxy
 from panda3d.core import Texture, TextNode, WindowProperties, LVector2i, \
-    TextProperties, TextPropertiesManager, NodePath
+    TextProperties, TextPropertiesManager
 from direct.gui.DirectGui import DirectButton, DirectCheckButton, \
-    DirectOptionMenu, DirectSlider, DirectCheckButton
+    DirectOptionMenu, DirectSlider
 from direct.gui.DirectGuiGlobals import FLAT
 from direct.gui.OnscreenText import OnscreenText
 from direct.showbase.DirectObject import DirectObject
 from ya2.utils.cursor import MouseCursor
 from ya2.p3d.p3d import LibP3d
-from logics.scene import Scene
-from panda3d.bullet import BulletWorld
 
 
 class Menu(DirectObject):
 
-    def __init__(self, fsm, lang_mgr, opt_file, music, pipeline, scenes, fun_test, pos_mgr):
+    def __init__(self, fsm, lang_mgr, opt_file, music, pipeline, scenes,
+                 fun_test, pos_mgr):
         super().__init__()
         self._fsm = fsm
         self._lang_mgr = lang_mgr
@@ -33,9 +29,10 @@ class Menu(DirectObject):
         self._pos_mgr = pos_mgr
         self._enforced_res = ''
         self._cursor = MouseCursor(
-            'assets/images/buttons/arrowUpLeft.dds', (.04, 1, .04), (.5, .5, .5, 1),
-            (.01, .01))
-        self._font = base.loader.load_font('assets/fonts/Hanken-Book.ttf')
+            'assets/images/buttons/arrowUpLeft.dds', (.04, 1, .04),
+            (.5, .5, .5, 1), (.01, .01))
+        self._font = base.loader.load_font(
+            'assets/fonts/Hanken-Book.ttf')
         self._font.clear()
         self._font.set_pixels_per_unit(60)
         self._font.set_minfilter(Texture.FTLinearMipmapLinear)
@@ -47,8 +44,10 @@ class Menu(DirectObject):
             'text_fg': (.9, .9, .9, 1),
             'relief': FLAT,
             'frameColor': (.4, .4, .4, .14),
-            'rolloverSound': loader.load_sfx('assets/audio/sfx/rollover.ogg'),
-            'clickSound': loader.load_sfx('assets/audio/sfx/click.ogg')}
+            'rolloverSound': loader.load_sfx(
+                'assets/audio/sfx/rollover.ogg'),
+            'clickSound': loader.load_sfx(
+                'assets/audio/sfx/click.ogg')}
         self._common_btn = {'frameSize': (-4.8, 4.8, -.6, 1.2)} | self._common
         hlc = self._common_btn['frameColor']
         hlc = (hlc[0] + .2, hlc[1] + .2, hlc[2] + .2, hlc[3] + .2)
@@ -92,6 +91,7 @@ class Menu(DirectObject):
             text=_('Credits'), pos=(0, 1, -.2), command=self.on_credits,
             **self._common_btn)]
         self._pos_mgr.register('credits', LibP3d.wdg_pos(self._widgets[-1]))
+
         def btn_exit():
             if self._fun_test:
                 ServerProxy('http://localhost:6000').destroy()
index b43f09f6238dadc192feb9651eb1a96850c891ed..565946335796ddfd1e8d63b7aca1e430edd4bb1e 100644 (file)
@@ -1,4 +1,6 @@
-import bpy, sys, os
+import bpy
+import sys
+import os
 
 filepath = os.path.abspath(sys.argv[-1])
 bpy.ops.export_scene.gltf(
index 420a7eb7f63ae633dd22c29045f5ca825ef799e9..52242e5854ac7737791c63331f49e33b5e5d80a8 100644 (file)
@@ -1,20 +1,19 @@
 '''Tools for making the builds.'''
 from os import walk, chdir, getcwd
-from os.path import join, getsize, exists, dirname, getmtime, sep
-from subprocess import Popen, PIPE, run
-from logging import debug
+from os.path import join, exists, dirname, getmtime, sep
+from subprocess import PIPE, run
 from time import strftime
 from pathlib import Path
 from hashlib import md5
 
 
-#TODO refactor: make class BuilderTools
+# TODO refactor: make class BuilderTools
 
 
 def exec_cmd(cmd):
     '''Synchronously executes a command and returns its output.'''
-    #ret = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True).communicate()
-    #return ret[0].decode('utf-8').strip()
+    # ret = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True).communicate()
+    # return ret[0].decode('utf-8').strip()
     proc = run(cmd, shell=True, stdout=PIPE, stderr=PIPE, universal_newlines=True)
     return proc.stdout.strip() + proc.stderr.strip()
 
@@ -38,7 +37,7 @@ def _branch():
             with open(root + 'assets/bld_version.txt') as fver:
                 ver = fver.read()
                 print('ver: %s' % ver)
-            #if branch in ver:
+            # if branch in ver:
             b2c = {'master': 'a', 'rc': 'r', 'stable': '.'}
             if ver[1] == b2c[branch]:
                 return branch
@@ -81,9 +80,9 @@ def _version():
                 _ver = fver.read().strip()
         ret_ver = _ver or ('0.' + day)
     else:
-        #try:  we want an error!
+        # try:  we want an error!
         pref = {'master': 'a', 'rc': 'rc', '': 'runtime'}[_branch()]
-        #except KeyError:
+        # except KeyError:
         #    pref = 'notfound'
         ret_ver = '0%s%s' % (pref, day)
         pref = ret_ver
@@ -165,7 +164,7 @@ bld_dpath = 'build/'
 branch = _branch()
 ver = _version()
 win_fpath = '{dst_dir}{appname}-%s-windows.exe' % branch
-#osx_fpath = '{dst_dir}{appname}-%s-osx.zip' % branch
-#flatpak_fpath = '{dst_dir}{appname}-%s-flatpak' % branch
+# osx_fpath = '{dst_dir}{appname}-%s-osx.zip' % branch
+# flatpak_fpath = '{dst_dir}{appname}-%s-flatpak' % branch
 appimage_fpath = '{dst_dir}{appname}-%s-appimage' % branch
-#docs_fpath = '{dst_dir}{appname}-%s-docs.tar.gz' % branch
+# docs_fpath = '{dst_dir}{appname}-%s-docs.tar.gz' % branch
index 839960a1be3922e8c74085e543850c8c5355cf46..42f2d46204f111bb5470419a0682472ef37e565c 100644 (file)
@@ -1,9 +1,7 @@
-from os.path import dirname
-from sys import executable
 from ya2.build.mtprocesser import ProcesserMgr
 
 
-#TODO refactor: make class ImagesBuilder
+# TODO refactor: make class ImagesBuilder
 
 
 def bld_images(files, cores):
@@ -14,5 +12,5 @@ def bld_images(files, cores):
 
 def __bld_img(fname_mp_mgr):
     fname, mp_mgr = fname_mp_mgr
-    curr_path = dirname(__file__)
+    curr_path = dirname(__file__)
     mp_mgr.add('convert "%s" "%s"' % (fname, fname[:-3] + 'dds'))
index 3d58730baaf7ff4f0d97ac31efe2d4f60bd15ad5..b18d19fc8976e7cb3830ab8b6eef3e6a5821a628 100644 (file)
@@ -38,7 +38,8 @@ class LanguageBuilder:
         lng_dir = lng_base_dir + lng + '/LC_MESSAGES/'
         if not exists('assets/locale/po/' + lng + '.po'):
             lines_to_fix = ['CHARSET/UTF-8', 'ENCODING/8bit']
-            [LanguageBuilder.__fix_line(line, lng_dir, appname) for line in lines_to_fix]
+            [LanguageBuilder.__fix_line(line, lng_dir, appname)
+             for line in lines_to_fix]
             copy(lng_dir + appname + '.pot', lng_dir + appname + '.po')
         return lng_dir
 
@@ -59,7 +60,8 @@ class LanguageBuilder:
         cmd = cmd.format(lng_dir=lng_dir, lng_code=lng_code, appname=appname,
                          tgt_path=tgt_path)
         system(cmd)
-        copy(lng_dir + appname + 'merge.po', 'assets/locale/po/%s.po' % lng_code)
+        copy(lng_dir + appname + 'merge.po',
+             'assets/locale/po/%s.po' % lng_code)
         poname_tmpl = '{lng_dir}{appname}merge.po'
         remove(poname_tmpl.format(lng_dir=lng_dir, appname=appname))
 
index bf9f473fbf334573445c707f74d5071cbae3082e..dd2ef8ba7040a2f0f4edda5f59a058f04103ef51 100644 (file)
@@ -1,12 +1,10 @@
 '''Provides tools for building models.'''
 from logging import info
 from os import system, walk, makedirs
-from os.path import exists, basename, dirname
+from os.path import exists, dirname
 from multiprocessing import Pool
-from glob import glob
 from hashlib import md5
-from shutil import copyfile, move, rmtree
-from ya2.build.mtprocesser import ProcesserMgr
+from shutil import copyfile, rmtree
 from ya2.build.build import to_be_built
 
 
@@ -20,15 +18,16 @@ class ModelsBuilder():
         ones.'''
         args = []
         for root, _, fnames in walk(blend_path):
-            for fname in [fname for fname in fnames if fname.endswith('.blend')]:
+            blends = [fname for fname in fnames if fname.endswith('.blend')]
+            for fname in blends:
                 if '/prototypes/' not in root:
                     args += [(root, fname)]
         with Pool() as p:
             p.starmap(self._export_blend, args)
         # caching is broken now: it is based on the previous
         # non-multiprocessing approach
-        # i should evaluate if fix it or just change the blend_path for building
-        # only specific models
+        # i should evaluate if fix it or just change the blend_path for
+        # building only specific models
         cache, lines = [], []
         if exists('hash_cache.txt'):
             with open('hash_cache.txt') as fhash:
@@ -57,7 +56,7 @@ class ModelsBuilder():
         new_dir = root.replace('assets/models/blend/', pgltf)
         rmtree(new_dir, ignore_errors=True)
         makedirs(new_dir)
-        #files_before = [basename(gname) for gname in glob('./*')]
+        # files_before = [basename(gname) for gname in glob('./*')]
         cmd = 'blender %s --background --python ya2/build/blend2gltf.py '
         cmd += '-- %s.gltf'
         cmd = cmd % (_fname, new_dir + '/' + fname[:-6])
@@ -67,15 +66,15 @@ class ModelsBuilder():
             return False
         system(cmd)
         self._cache_files += [_fname, gltf_name]
-        #files_after = [basename(gname) for gname in glob('./*')]
-        #new_files = [nnm for nnm in files_after if nnm not in files_before]
-        #new_dir = root.replace('assets/models/blend/', pgltf)
-        #rmtree(new_dir, ignore_errors=True)
-        #makedirs(new_dir)
-        #for mname in new_files:
-        #    new_name = '%s/%s' % (new_dir, mname)
-        #    move(mname, new_name)
-        #    info('move %s %s' % (mname, new_name))
+        # files_after = [basename(gname) for gname in glob('./*')]
+        # new_files = [nnm for nnm in files_after if nnm not in files_before]
+        # new_dir = root.replace('assets/models/blend/', pgltf)
+        # rmtree(new_dir, ignore_errors=True)
+        # makedirs(new_dir)
+        # for mname in new_files:
+        #     new_name = '%s/%s' % (new_dir, mname)
+        #     move(mname, new_name)
+        #     info('move %s %s' % (mname, new_name))
         # # blender rewrites metal files: let's restore them
         # metal_files = [fnm for fnm in glob(new_dir + '/*') if 'metal' in fnm]
         # for metal_file in metal_files:
@@ -112,7 +111,12 @@ class ModelsBuilder():
             makedirs(dirname(tgt), exist_ok=True)
             info('convert %s %s' % (dep, tgt))
             system('convert %s %s' % (dep, tgt))
-        rpl = lambda lin: lin.replace('.png', '.dds').replace('.jpg', '.dds').replace('/png', '/dds').replace('/jpg', '/dds')
+
+        def rpl(lin):
+            lin = lin.replace('.png', '.dds')
+            lin = lin.replace('.jpg', '.dds')
+            lin = lin.replace('/png', '/dds')
+            return lin.replace('/jpg', '/dds')
         with open(gltf_name, 'w') as fgltf:
             fgltf.write(''.join([rpl(line) for line in lines]))
         makedirs(dirname(bam_name), exist_ok=True)
index 964cc595e0e726bcbdcd3402d54e4b88e0d87a51..426e5885e88119e354a10e5ce28a3cd22fb346b2 100644 (file)
@@ -1,9 +1,5 @@
 from os import system
-from glob import glob
-from importlib import import_module
-from inspect import isclass
 from multiprocessing import Pool
-from logics.scene import Scene
 
 
 def do_screenshot(cls):
index 56f6a8704b15c78eec2292c6a59d998693354daf..7eb5281d65ade073697e597f73232e78868cf4a0 100755 (executable)
@@ -1,13 +1,8 @@
 import datetime
-from logging import debug, info
+from logging import info
 from os import getcwd
-from os.path import exists, dirname
-from panda3d.core import get_model_path, AntialiasAttrib, PandaNode, \
-    LightRampAttrib, Camera, OrthographicLens, NodePath, OmniBoundingVolume, \
-    AmbientLight as P3DAmbientLight, Spotlight as P3DSpotlight, Point2, \
-    Point3, Texture
-from direct.filter.CommonFilters import CommonFilters
-from direct.actor.Actor import Actor
+from panda3d.core import AntialiasAttrib, PandaNode, LightRampAttrib, \
+    NodePath, Point2, Point3, Texture
 # from ya2.lib.p3d.p3d import LibP3d
 
 
@@ -62,34 +57,34 @@ def set_srgb(model):
 
 class P3dGfxMgr:
 
-    def __init__(self, model_path, antialiasing, shaders, srgb):
-        self.root = P3dNode(render)
-        self.__srgb = srgb
-        self.callbacks = {}
-        self.filters = None
-        get_model_path().append_directory(model_path)
-        if LibP3d.runtime():
-            root_dir = LibP3d.p3dpath(dirname(__file__))
-            paths = [root_dir + '/' + model_path, root_dir]
-            list(map(get_model_path().append_directory, paths))
-        render.set_shader_auto()
-        # render.set_two_sided(True)  # it breaks shadows
-        if antialiasing: render.set_antialias(AntialiasAttrib.MAuto)
-        if shaders and base.win:
-            self.filters = CommonFilters(base.win, base.cam)
-
-    def load_model(self, filename, callback=None, anim=None):
-        ext = '.bam' if exists(filename + '.bam') else ''
-        if anim:
-            anim_dct = {'anim': filename + '-Anim' + ext}
-            node = P3dNode(self.set_srgb(Actor(filename + ext, anim_dct)))
-        elif callback:
-            callb = lambda model: callback(P3dNode(self.set_srgb(model)))
-            node = loader.loadModel(filename + ext, callback=callb)
-        else:
-            node = P3dNode(self.set_srgb(
-                loader.loadModel(LibP3d.p3dpath(filename + ext))))
-        return node
+    def __init__(self, model_path, antialiasing, shaders, srgb):
+        self.root = P3dNode(render)
+        self.__srgb = srgb
+        self.callbacks = {}
+        self.filters = None
+        get_model_path().append_directory(model_path)
+        if LibP3d.runtime():
+            root_dir = LibP3d.p3dpath(dirname(__file__))
+            paths = [root_dir + '/' + model_path, root_dir]
+            list(map(get_model_path().append_directory, paths))
+        render.set_shader_auto()
+        # render.set_two_sided(True)  # it breaks shadows
+        if antialiasing: render.set_antialias(AntialiasAttrib.MAuto)
+        if shaders and base.win:
+            self.filters = CommonFilters(base.win, base.cam)
+
+    def load_model(self, filename, callback=None, anim=None):
+        ext = '.bam' if exists(filename + '.bam') else ''
+        if anim:
+            anim_dct = {'anim': filename + '-Anim' + ext}
+            node = P3dNode(self.set_srgb(Actor(filename + ext, anim_dct)))
+        elif callback:
+            callb = lambda model: callback(P3dNode(self.set_srgb(model)))
+            node = loader.loadModel(filename + ext, callback=callb)
+        else:
+            node = P3dNode(self.set_srgb(
+                loader.loadModel(LibP3d.p3dpath(filename + ext))))
+        return node
 
     def set_srgb(self, model):
         if self.__srgb:
@@ -105,7 +100,8 @@ class P3dGfxMgr:
         aa_not_none = render.get_antialias() != AntialiasAttrib.MNone
         if render.has_antialias() and aa_not_none:
             render.clear_antialias()
-        else: render.set_antialias(AntialiasAttrib.MAuto, 1)
+        else:
+            render.set_antialias(AntialiasAttrib.MAuto, 1)
 
     def set_toon(self):
         tmp_node = NodePath(PandaNode('temp node'))
@@ -115,7 +111,8 @@ class P3dGfxMgr:
         self.filters.set_cartoon_ink(separation=1)
 
     def set_bloom(self):
-        if not base.win: return
+        if not base.win:
+            return
         self.filters.setBloom(
             blend=(.3, .4, .3, 0), mintrigger=.6, maxtrigger=1.0, desat=.6,
             intensity=1.0, size='medium')
@@ -136,15 +133,18 @@ class P3dGfxMgr:
         coord2d = Point2()
         base.camLens.project(coord3d, coord2d)
         coord_r2d = Point3(coord2d[0], 0, coord2d[1])
-        coord_a2d = base.aspect2d.get_relative_point(render2d, coord_r2d)
+        coord_a2d = base.aspect2d.get_relative_point(
+            render2d, coord_r2d)
         return coord_a2d[0], coord_a2d[2]
 
     @staticmethod
     def world_from_to(pos):
         p_from, p_to = Point3(), Point3()    # in camera coordinates
         base.camLens.extrude(pos, p_from, p_to)
-        p_from = render.get_relative_point(base.cam, p_from)  # global coords
-        p_to = render.get_relative_point(base.cam, p_to)  # global coords
+        p_from = render.get_relative_point(
+            base.cam, p_from)  # global coords
+        p_to = render.get_relative_point(
+            base.cam, p_to)  # global coords
         return p_from, p_to
 
     @property
@@ -153,29 +153,34 @@ class P3dGfxMgr:
 
     def screenshot(self, path=None):
         time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
-        #res = base.win.save_screenshot(Filename(path or ("yocto%s.png" % time)))
-        #debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
-        res = base.screenshot(path or ("pmachines%s.png" % time), False)
-        info('screenshot %s (%s; %s)' % (path or ("pmachines%s.png" % time), res, getcwd()))
+        # res = base.win.save_screenshot(
+        #     Filename(path or ("yocto%s.png" % time)))
+        # debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
+        res = base.screenshot(
+            path or ("pmachines%s.png" % time), False)
+        info('screenshot %s (%s; %s)' % (path or ("pmachines%s.png" % time),
+                                         res, getcwd()))
 
     @staticmethod
-    def enable_shader(): render.set_shader_auto()
+    def enable_shader():
+        render.set_shader_auto()
 
     @staticmethod
-    def disable_shader(): render.set_shader_off()
+    def disable_shader():
+        render.set_shader_off()
 
     @staticmethod
     def print_stats(two_d=True, three_d=True, analyze=True, ls=True):
         '''Print graphics stats. They use standard output (from p3d).'''
         info = []
         if two_d and analyze:
-            info +=[('render2d.analyze', base.render2d.analyze)]
+            info += [('render2d.analyze', base.render2d.analyze)]
         if three_d and analyze:
-            info +=[('render.analyze', base.render.analyze)]
+            info += [('render.analyze', base.render.analyze)]
         if two_d and ls:
-            info +=[('render2d.ls', base.render2d.ls)]
+            info += [('render2d.ls', base.render2d.ls)]
         if three_d and ls:
-            info +=[('render.ls', base.render.ls)]
+            info += [('render.ls', base.render.ls)]
         for elm in info:
             print('\n\n#####\n%s()' % elm[0])
             elm[1]()
@@ -292,7 +297,8 @@ class P3dGfxMgr:
 #         if model: return self.__get_pandanode(model)
 
 #     def optimize(self):
-#         self.node.prepare_scene(base.win.get_gsg())  # crash with texture.set_format
+#         # crash with texture.set_format
+#         self.node.prepare_scene(base.win.get_gsg())
 #         self.node.premunge_scene(base.win.get_gsg())
 
 #     def hide(self, mask=None):
index 46d2a21d8a3c15d76d465574ea8d52cd8fa483e6..70381abb8bf2615370a2850e02270d5dd31b0348 100755 (executable)
@@ -1,19 +1,6 @@
 from inspect import getmro
-from panda3d.core import TextNode, Texture
-from direct.gui.DirectGuiGlobals import FLAT, ENTER, EXIT, DISABLED, NORMAL, \
-    B1PRESS
-from direct.showbase.DirectObject import DirectObject
-from direct.gui.DirectButton import DirectButton
-from direct.gui.DirectCheckButton import DirectCheckButton
-from direct.gui.DirectOptionMenu import DirectOptionMenu
+from direct.gui.DirectGuiGlobals import ENTER, EXIT
 from direct.gui.OnscreenImage import OnscreenImage
-from direct.gui.DirectSlider import DirectSlider
-from direct.gui.DirectEntry import DirectEntry, ENTRY_FOCUS_STATE
-from direct.gui.DirectLabel import DirectLabel
-from direct.gui.DirectFrame import DirectFrame
-from direct.gui.OnscreenText import OnscreenText
-from direct.gui.DirectScrolledFrame import DirectScrolledFrame
-from ya2.patterns.observer import Subject
 # from ya2.lib.ivals import Seq, Wait, PosIval, Func
 
 
@@ -41,31 +28,33 @@ class CommonBase:
         clsname = self.__class__.__name__ + 'Widget'
         self.__class__ = type(clsname, (self.__class__, par_cls), {})
         self.init(self)
-        if not hasattr(self, 'bind'): return
+        if not hasattr(self, 'bind'):
+            return
         bind_args = [(ENTER, self.on_wdg_enter), (EXIT, self.on_wdg_exit)]
         list(map(lambda args: self.bind(*args), bind_args))
 
-    def set_enter_transition(self):
-        start_pos = self.get_pos()
-        pos = self.pos - (3.6, 0)
-        self.set_pos((pos.x, 1, pos.y))
-        Seq(
-            Wait(abs(pos.y - 1) / 4),
-            PosIval(self.get_np(), .5, start_pos)
-        ).start()
-
-    def set_exit_transition(self, destroy):
-        start_pos = self.get_pos()
-        end_pos = (self.pos.x + 3.6, 1, self.pos.y)
-        seq = Seq(
-            Wait(abs(self.pos.y - 1) / 4),
-            PosIval(self.get_np(), .5, end_pos),
-            Func(self.destroy if destroy else self.hide))
-        if not destroy: seq += Func(self.set_pos, start_pos)
-        seq.start()
+    def set_enter_transition(self):
+        start_pos = self.get_pos()
+        pos = self.pos - (3.6, 0)
+        self.set_pos((pos.x, 1, pos.y))
+        Seq(
+            Wait(abs(pos.y - 1) / 4),
+            PosIval(self.get_np(), .5, start_pos)
+        ).start()
+
+    def set_exit_transition(self, destroy):
+        start_pos = self.get_pos()
+        end_pos = (self.pos.x + 3.6, 1, self.pos.y)
+        seq = Seq(
+            Wait(abs(self.pos.y - 1) / 4),
+            PosIval(self.get_np(), .5, end_pos),
+            Func(self.destroy if destroy else self.hide))
+        if not destroy: seq += Func(self.set_pos, start_pos)
+        seq.start()
 
     def translate(self):
-        if hasattr(self, 'bind_transl'): self.wdg['text'] = self.bind_transl
+        if hasattr(self, 'bind_transl'):
+            self.wdg['text'] = self.bind_transl
 
 
 class P3dImg(CommonBase):
@@ -74,30 +63,34 @@ class P3dImg(CommonBase):
                  foreground=False, parent=None):
         self.img = OnscreenImage(
             filepath, pos=(pos[0], 1, pos[1]), scale=scale, parent=parent)
-        if background: self.img.set_bin('background', 10)
+        if background:
+            self.img.set_bin('background', 10)
         alpha_formats = [12]  # panda3d.core.texture.Frgba
         if self.img.get_texture().get_format() in alpha_formats:
             self.img.set_transparency(True)
-        if foreground: self.img.set_bin('gui-popup', 50)
+        if foreground:
+            self.img.set_bin('gui-popup', 50)
 
     def reparent_to(self, node): return self.img.reparent_to(node)
     def show(self): return self.img.show()
     def hide(self): return self.img.hide()
     def set_shader(self, shader): return self.img.set_shader(shader)
+
     def set_shader_input(self, name, val):
         return self.img.set_shader_input(name, val)
+
     def set_texture(self, texturestage, texture):
         return self.img.set_texture(texturestage, texture)
 
-    def set_exit_transition(self, destroy):
-        start_pos = self.get_pos()
-        end_pos = (self.pos.x + 3.6, 1, self.pos.y)
-        seq = Seq(
-            Wait(abs(self.pos.y - 1) / 4),
-            PosIval(self.get_np(), .5, end_pos),
-            Func(self.destroy if destroy else self.hide))
-        if not destroy: seq += Func(self.set_pos, (start_pos[0], start_pos[2]))
-        seq.start()
+    def set_exit_transition(self, destroy):
+        start_pos = self.get_pos()
+        end_pos = (self.pos.x + 3.6, 1, self.pos.y)
+        seq = Seq(
+            Wait(abs(self.pos.y - 1) / 4),
+            PosIval(self.get_np(), .5, end_pos),
+            Func(self.destroy if destroy else self.hide))
+        if not destroy: seq += Func(self.set_pos, (start_pos[0], start_pos[2]))
+        seq.start()
 
     def set_pos(self, pos): return self.img.set_pos(pos[0], 1, pos[1])
 
@@ -187,7 +180,8 @@ class P3dImg(CommonBase):
 #             text=text, parent=parent, pos=(pos[0], 1, pos[1]),
 #             scale=(scale[0], 1, scale[1]), command=cmd,
 #             frameSize=frame_size, clickSound=click_snd, text_fg=text_fg,
-#             frameColor=frame_col, text_font=text_font, rolloverSound=over_snd,
+#             frameColor=frame_col, text_font=text_font,
+#             rolloverSound=over_snd,
 #             extraArgs=extra_args, frameTexture=frame_texture, image=img,
 #             text_scale=text_scale)
 #         P3dAbs.__init__(self, tra_src, tra_tra)
@@ -287,7 +281,8 @@ class P3dImg(CommonBase):
 #         self.wdg = DirectEntry(
 #             scale=scale, pos=(pos[0], 1, pos[1]), entryFont=entry_font,
 #             width=width, frameColor=frame_col, initialText=initial_text,
-#             obscured=obscured, command=cmd, focusInCommand=self._focus_in_cmd,
+#             obscured=obscured, command=cmd,
+#             focusInCommand=self._focus_in_cmd,
 #             focusInExtraArgs=focus_in_args,
 #             focusOutCommand=self._focus_out_cmd,
 #             focusOutExtraArgs=focus_out_args, parent=parent,
@@ -338,7 +333,8 @@ class P3dImg(CommonBase):
 #     def __init__(
 #             self, text='', pos=(0, 0), parent=None, text_wordwrap=12,
 #             text_align=None, text_fg=(1, 1, 1, 1), text_font=None, scale=.05,
-#             frame_col=(1, 1, 1, 1), tra_src=None, tra_tra=None, hpr=(0, 0, 0)):
+#             frame_col=(1, 1, 1, 1), tra_src=None, tra_tra=None,
+#             hpr=(0, 0, 0)):
 #         self.wdg = DirectLabel(
 #             text=text, pos=(pos[0], 1, pos[1]), parent=parent,
 #             text_wordwrap=text_wordwrap, text_align=text_align,
@@ -346,7 +342,8 @@ class P3dImg(CommonBase):
 #             frameColor=frame_col, hpr=hpr)
 #         P3dAbs.__init__(self, tra_src, tra_tra)
 
-#     def set_bin(self, bin_name, priority): return self.wdg.set_bin(bin_name, priority)
+#     def set_bin(self, bin_name, priority):
+#         return self.wdg.set_bin(bin_name, priority)
 
 #     def set_x(self, x): return self.wdg.set_x(x)
 
index 2ea7b6f9e2f4d9f469f093004f83e3cb337d3730..90799158da16a3b91eaa283596ecab629b076a65 100755 (executable)
@@ -1,16 +1,15 @@
 import sys
 from logging import info
 from os.path import exists, dirname
-from os import getcwd, _exit
+from os import _exit
 from glob import glob
 from pathlib import Path
 from panda3d.core import loadPrcFileData, Texture, TextPropertiesManager, \
     TextProperties, PandaSystem, Filename, WindowProperties, GraphicsWindow
 from panda3d.bullet import get_bullet_version
-from direct.showbase.ShowBase import ShowBase
 from direct.showbase.DirectObject import DirectObject
 from direct.task.Task import Task
-#from gltf import patch_loader
+# from gltf import patch_loader
 
 
 # class LibShowBase(ShowBase): pass
@@ -37,7 +36,8 @@ class LibP3d(DirectObject):
     def fixpath(path):
         home = '/home/flavio'
         if sys.platform == 'win32' and not exists(exists(home + '/.wine/')):
-            if path.startswith('/'): path = path[1] + ':\\' + path[3:]
+            if path.startswith('/'):
+                path = path[1] + ':\\' + path[3:]
             path = path.replace('/', '\\')
         return path
 
@@ -45,13 +45,15 @@ class LibP3d(DirectObject):
     def p3dpath(path): return Filename.fromOsSpecific(path)
 
     @property
-    def last_frame_dt(self): return globalClock.get_dt()
+    def last_frame_dt(self):
+        return globalClock.get_dt()
 
     @property
     def build_version(self):
         appimg_mnt = glob('/tmp/.mount_Yocto*')
         if appimg_mnt:
-            #with open(appimg_mnt[0] + '/usr/bin/appimage_version.txt') as fver:
+            # with open(
+            #     appimg_mnt[0] + '/usr/bin/appimage_version.txt') as fver:
             with open(self.curr_path + '/assets/bld_version.txt') as fver:
                 return fver.read().strip()
         try:
@@ -79,13 +81,14 @@ class LibP3d(DirectObject):
         is_snap = is_snap and par_path.endswith('/x1')
         if is_snap:
             return str(Path(par_path).absolute())
-        #return getcwd()
+        # return getcwd()
         curr_path = dirname(__file__)
         info('current path: %s' % curr_path)
         return curr_path
 
     @staticmethod
-    def send(msg): return messenger.send(msg)
+    def send(msg):
+        return messenger.send(msg)
 
     @staticmethod
     def do_later(time, meth, args=None):
@@ -98,20 +101,22 @@ class LibP3d(DirectObject):
         return taskMgr.add(mth, mth.__name__, priority)
 
     @staticmethod
-    def remove_task(tsk): taskMgr.remove(tsk)
-
-    def init(self, green=(.2, .8, .2, 1), red=(.8, .2, .2, 1), end_cb=None):
-        LibShowBase()
-        base.disableMouse()
-        #patch_loader(base.loader)
-        self.__end_cb = end_cb
-        self.__init_win()
-        self.__init_fonts(green, red)
-        self.__set_roots()
-        self.accept('aspectRatioChanged', self.on_aspect_ratio_changed)
+    def remove_task(tsk):
+        taskMgr.remove(tsk)
+
+    # def init(self, green=(.2, .8, .2, 1), red=(.8, .2, .2, 1), end_cb=None):
+    #     LibShowBase()
+    #     base.disableMouse()
+    #     #patch_loader(base.loader)
+    #     self.__end_cb = end_cb
+    #     self.__init_win()
+    #     self.__init_fonts(green, red)
+    #     self.__set_roots()
+    #     self.accept('aspectRatioChanged', self.on_aspect_ratio_changed)
 
     @staticmethod
     def __set_roots():
+        base = base
         base.a2dTopQuarter = base.aspect2d.attachNewNode('a2dTopQuarter')
         base.a2dTopQuarter.set_pos(base.a2dLeft / 2, 0, base.a2dTop)
         base.a2dTopThirdQuarter = \
@@ -131,6 +136,7 @@ class LibP3d(DirectObject):
 
     @staticmethod
     def on_aspect_ratio_changed():
+        base = base
         base.a2dTopQuarter.set_pos(base.a2dLeft / 2, 0, base.a2dTop)
         base.a2dTopThirdQuarter.set_pos(base.a2dRight / 2, 0, base.a2dTop)
         base.a2dBottomQuarter.set_pos(base.a2dLeft / 2, 0, base.a2dBottom)
@@ -138,7 +144,8 @@ class LibP3d(DirectObject):
             base.a2dRight / 2, 0, base.a2dBottom)
 
     @property
-    def has_window(self): return bool(base.win)
+    def has_window(self):
+        return bool(base.win)
 
     @property
     def resolution(self):
@@ -167,7 +174,8 @@ class LibP3d(DirectObject):
     def set_resolution(res, fullscreen=None):
         props = WindowProperties()
         props.set_size(res)
-        if fullscreen: props.set_fullscreen(True)
+        if fullscreen:
+            props.set_fullscreen(True)
         if isinstance(base.win, GraphicsWindow):
             base.win.request_properties(props)
 
@@ -194,7 +202,8 @@ class LibP3d(DirectObject):
 
     def __on_end(self):
         base.closeWindow(base.win)
-        if self.__end_cb: self.__end_cb()
+        if self.__end_cb:
+            self.__end_cb()
         _exit(0)
 
     @staticmethod
@@ -202,7 +211,8 @@ class LibP3d(DirectObject):
         font = base.loader.loadFont(filepath)
         font.set_pixels_per_unit(60)
         font.set_minfilter(Texture.FTLinearMipmapLinear)
-        if outline: font.set_outline((0, 0, 0, 1), .8, .2)
+        if outline:
+            font.set_outline((0, 0, 0, 1), .8, .2)
         return font
 
     @staticmethod
@@ -221,10 +231,12 @@ class LibP3d(DirectObject):
     def user_appdata_dir(self): return Filename.get_user_appdata_directory()
 
     @property
-    def driver_vendor(self): return base.win.get_gsg().get_driver_vendor()
+    def driver_vendor(self):
+        return base.win.get_gsg().get_driver_vendor()
 
     @property
-    def driver_renderer(self): return base.win.get_gsg().get_driver_renderer()
+    def driver_renderer(self):
+        return base.win.get_gsg().get_driver_renderer()
 
     @property
     def driver_shader_version_major(self):
@@ -235,7 +247,8 @@ class LibP3d(DirectObject):
         return base.win.get_gsg().get_driver_shader_version_minor()
 
     @property
-    def driver_version(self): return base.win.get_gsg().get_driver_version()
+    def driver_version(self):
+        return base.win.get_gsg().get_driver_version()
 
     @property
     def driver_version_major(self):
@@ -251,20 +264,25 @@ class LibP3d(DirectObject):
             return base.win.get_properties().get_fullscreen()
 
     @property
-    def volume(self): return base.sfxManagerList[0].get_volume()
+    def volume(self):
+        return base.sfxManagerList[0].get_volume()
 
     @volume.setter
-    def volume(self, vol): base.sfxManagerList[0].set_volume(vol)
+    def volume(self, vol):
+        base.sfxManagerList[0].set_volume(vol)
 
     @property
     def mousepos(self):
         mwn = base.mouseWatcherNode
-        if not mwn: return 0, 0
-        if not mwn.hasMouse(): return 0, 0
+        if not mwn:
+            return 0, 0
+        if not mwn.hasMouse():
+            return 0, 0
         return mwn.get_mouse_x(), mwn.get_mouse_y()
 
     @property
-    def aspect_ratio(self): return base.getAspectRatio()
+    def aspect_ratio(self):
+        return base.getAspectRatio()
 
     @staticmethod
     def wdg_pos(wdg):
@@ -294,7 +312,9 @@ class LibP3d(DirectObject):
     @staticmethod
     def find_geoms(model, name):  # no need to be cached
         geoms = model.node.find_all_matches('**/+GeomNode')
-        is_nm = lambda geom: geom.get_name().startswith(name)
+
+        def is_nm(geom):
+            return geom.get_name().startswith(name)
         named_geoms = [geom for geom in geoms if is_nm(geom)]
         return [ng for ng in named_geoms if name in ng.get_name()]
 
@@ -327,8 +347,8 @@ class LibP3d(DirectObject):
     def remap_str(self, key):
         if not base.win:  # when launched with --version
             return key
-        #if isinstance(base.win, GraphicsBuffer):
-        #    return key
+        # if isinstance(base.win, GraphicsBuffer):
+        #     return key
         kmap = base.win.get_keyboard_map()
         for i in range(kmap.get_num_buttons()):
             if str(key).lower() == kmap.get_mapped_button_label(i).lower():
index 6f9b2926c6965b4fd7eb943f80d23e36b2234979..50dc5a1bc65ea259883ab593e5232377ddc0457a 100644 (file)
@@ -23,7 +23,8 @@ class FsmColleague(FSM, Colleague):
         Colleague.__init__(self, mediator)
 
     def destroy(self):
-        if self.state: self.cleanup()
+        if self.state:
+            self.cleanup()
         Colleague.destroy(self)
 
 
@@ -34,16 +35,20 @@ class EventColleague(Colleague, DirectObject):
         Colleague.destroy(self)
 
 
-class AudioColleague(Colleague): pass
+class AudioColleague(Colleague):
+    pass
 
 
-class AiColleague(Colleague): pass
+class AiColleague(Colleague):
+    pass
 
 
-class GfxColleague(Colleague): pass
+class GfxColleague(Colleague):
+    pass
 
 
-class GuiColleague(Colleague): pass
+class GuiColleague(Colleague):
+    pass
 
 
 class LogicColleague(Colleague):
@@ -51,7 +56,8 @@ class LogicColleague(Colleague):
     def on_start(self): pass
 
 
-class PhysColleague(Colleague): pass
+class PhysColleague(Colleague):
+    pass
 
 
 class GODirector:
@@ -63,7 +69,8 @@ class GODirector:
         self.completed = [False for _ in init_lst]
         self.pending = {}
         self.__init_lst = init_lst
-        for idx, _ in enumerate(init_lst): self.__process_lst(tgt_obj, idx)
+        for idx, _ in enumerate(init_lst):
+            self.__process_lst(tgt_obj, idx)
 
     def __process_lst(self, obj, idx):
         if not self.__init_lst[idx]:
@@ -80,7 +87,8 @@ class GODirector:
     def end_lst(self, idx):
         self.completed[idx] = True
         if all(self.completed):
-            if self.end_cb: self.end_cb()
+            if self.end_cb:
+                self.end_cb()
             self.destroy()
 
     def destroy(self):
@@ -88,4 +96,5 @@ class GODirector:
         self.__obj = self.end_cb = self.__init_lst = None
 
 
-class GameObject(Subject): pass
+class GameObject(Subject):
+    pass
index 7c49116b459eb695902524f600f2dbf0173d39bc..963d82288b78c2e39e868c7c80afd6192377fac2 100644 (file)
@@ -16,7 +16,8 @@ class Subject:
     def attach(self, obs_meth, sort=10, rename='', args=None):
         args = args or []
         onm = rename or obs_meth.__name__
-        if onm not in self.observers: self.observers[onm] = []
+        if onm not in self.observers:
+            self.observers[onm] = []
         self.observers[onm] += [ObsInfo(obs_meth, sort, args)]
         sorted_obs = sorted(self.observers[onm], key=lambda obs: obs.sort)
         self.observers[onm] = sorted_obs
@@ -30,11 +31,13 @@ class Subject:
             onm = obs_meth.__name__
             observers = [obs for obs in self.observers[onm]
                          if obs.mth == obs_meth]
-        if not observers: raise Exception
+        if not observers:
+            raise Exception
         list(map(self.observers[onm].remove, observers))
 
     def notify(self, meth, *args, **kwargs):
-        if meth not in self.observers: return  # no obs for this notification
+        if meth not in self.observers:
+            return  # no obs for this notification
         for obs in self.observers[meth][:]:
             if obs in self.observers[meth]:  # if an obs removes another one
                 try:
@@ -42,13 +45,16 @@ class Subject:
                     obs.mth(*act_args, **kwargs)
                 except SystemError:
                     print('Quit')
-                    import sys; sys.exit()
+                    import sys
+                    sys.exit()
 
     def observing(self, obs_meth):
-        if callable(obs_meth): obs_meth = obs_meth.__name__
+        if callable(obs_meth):
+            obs_meth = obs_meth.__name__
         return obs_meth in self.observers and self.observers[obs_meth]
 
     def destroy(self): self.observers = None
 
 
-class Observer: pass
+class Observer:
+    pass
index 36ff05b6cc59953f9232d63edd1afbd40bc69e16..0968759c0833f28ceb91b845306248bcfc48b9ca 100644 (file)
@@ -8,7 +8,9 @@ class MouseCursorFacade:
     def show(self):
         if not self.eng.cfg.dev_cfg.functional_test:
             return self.cursor_img.show()
-    def hide(self): return self.cursor_img.hide()
+
+    def hide(self):
+        return self.cursor_img.hide()
 
 
 class MouseCursor(GameObject, MouseCursorFacade):
@@ -16,16 +18,17 @@ class MouseCursor(GameObject, MouseCursorFacade):
     def __init__(self, filepath, scale, color, hotspot):
         GameObject.__init__(self)
         MouseCursorFacade.__init__(self)
-        if not filepath: return
+        if not filepath:
+            return
         self.__set_std_cursor(False)
         self.cursor_img = Img(filepath, scale=scale, foreground=True)
         self.cursor_img.img.set_color(color)
-        #if self.eng.cfg.dev_cfg.functional_test:
-        #    self.cursor_img.hide()
+        # if self.eng.cfg.dev_cfg.functional_test:
+        #     self.cursor_img.hide()
         self.hotspot_dx = scale[0] * (1 - 2 * hotspot[0])
         self.hotspot_dy = scale[2] * (1 - 2 * hotspot[1])
-        #self.eng.attach_obs(self.on_frame)
-        #self.eng.attach_obs(self.on_frame_unpausable)
+        # self.eng.attach_obs(self.on_frame)
+        # self.eng.attach_obs(self.on_frame_unpausable)
         self._tsk = taskMgr.add(self.__on_frame, 'on frame cursor')
 
     @staticmethod
@@ -35,12 +38,12 @@ class MouseCursor(GameObject, MouseCursorFacade):
         if isinstance(base.win, GraphicsWindow):
             base.win.requestProperties(props)
 
-    #def show_standard(self): self.eng.lib.show_std_cursor()
+    # def show_standard(self): self.eng.lib.show_std_cursor()
 
-    #def hide_standard(self): self.eng.lib.hide_std_cursor()
+    # def hide_standard(self): self.eng.lib.hide_std_cursor()
 
-    #def cursor_top(self):
-    #    self.cursor_img.reparent_to(self.cursor_img.parent)
+    # def cursor_top(self):
+    #     self.cursor_img.reparent_to(self.cursor_img.parent)
 
     def __on_frame(self, task):
         mwn = base.mouseWatcherNode
@@ -51,11 +54,11 @@ class MouseCursor(GameObject, MouseCursorFacade):
         self.cursor_img.set_pos((h_x, mouse[1] - self.hotspot_dy))
         return task.again
 
-    #def on_frame(self):
-    #    if not self.eng.pause.paused: self.__on_frame()
+    # def on_frame(self):
+    #     if not self.eng.pause.paused: self.__on_frame()
 
-    #def on_frame_unpausable(self):
-    #    if self.eng.pause.paused: self.__on_frame()
+    # def on_frame_unpausable(self):
+    #     if self.eng.pause.paused: self.__on_frame()
 
     def set_image(self, img):
         self.cursor_img.img.set_texture(loader.load_texture(img), 1)
index b30aefe53263a627b68956740e3fc0e4544f5328..15f885e49dae8e748723b5b36f55b2299094c585 100644 (file)
@@ -4,7 +4,6 @@ from os import makedirs
 from os.path import dirname
 from collections.abc import Mapping
 from configparser import ConfigParser
-from json import load, dumps
 from ya2.patterns.gameobject import GameObject
 from ya2.p3d.p3d import LibP3d
 
@@ -19,27 +18,33 @@ class DctFile(GameObject):
         self.fpath = fpath
         self.persistent = persistent
         try:
-            #with open(fpath) as json: fdct = load(json)
+            # with open(fpath) as json: fdct = load(json)
             config = ConfigParser()
             config.read(fpath)
-            fdct = {section: dict(config.items(section)) for section in config.sections()}
+            fdct = {section: dict(config.items(section))
+                    for section in config.sections()}
             fdct = self.__typed_dct(fdct)
             self.dct = self.__add_default(default_dct, fdct)
-        except IOError: self.dct = default_dct
+        except IOError:
+            self.dct = default_dct
 
     @staticmethod
     def __typed_dct(dct):
         def convert_single_val(val):
-            try: return int(val)
+            try:
+                return int(val)
             except ValueError:
-                try: return float(val)
+                try:
+                    return float(val)
                 except ValueError:
                     if not val or val[0] != '[':
                         return val
                     else:
                         raise ValueError
+
         def converted(val):
-            try: return convert_single_val(val)
+            try:
+                return convert_single_val(val)
             except ValueError:
                 return [elm.strip() for elm in val[1:-1].split(',')]
         new_dct = {}
@@ -55,7 +60,8 @@ class DctFile(GameObject):
         for key, val in upd.items():
             if isinstance(val, Mapping):
                 dct[key] = DctFile.__add_default(dct.get(key, {}), val)
-            else: dct[key] = upd[key]
+            else:
+                dct[key] = upd[key]
         return dct
 
     @staticmethod
@@ -63,15 +69,16 @@ class DctFile(GameObject):
         for key, val in new_dct.items():
             if isinstance(val, Mapping):
                 dct[key] = DctFile.deepupdate(dct.get(key, {}), val)
-            else: dct[key] = val
+            else:
+                dct[key] = val
         return dct
 
     def store(self):
         info('storing %s' % self.fpath)
         if not self.persistent: return
-        #json_str = dumps(self.dct, sort_keys=True, indent=4,
-        #                 separators=(',', ': '))
-        #with open(self.fpath, 'w') as json: json.write(json_str)
+        # json_str = dumps(self.dct, sort_keys=True, indent=4,
+        #                  separators=(',', ': '))
+        # with open(self.fpath, 'w') as json: json.write(json_str)
         fdct = {}
         for section, sec_dct in self.dct.items():
             if section not in fdct:
index 1a886cb13155af3bf08270258cdc4fe887ca7b5a..f9ff93f0976ae9a524ae5bcc3ef41f474f721016 100644 (file)
@@ -1,12 +1,8 @@
-import datetime
-from os import getcwd, system
-from logging import debug, info
-from pathlib import Path
+from os import getcwd
+from logging import info
 from shutil import rmtree
 from os import makedirs
 from os.path import join, exists
-from glob import glob
-from sys import exit
 from xmlrpc.server import SimpleXMLRPCServer
 from threading import Thread
 from panda3d.core import Filename
@@ -67,16 +63,20 @@ class FunctionalTest(GameObject):
     def __init__(self, ref, pos_mgr):
         super().__init__()
         self._pos_mgr = pos_mgr
-        RPCServerThread([self._do_screenshot, self._do_enforce_res, self.__verify, self._set_idx, self._do_enforce_resolution, self.__get_pos]).start()
+        RPCServerThread([self._do_screenshot, self._do_enforce_res,
+                         self.__verify, self._set_idx,
+                         self._do_enforce_resolution, self.__get_pos]).start()
         self.txt = OnscreenText('', fg=(1, 0, 0, 1), scale=.16)
-        #self._path = ''
-        #if self.eng.is_appimage:
+        # self._path = ''
+        # if self.eng.is_appimage:
         self._path = str(Filename().get_user_appdata_directory())
         self._path += '/pmachines/'
         self._path += 'tests/functional%s/' % ('_ref' if ref else '')
         home = '/home/flavio'  # we must force this for wine
-        # if self._path.startswith('/c/users/') and exists(str(Path.home()) + '/.local/share/flatpak-wine601/default/'):
-        #     self._path = str(Path.home()) + '/.local/share/flatpak-wine601/default/drive_' + self._path[1:]
+        # if self._path.startswith('/c/users/') and exists(str(Path.home()) +
+        #     '/.local/share/flatpak-wine601/default/'):
+        #     self._path = str(Path.home()) +
+        #       '/.local/share/flatpak-wine601/default/drive_' + self._path[1:]
         if self._path.startswith('/c/users/') and exists(home + '/.wine/'):
             self._path = home + '/.wine/drive_' + self._path[1:]
         if ref:
@@ -84,8 +84,8 @@ class FunctionalTest(GameObject):
                 Filename().get_user_appdata_directory(),
                 'pmachines/tests/functional_ref_%s/' % _branch())
         self._fnames = []
-        #taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
-        #self._do_screenshots(idx)
+        # taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
+        # self._do_screenshots(idx)
 
     def _set_idx(self, idx):
         if int(idx) == 1:
@@ -98,9 +98,10 @@ class FunctionalTest(GameObject):
 
     def _do_screenshot(self, name):
         self._fnames += [self._path + name]
-        #time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
-        #res = base.win.save_screenshot(Filename(path or ("yocto%s.png" % time)))
-        #debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
+        # time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
+        # res = base.win.save_screenshot(
+        #     Filename(path or ("yocto%s.png" % time)))
+        # debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
         res = base.screenshot(self._path + name, False)
         info('screenshot %s (%s; %s)' % (self._path + name, res, getcwd()))
 
@@ -112,559 +113,8 @@ class FunctionalTest(GameObject):
         info('enforce resolution %s (callback)' % res)
         messenger.send('enforce_resolution', [res])
 
-    #def _screenshot(self, time, name):
-        #self._fnames += [self._path + name + '.png']
-        #self._tasks += [(
-        #    self._curr_time + time,
-        #    lambda: self._do_screenshot(self._path + name + '.png'),
-        #    'screenshot: %s' % name)]
-        #def txt(show_hide):
-        #    self.txt['text'] = name
-        #    (self.txt.show if show_hide else self.txt.hide)()
-        #self._tasks += [(
-        #    self._curr_time + time + .1,
-        #    lambda: txt(True),
-        #    'screenshot: %s (show)' % name)]
-        #self._tasks += [(
-        #    self._curr_time + time + FunctionalTest.evt_time - .1,
-        #    lambda: txt(False),
-        #    'screenshot: %s (hide)' % name)]
-        #self._curr_time += time
-
-    #def __keypress(self, key):
-        #'''Emulates a keypress'''
-        #dev = base.win.getInputDevice(0)
-        #dev.buttonDown(key)
-        #dev.buttonUp(key)
-
-    #def __char_entered(self, char):
-        #'''Emulates a character being entered.'''
-        #dev = base.win.getInputDevice(0)
-        #dev.keystroke(ord(char))
-
-    # def _event(self, time, evt, messenger_evt=False, append_up=True, mouse_args=None):
-    #     def _append_up(evt_name):
-    #         return evt + ('' if evt.endswith('-up') or not append_up else '-up')
-    #     def cback_char(_evt):
-    #         self.__char_entered(_evt)
-    #     def cback_keyp(_evt):
-    #         self.__keypress(_evt)
-    #         self.__keypress('raw-' + _evt)
-    #     cback = lambda: (cback_char(evt) if len(evt) == 1 else cback_keyp(evt))
-    #     if evt in ['mousemove', 'mouseclick', 'mousedrag']:
-    #         if evt == 'mousemove':
-    #             cback = lambda: self.__mouse_move(*mouse_args)
-    #         elif evt == 'mouseclick':
-    #             cback = lambda: self.__mouse_click(*mouse_args)
-    #         elif evt == 'mousedrag':
-    #             cback = lambda: self.__mouse_drag(*mouse_args)
-    #     if messenger_evt:
-    #         cback = lambda: messenger.send(_append_up(evt))
-    #     self._tasks += [(
-    #         self._curr_time + time,
-    #         cback,
-    #         'event: %s' % evt)]
-    #     def txt(show_hide):
-    #         self.txt['text'] = evt
-    #         (self.txt.show if show_hide else self.txt.hide)()
-    #     self._tasks += [(
-    #         self._curr_time + time + .2,
-    #         lambda: txt(True),
-    #         'event: %s (show)' % evt)]
-    #     self._tasks += [(
-    #         self._curr_time + time + .8,
-    #         lambda: txt(False),
-    #         'event: %s (hide)' % evt)]
-    #     self._curr_time += time
-
-    # def _enforce_res(self, time, res):
-    #     cback = lambda: messenger.send('enforce_res', [res])
-    #     self._tasks += [(
-    #         self._curr_time + time,
-    #         cback,
-    #         'enforce res: %s' % res)]
-    #     self._curr_time += time
-
     def __verify(self, task):
-        files = glob(self._path + '*')
+        files = glob(self._path + '*')
         for fname in self._fnames:
             info('verifying %s' % fname)
             assert exists(fname)
-
-    #def on_frame_unpausable(self, task):
-        #self._process_conn()
-        #for tsk in self._tasks:
-        #    #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time:
-        #    if self._prev_time <= tsk[0] < globalClock.getFrameTime():
-        #        debug('%s %s' % (tsk[0], tsk[2]))
-        #        tsk[1]()
-        #self._prev_time = globalClock.getFrameTime()  # self.eng.event.unpaused_time
-        #return task.cont
-
-    # def _do_screenshots_1(self):
-    #     info('_do_screenshots_1')
-    #     self._screenshot(FunctionalTest.start_time, 'main_menu')
-    #     self._do_screenshots_credits()
-    #     self._do_screenshots_options()
-    #     self._do_screenshots_exit()
-
-    # def _do_screenshots_credits(self):
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'main_menu_back_from_credits')
-    #     # # go to credits
-    #     # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'main_menu_highlight')
-    #     # self._event(FunctionalTest.evt_time, 'rcontrol')
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
-    #     # # go to supporters
-    #     # self._event(FunctionalTest.evt_time, 'joypad0-face_a', True)
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'supporters_menu')
-    #     # # back to main
-    #     # self._event(FunctionalTest.evt_time, 'rcontrol')
-    #     # self._event(FunctionalTest.evt_time, 'joypad0-face_b', True)
-    #     # self._event(FunctionalTest.evt_time, 'arrow_up')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_up')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_up')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_up')
-
-    # def _do_screenshots_options(self):
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 300), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
-    #     # languages
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 60), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'open_languages')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(980, 120), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_italian')
-    #     # volume
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(740, 163), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_1')
-    #     # antialiasing
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 440), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_no')
-    #     # shadows
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 540), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'shadows_no')
-    #     # test aa and shadows
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left'])  # back
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left'])  # play
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left'])  # domino
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(900, 490), 'left'])  # close instructions
-    #     self._screenshot(FunctionalTest.screenshot_time, 'aa_no_shadows_no')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(25, 740), 'left'])  # home
-
-    # def _do_screenshots_restore_options(self):
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 300), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
-    #     # languages
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 60), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'open_languages_restored')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(980, 20), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_english')
-    #     # volume
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(719, 163), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_2')
-    #     # fullscreen
-    #     # the first one is because of the windowed mode in test
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
-    #     # self._event(8 + FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
-    #     # self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
-    #     # resolution
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 340), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1020, 160), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, '1440x900')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(740, 400), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'resolutions_2')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1110, 80), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, '1360x768')
-    #     # antialiasing
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 440), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_yes')
-    #     # shadows
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 540), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'shadows_yes')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left'])  # back
-
-    # #     # go to options
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
-    # #     # language
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'language_open')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'language_highlight')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'language_it')
-    # #     # volume
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_right')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_right')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'volume')
-    # #     # car's number
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'cars_open')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'cars_changed')
-    # #     # back
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-
-    # def _do_screenshots_play(self):
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left'])  # play
-    #     self._screenshot(FunctionalTest.screenshot_time, 'play_menu')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left'])  # back
-    #     self._screenshot(FunctionalTest.screenshot_time, 'back_from_play')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left'])  # play
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left'])  # domino scene
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_instructions')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left'])  # close instructions
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_domino')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(25, 740), 'left'])  # home
-    #     self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_scene')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left'])  # play
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left'])  # domino
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(70, 740), 'left'])  # info
-    #     self._screenshot(FunctionalTest.screenshot_time, 'info')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (430, 280), 'left'])  # drag a piece
-    #     self._screenshot(FunctionalTest.screenshot_time, 'domino_dragged')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1220, 740), 'left'])  # rewind
-    #     self._screenshot(FunctionalTest.screenshot_time, 'rewind')
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (550, 380), 'left'])  # drag a piece
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (715, 380), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(630, 450), 'left'])  # home
-    #     self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_fail')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left'])  # play
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left'])  # domino
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (550, 380), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (715, 380), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_2')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])  # replay
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (570, 380), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(570, 355), (605, 355), 'right'])  # rotate the piece
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (715, 380), 'left'])  # drag a piece
-    #     self._enforce_res(FunctionalTest.evt_time, 'win')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino')
-    #     self._enforce_res(FunctionalTest.evt_time, '')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left'])  # next
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_box')
-    #     # scene 2
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(880, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 620), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 540), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])  # replay
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 620), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 540), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (705, 460), 'left'])  # drag a box
-    #     self._enforce_res(FunctionalTest.evt_time, 'win')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box')
-    #     self._enforce_res(FunctionalTest.evt_time, '')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left'])  # next
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_box_domino')
-    #     # scene 3
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(930, 485), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (910, 440), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (910, 360), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box_domino')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])  # replay
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (910, 440), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (835, 250), 'left'])  # drag a box
-    #     self._enforce_res(FunctionalTest.evt_time, 'win')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box_domino')
-    #     self._enforce_res(FunctionalTest.evt_time, '')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left'])  # next
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_basketball')
-    #     # scene 4
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(870, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(55, 50), (650, 310), 'left'])  # drag a ball
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_basketball')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])  # replay
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(55, 50), (380, 50), 'left'])  # drag a ball
-    #     self._enforce_res(FunctionalTest.evt_time, 'win')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'win_basketball')
-    #     self._enforce_res(FunctionalTest.evt_time, '')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left'])  # next
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_box_basketball')
-    #     # scene 5
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(865, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (580, 440), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 60), (590, 370), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_box_basketball')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])  # replay
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (580, 440), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 60), (660, 440), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(660, 425), (625, 425), 'right'])  # rotate a piece
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(660, 435), (650, 445), 'left'])  # drag a piece
-    #     self._enforce_res(FunctionalTest.evt_time, 'win')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino_box_basketball')
-    #     self._enforce_res(FunctionalTest.evt_time, '')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left'])  # next
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter')
-    #     # # scene 6
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(820, 455), 'left'])  # close instructions
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 300), 'left'])  # drag a box
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-    #     # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_tooter')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 150), 'left'])  # drag a box
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(515, 115), (515, 122), 'right'])  # rotate a box
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-    #     # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_tooter')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball')
-    #     # # scene 7
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(880, 455), 'left'])  # close instructions
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (155, 180), 'left'])  # drag a box
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-    #     # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (170, 80), 'left'])  # drag a box
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(195, 50), (195, 80), 'right'])  # rotate a box
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-    #     # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(630, 450), 'left'])  # home
-    #     self._screenshot(FunctionalTest.screenshot_time, 'home_from_play')
-
-    # def _do_screenshots_exit(self):
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'rcontrol')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     self._verify()
-    #     # self._event(FunctionalTest.evt_time, 'rcontrol')
-    #     # self._exit()
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 600), 'left'])
-
-
-    # def _do_screenshots_2(self):
-    #     info('_do_screenshots_2')
-    #     self._screenshot(FunctionalTest.start_time, 'main_menu_2')
-    #     self._do_screenshots_restore_options()
-    #     self._do_screenshots_play()
-    #     self._do_screenshots_exit()
-    # #     self._do_screenshots_game()
-    # #     self._do_screenshots_end()
-
-    # # def _do_screenshots_restore_options(self):
-    # #     # go to options
-    # #     self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
-    # #     # # language
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'language_en_restored')
-    # #     # # volume
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_left')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_left')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'volume_restored')
-    # #     # car's number
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'cars_restored')
-    # #     # graphics settings
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'graphics_settings')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'antialiasing')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'shadows')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'fog')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'normal_mapping')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'occlusion')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     # input
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'input')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_rec')
-    # #     self._event(FunctionalTest.evt_time, '8', True, False)
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_changed')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up', True, False)
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_restored')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'w', True, False)
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already_closed')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p2')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p3')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p4')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-
-    # # def _do_screenshots_game(self):
-    # #     # single player
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'single_player_menu')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'track_page')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'car_page_start')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_left')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'car_page_sel')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'driver_page_start')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_left')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_left')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_empty')
-    # #     self._event(FunctionalTest.evt_time, 'f')
-    # #     self._event(FunctionalTest.evt_time, 'l')
-    # #     self._event(FunctionalTest.evt_time, 'a')
-    # #     self._event(FunctionalTest.evt_time, 'v')
-    # #     self._event(FunctionalTest.evt_time, 'i')
-    # #     self._event(FunctionalTest.evt_time, 'o')
-    # #     self._event(FunctionalTest.evt_time, 'enter')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_full')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_right')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'driver_page_sel')
-    # #     # some ai tests
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(40, 'escape-up')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'ingame_menu')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'race_back')
-    # #     self._event(FunctionalTest.evt_time, 'escape-up')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'ingame_sel')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'main_page_back_race')
-
-    # # def _do_screenshots_end(self):
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'exit_page')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'exit_page_sel')
-    # #     self._verify()
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._exit()
-
-    # def _do_screenshots(self, idx):
-    #     [self._do_screenshots_1, self._do_screenshots_2][int(idx) - 1]()
index bbfa49b22323343bdcae49d10e99482e1399560f..20d332aa40c2e793bc9dbe5eea7b6f63dcbfbcdb 100644 (file)
@@ -16,7 +16,8 @@ def is_appimage():
 
 
 def curr_path():
-    if not is_runtime(): return ''
+    if not is_runtime():
+        return ''
     if sys.platform == 'darwin':
         return dirname(__file__) + '/../Resources/'
     # return dirname(__file__)
@@ -27,7 +28,7 @@ def curr_path():
     is_snap = is_snap and par_path.endswith('/x1')
     if is_snap:
         return str(Path(par_path).absolute())
-    #return getcwd()
+    # return getcwd()
     curr_path = dirname(__file__)
     info('current path: %s' % curr_path)
     return curr_path + '/'
index 68fa6287f5860620eeccd637088d9dc0cc208d6a..f6b70c55d859ec6695dba3325bcc932486e0c327 100755 (executable)
@@ -4,11 +4,10 @@ from sys import platform, argv
 from platform import system
 from pathlib import Path
 from glob import glob
-from json import load, dumps
-#from datetime import datetime
+# from datetime import datetime
 from pprint import pprint
 from os import getcwd, environ
-from os.path import exists, dirname
+from os.path import exists
 from traceback import print_stack
 from sys import version_info
 # from platform import system, release, architecture, platform, processor, \
@@ -18,7 +17,6 @@ from panda3d.core import Filename, GraphicsWindow, PandaSystem
 from panda3d.bullet import get_bullet_version
 from ya2.patterns.gameobject import Colleague
 from ya2.p3d.p3d import LibP3d
-import sys
 
 
 lev = INFO
@@ -30,11 +28,13 @@ opath = LibP3d.fixpath(opt_path + '/options.ini') if opt_path else \
         'options.ini'
 if exists(opath):
     with open(opath) as json_file:
-        #optfile = load(json_file)
+        # optfile = load(json_file)
         optfile = ConfigParser()
         optfile.read(opath)
-        # optfile['development']['verbose'] and int(optfile['development']['verbose']) or \
-        if optfile['development']['verbose_log'] and int(optfile['development']['verbose_log']):
+        # optfile['development']['verbose']
+        # and int(optfile['development']['verbose']) or \
+        if optfile['development']['verbose_log'] and \
+                int(optfile['development']['verbose_log']):
             lev = DEBUG
 
 basicConfig(level=lev, format='%(asctime)s %(message)s', datefmt='%H:%M:%S')
@@ -52,7 +52,8 @@ class LogMgrBase(Colleague):  # headless log manager
         self.log_cfg()
 
     def log(self, msg, verbose=False):
-        if verbose and not self.eng.cfg.dev_cfg.verbose_log: return
+        if verbose and not self.eng.cfg.dev_cfg.verbose_log:
+            return
         info(msg)
 
     @property
@@ -98,7 +99,8 @@ class LogMgrBase(Colleague):  # headless log manager
     def build_version(self):
         appimg_mnt = glob('/tmp/.mount_Pmachi*')
         if appimg_mnt:
-            #with open(appimg_mnt[0] + '/usr/bin/appimage_version.txt') as fver:
+            # with open(
+            #     appimg_mnt[0] + '/usr/bin/appimage_version.txt') as fver:
             with open(self.curr_path + 'assets/bld_version.txt') as fver:
                 return fver.read().strip()
         try:
@@ -116,18 +118,21 @@ class LogMgrBase(Colleague):  # headless log manager
                 path = home + '/.wine/drive_' + path[1:]
             info('writing %s' % path + '/pmachines/obs_version.txt')
             with open(path + '/pmachines/obs_version.txt', 'w') as f:
-                #f.write(self.eng.logic.version)
+                # f.write(self.eng.logic.version)
                 f.write(self.build_version)
             if not platform.startswith('win'):
-                from os import ttyname  # here because it doesn't work on windows
+                from os import ttyname
+                # here because it doesn't work on windows
                 import sys
                 try:
                     with open(ttyname(0), 'w') as fout:
                         sys.stdout = fout
-                        print('version: ' + self.build_version)  # self.eng.logic.version)
+                        print('version: ' + self.build_version)
+                        # self.eng.logic.version)
                 except OSError:  # it doesn't work with crontab
                     print('version: ' + self.build_version)
-        messages = ['version: ' + self.build_version]  # self.eng.logic.version]
+        messages = ['version: ' + self.build_version]
+        # self.eng.logic.version]
         messages += ['argv[0]: %s' % argv[0]]
         messages += ['getcwd: %s' % getcwd()]
         messages += ['__file__: %s' % __file__]
@@ -148,14 +153,16 @@ class LogMgrBase(Colleague):  # headless log manager
             import psutil
             mem = psutil.virtual_memory().total / 1000000000.0
             messages += ['memory: %s GB' % round(mem, 2)]
-        except ImportError: info("can't import psutil")  # windows
+        except ImportError:
+            info("can't import psutil")  # windows
         lib_commit = PandaSystem.get_git_commit()
         py_ver = [str(elm) for elm in version_info[:3]]
         messages += ['python version: %s' % '.'.join(py_ver)]
         messages += ['panda version: %s %s' % (lib_ver, lib_commit)]
         messages += ['bullet version: ' + str(get_bullet_version())]
         messages += ['appdata: ' + str(Filename.get_user_appdata_directory())]
-        if base.win and isinstance(base.win, GraphicsWindow):  # not headless
+        if base.win and isinstance(base.win, GraphicsWindow):
+            # not headless
             print(base.win.get_keyboard_map())
         list(map(self.log, messages))
 
@@ -178,8 +185,10 @@ class LogMgr(LogMgrBase):
         LogMgrBase.log_cfg(self)
         messages = [base.win.get_gsg().get_driver_vendor()]
         messages += [base.win.get_gsg().get_driver_renderer()]
-        shad_maj = base.win.get_gsg().get_driver_shader_version_major()
-        shad_min = base.win.get_gsg().get_driver_shader_version_minor()
+        shad_maj = base.win.get_gsg().\
+            get_driver_shader_version_major()
+        shad_min = base.win.get_gsg().\
+            get_driver_shader_version_minor()
         messages += ['shader: {maj}.{min}'.format(maj=shad_maj, min=shad_min)]
         messages += [base.win.get_gsg().get_driver_version()]
         drv_maj = base.win.get_gsg().get_driver_version_major()
@@ -190,6 +199,7 @@ class LogMgr(LogMgrBase):
         if isinstance(base.win, GraphicsWindow):
             fullscreen = base.win.get_properties().get_fullscreen()
         messages += ['fullscreen: ' + str(fullscreen)]
+
         def resolution():
             if not isinstance(base.win, GraphicsWindow):
                 return 800, 600