/gtk/prep-images

To get this branch, use:
bzr branch http://bzr.ed.am/gtk/prep-images
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python

# prep-images
#
# Copyright (C) 2011 Tim Marston <edam@waxworlds.org>
#
# This file is part of prep-images (hereafter referred to as "this program").
# See http://www.waxworlds.org/edam/software/gtk/prep-images for more
# information.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


# @PACKAGE_NAME@ version @PACKAGE_VERSION@

import sys
from os.path import join, abspath, exists

# check for a development source directory and use that if it's there
PACKAGE_DIR = join( abspath( sys.path[ 0 ] ), "..", "lib" )
if exists( join( PACKAGE_DIR, "prep_images", "prefs_dialog.py" ) ):
	print "!!! using development packages !!!"
	sys.path.insert( 0, PACKAGE_DIR )
else:
	del PACKAGE_DIR

import pygtk
pygtk.require( '2.0' );
import gtk
from prep_images.main_window import *

# no arguments?
if( len( sys.argv[ 1: ] ) == 0 ):
	dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, \
		gtk.BUTTONS_CLOSE, "No images specified" )
	dialog.format_secondary_text( "You must select some files first!" )
	dialog.run()
	dialog.destroy()
	exit( 1 )

# process each image in turn
for filename in sys.argv[ 1: ]:
	MainWindow( filename ).main()