/gtk/prep-images

To get this branch, use:
bzr branch http://bzr.ed.am/gtk/prep-images

« back to all changes in this revision

Viewing changes to lib/prep_images/prefs_dialog.py

  • Committer: Tim Marston
  • Date: 2013-07-17 22:56:36 UTC
  • Revision ID: tim@ed.am-20130717225636-on2as6cto9js0cpr
set version to development version

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#
3
3
# Copyright (C) 2011 Tim Marston <edam@waxworlds.org>
4
4
#
5
 
# This file is part of add-copyright-to-images (hereafter referred to as "this
6
 
# program").
7
 
# See http://www.waxworlds.org/edam/software/add-copyright-to-images for more
 
5
# This file is part of prep-images (hereafter referred to as "this program").
 
6
# See http://www.waxworlds.org/edam/software/gtk/prep-images for more
8
7
# information.
9
8
#
10
9
# 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
 
10
# it under the terms of the GNU General Public License as published by
 
11
# the Free Software Foundation, either version 3 of the License, or
13
12
# (at your option) any later version.
14
13
#
15
14
# This program is distributed in the hope that it will be useful,
16
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
# GNU Lesser General Public License for more details.
 
17
# GNU General Public License for more details.
19
18
#
20
 
# You should have received a copy of the GNU Lesser General Public License
 
19
# You should have received a copy of the GNU General Public License
21
20
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
21
 
23
22
 
81
80
                vbox1 = gtk.VBox( False, 0 )
82
81
                alignment2.add( vbox1 )
83
82
                self.resize_check_button = gtk.CheckButton( \
84
 
                                "Resize image when adding copyright overlay" )
 
83
                        "Resize image when adding copyright overlay" )
85
84
                self.resize_check_button.set_active( self.prefs.resize )
86
85
                self.resize_check_button.connect( "clicked", \
87
 
                                self.resize_check_button_pressed )
 
86
                        self.resize_check_button_pressed )
88
87
                vbox1.pack_start( self.resize_check_button, False, False, 0 )
89
88
                alignment3 = gtk.Alignment( 0.5, 0.5, 1.0, 1.0 )
90
89
                alignment3.set_padding( 5, 0, 12, 0 )
94
93
                label3 = gtk.Label( "Width:" )
95
94
                self.resize_hbox.pack_start( label3, False, False, 0 )
96
95
                adjustment1 = gtk.Adjustment( self.prefs.resize_width, \
97
 
                                1, 9999999, 1 )
 
96
                        1, 9999999, 1 )
98
97
                self.resize_width_spin_button = gtk.SpinButton( adjustment1 )
99
98
                self.resize_width_spin_button.set_numeric( True )
100
99
                self.resize_hbox.pack_start( \
101
 
                                self.resize_width_spin_button, True, True, 0 )
 
100
                        self.resize_width_spin_button, True, True, 0 )
102
101
                label4 = gtk.Label( "Height:" )
103
102
                self.resize_hbox.pack_start( label4, False, False, 0 )
104
103
                adjustment2 = gtk.Adjustment( self.prefs.resize_height, \
105
 
                                1, 9999999, 1 )
 
104
                        1, 9999999, 1 )
106
105
                self.resize_height_spin_button = gtk.SpinButton( adjustment2 )
107
106
                self.resize_height_spin_button.set_numeric( True )
108
107
                self.resize_hbox.pack_start( \
109
 
                                self.resize_height_spin_button, True, True, 0 )
 
108
                        self.resize_height_spin_button, True, True, 0 )
110
109
 
111
110
                # export frame
112
111
                export_frame = gtk.Frame()
121
120
                vbox2 = gtk.VBox( False, 0 )
122
121
                alignment6.add( vbox2 )
123
122
                self.export_radio_button = gtk.RadioButton( None, \
124
 
                                "Resize and add copyright to image in place" )
 
123
                        "Resize and add copyright to image in place" )
125
124
                self.export_radio_button.set_active( self.prefs.export_inplace )
126
125
                vbox2.pack_start( self.export_radio_button, False, False, 0 )
127
126
                hbox3 = gtk.HBox( False, 10 )
128
127
                vbox2.pack_start( hbox3, False, False, 0 )
129
128
                radio_button1 = gtk.RadioButton( self.export_radio_button, \
130
 
                                "Append" )
 
129
                        "Append" )
131
130
                radio_button1.set_active( not self.prefs.export_inplace )
132
131
                hbox3.pack_start( radio_button1, False, False, 0 )
133
132
                self.export_append_entry = gtk.Entry()
170
169
 
171
170
        def ok_button_pressed( self, widget ):
172
171
                self.prefs.copyright_filename = \
173
 
                                self.copyright_entry.get_text().strip()
 
172
                        self.copyright_entry.get_text().strip()
174
173
                self.prefs.resize = \
175
 
                                self.resize_check_button.get_active()
 
174
                        self.resize_check_button.get_active()
176
175
                self.prefs.resize_width = \
177
 
                                int( self.resize_width_spin_button.get_value_as_int() )
 
176
                        int( self.resize_width_spin_button.get_value_as_int() )
178
177
                self.prefs.resize_height = \
179
 
                                int( self.resize_height_spin_button.get_value_as_int() )
 
178
                        int( self.resize_height_spin_button.get_value_as_int() )
180
179
                self.prefs.export_inplace = \
181
 
                                self.export_radio_button.get_active()
 
180
                        self.export_radio_button.get_active()
182
181
                self.prefs.export_append = \
183
 
                                self.export_append_entry.get_text().strip()
 
182
                        self.export_append_entry.get_text().strip()
184
183
                self.prefs.save()
185
184
                self.window.destroy()
186
185
 
187
186
        def open_button_pressed( self, widget ):
188
187
                dialog = gtk.FileChooserDialog( "Choose Copyright Overlay Image", \
189
 
                                self.window, gtk.FILE_CHOOSER_ACTION_OPEN, \
190
 
                                ( gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, \
191
 
                                gtk.STOCK_OPEN, gtk.RESPONSE_OK) )
 
188
                        self.window, gtk.FILE_CHOOSER_ACTION_OPEN, \
 
189
                        ( gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, \
 
190
                        gtk.STOCK_OPEN, gtk.RESPONSE_OK) )
192
191
                dialog.set_default_response(gtk.RESPONSE_OK)
193
192
                filter = gtk.FileFilter()
194
193
                filter.set_name( "Images" )
212
211
 
213
212
        def resize_check_button_pressed( self, widget = None ):
214
213
                self.resize_hbox.set_sensitive(
215
 
                                self.resize_check_button.get_active() )
 
214
                        self.resize_check_button.get_active() )