Skip to content

Commit ebcceaf

Browse files
committed
names
1 parent 1d23724 commit ebcceaf

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

Averager.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
66
Average image colors in a pixel row until difference between averaged and next pixel in row reach threshold. Then repeat the same in column. Thus filter changes smooth image areas to completely flat colored, with detailed edges between them.
77
8-
Input: PNG, PPM, PGM.
8+
Input: PNG, PPM, PGM, PBM.
99
10-
Output: PNG, PPM.
10+
Output: PNG, PPM, PGM.
1111
1212
Created by: `Ilya Razmanov<mailto:ilyarazmanov@gmail.com>`_ aka `Ilyich the Toad<mailto:amphisoft@gmail.com>`_.
1313
@@ -24,7 +24,7 @@
2424
2525
2.16.20.20 Changed GUI to menus.
2626
27-
3.20.6.8 Changed GUI to grid to fit all new features. More detailed image info; image edited/saved status displayed as "*" a-la Photoshop.
27+
3.20.7.14 Changed GUI to grid to fit all new features. More detailed image info; image edited/saved status displayed as "*" a-la Photoshop.
2828
2929
----
3030
Main site: `The Toad's Slimy Mudhole<https://dnyarri.github.io>`_
@@ -37,7 +37,7 @@
3737
__copyright__ = '(c) 2024-2025 Ilya Razmanov'
3838
__credits__ = 'Ilya Razmanov'
3939
__license__ = 'unlicense'
40-
__version__ = '3.20.7.14'
40+
__version__ = '3.20.8.10'
4141
__maintainer__ = 'Ilya Razmanov'
4242
__email__ = 'ilyarazmanov@gmail.com'
4343
__status__ = 'Production'
@@ -93,6 +93,7 @@ def UINormal() -> None:
9393
info_string.config(text=info_normal['txt'], foreground=info_normal['fg'], background=info_normal['bg'])
9494
if Z == 1 or Z == 3:
9595
check02['state'] = 'disabled'
96+
butt02.focus_set()
9697

9798

9899
def UIBusy() -> None:
@@ -128,7 +129,7 @@ def ShowPreview(preview_name: PhotoImage, caption: str) -> None:
128129

129130
def GetSource(event=None) -> None:
130131
"""Opening source image and redefining other controls state"""
131-
global zoom_factor, view_src, is_filtered, is_saved, info_normal
132+
global zoom_factor, view_src, is_filtered, is_saved, info_normal, color_title
132133
global preview
133134
global X, Y, Z, maxcolors, image3D, info, sourcefilename
134135
global source_image3D, preview_src, preview_filtered # deep copy of source data and copies of preview
@@ -210,15 +211,25 @@ def GetSource(event=None) -> None:
210211
# ↓ updating zoom label display
211212
label_zoom['text'] = 'Zoom 1:1'
212213
# ↓ Adding filename to window title a-la Photoshop
213-
sortir.title(f'Averager: {Path(sourcefilename).name}{"*" if is_filtered else ""}')
214+
if Z == 1:
215+
color_title = ' (L)'
216+
elif Z == 2:
217+
color_title = ' (LA)'
218+
elif Z == 3:
219+
color_title = ' (RGB)'
220+
elif Z == 4:
221+
color_title = ' (RGBA)'
222+
else:
223+
color_title = ''
224+
sortir.title(f'Averager: {Path(sourcefilename).name}{color_title}{"*" if is_filtered else ""}')
214225
info_normal = {'txt': f'{Path(sourcefilename).name}{"*" if is_filtered else ""} X={X} Y={Y} Z={Z} maxcolors={maxcolors}', 'fg': 'grey', 'bg': 'grey90'}
215226
# ↓ enabling "Filter"
216227
UINormal()
217228

218229

219230
def RunFilter(event=None) -> None:
220231
"""Filtering image, and previewing"""
221-
global zoom_factor, view_src, is_filtered, is_saved, info_normal
232+
global zoom_factor, view_src, is_filtered, is_saved, info_normal, color_title
222233
global preview, preview_filtered
223234
global X, Y, Z, maxcolors, image3D, info
224235

