Compare commits
No commits in common. "86692904a33184dfd666528b2d83bb49a16b4fd5" and "73df06730ff4c6a9cc858260eb12635ca298d8a8" have entirely different histories.
86692904a3
...
73df06730f
2 changed files with 417 additions and 431 deletions
2
PGUI.pyw
2
PGUI.pyw
|
|
@ -84,7 +84,6 @@ class PGUILauncher(tkinter.Frame):
|
|||
)
|
||||
self.filter_entry.bind('<Return>', self.launch_filtered)
|
||||
self.filter_entry.bind('<Escape>', self.quit)
|
||||
self.filter_entry.bind('<Control-w>', self.quit)
|
||||
|
||||
self.open_folder_button = tkinter.Button(
|
||||
self.upper_frame,
|
||||
|
|
@ -98,6 +97,7 @@ class PGUILauncher(tkinter.Frame):
|
|||
self.upper_frame.grid(row=0, column=0, columnspan=999, sticky='ew', padx=8, pady=8)
|
||||
self.filter_entry.grid(row=0, column=0, sticky='news', padx=2, pady=2)
|
||||
self.open_folder_button.grid(row=0, column=1, sticky='news', padx=2, pady=2)
|
||||
return self.filter_entry
|
||||
|
||||
def filter(self, *args):
|
||||
text = self.filter_entry.get().lower()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,12 @@ from voussoirkit import vlogging
|
|||
|
||||
log = vlogging.getLogger(__name__, 'imagegallery')
|
||||
|
||||
TEMPLATE = jinja2.Template('''
|
||||
def imagegallery_argparse(args):
|
||||
patterns = pipeable.input_many(args.patterns)
|
||||
files = list(pathclass.glob_many_files(patterns))
|
||||
files.sort()
|
||||
|
||||
html = jinja2.Template(textwrap.dedent('''
|
||||
<html>
|
||||
<head>
|
||||
{% if title %}
|
||||
|
|
@ -288,9 +293,7 @@ pre,
|
|||
{% for file in files %}
|
||||
<article class="photograph">
|
||||
<a target="_blank" href="{{urlroot}}{{file.relative_to('.', simple=True)}}"><img loading="lazy" src="{{urlroot}}thumbs/small_{{file.relative_to('.', simple=True)}}"/></a>
|
||||
{% if with_download_links %}
|
||||
<a class="download_link" download="{{file.basename}}" href="{{urlroot}}{{file.relative_to('.', simple=True)}}">#{{loop.index}}/{{files|length}}</a>
|
||||
{% endif %}
|
||||
</article>
|
||||
{% endfor %}
|
||||
</body>
|
||||
|
|
@ -427,27 +430,10 @@ function on_pageload()
|
|||
document.addEventListener("DOMContentLoaded", on_pageload);
|
||||
</script>
|
||||
</html>
|
||||
''')
|
||||
|
||||
def imagegallery(files, title, urlroot, with_download_links):
|
||||
html = TEMPLATE.render(
|
||||
files=files,
|
||||
title=title,
|
||||
urlroot=urlroot,
|
||||
with_download_links=with_download_links,
|
||||
)
|
||||
return html
|
||||
|
||||
def imagegallery_argparse(args):
|
||||
patterns = pipeable.input_many(args.patterns)
|
||||
files = list(pathclass.glob_many_files(patterns))
|
||||
files.sort()
|
||||
|
||||
html = imagegallery(
|
||||
''')).render(
|
||||
files=files,
|
||||
title=args.title,
|
||||
urlroot=args.urlroot or '',
|
||||
with_download_links=True,
|
||||
)
|
||||
pathclass.Path('gallery.html').open('w', encoding='utf-8').write(html)
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue