rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
ignore_elements(self.unexpected_difference.added_files, wildcard) ignore_elements(self.unexpected_difference.removed_files, wildcard) ignore_elements(self.unexpected_difference.modified_files, wildcard) ignore_elements(self.unexpected_difference.touched_files, wildcard)
self.ignore_elements(self.unexpected_difference.added_files, wildcard) self.ignore_elements(self.unexpected_difference.removed_files, wildcard) self.ignore_elements(self.unexpected_difference.modified_files, wildcard) self.ignore_elements(self.unexpected_difference.touched_files, wildcard)
def ignore(self, wildcard): ignore_elements(self.unexpected_difference.added_files, wildcard) ignore_elements(self.unexpected_difference.removed_files, wildcard) ignore_elements(self.unexpected_difference.modified_files, wildcard) ignore_elements(self.unexpected_difference.touched_files, wildcard)
def ignore_elements(list, wildcard):
def ignore_elements(self, list, wildcard):
def ignore_elements(list, wildcard): """Removes in-place, element of 'list' that match the given wildcard.""" w = fnmatch.translate(wildcard) list[:] = filter(lambda x, w=w: not w(x), list)
w = fnmatch.translate(wildcard) list[:] = filter(lambda x, w=w: not w(x), list)
list[:] = filter(lambda x, w=wildcard: not fnmatch.fnmatch(x, w), list)
def ignore_elements(list, wildcard): """Removes in-place, element of 'list' that match the given wildcard.""" w = fnmatch.translate(wildcard) list[:] = filter(lambda x, w=w: not w(x), list)
def __init__(self):
def __init__(self, arguments=""):
def __init__(self):
return open(self.native_file_name(name), "wb").read()
return open(self.native_file_name(name), "rb").read()
def read(self, name): return open(self.native_file_name(name), "wb").read()
def empty():
def empty(self):
def empty(): return (len(self.added_files) == 0 and len(self.removed_files) == 0)\ and len(modified_files) == 0 and len(self.touched_files) == 0
first_image = ""
def expand_filelist_and_load_image(self, inputlist):
self.do_image_list_stuff(first_image)
self.do_image_list_stuff(first_image, second_image)
def expand_filelist_and_load_image(self, inputlist):
def do_image_list_stuff(self, first_image):
def do_image_list_stuff(self, first_image, second_image):
def do_image_list_stuff(self, first_image): if len(self.image_list) > 0: self.set_go_navigation_sensitivities() self.image_list = list(set(self.image_list)) self.image_list.sort(locale.strcoll) for itemnum in range(len(self.image_list)): if first_image == self.image_list[itemnum]: temp = self.image_list[0] self.image_l...
zoomratio = float(self.currimg.get_width())/self.previmg_width newvalue = xadjust.get_value() * zoomratio + (self.available_image_width()) * (zoomratio - 1) / 2
zoomratio = float(self.currimg_width)/self.previmg_width newvalue = abs(xadjust.get_value() * zoomratio + (self.available_image_width()) * (zoomratio - 1) / 2)
def x_adjustment_changed(self, xadjust): try: zoomratio = float(self.currimg.get_width())/self.previmg_width newvalue = xadjust.get_value() * zoomratio + (self.available_image_width()) * (zoomratio - 1) / 2 if newvalue >= xadjust.lower and newvalue <= (xadjust.upper - xadjust.page_size): xadjust.set_value(newvalue) exc...
zoomratio = float(self.currimg.get_width())/self.previmg_width newvalue = yadjust.get_value() * zoomratio + (self.available_image_height()) * (zoomratio - 1) / 2
zoomratio = float(self.currimg_width)/self.previmg_width newvalue = abs(yadjust.get_value() * zoomratio + (self.available_image_height()) * (zoomratio - 1) / 2)
def y_adjustment_changed(self, yadjust): try: zoomratio = float(self.currimg.get_width())/self.previmg_width newvalue = yadjust.get_value() * zoomratio + (self.available_image_height()) * (zoomratio - 1) / 2 if newvalue >= yadjust.lower and newvalue <= (yadjust.upper - yadjust.page_size): yadjust.set_value(newvalue) # ...
self.previmg_width = self.currimg.get_width()
self.previmg_width = self.currimg_width
def y_adjustment_changed(self, yadjust): try: zoomratio = float(self.currimg.get_width())/self.previmg_width newvalue = yadjust.get_value() * zoomratio + (self.available_image_height()) * (zoomratio - 1) / 2 if newvalue >= yadjust.lower and newvalue <= (yadjust.upper - yadjust.page_size): yadjust.set_value(newvalue) # ...
if self.last_image_action_was_fit == True: if self.zoomratio != 1: self.zoom_to_fit_window(None)
if self.last_image_action_was_fit == True and self.zoomratio != 1: self.zoom_to_fit_window(None)
def window_resized(self, widget, allocation): # Update the image size on window resize if the current image was last fit: if self.image_loaded == True: if allocation.width != self.prevwinwidth or allocation.height != self.prevwinheight: if self.last_image_action_was_fit == True: if self.zoomratio != 1: self.zoom_to_fit...
self.statusbar2.set_size_request(100, -1)
self.statusbar2.set_size_request(200, -1)
def __init__(self):
for i in range(len(self.image_list)):
self.num_custom_actions = len(self.image_list) for i in range(self.num_custom_actions): self.curr_custom_action += 1 self.update_statusbar() while gtk.events_pending(): gtk.main_iteration()
def parse_action_command(self, command, batchmode): self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) while gtk.events_pending(): gtk.main_iteration() if batchmode == True: for i in range(len(self.image_list)): imagename = self.image_list[i] self.parse_action_command2(command, imagename) else: self.parse_action_command...
if (animtest.is_static_image() == True and self.currimg_pixbuf_original != animtest.get_static_image()) or (animtest.is_static_image() == False and self.currimg_pixbuf_original != animtest): self.load_new_image(False, False, False, True, False)
if animtest.is_static_image() == True: if self.images_are_different(animtest.get_static_image(), self.currimg_pixbuf_original): self.load_new_image(False, False, False, True, False) else: if self.images_are_different(animtest, self.currimg_pixbuf_original): self.load_new_image(False, False, False, True, False) self.run...
def parse_action_command(self, command, batchmode): self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) while gtk.events_pending(): gtk.main_iteration() if batchmode == True: for i in range(len(self.image_list)): imagename = self.image_list[i] self.parse_action_command2(command, imagename) else: self.parse_action_command...
if (animtest.is_static_image() == True and self.preloadimg_prev_pixbuf_original != animtest.get_static_image()) or (animtest.is_static_image() == False and self.preloadimg_prev_pixbuf_original != animtest): self.preloadimg_prev_pixbuf_original = None self.preload_when_idle = gobject.idle_add(self.preload_prev_image, Fa...
if animtest.is_static_image() == True: if self.images_are_different(animtest.get_static_image(), self.preloadimg_prev_pixbuf_original): self.preloadimg_prev_pixbuf_original = None self.preload_when_idle = gobject.idle_add(self.preload_prev_image, False) else: if self.images_are_different(animtest, self.preloadimg_prev_...
def parse_action_command(self, command, batchmode): self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) while gtk.events_pending(): gtk.main_iteration() if batchmode == True: for i in range(len(self.image_list)): imagename = self.image_list[i] self.parse_action_command2(command, imagename) else: self.parse_action_command...
if (animtest.is_static_image() == True and self.preloadimg_next_pixbuf_original != animtest.get_static_image()) or (animtest.is_static_image() == False and self.preloadimg_next_pixbuf_original != animtest): self.preloadimg_next_pixbuf_original = None self.preload_when_idle = gobject.idle_add(self.preload_next_image, Fa...
if animtest.is_static_image() == True: if self.images_are_different(animtest.get_static_image(), self.preloadimg_next_pixbuf_original): self.preloadimg_next_pixbuf_original = None self.preload_when_idle = gobject.idle_add(self.preload_next_image, False) else: if self.images_are_different(animtest, self.preloadimg_next_...
def parse_action_command(self, command, batchmode): self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) while gtk.events_pending(): gtk.main_iteration() if batchmode == True: for i in range(len(self.image_list)): imagename = self.image_list[i] self.parse_action_command2(command, imagename) else: self.parse_action_command...
if self.searching_for_images == True:
if self.running_custom_actions: status_text = _('Custom actions') + ': ' + str(self.curr_custom_action) + ' ' + _('of') + ' ' + str(self.num_custom_actions) elif self.searching_for_images == True:
def update_statusbar(self): # Update status bar: try: st = os.stat(self.currimg_name) filesize = st[stat.ST_SIZE]/1000 ratio = int(100 * self.currimg_zoomratio) status_text = str(self.currimg_pixbuf_original.get_width()) + "x" + str(self.currimg_pixbuf_original.get_height()) + " " + str(filesize) + "KB " + str(rati...
self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) gtk.main_iteration()
if self.fullscreen_mode == False and (self.slideshow_mode == False or (self.slideshow_mode == True and action != "ss")): self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) gtk.main_iteration()
def goto_first_image(self, action): if self.slideshow_mode == True and action != "ss": gobject.source_remove(self.timer_delay) if len(self.image_list) > 1 and self.curr_img_in_list != 0: try: gobject.source_remove(self.preload_when_idle) gobject.source_remove(self.preload_when_idle2) except: pass cancel = self.autosave...
self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) gtk.main_iteration()
if self.fullscreen_mode == False and (self.slideshow_mode == False or (self.slideshow_mode == True and action != "ss")): self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) gtk.main_iteration()
def goto_last_image(self, action): if self.slideshow_mode == True and action != "ss": gobject.source_remove(self.timer_delay) if len(self.image_list) > 1 and self.curr_img_in_list != len(self.image_list)-1: try: gobject.source_remove(self.preload_when_idle) gobject.source_remove(self.preload_when_idle2) except: pass ca...
if set_prev_to_none == True: self.preloadimg_prev_pixbuf_original = None elif set_next_to_none == True: self.preloadimg_next_pixbuf_original = None
def load_new_image(self, use_preloadimg_next, use_preloadimg_prev, use_current_pixbuf_original, reset_cursor, perform_onload_action): # If use_current_pixbuf_original == True, do not reload the # self.currimg_pixbuf_original from the file; instead, use the existing # one. This is only currently useful for resizing imag...
self.set_window_title()
self.update_title()
def __init__(self):
shortcut = gtk.accelerator_name(event.keyval, event.state)
def topwindow_keypress(self, widget, event): # For whatever reason, 'Left' and 'Right' cannot be used as menu # accelerators so we will manually check for them here: if event.state != gtk.gdk.SHIFT_MASK and event.state != gtk.gdk.CONTROL_MASK and event.state != gtk.gdk.MOD1_MASK and event.state != gtk.gdk.CONTROL_MASK ...
def update_preview(self, file_chooser, preview): filename = file_chooser.get_preview_filename() try: pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filename, 128, 128) preview.set_from_pixbuf(pixbuf) have_preview = True except: pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 1, 8, 128, 128) pixbuf.fill(0x00000000) previ...
def open_folder(self, action): self.open_file_or_folder(action, False)
self.expand_filelist_and_load_image(filenames) self.recursive = False
getfiles = gobject.idle_add(self.expand_filelist_and_load_image, filenames)
def open_file_or_folder(self, action, isfile): # If isfile = True, file; If isfile = False, folder dialog = gtk.FileChooserDialog(title=_("Open"),action=gtk.FILE_CHOOSER_ACTION_OPEN,buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK)) if isfile == True: filter = gtk.FileFilter() filter.set_nam...
self.set_window_title()
self.update_title()
def delete_image(self, action): if len(self.image_list) > 0: temp_slideshow_mode = self.slideshow_mode if self.slideshow_mode == True: self.toggle_slideshow(None) delete_dialog = gtk.Dialog(_('Delete Image'), self.window, gtk.DIALOG_MODAL) if self.delete_without_prompt == False: permlabel = gtk.Label(_('Are you sure yo...
self.set_window_title()
self.update_title()
def image_load_failed(self, reset_cursor): self.currimg_name = str(self.image_list[self.curr_img_in_list]) if self.verbose == True and self.currimg_name != "": print _("Loading:"), self.currimg_name self.set_window_title() self.put_error_image_to_window() self.image_loaded = False self.currimg_pixbuf_original = None if...
self.set_window_title()
self.update_title()
def load_new_image(self, use_preloadimg_next, use_preloadimg_prev, reset_cursor): # If there is a preloaded image available, use that instead of generating # a new one: if use_preloadimg_next == True and self.preloading_images == True: # Set current image as preload_prev_image self.preloadimg_prev_name = self.currimg_n...
self.set_window_title()
self.update_title()
def expand_filelist_and_load_image(self, inputlist): self.images_found = 0 self.stop_now = True # Make sure that any previous search process is stopped # Takes the current list (i.e. ["pic.jpg", "pic2.gif", "../images"]) and # expands it into a list of all pictures found; returns new list self.change_cursor(gtk.gdk.Cur...
def expand_directory(self, item, stop_when_image_found, go_buttons_enabled, update_title, print_found_msg):
def expand_directory(self, item, stop_when_image_found, go_buttons_enabled, update_window_title, print_found_msg):
def expand_directory(self, item, stop_when_image_found, go_buttons_enabled, update_title, print_found_msg): if self.stop_now == False and self.closing_app == False: folderlist = [] filelist = [] if os.access(item, os.R_OK) == False: return False for item2 in os.listdir(item): if item2[0] != '.' and self.closing_app == ...
if item2[0] != '.' and self.closing_app == False:
if item2[0] != '.' and self.closing_app == False and self.stop_now == False:
def expand_directory(self, item, stop_when_image_found, go_buttons_enabled, update_title, print_found_msg): if self.stop_now == False and self.closing_app == False: folderlist = [] filelist = [] if os.access(item, os.R_OK) == False: return False for item2 in os.listdir(item): if item2[0] != '.' and self.closing_app == ...
self.expand_directory(item2, stop_when_image_found, go_buttons_enabled, update_title, print_found_msg) if update_title == True: self.set_window_title() if not self.closing_app: while gtk.events_pending(): gtk.main_iteration(True)
if self.stop_now == False: self.expand_directory(item2, stop_when_image_found, go_buttons_enabled, update_window_title, print_found_msg)
def expand_directory(self, item, stop_when_image_found, go_buttons_enabled, update_title, print_found_msg): if self.stop_now == False and self.closing_app == False: folderlist = [] filelist = [] if os.access(item, os.R_OK) == False: return False for item2 in os.listdir(item): if item2[0] != '.' and self.closing_app == ...
self.set_window_title()
self.update_title()
def toggle_slideshow(self, action): if len(self.image_list) > 1: if self.slideshow_mode == False: if self.slideshow_in_fullscreen == True and self.fullscreen_mode == False: self.enter_fullscreen(None) self.slideshow_mode = True self.set_window_title() self.set_slideshow_sensitivities() if self.curr_slideshow_random == ...
def set_window_title(self):
def update_title(self):
def set_window_title(self): if len(self.image_list) == 0: self.window.set_title("Mirage") else: if self.slideshow_mode == True: self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + ' ' + _('of') + ' ' + str(len(self.image_list)) + "] " + os.path.basename(self.currimg_name) + ' - ' + _('Slideshow Mode')) ...
self.window.set_title("Mirage") else:
title = "Mirage" else: title = "Mirage - [" + str(self.curr_img_in_list+1) + ' ' + _('of') + ' ' + str(len(self.image_list)) + "] " + os.path.basename(self.currimg_name)
def set_window_title(self): if len(self.image_list) == 0: self.window.set_title("Mirage") else: if self.slideshow_mode == True: self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + ' ' + _('of') + ' ' + str(len(self.image_list)) + "] " + os.path.basename(self.currimg_name) + ' - ' + _('Slideshow Mode')) ...
self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + ' ' + _('of') + ' ' + str(len(self.image_list)) + "] " + os.path.basename(self.currimg_name) + ' - ' + _('Slideshow Mode')) else: self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + ' ' + _('of') + ' ' + str(len(self.image_list)) + "] "...
title = title + ' - ' + _('Slideshow Mode') self.window.set_title(title)
def set_window_title(self): if len(self.image_list) == 0: self.window.set_title("Mirage") else: if self.slideshow_mode == True: self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + ' ' + _('of') + ' ' + str(len(self.image_list)) + "] " + os.path.basename(self.currimg_name) + ' - ' + _('Slideshow Mode')) ...
if int(round(self.zoomvalue, 0)) == 1:
if int(round(self.zoomvalue, 0)) == 0:
def __init__(self):
self.zoom_quality = gtk.gdk.INTERP_TILES
self.zoom_quality = gtk.gdk.INTERP_BILINEAR
def __init__(self):
self.zoom_quality = gtk.gdk.INTERP_BILINEAR elif int(round(self.zoomvalue, 0)) == 4:
def __init__(self):
fileext = os.path.splitext(os.path.basename(filename))[1]
fileext = os.path.splitext(os.path.basename(filename))[1].lower
def save_image_as(self, action): dialog = gtk.FileChooserDialog(title=_("Save As"),action=gtk.FILE_CHOOSER_ACTION_SAVE,buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK)) dialog.set_default_response(gtk.RESPONSE_OK) filename = os.path.basename(self.currimg_name) filetype = None dialog.set_cur...
if int(round(self.zoomvalue, 0)) == 1:
if int(round(self.zoomvalue, 0)) == 0:
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(_("Mirage Preferences"), self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # "Interface" prefs: table_settings = gtk.Table(13, 3, False) bglabel = gtk.Label() bglabel.set_markup('<b>' + _('Interface') + '</b>') bgl...
self.zoom_quality = gtk.gdk.INTERP_TILES
self.zoom_quality = gtk.gdk.INTERP_BILINEAR
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(_("Mirage Preferences"), self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # "Interface" prefs: table_settings = gtk.Table(13, 3, False) bglabel = gtk.Label() bglabel.set_markup('<b>' + _('Interface') + '</b>') bgl...
self.zoom_quality = gtk.gdk.INTERP_BILINEAR elif int(round(self.zoomvalue, 0)) == 4:
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(_("Mirage Preferences"), self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # "Interface" prefs: table_settings = gtk.Table(13, 3, False) bglabel = gtk.Label() bglabel.set_markup('<b>' + _('Interface') + '</b>') bgl...
if len(self.image_list) > 0: self.set_go_navigation_sensitivities() self.image_list = list(set(self.image_list)) self.image_list.sort(locale.strcoll) for itemnum in range(len(self.image_list)): if first_image == self.image_list[itemnum]: self.curr_img_in_list = itemnum self.set_window_title() if not self.closing_app: w...
if first_image_came_from_dir == True: self.add_folderlist_images(folderlist, go_buttons_enabled) self.do_image_list_stuff(first_image) else: self.do_image_list_stuff(first_image) self.add_folderlist_images(folderlist, go_buttons_enabled)
def expand_filelist_and_load_image(self, inputlist):
self.max_zoomratio = 5 self.min_zoomratio = 0.1
self.min_zoomratio = 0.02
def __init__(self):
self.zoomratio_for_zoom_to_fit = 1
def __init__(self):
if self.currimg_zoomratio < self.min_zoomratio * self.zoomratio_for_zoom_to_fit: self.set_zoom_out_sensitivities(False) else: self.set_zoom_out_sensitivities(True) if self.currimg_zoomratio > self.max_zoomratio * self.zoomratio_for_zoom_to_fit: self.set_zoom_in_sensitivities(False) else: self.set_zoom_in_sensitivities(...
self.set_zoom_out_sensitivities(True) self.set_zoom_in_sensitivities(True)
def set_zoom_sensitivities(self): if self.currimg_is_animation == False: if self.currimg_zoomratio < self.min_zoomratio * self.zoomratio_for_zoom_to_fit: self.set_zoom_out_sensitivities(False) else: self.set_zoom_out_sensitivities(True) if self.currimg_zoomratio > self.max_zoomratio * self.zoomratio_for_zoom_to_fit: se...
if self.preloading_images == True: self.preloadimg_next_pixbuf_original = None self.preloadimg_prev_pixbuf_original = None self.preload_when_idle = gobject.idle_add(self.preload_next_image, False) self.preload_when_idle2 = gobject.idle_add(self.preload_prev_image, False)
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # "Interface" prefs: table_settings = gtk.Table(13, 3, False) bglabel = gtk.Label() bglabel.set_markup('<b>' + _('Interface') ...
self.set_go_navigation_sensitivities(False)
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # "Interface" prefs: table_settings = gtk.Table(13, 3, False) bglabel = gtk.Label() bglabel.set_markup('<b>' + _('Interface') ...
self.zoomratio_for_zoom_to_fit = self.currimg_zoomratio
def zoom_to_fit_or_1_to_1(self, action, is_preloadimg_next, is_preloadimg_prev): if is_preloadimg_next == True: if self.preloading_images == True and self.preloadimg_next_pixbuf_original != None: win_width = self.available_image_width() win_height = self.available_image_height() preimg_width = self.preloadimg_next_pixb...
if self.image_modified == False:
if self.image_modified == False and self.image_zoomed == False:
def load_new_image(self, use_preloadimg_next, use_preloadimg_prev, use_current_pixbuf_original, reset_cursor, perform_onload_action): # If use_current_pixbuf_original == True, do not reload the # self.currimg_pixbuf_original from the file; instead, use the existing # one. This is only currently useful for resizing imag...
self.load_new_image(False, False, False, False, True)
self.load_new_image(False, False, False, True, True)
def expand_filelist_and_load_image(self, inputlist): # Takes the current list (i.e. ["pic.jpg", "pic2.gif", "../images"]) and # expands it into a list of all pictures found self.images_found = 0 self.stop_now = True # Make sure that any previous search process is stopped self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)...
if self.image_loaded == True and self.last_image_action_was_fit == True:
if self.image_loaded == True:
def window_resized(self, widget, allocation): # Update the image size on window resize if the current image was last fit: if self.image_loaded == True and self.last_image_action_was_fit == True: if allocation.width != self.prevwinwidth or allocation.height != self.prevwinheight: if self.zoomratio != 1: print "window re...
if self.zoomratio != 1: print "window resized" self.zoom_to_fit_window(None)
if self.last_image_action_was_fit == True: if self.zoomratio != 1: self.zoom_to_fit_window(None) else: self.center_image()
def window_resized(self, widget, allocation): # Update the image size on window resize if the current image was last fit: if self.image_loaded == True and self.last_image_action_was_fit == True: if allocation.width != self.prevwinwidth or allocation.height != self.prevwinheight: if self.zoomratio != 1: print "window re...
self.center_image()
def toggle_fullscreen(self, action): if self.fullscreen_mode == True: self.fullscreen_mode = False self.UIManager.get_widget('/Popup/FM4').hide() self.UIManager.get_widget('/Popup/Exit Full Screen').hide() self.window.unfullscreen() if self.toolbar_show == True: self.toolbar.show() self.menubar.show() if self.statusbar...
hbox = gtk.HBox(False, 0) vbox.pack_start(hbox, True, True, 0) hbox.pack_start(self.layout, True, True, 0) hbox.pack_start(self.vscroll, False, False, 0) vbox.pack_start(self.hscroll, False, False, 0)
self.table = gtk.Table(2, 2, False) self.table.attach(self.layout, 0, 1, 0, 1, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 0, 0) self.table.attach(self.hscroll, 0, 1, 1, 2, gtk.FILL|gtk.SHRINK, gtk.FILL|gtk.SHRINK, 0, 0) self.table.attach(self.vscroll, 1, 2, 0, 1, gtk.FILL|gtk.SHRINK, gtk.FILL|gtk.SHRINK, 0, 0) vbox.pack...
def __init__(self):
elif event.keyval == 65363:
elif event.keyval == 65363 or event.keyval == 32:
def topwindow_keypress(self, widget, event): if event.state != gtk.gdk.SHIFT_MASK and event.state != gtk.gdk.CONTROL_MASK and event.state != gtk.gdk.MOD1_MASK and event.state != gtk.gdk.CONTROL_MASK | gtk.gdk.MOD2_MASK: if event.keyval == 65361: # Left arrow self.prev_img_in_list(None) elif event.keyval == 65363: #...
newvalue = xadjust.get_value() * zoomratio + (self.available_image_width() - 20) * (zoomratio - 1) / 2
newvalue = xadjust.get_value() * zoomratio + (self.available_image_width()) * (zoomratio - 1) / 2
def x_adjustment_changed(self, xadjust): try: zoomratio = float(self.currimg.get_width())/self.previmg_width newvalue = xadjust.get_value() * zoomratio + (self.available_image_width() - 20) * (zoomratio - 1) / 2 if newvalue >= xadjust.lower and newvalue <= (xadjust.upper - xadjust.page_size): xadjust.set_value(newvalue...
newvalue = yadjust.get_value() * zoomratio + (self.available_image_height() - 20) * (zoomratio - 1) / 2
newvalue = yadjust.get_value() * zoomratio + (self.available_image_height()) * (zoomratio - 1) / 2
def y_adjustment_changed(self, yadjust): try: zoomratio = float(self.currimg.get_width())/self.previmg_width newvalue = yadjust.get_value() * zoomratio + (self.available_image_height() - 20) * (zoomratio - 1) / 2 if newvalue >= yadjust.lower and newvalue <= (yadjust.upper - yadjust.page_size): yadjust.set_value(newvalu...
if finalimg_width > self.available_image_width(): self.hscroll.show() else: self.hscroll.hide() if finalimg_height > self.available_image_height(): self.vscroll.show() else: self.vscroll.hide() self.layout.set_size(finalimg_width, finalimg_height) self.center_image(finalimg_width, finalimg_height)
if self.orientation == 0: self.currimg_width, self.currimg_height = finalimg_width, finalimg_height else: self.currimg_width, self.currimg_height = finalimg_height, finalimg_width self.show_scrollbars_if_needed() self.layout.set_size(self.currimg_width, self.currimg_height) self.center_image()
def put_zoom_image_to_window(self): previmg = self.currimg # Always start with the original image to preserve quality! # Calculate image size: finalimg_width = int(self.originalimg.get_width() * self.zoomratio) finalimg_height = int(self.originalimg.get_height() * self.zoomratio) # If self.zoomratio < 1, scale first so...
def center_image(self, width, height): if width == 0: width = self.imageview.size_request()[0] if height == 0: height = self.imageview.size_request()[1] while gtk.events_pending(): gtk.main_iteration() x_shift = int((self.available_image_width() - width)/2)
def show_scrollbars_if_needed(self): if self.currimg_width > self.available_image_width(): self.hscroll.show() else: self.hscroll.hide() if self.currimg_height > self.available_image_height(): self.vscroll.show() else: self.vscroll.hide() def center_image(self): x_shift = int((self.available_image_width() - self.curri...
def put_zoom_image_to_window(self): previmg = self.currimg # Always start with the original image to preserve quality! # Calculate image size: finalimg_width = int(self.originalimg.get_width() * self.zoomratio) finalimg_height = int(self.originalimg.get_height() * self.zoomratio) # If self.zoomratio < 1, scale first so...
y_shift = int((self.available_image_height() - height)/2)
y_shift = int((self.available_image_height() - self.currimg_height)/2)
def center_image(self, width, height): if width == 0: width = self.imageview.size_request()[0] if height == 0: height = self.imageview.size_request()[1] while gtk.events_pending(): gtk.main_iteration() x_shift = int((self.available_image_width() - width)/2) if x_shift < 0: x_shift = 0 y_shift = int((self.available_imag...
print x_shift, y_shift
def center_image(self, width, height): if width == 0: width = self.imageview.size_request()[0] if height == 0: height = self.imageview.size_request()[1] while gtk.events_pending(): gtk.main_iteration() x_shift = int((self.available_image_width() - width)/2) if x_shift < 0: x_shift = 0 y_shift = int((self.available_imag...
self.center_image(0, 0)
self.center_image()
def toggle_fullscreen(self, action): if self.fullscreen_mode == True: self.fullscreen_mode = False self.UIManager.get_widget('/Popup/FM4').hide() self.UIManager.get_widget('/Popup/Exit Full Screen').hide() self.window.unfullscreen() if self.toolbar_show == True: self.toolbar.show() self.menubar.show() if self.statusbar...
x = event.x y = event.y
def mouse_moved(self, widget, event):
self.prevmousex = event.x self.prevmousey = event.y
self.prevmousex = event.x_root self.prevmousey = event.y_root
def button_pressed(self, widget, event): # Changes the cursor to the 'resize' cursor, like GIMP, on a middle click: if event.button == 2 or event.button == 1: self.layout.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.FLEUR)) self.prevmousex = event.x self.prevmousey = event.y # Right-click popup: elif self.image_loaded == T...
self.center_image(0, 0)
self.show_scrollbars_if_needed() self.center_image()
def rotate_left(self, action): if self.userimage != "": self.last_image_action_was_fit = False if self.orientation == 0: self.orientation = 1 else: self.orientation = 0 self.location -= 1 if self.location == -1: self.location = 3 self.currimg = self.image_rotate(self.currimg, 90) self.imageview.set_from_pixbuf(self.cur...
self.center_image(0, 0)
self.show_scrollbars_if_needed() self.center_image()
def rotate_right(self, action): if self.userimage != "": self.last_image_action_was_fit = False if self.orientation == 0: self.orientation = 1 else: self.orientation = 0 self.location += 1 if self.location == 4: self.location = 0 self.currimg = self.image_rotate(self.currimg, 270) self.imageview.set_from_pixbuf(self.cu...
if os.path.exists(os.path.expanduser('~/.config/mirage/')) == False: os.mkdir(os.path.expanduser('~/.config/mirage/')) conf.write(file(os.path.expanduser('~/.config/mirage/miragerc'), 'w')) return def delete_event(self, widget, event, data=None): self.stop_now = True self.closing_app = True self.save_settings() sys.ex...
if os.path.exists(os.path.expanduser('~/.config/mirage/')) == False: os.mkdir(os.path.expanduser('~/.config/mirage/')) conf.write(file(os.path.expanduser('~/.config/mirage/miragerc'), 'w')) return def delete_event(self, widget, event, data=None):
def save_settings(self): conf = ConfigParser.ConfigParser() conf.add_section('window') conf.set('window', 'w', self.window.get_allocation().width) conf.set('window', 'h', self.window.get_allocation().height) conf.set('window', 'toolbar', self.toolbar_show) conf.set('window', 'statusbar', self.statusbar_show) conf.add_s...
sys.exit(0) def put_zoom_image_to_window(self, currimg_preloaded):
sys.exit(0) return False def destroy(self, event, data=None): self.stop_now = True self.closing_app = True self.save_settings() return False def exit_app(self, action): self.stop_now = True self.closing_app = True self.save_settings() sys.exit(0) def put_zoom_image_to_window(self, currimg_preloaded):
def exit_app(self, action):
self.ss_delaycombo.append_text(str(self.delayoptions[0]) + " seconds") self.ss_delaycombo.append_text(str(self.delayoptions[1]) + " seconds") self.ss_delaycombo.append_text(str(self.delayoptions[2]) + " seconds") self.ss_delaycombo.append_text(str(self.delayoptions[3]) + " seconds") self.ss_delaycombo.append_text(str(s...
self.ss_delaycombo.append_text(str(self.delayoptions[0]) + ' ' + _('seconds')) self.ss_delaycombo.append_text(str(self.delayoptions[1]) + ' ' + _('seconds')) self.ss_delaycombo.append_text(str(self.delayoptions[2]) + ' ' + _('seconds')) self.ss_delaycombo.append_text(str(self.delayoptions[3]) + ' ' + _('seconds')) self...
def __init__(self):
bglabel.set_markup("<b>_('Interface')</b>")
bglabel.set_markup('<b>' + _('Interface') + '</b>')
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
colortext = gtk.Label("_('Background Color'): ")
colortext = gtk.Label(_('Background Color') + ': ')
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
zoomlabel.set_markup("<b>_('Zoom Quality')</b>")
zoomlabel.set_markup('<b>' + _('Zoom Quality') + '</b>')
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
zoom_label1.set_markup("<i>_('Fastest')</i>")
zoom_label1.set_markup('<i>' + _('Fastest') + '</i>')
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
zoom_label2.set_markup("<i>_('Best')</i>")
zoom_label2.set_markup('<i>' + _('Best') + '</i>')
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
openlabel.set_markup("<b>_('Open Behavior')</b>")
openlabel.set_markup('<b>' + _('Open Behavior') + '</b>')
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
hbox_openmode.pack_start(gtk.Label("_('Open new image in'):"), False, False, 0)
hbox_openmode.pack_start(gtk.Label(_('Open new image in') + ':'), False, False, 0)
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
navlabel.set_markup("<b>_('Navigation')</b>")
navlabel.set_markup('<b>' + _('Navigation') + '</b>')
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
slideshowlabel.set_markup("<b>_('Slideshow')</b>")
slideshowlabel.set_markup('<b>' + _('Slideshow') + '</b>')
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
delaycombo.append_text(str(self.delayoptions[0]) + " _('seconds')") delaycombo.append_text(str(self.delayoptions[1]) + " _('seconds')") delaycombo.append_text(str(self.delayoptions[2]) + " _('seconds')") delaycombo.append_text(str(self.delayoptions[3]) + " _('seconds')") delaycombo.append_text(str(self.delayoptions[4])...
delaycombo.append_text(str(self.delayoptions[0]) + ' ' + _('seconds')) delaycombo.append_text(str(self.delayoptions[1]) + ' ' + _('seconds')) delaycombo.append_text(str(self.delayoptions[2]) + ' ' + _('seconds')) delaycombo.append_text(str(self.delayoptions[3]) + ' ' + _('seconds')) delaycombo.append_text(str(self.dela...
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
editorlabel.set_markup("<b>_('External Image Editor')</b>")
editorlabel.set_markup('<b>' + _('External Image Editor') + '</b>')
def show_prefs(self, action): self.prefs_dialog = gtk.Dialog(title=_("Mirage Preferences"), parent=self.window) self.prefs_dialog.set_has_separator(False) self.prefs_dialog.set_resizable(False) # Add "Interface" prefs:
self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + " _('of') " + str(len(self.image_list)) + "] " + os.path.basename(self.userimage) + " - _('Slideshow Mode')")
self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + ' ' + _('of') + ' ' + str(len(self.image_list)) + "] " + os.path.basename(self.userimage) + ' - ' + _('Slideshow Mode'))
def set_window_title(self): if len(self.image_list) == 0: self.window.set_title("Mirage") else: if self.slideshow_mode == True: self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + " _('of') " + str(len(self.image_list)) + "] " + os.path.basename(self.userimage) + " - _('Slideshow Mode')") else: self.win...
self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + " _('of') " + str(len(self.image_list)) + "] " + os.path.basename(self.userimage))
self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + ' ' + _('of') + ' ' + str(len(self.image_list)) + "] " + os.path.basename(self.userimage))
def set_window_title(self): if len(self.image_list) == 0: self.window.set_title("Mirage") else: if self.slideshow_mode == True: self.window.set_title("Mirage - [" + str(self.curr_img_in_list+1) + " _('of') " + str(len(self.image_list)) + "] " + os.path.basename(self.userimage) + " - _('Slideshow Mode')") else: self.win...
error_dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, "_('Unable to launch') \"" + self.editor + "\". _('Please specify a valid application from Edit > Preferences.')")
error_dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, _('Unable to launch') + ' \"' + self.editor + '\". ' + _('Please specify a valid application from Edit > Preferences.'))
def load_editor(self, action): if self.UIManager.get_widget('/MainMenu/EditMenu/Open in Editor').get_property('sensitive') == True: test = os.spawnlp(os.P_WAIT, self.editor, self.editor, self.userimage) if test == 127: error_dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOS...
if self.show_slideshow_controls == False:
if self.show_slideshow_controls == False and self.controls_moving == False:
def slideshow_controls_show(self): if self.show_slideshow_controls == False: self.show_slideshow_controls = True self.slideshow_controls = gtk.HBox(False, 0) back = gtk.Button("", gtk.STOCK_GO_BACK) alignment = back.get_children()[0] hbox2 = alignment.get_children()[0] image, label = hbox2.get_children() label.set_te...
self.slideshow_controls = gtk.HBox(False, 0) back = gtk.Button("", gtk.STOCK_GO_BACK) alignment = back.get_children()[0] hbox2 = alignment.get_children()[0] image, label = hbox2.get_children() label.set_text('') back.set_property('can-focus', False) back.connect('clicked', self.prev_img_in_list) self.ss_start = gtk.Bu...
def slideshow_controls_show(self): if self.show_slideshow_controls == False: self.show_slideshow_controls = True self.slideshow_controls = gtk.HBox(False, 0) back = gtk.Button("", gtk.STOCK_GO_BACK) alignment = back.get_children()[0] hbox2 = alignment.get_children()[0] image, label = hbox2.get_children() label.set_te...
self.slideshow_controls.pack_start(back, False, False, 0) self.slideshow_controls.pack_start(self.ss_start, False, False, 0) self.slideshow_controls.pack_start(forward, False, False, 0) self.layout.add(self.slideshow_controls) x = 0
def slideshow_controls_show(self): if self.show_slideshow_controls == False: self.show_slideshow_controls = True self.slideshow_controls = gtk.HBox(False, 0) back = gtk.Button("", gtk.STOCK_GO_BACK) alignment = back.get_children()[0] hbox2 = alignment.get_children()[0] image, label = hbox2.get_children() label.set_te...
self.layout.move(self.slideshow_controls, x, y_min) self.slideshow_controls.show_all()
self.layout.move(self.slideshow_controls, 0, y_min)
def slideshow_controls_show(self): if self.show_slideshow_controls == False: self.show_slideshow_controls = True self.slideshow_controls = gtk.HBox(False, 0) back = gtk.Button("", gtk.STOCK_GO_BACK) alignment = back.get_children()[0] hbox2 = alignment.get_children()[0] image, label = hbox2.get_children() label.set_te...
while y > y_max:
while y > y_max and self.show_slideshow_controls == True:
def slideshow_controls_show(self): if self.show_slideshow_controls == False: self.show_slideshow_controls = True self.slideshow_controls = gtk.HBox(False, 0) back = gtk.Button("", gtk.STOCK_GO_BACK) alignment = back.get_children()[0] hbox2 = alignment.get_children()[0] image, label = hbox2.get_children() label.set_te...
self.layout.move(self.slideshow_controls, x, y)
self.layout.move(self.slideshow_controls, 5, y)
def slideshow_controls_show(self): if self.show_slideshow_controls == False: self.show_slideshow_controls = True self.slideshow_controls = gtk.HBox(False, 0) back = gtk.Button("", gtk.STOCK_GO_BACK) alignment = back.get_children()[0] hbox2 = alignment.get_children()[0] image, label = hbox2.get_children() label.set_te...
gtk.main_iteration()
gtk.main_iteration() self.controls_moving = False
def slideshow_controls_show(self): if self.show_slideshow_controls == False: self.show_slideshow_controls = True self.slideshow_controls = gtk.HBox(False, 0) back = gtk.Button("", gtk.STOCK_GO_BACK) alignment = back.get_children()[0] hbox2 = alignment.get_children()[0] image, label = hbox2.get_children() label.set_te...
if self.show_slideshow_controls == True:
if self.show_slideshow_controls == True and self.controls_moving == False:
def slideshow_controls_hide(self): if self.show_slideshow_controls == True: self.show_slideshow_controls = False
x = 0
def slideshow_controls_hide(self): if self.show_slideshow_controls == True: self.show_slideshow_controls = False
self.controls_moving = True
def slideshow_controls_hide(self): if self.show_slideshow_controls == True: self.show_slideshow_controls = False
while y < y_min:
while y < y_min and self.show_slideshow_controls == False:
def slideshow_controls_hide(self): if self.show_slideshow_controls == True: self.show_slideshow_controls = False
self.layout.move(self.slideshow_controls, x, y)
self.layout.move(self.slideshow_controls, 5, y)
def slideshow_controls_hide(self): if self.show_slideshow_controls == True: self.show_slideshow_controls = False
self.coords = [x.get_value(), y.get_value(), width.get_value(), height.get_value()] self.crop_rectangle[0] = int(float(self.coords[0])/self.currimg_pixbuf_original.get_width()*image_width) self.crop_rectangle[1] = int(float(self.coords[1])/self.currimg_pixbuf_original.get_height()*image_height) x2 = int(float(self.coor...
self.coords = [int(x.get_value()), int(y.get_value()), int(width.get_value()), int(height.get_value())] self.crop_rectangle[0] = int(round(float(self.coords[0])/self.currimg_pixbuf_original.get_width()*image_width, 0)) self.crop_rectangle[1] = int(round(float(self.coords[1])/self.currimg_pixbuf_original.get_height()*im...
def crop_value_changed(self, currspinbox, x, y, width, height, width_adj, height_adj, image_width, image_height, image, type): if type == 0: # X if x.get_value() + width.get_value() > self.currimg_pixbuf_original.get_width(): width.handler_block(self.width_changed) width.set_value(self.currimg_pixbuf_original.get_wid...
self.coords[0] = int(float(self.rect[0])/image_width*self.currimg_pixbuf_original.get_width()) self.coords[1] = int(float(self.rect[1])/image_height*self.currimg_pixbuf_original.get_height()) self.coords[2] = int(float(self.rect[2])/image_width*self.currimg_pixbuf_original.get_width()) self.coords[3] = int(float(self.r...
self.coords[0] = int(round(float(self.rect[0])/image_width*self.currimg_pixbuf_original.get_width(), 0)) self.coords[1] = int(round(float(self.rect[1])/image_height*self.currimg_pixbuf_original.get_height(), 0)) self.coords[2] = int(round(float(self.rect[2])/image_width*self.currimg_pixbuf_original.get_width(), 0)) sel...
def crop_image_mouse_moved(self, widget, event, image, x2, y2, x, y, width, height, image_width, image_height, width_adj, height_adj): if event != None: x2, y2, state = event.window.get_pointer() if self.drawing_crop_rectangle == True: if self.crop_rectangle != None or self.update_rectangle == True: gc = image.window.n...