Fix minor lint issues
This commit is contained in:
parent
5cccb9b521
commit
ad6d36762e
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
|
||||
|
||||
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" palette: {self.palette.name}")
|
||||
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):
|
||||
return bool(sdlmixer.Mix_PlayingMusic())
|
||||
|
||||
def resume_music(self):
|
||||
if self.current_music:
|
||||
sdlmixer.Mix_ResumeMusic()
|
||||
|
||||
def stop_all_music(self):
|
||||
sdlmixer.Mix_HaltMusic()
|
||||
self.current_music = None
|
||||
|
|
|
|||
|
|
@ -652,6 +652,5 @@ def circle_box_penetration(
|
|||
pdist = circle_radius - d
|
||||
if d == 0:
|
||||
return
|
||||
1, 0, -pdist, -pdist
|
||||
# TODO: calculate other axis of intersection for area?
|
||||
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
|
||||
self.resize(WIDTH, max_y)
|
||||
# rare cases where no lines covered
|
||||
if self.art.height == 0:
|
||||
return False
|
||||
return True
|
||||
return self.art.height != 0
|
||||
|
|
|
|||
20
playscii.py
20
playscii.py
|
|
@ -1,13 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
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 sys
|
||||
|
||||
if platform.system() == "Windows" or platform.system() == "Darwin":
|
||||
import os
|
||||
|
|
@ -21,6 +16,7 @@ if platform.system() == "Darwin" and hasattr(sys, "frozen"):
|
|||
os.chdir(os.path.abspath(os.path.dirname(sys.executable)))
|
||||
|
||||
# app imports
|
||||
import contextlib
|
||||
import ctypes
|
||||
import hashlib
|
||||
import importlib
|
||||
|
|
@ -47,10 +43,10 @@ if version.parse(Image.__version__) > version.parse("10.0.0"):
|
|||
Image.ANTIALIAS = Image.LANCZOS
|
||||
# cache whether pdoc is available for help menu item
|
||||
pdoc_available = False
|
||||
try:
|
||||
with contextlib.suppress(Exception):
|
||||
import pdoc # noqa: F401, E402
|
||||
|
||||
pdoc_available = True
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# submodules - set here so cfg file can modify them all easily
|
||||
from art import (
|
||||
|
|
@ -305,7 +301,7 @@ class Application:
|
|||
self.log("GLSL support not detected, " + self.compat_fail_message)
|
||||
self.should_quit = True
|
||||
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]")
|
||||
# verify that we got at least a 2.1 context
|
||||
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)
|
||||
# os.path.exists can fail in Windows b/c case insensitivity,
|
||||
# so just try and fail :[
|
||||
try:
|
||||
with contextlib.suppress(Exception):
|
||||
os.mkdir(new_dir)
|
||||
except Exception:
|
||||
pass
|
||||
return config_dir, documents_dir, cache_dir
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -479,9 +479,7 @@ class AddFrameDialog(UIDialog):
|
|||
index = int(index)
|
||||
except Exception:
|
||||
return False
|
||||
if index < 1 or index > self.ui.active_art.frames + 1:
|
||||
return False
|
||||
return True
|
||||
return not (index < 1 or index > self.ui.active_art.frames + 1)
|
||||
|
||||
def is_valid_frame_delay(self, delay):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue