0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-02-02 07:00:42 +00:00

🎨 Python style tweaks (#27312)

This commit is contained in:
dmitrygribenchuk 2024-07-29 18:41:50 +03:00 committed by GitHub
parent b4dd20c0eb
commit 29469a0615
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 7 deletions

View file

@ -118,14 +118,14 @@ class DWIN_ICO_File():
count += 1
def createFile(self, iconDir, filename):
'''Create a new .ico file from the contents of iconDir.
"""Create a new .ico file from the contents of iconDir.
The contents of iconDir are processed to get image
resolution, and a new entry is created for each.
Each filename must have a leading number followed by a
dash, which is the icon index. E.g., "071-ICON_StepX.jpg".
'''
"""
self.entries = [Entry() for i in range(0,256)]
# 1. Scan icon directory and record all valid files
print('Scanning icon directory', iconDir)
@ -140,7 +140,7 @@ class DWIN_ICO_File():
if not (0 <= index <= 255):
print('...Ignoring invalid index on', dirEntry.path)
continue
#dirEntry.path is iconDir/name
# dirEntry.path is iconDir/name
w,h = getJpegResolution(dirEntry.path)
length = dirEntry.stat().st_size
e = self.entries[index]
@ -171,7 +171,7 @@ class DWIN_ICO_File():
continue
e.offset = offset
offset += e.length
#print('%03d: (%d x %d) len=%d off=%d' %
# print('%03d: (%d x %d) len=%d off=%d' %
# (i, e.width, e.height, e.length, e.offset))
def _combineAndWriteIcoFile(self, filename):
@ -201,9 +201,9 @@ class DWIN_ICO_File():
return contents
class Entry():
'''Entry objects record resolution and size information
"""Entry objects record resolution and size information
about each icon stored in an ICO file.
'''
"""
__slots__ = ('width', 'height', 'offset', 'length', 'filename')
def __init__(self, w=0, h=0, length=0, offset=0, filename=None):

View file

@ -49,4 +49,3 @@ if __name__ == '__main__':
except Exception as e:
print('Error: ', e)