Fix minor lint issues
This commit is contained in:
parent
45d72bf8ed
commit
86e6382adc
6 changed files with 10 additions and 25 deletions
2
art.py
2
art.py
|
|
@ -1236,7 +1236,7 @@ class ArtFromDisk(Art):
|
||||||
self.valid = True
|
self.valid = True
|
||||||
|
|
||||||
def log_init(self):
|
def log_init(self):
|
||||||
self.app.log(f"Loaded {filename} from disk:")
|
self.app.log(f"Loaded {self.filename} from disk:")
|
||||||
self.app.log(f" character set: {self.charset.name}")
|
self.app.log(f" character set: {self.charset.name}")
|
||||||
self.app.log(f" palette: {self.palette.name}")
|
self.app.log(f" palette: {self.palette.name}")
|
||||||
self.app.log(f" width/height: {self.width} x {self.height}")
|
self.app.log(f" width/height: {self.width} x {self.height}")
|
||||||
|
|
|
||||||
4
audio.py
4
audio.py
|
|
@ -130,10 +130,6 @@ class AudioLord:
|
||||||
def is_music_playing(self):
|
def is_music_playing(self):
|
||||||
return bool(sdlmixer.Mix_PlayingMusic())
|
return bool(sdlmixer.Mix_PlayingMusic())
|
||||||
|
|
||||||
def resume_music(self):
|
|
||||||
if self.current_music:
|
|
||||||
sdlmixer.Mix_ResumeMusic()
|
|
||||||
|
|
||||||
def stop_all_music(self):
|
def stop_all_music(self):
|
||||||
sdlmixer.Mix_HaltMusic()
|
sdlmixer.Mix_HaltMusic()
|
||||||
self.current_music = None
|
self.current_music = None
|
||||||
|
|
|
||||||
|
|
@ -652,6 +652,5 @@ def circle_box_penetration(
|
||||||
pdist = circle_radius - d
|
pdist = circle_radius - d
|
||||||
if d == 0:
|
if d == 0:
|
||||||
return
|
return
|
||||||
1, 0, -pdist, -pdist
|
|
||||||
# TODO: calculate other axis of intersection for area?
|
# TODO: calculate other axis of intersection for area?
|
||||||
return -closest_x / d, -closest_y / d, -pdist, -pdist
|
return -closest_x / d, -closest_y / d, -pdist, -pdist
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,4 @@ Assumes 80 columns, DOS character set and EGA palette.
|
||||||
# resize to last line touched
|
# resize to last line touched
|
||||||
self.resize(WIDTH, max_y)
|
self.resize(WIDTH, max_y)
|
||||||
# rare cases where no lines covered
|
# rare cases where no lines covered
|
||||||
if self.art.height == 0:
|
return self.art.height != 0
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
|
||||||
20
playscii.py
20
playscii.py
|
|
@ -1,13 +1,8 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
|
||||||
|
|
||||||
if sys.version_info.major < 3:
|
|
||||||
print("Python 3 is required to run Playscii.", file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
|
import sys
|
||||||
|
|
||||||
if platform.system() == "Windows" or platform.system() == "Darwin":
|
if platform.system() == "Windows" or platform.system() == "Darwin":
|
||||||
import os
|
import os
|
||||||
|
|
@ -21,6 +16,7 @@ if platform.system() == "Darwin" and hasattr(sys, "frozen"):
|
||||||
os.chdir(os.path.abspath(os.path.dirname(sys.executable)))
|
os.chdir(os.path.abspath(os.path.dirname(sys.executable)))
|
||||||
|
|
||||||
# app imports
|
# app imports
|
||||||
|
import contextlib
|
||||||
import ctypes
|
import ctypes
|
||||||
import hashlib
|
import hashlib
|
||||||
import importlib
|
import importlib
|
||||||
|
|
@ -47,10 +43,10 @@ if version.parse(Image.__version__) > version.parse("10.0.0"):
|
||||||
Image.ANTIALIAS = Image.LANCZOS
|
Image.ANTIALIAS = Image.LANCZOS
|
||||||
# cache whether pdoc is available for help menu item
|
# cache whether pdoc is available for help menu item
|
||||||
pdoc_available = False
|
pdoc_available = False
|
||||||
try:
|
with contextlib.suppress(Exception):
|
||||||
|
import pdoc # noqa: F401, E402
|
||||||
|
|
||||||
pdoc_available = True
|
pdoc_available = True
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# submodules - set here so cfg file can modify them all easily
|
# submodules - set here so cfg file can modify them all easily
|
||||||
from art import (
|
from art import (
|
||||||
|
|
@ -305,7 +301,7 @@ class Application:
|
||||||
self.log("GLSL support not detected, " + self.compat_fail_message)
|
self.log("GLSL support not detected, " + self.compat_fail_message)
|
||||||
self.should_quit = True
|
self.should_quit = True
|
||||||
return
|
return
|
||||||
glsl_ver = glsl_ver.decode("utf-8") if glsl_ver != None else None
|
glsl_ver = glsl_ver.decode("utf-8") if glsl_ver is not None else None
|
||||||
self.log(f" GLSL detected: {glsl_ver}" or "[unknown]")
|
self.log(f" GLSL detected: {glsl_ver}" or "[unknown]")
|
||||||
# verify that we got at least a 2.1 context
|
# verify that we got at least a 2.1 context
|
||||||
majorv, minorv = ctypes.c_int(0), ctypes.c_int(0)
|
majorv, minorv = ctypes.c_int(0), ctypes.c_int(0)
|
||||||
|
|
@ -1204,10 +1200,8 @@ def get_paths():
|
||||||
new_dir = os.path.abspath(documents_dir + subdir)
|
new_dir = os.path.abspath(documents_dir + subdir)
|
||||||
# os.path.exists can fail in Windows b/c case insensitivity,
|
# os.path.exists can fail in Windows b/c case insensitivity,
|
||||||
# so just try and fail :[
|
# so just try and fail :[
|
||||||
try:
|
with contextlib.suppress(Exception):
|
||||||
os.mkdir(new_dir)
|
os.mkdir(new_dir)
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
return config_dir, documents_dir, cache_dir
|
return config_dir, documents_dir, cache_dir
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -479,9 +479,7 @@ class AddFrameDialog(UIDialog):
|
||||||
index = int(index)
|
index = int(index)
|
||||||
except Exception:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
if index < 1 or index > self.ui.active_art.frames + 1:
|
return not (index < 1 or index > self.ui.active_art.frames + 1)
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def is_valid_frame_delay(self, delay):
|
def is_valid_frame_delay(self, delay):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue