Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Commit

Permalink
multiply files support for gui
Browse files Browse the repository at this point in the history
  • Loading branch information
exherb committed May 13, 2015
1 parent 9031848 commit 322a26f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 23 deletions.
5 changes: 3 additions & 2 deletions freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
app=[mainscript],
options={'py2app': {'argv_emulation': False,
'iconfile': 'icos/icon.icns',
'packages': ['PIL'],
'plist': {
'CFBundleName': name,
'CFBundleShortVersionString': '1.0.1',
'CFBundleVersion': '1.0.1',
'CFBundleShortVersionString': '0.1.2',
'CFBundleVersion': '0.1.2',
'NSHumanReadableCopyright': '@Herb Brewer 2014'
}
}})
Expand Down
30 changes: 17 additions & 13 deletions icons/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,17 @@ def _main_():
output_path = tk.StringVar(window, '')

icon_types = []
icon_types.append(('icon', 'App Icon'))
icon_types.append(('launch',
'App Lauch Image'))
icon_types.append(('image', 'Icon'))
icon_types.append(('favicon', 'Favicon'))
icon_types.append(('tab', 'Tabbar Icon'))
icon_types.append(('toolbar',
'Toolbar Icon'))
icon_types.append(('tab', 'Tabbar Icon'))
icon_types.append(('icon', 'App Icon'))
icon_types.append(('launch',
'App Lauch Image'))
icon_types.append(('notification',
'Notification Icon'))
icon_type = tk.StringVar(window, 'icon')
icon_types.append(('favicon', 'Favicon'))
icon_type = tk.StringVar(window, 'image')
device_type = tk.StringVar(window, 'device')

baseline = tk.IntVar(window, 3, 'baseline')
Expand Down Expand Up @@ -296,19 +296,23 @@ def on_select_icon(event):
return
window.is_picking_file = True
if hasattr(event, 'data'):
icon_path = event.data.split()[0]
_, ext = os.path.splitext(icon_path)
if ext.lower() not in ['.png', '.jpg', '.jpeg', '.bmp']:
return
icon_paths = []
input_icon_paths = event.data.split()
for icon_path in input_icon_paths:
_, ext = os.path.splitext(icon_path)
if ext.lower() not in ['.png', '.jpg', '.jpeg', '.bmp']:
continue
icon_paths.append(icon_path)
else:
icon_path = filedialog.\
icon_paths = filedialog.\
askopenfilename(title='Select your icon',
multiple=True,
filetypes=[('Images', '.png .jpg .jpeg .bmp')])
if icon_path:
for icon_path in icon_paths:
try:
image = Image.open(icon_path)
except Exception:
return
continue

image_name, _ = os.path.splitext(os.path.basename(icon_path))
if output_path.get():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


setup(name='icons',
version='0.1.1',
version='0.1.2',
description='generate icons of all sizes and config file ' +
'(e.g. Contents.json) required by iOS or Android app, ' +
'inspired by http://makeappicon.com',
Expand Down
4 changes: 1 addition & 3 deletions web/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def get(self):
self.response.write(template.render())

def post(self):
image_type = self.request.get('type', 'icon')
if image_type not in supported_types():
image_type = 'icon'
image_type = self.request.get('type', 'image')
file = StringIO.StringIO(self.request.get('file'))
zip_file = StringIO.StringIO()
with closing(ZipFile(zip_file, 'w', ZIP_DEFLATED)) as tmp:
Expand Down
8 changes: 4 additions & 4 deletions web/template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ <h1>Drop Icon Below</h1>
<div id="main">
<form id="dropzone" action="/" method="post"></form>
<select id="type">
<option value="icon">App Icon</option>
<option value="launch">App Lauch Image</option>
<option value="toolbar">Toolbar Icon</option>
<option value="image">Icon</option>
<option value="tab">Tabbar Icon</option>
<option value="image">Common</option>
<option value="toolbar">Toolbar Icon</option>
<option value="notification">Notification Icon</option>
<option value="icon">App Icon</option>
<option value="launch">App Lauch Image</option>
<option value="favicon">Favicon</option>
</select>
<p id="download" style="text-align: center;"></p>
Expand Down

0 comments on commit 322a26f

Please sign in to comment.