@@ -258,7 +269,7 @@ def RunFilter(event=None) -> None:
258269
# ↓ binding switch on preview click
259270
zanyato.bind('<Button-1>', SwitchView) # left click
260271
# ↓ Adding filename to window title a-la Photoshop
261-
sortir.title(f'Averager: {Path(sourcefilename).name}{"*" if is_filtered else ""}')
272+
sortir.title(f'Averager: {Path(sourcefilename).name}{color_title}{"*" if is_filtered else ""}')
262273
info_normal = {'txt': f'{Path(sourcefilename).name}{"*" if is_filtered else ""} X={X} Y={Y} Z={Z} maxcolors={maxcolors}', 'fg': 'grey', 'bg': 'grey90'}
263274
UINormal()
264275

@@ -319,7 +330,7 @@ def SwitchView(event=None) -> None:
319330

320331
def Save(event=None) -> None:
321332
"""Once pressed on Save"""
322-
global is_filtered, is_saved, info_normal
333+
global is_filtered, is_saved, info_normal, color_title
323334

324335
if is_saved: # block repetitive saving
325336
return
@@ -338,14 +349,14 @@ def Save(event=None) -> None:
338349
is_filtered = False
339350
menu02.entryconfig('Save', state='disabled')
340351
# ↓ Adding filename to window title a-la Photoshop
341-
sortir.title(f'Averager: {Path(sourcefilename).name}{"*" if is_filtered else ""}')
352+
sortir.title(f'Averager: {Path(sourcefilename).name}{color_title}{"*" if is_filtered else ""}')
342353
info_normal = {'txt': f'{Path(sourcefilename).name}{"*" if is_filtered else ""} X={X} Y={Y} Z={Z} maxcolors={maxcolors}', 'fg': 'grey', 'bg': 'grey90'}
343354
UINormal()
344355

345356

346357
def SaveAs(event=None) -> None:
347358
"""Once pressed on Save as..."""
348-
global sourcefilename, is_saved, is_filtered, info_normal
359+
global sourcefilename, is_saved, is_filtered, info_normal, color_title
349360

350361
# ↓ Adjusting "Save to" formats to be displayed according to bitdepth
351362
if Z < 3:
@@ -374,7 +385,7 @@ def SaveAs(event=None) -> None:
374385
is_filtered = False
375386
menu02.entryconfig('Save', state='disabled')
376387
# ↓ Adding filename to window title a-la Photoshop
377-
sortir.title(f'Averager: {Path(sourcefilename).name}{"*" if is_filtered else ""}')
388+
sortir.title(f'Averager: {Path(sourcefilename).name}{color_title}{"*" if is_filtered else ""}')
378389
info_normal = {'txt': f'{Path(sourcefilename).name}{"*" if is_filtered else ""} X={X} Y={Y} Z={Z} maxcolors={maxcolors}', 'fg': 'grey', 'bg': 'grey90'}
379390
UINormal()
380391

@@ -397,6 +408,7 @@ def SaveAs(event=None) -> None:
397408
# ↓ Info statuses dictionaries
398409
info_normal = {'txt': f'Adaptive Average {__version__}', 'fg': 'grey', 'bg': 'grey90'}
399410
info_busy = {'txt': 'BUSY, PLEASE WAIT', 'fg': 'red', 'bg': 'yellow'}
411+
color_title = ' '
400412

401413
info_string = Label(sortir, text=info_normal['txt'], font=('courier', 7), foreground=info_normal['fg'], background=info_normal['bg'], relief='groove')
402414
info_string.pack(side='bottom', padx=0, pady=(2, 0), fill='both')
@@ -431,6 +443,7 @@ def SaveAs(event=None) -> None:
431443
menu02.add_command(label='Exit', state='normal', command=DisMiss, accelerator='Ctrl+Q')
432444

433445
butt01['menu'] = menu02
446+
butt01.focus_set()
434447

435448
# ↓ Filter section begins
436449
info00 = Label(frame_top, text='Filtering threshold:', font=('helvetica', 8, 'italic'), justify='right', foreground='brown', state='disabled')

0 commit comments

Comments
 (0)