From 9662d0438fd80293d6353469553f62397d5295a3 Mon Sep 17 00:00:00 2001 From: Adam Lundrigan Date: Thu, 24 May 2012 15:43:22 -0230 Subject: [PATCH 1/3] Added simple --edit flag handling to allow editing before uploading screenshot --- screenshot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/screenshot b/screenshot index 98c8efd..e63fa1c 100755 --- a/screenshot +++ b/screenshot @@ -32,6 +32,9 @@ path = '/tmp/ss.png' os.system('scrot --b -s '+path) os.system('convert '+path+' \( +clone -background black -shadow 60x5+10+10 \) +swap -background none -layers merge +repage '+path) +if sys.argv[1] == '--edit-gimp': + os.system('gimp '+path); + # encode the screenshot with base64 data = base64.b64encode(open(path, 'r').read()) From 03aaec77cc17a5d178be125c9ce68516af482972 Mon Sep 17 00:00:00 2001 From: Adam Lundrigan Date: Thu, 24 May 2012 16:07:03 -0230 Subject: [PATCH 2/3] Added option to configuration file to control which program is executed when edit flag is used --- config.cfg-sample | 1 + screenshot | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.cfg-sample b/config.cfg-sample index 8ce0933..871bcec 100644 --- a/config.cfg-sample +++ b/config.cfg-sample @@ -2,3 +2,4 @@ username=myuser password=mypass posturl=http://yourhost.tld/gtkgrab/handler.php +editor=gimp %s diff --git a/screenshot b/screenshot index e63fa1c..923d26f 100755 --- a/screenshot +++ b/screenshot @@ -27,13 +27,14 @@ config.readfp(open(os.path.dirname(sys.argv[0]) + '/config.cfg')) user = config.get('GtkGrab','username') token = config.get('GtkGrab','password') postURL = config.get('GtkGrab','posturl') +editorCmd = config.get('GtkGrab', 'editor') path = '/tmp/ss.png' os.system('scrot --b -s '+path) os.system('convert '+path+' \( +clone -background black -shadow 60x5+10+10 \) +swap -background none -layers merge +repage '+path) -if sys.argv[1] == '--edit-gimp': - os.system('gimp '+path); +if len(sys.argv) > 1 and sys.argv[1] == '--edit': + os.system(editorCmd % (path)); # encode the screenshot with base64 data = base64.b64encode(open(path, 'r').read()) From dc0e7c572e9a75ad9dc0d83048814ed5eeef9867 Mon Sep 17 00:00:00 2001 From: Adam Lundrigan Date: Thu, 24 May 2012 16:09:52 -0230 Subject: [PATCH 3/3] Added edit flag to screenshot-mac --- screenshot-mac | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/screenshot-mac b/screenshot-mac index 2007099..d3bc57c 100755 --- a/screenshot-mac +++ b/screenshot-mac @@ -27,10 +27,14 @@ config.readfp(open(os.path.dirname(sys.argv[0]) + '/config.cfg')) user = config.get('GtkGrab','username') token = config.get('GtkGrab','password') postURL = config.get('GtkGrab','posturl') +editorCmd = config.get('GtkGrab', 'editor') path = '/tmp/ss.png' os.system('screencapture -i '+path) +if len(sys.argv) > 1 and sys.argv[1] == '--edit': + os.system(editorCmd % (path)); + # encode the screenshot with base64 data = base64.b64encode(open(path, 'r').read())