45
45
ui_manager = self.window.get_ui_manager()
46
46
self.action_group = Gtk.ActionGroup( 'EogManageRawsPluginActions' )
47
47
self.action_group.add_actions( [ ( 'EogPluginRunKeepRaw', None,
48
_( 'Keep Raw Image' ), 'K',
48
_( 'Keep Raw File' ), 'K',
49
49
_( "Move the accompanying raw file to a 'raw' subdirectory" ),
50
self.do_keep_raw_image ) ], self.window )
50
self.do_keep_raw_file ) ], self.window )
51
51
self.action_group.add_actions( [ ( 'EogPluginRunUnkeepRaw', None,
52
_( 'Unkeep Raw Image' ), 'U',
52
_( 'Unkeep Raw File' ), 'U',
53
53
_( "Move the accompanying raw file back to the image's directory" ),
54
self.do_unkeep_raw_image ) ], self.window )
54
self.do_unkeep_raw_file ) ], self.window )
55
55
self.action_group.add_actions( [ ( 'EogPluginRunDeleteRaw', None,
56
_( 'Delete Unkept Raw Images' ), None,
56
_( 'Delete Unkept Raw Files' ), None,
57
57
_( "Delete all raw files in the current image's directory (the unkept ones)" ),
58
self.do_delete_raw_images ) ], self.window )
58
self.do_delete_raw_files ) ], self.window )
59
59
ui_manager.insert_action_group( self.action_group, -1 )
60
60
self.ui_id = ui_manager.add_ui_from_string( """
144
144
if( os.path.isfile( base_fname + '.' + ext ) ):
145
145
return os.path.basename( base_fname + '.' + ext );
147
# path the raw images will be moved to
147
# path the raw files will be moved to
148
148
raw_path = os.path.dirname( fname ) + '/raw';
150
150
# loop through valid raw file extensions, uppercase and lowercase
181
181
self.statusbar.push( 0, " " + _( 'raw: keep' ) )
183
def do_keep_raw_image( self, action, window ):
185
# do we have just the one selected image? we can't handle multiple
186
# images because EogThumbView.get_selected_images() doesn't work.
187
thumb_view = window.get_thumb_view()
188
if( thumb_view.get_n_selected() == 1 ):
191
image = thumb_view.get_first_selected_image()
193
self.keep_raw_image( image )
196
self.update_status( window )
198
def do_unkeep_raw_image( self, action, window ):
200
# do we have just the one selected image? we can't handle multiple
201
# images because EogThumbView.get_selected_images() doesn't work.
202
thumb_view = window.get_thumb_view()
203
if( thumb_view.get_n_selected() == 1 ):
206
image = thumb_view.get_first_selected_image()
208
self.unkeep_raw_image( image )
211
self.update_status( window )
213
def keep_raw_image( self, image ):
183
def do_keep_raw_file( self, action, window ):
185
# do we have just the one selected image? we can't handle multiple
186
# images because EogThumbView.get_selected_images() doesn't work.
187
thumb_view = window.get_thumb_view()
188
if( thumb_view.get_n_selected() == 1 ):
191
image = thumb_view.get_first_selected_image()
193
self.keep_raw_file( image )
196
self.update_status( window )
198
def do_unkeep_raw_file( self, action, window ):
200
# do we have just the one selected image? we can't handle multiple
201
# images because EogThumbView.get_selected_images() doesn't work.
202
thumb_view = window.get_thumb_view()
203
if( thumb_view.get_n_selected() == 1 ):
206
image = thumb_view.get_first_selected_image()
208
self.unkeep_raw_file( image )
211
self.update_status( window )
213
def keep_raw_file( self, image ):
215
215
raw_fname = self.get_raw_filename_from_image( image )
216
216
if( raw_fname is False ):
234
234
# move the raw file in to the raw directory
235
235
os.rename( path + '/' + raw_fname, path + '/raw/' + raw_fname )
237
def unkeep_raw_image( self, image ):
237
def unkeep_raw_file( self, image ):
239
239
raw_fname = self.get_raw_filename_from_image( image )
240
240
if( raw_fname is False ):
258
258
if( len( os.listdir( path + '/raw' ) ) == 0 ):
259
259
os.rmdir( path + '/raw' )
261
def do_delete_raw_images( self, action, window ):
261
def do_delete_raw_files( self, action, window ):
263
263
# get path to first selected image, if there is one
264
264
thumb_view = window.get_thumb_view()