Skip to content

Commit

Permalink
admin clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
villares committed Oct 14, 2023
1 parent 1065847 commit 5185cb3
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 13 deletions.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions admin_scripts/one_off/sketch_2023_09_30.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import PIL.Image
import py5

from zipfile import ZipFile

def setup():
py5.size(896, 768)
y = x = 0
icon_imgs = {}
with ZipFile('icons.zip') as icons:
for f in sorted(icons.namelist()[1:]):
img = PIL.Image.open(icons.open(f))
py5image = py5.convert_image(img)
py5.image(py5image, x, y)
suf = f.split('/')[1].split('.')[0]
print(suf)
icon_imgs[suf] = py5image
x += 64
if x > py5.width - 64:
x = 0
y += 64

py5.run_sketch()
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions admin_scripts/py5_experimental_conversion.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path

import py5_tools
import py5
from shutil import copytree
from pathlib import Path

# pp2i = py5_tools.translators.processingpy2imported

Expand Down
22 changes: 11 additions & 11 deletions admin_scripts/py5_tools_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
source_dir = Path.cwd()
target_dir = source_dir.parent / f'{source_dir.name}_converted'

args = sys.argv[1:]
for i, arg in enumerate(args):
if i == 0:
if translator := translators.get(arg):
print(arg)
else:
print('no translator selected.')
exit()

result = translator.translate_dir(source_dir, target_dir, ext='.py')
print(result)
args = sys.argv
if len(args) == 2:
arg = args[1]
if translator := translators.get(arg):
print(arg)
result = translator.translate_dir(source_dir, target_dir, ext='.py')
print(result)
exit()

print('no translator selected.')
exit()


#source_dir = '/home/villares/GitHub/processing-python/'
#target_dir = '/home/villares/GitHub/processing-python/'
#source_dir = '/home/villares/GitHub/py.processing-play/'
Expand Down

0 comments on commit 5185cb3

Please sign in to comment.