From b8787adf29b675906ad28418c3b523bb078097d1 Mon Sep 17 00:00:00 2001 From: Chris Brulak Date: Mon, 26 Oct 2015 14:10:28 -0400 Subject: [PATCH 1/2] support mutliple sketch files and pass in Asset group as 3rd arg --- slice.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/slice.py b/slice.py index 4c3b787..7df1b29 100644 --- a/slice.py +++ b/slice.py @@ -89,8 +89,8 @@ def info(self): # parse arguments -if not len(sys.argv) == 3: - print "Proper usage: python slice.py [.sketch file] [.xcassets file]" +if not len(sys.argv) == 4: + print "Proper usage: python slice.py [.sketch file] [.xcassets file] Group" exit(1) INPUT_FILE = os.path.abspath(sys.argv[1]) @@ -108,9 +108,14 @@ def info(self): if not ASSETS_FILE.endswith('.xcassets'): print "Output file is expected to be a .xcassets bundle" exit(1) + +ASSETS_GROUP = sys.argv[3] +if not ASSETS_GROUP: + ASSETS_GROUP = "Slices" + EXPORT_DIR = os.path.join(os.path.dirname(INPUT_FILE), 'tmp_exported_slices') -OUTPUT_DIR = os.path.join(ASSETS_FILE, 'Slices') +OUTPUT_DIR = os.path.join(ASSETS_FILE, ASSETS_GROUP) OUTPUT_INFO_PATH = os.path.join(OUTPUT_DIR, 'info.json') # check to see if the sketch file has been modified @@ -145,6 +150,7 @@ def info(self): sketchtool_executable, 'export', 'slices', + '--scales="1.0, 2.0, 3.0"', INPUT_FILE, '--output=' + EXPORT_DIR, ]) From 5f39cf337f76ca55a05298a5c10017906b9e8db1 Mon Sep 17 00:00:00 2001 From: Chris Brulak Date: Mon, 26 Oct 2015 14:12:24 -0400 Subject: [PATCH 2/2] remove slices from PR --- slice.py | 1 - 1 file changed, 1 deletion(-) diff --git a/slice.py b/slice.py index 7df1b29..d4d87b8 100644 --- a/slice.py +++ b/slice.py @@ -150,7 +150,6 @@ def info(self): sketchtool_executable, 'export', 'slices', - '--scales="1.0, 2.0, 3.0"', INPUT_FILE, '--output=' + EXPORT_DIR, ])