3
# Copyright (C) 2011 Tim Marston <edam@waxworlds.org>
5
# This file is part of add-copyright-to-images (hereafter referred to as "this
7
# See http://www.waxworlds.org/edam/software/add-copyright-to-images for more
10
# This program is free software: you can redistribute it and/or modify
11
# it under the terms of the GNU Lesser General Public License as published
12
# by the Free Software Foundation, either version 3 of the License, or
13
# (at your option) any later version.
15
# This program is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
# GNU Lesser General Public License for more details.
20
# You should have received a copy of the GNU Lesser General Public License
21
# along with this program. If not, see <http://www.gnu.org/licenses/>.
26
pygtk.require( '2.0' );
32
RCFILE = '~/.config/add-copyright-to-images.rc'
37
self.copyright_filename = ''
39
self.resize_width = 1000
40
self.resize_height = 1000
41
self.export_inplace = False
42
self.export_append = ".publish"
47
f = open( os.path.expanduser( self.RCFILE ), 'r' )
49
rclines = f.readlines()
51
dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL, \
52
gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, \
62
parts = line.strip().split( ' ', 2 )
64
if parts[ 0 ] == 'copyright-filename':
65
self.copyright_filename = parts[ 1 ].strip()
66
elif parts[ 0 ] == 'resize':
67
self.resize = bool( int( parts[ 1 ] ) )
68
elif parts[ 0 ] == 'resize-width':
69
self.resize_width = int( parts[ 1 ] )
70
elif parts[ 0 ] == 'resize-height':
71
self.resize_height = int( parts[ 1 ] )
72
elif parts[ 0 ] == 'export-inplace':
73
self.export_inplace = bool( int( parts[ 1 ] ) )
74
elif parts[ 0 ] == 'export-append':
75
self.export_append = parts[ 1 ].strip()
79
f = open( os.path.expanduser( self.RCFILE ), 'w' )
80
f.write( "copyright-filename " + self.copyright_filename + "\n" )
81
f.write( "resize " + str( int( self.resize ) ) + "\n" )
82
f.write( "resize-width " + str( self.resize_width ) + "\n" )
83
f.write( "resize-height " + str( self.resize_height ) + "\n" )
84
f.write( "export-inplace " + str( int( self.export_inplace ) ) + \
86
f.write( "export-append " + self.export_append + "\n" )
88
dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL, \
89
gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, e.strerror )