25
25
# @PACKAGE_NAME@ version @PACKAGE_VERSION@
28
28
from os.path import join, abspath, exists
30
32
# check for a development source directory and use that if it's there
31
33
PACKAGE_DIR = join( abspath( sys.path[ 0 ] ), "..", "lib" )
32
34
if exists( join( PACKAGE_DIR, "prep_images", "prefs_dialog.py" ) ):
33
print "!!! using development packages !!!"
35
print >> sys.stderr, "!!! using development packages !!!"
34
36
sys.path.insert( 0, PACKAGE_DIR )
39
pygtk.require( '2.0' );
41
def usage( error = True ):
42
print >> sys.stderr, 'Try "@PACKAGE_NAME@ --help" for help'
47
print "Usage: @PACKAGE_NAME@ [OPTION]... FILE..."
49
print "Prepare the specified image FILEs for publishing."
52
print " --help display this help and exit"
53
print " --version output version information and exit"
58
print "@PACKAGE_NAME@ @PACKAGE_VERSION@"
60
print "Copyright (C) 2011 to 2013 Tim Marston"
61
print "License GPLv3+: GNU GPL version 3 or later " + \
62
"<http://gnu.org/licenses/gpl.html>"
63
print "This is free software: you are free to change and " + \
66
print "For more information, including documentation, see the " +\
68
print "<@PACKAGE_URL@>. Please report bugs to <@PACKAGE_BUGREPORT@>."
74
opts, args = getopt.gnu_getopt(
76
[ "help", "version" ] )
77
except getopt.GetoptError as e:
82
for opt, args in opts:
85
elif opt == "--version":
88
print >> sys.stderr, "unknown option"
93
print >> sys.stderr, "no files specified"
96
# try to detect no DISPLAY
97
if os.getenv( 'DISPLAY', '' ) == '':
98
print >> sys.stderr, 'could not open display'
101
# we only now import the main window stuff, because it pulls in PyGTK which
102
# complains if it can't connect to a display
41
103
from prep_images.main_window import *
44
if( len( sys.argv[ 1: ] ) == 0 ):
45
dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, \
46
gtk.BUTTONS_CLOSE, "No images specified" )
47
dialog.format_secondary_text( "You must select some files first!" )
52
105
# process each image in turn
53
for filename in sys.argv[ 1: ]:
106
for filename in args:
54
107
MainWindow( filename ).main()