/gtk/prep-images

To get this branch, use:
bzr branch http://bzr.ed.am/gtk/prep-images
1 by edam
- initial commit, includes project and build setup
1
#!/usr/bin/env python
2
3 by edam
- renamed project from add-copyright-to-images to prep-images
3
# prep-images
1 by edam
- initial commit, includes project and build setup
4
#
5
# Copyright (C) 2011 Tim Marston <edam@waxworlds.org>
6
#
3 by edam
- renamed project from add-copyright-to-images to prep-images
7
# This file is part of prep-images (hereafter referred to as "this program").
8
# See http://www.waxworlds.org/edam/software/gtk/prep-images for more
1 by edam
- initial commit, includes project and build setup
9
# information.
10
#
11
# This program is free software: you can redistribute it and/or modify
3 by edam
- renamed project from add-copyright-to-images to prep-images
12
# it under the terms of the GNU General Public License as published by
13
# the Free Software Foundation, either version 3 of the License, or
1 by edam
- initial commit, includes project and build setup
14
# (at your option) any later version.
15
#
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3 by edam
- renamed project from add-copyright-to-images to prep-images
19
# GNU General Public License for more details.
1 by edam
- initial commit, includes project and build setup
20
#
3 by edam
- renamed project from add-copyright-to-images to prep-images
21
# You should have received a copy of the GNU General Public License
1 by edam
- initial commit, includes project and build setup
22
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
24
4 by edam
- removed '.0' from the end of the version no.
25
# @PACKAGE_NAME@ version @PACKAGE_VERSION@
1 by edam
- initial commit, includes project and build setup
26
27
import sys
28
from os.path import join, abspath, exists
29
30
# check for a development source directory and use that if it's there
3 by edam
- renamed project from add-copyright-to-images to prep-images
31
PACKAGE_DIR = join( abspath( sys.path[ 0 ] ), "..", "lib" )
32
if exists( join( PACKAGE_DIR, "prep_images", "prefs_dialog.py" ) ):
33
	print "!!! using development packages !!!"
34
	sys.path.insert( 0, PACKAGE_DIR )
1 by edam
- initial commit, includes project and build setup
35
else:
3 by edam
- renamed project from add-copyright-to-images to prep-images
36
	del PACKAGE_DIR
1 by edam
- initial commit, includes project and build setup
37
38
import pygtk
39
pygtk.require( '2.0' );
40
import gtk
3 by edam
- renamed project from add-copyright-to-images to prep-images
41
from prep_images.main_window import *
1 by edam
- initial commit, includes project and build setup
42
43
# no arguments?
44
if( len( sys.argv[ 1: ] ) == 0 ):
3 by edam
- renamed project from add-copyright-to-images to prep-images
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!" )
48
	dialog.run()
49
	dialog.destroy()
50
	exit( 1 )
1 by edam
- initial commit, includes project and build setup
51
52
# process each image in turn
53
for filename in sys.argv[ 1: ]:
3 by edam
- renamed project from add-copyright-to-images to prep-images
54
	MainWindow( filename ).main()