def _check_button_cb(self, button, preference): """Callback for all checkbutton-type preferences.""" prefs[preference] = button.get_active() if preference == 'color box bg' and button.get_active(): if not prefs[ 'smart bg'] or not self._window.filehandler.file_loaded: self._window.set_bg_colour(prefs['bg colour']) elif preference == 'smart bg' and button.get_active(): # if the color is no longer using the smart background then return it to the chosen color if not prefs[preference]: self._window.set_bg_colour(prefs['bg colour']) else: # draw_image() will set the main background to the smart background self._window.draw_image() elif preference == 'color box thumb bg' and button.get_active(): if prefs[preference]: prefs['smart thumb bg'] = False prefs['thumbnail bg uses main colour'] = False self._window.thumbnailsidebar.change_thumbnail_background_color( prefs['thumb bg colour']) else: self._window.draw_image() elif preference == 'smart thumb bg' and button.get_active(): if prefs[preference]: prefs['color box thumb bg'] = False prefs['thumbnail bg uses main colour'] = False pixbuf = image_tools.static_image( image_tools.unwrap_image(self._window.images[0]) ) # XXX transitional(double page limitation) if pixbuf: bg_color = image_tools.get_most_common_edge_colour(pixbuf) self._window.thumbnailsidebar.change_thumbnail_background_color( bg_color) else: self._window.draw_image() elif preference in ('checkered bg for transparent images', 'no double page for wide images', 'auto rotate from exif'): self._window.draw_image() elif (preference == 'hide all in fullscreen' and self._window.is_fullscreen): self._window.draw_image() elif preference == 'show page numbers on thumbnails': self._window.thumbnailsidebar.toggle_page_numbers_visible()
def get_pixbuf_auto_background(self, single=False): """ Returns an automatically calculated background color for the current page(s). """ pixbufs = self.get_pixbufs(single) if len(pixbufs) == 1: auto_bg = image_tools.get_most_common_edge_colour(pixbufs[0]) elif len(pixbufs) == 2: left, right = pixbufs if self._window.is_manga_mode: left, right = right, left auto_bg = image_tools.get_most_common_edge_colour((left, right)) else: assert False, 'Unexpected pixbuf count' return auto_bg
def get_pixbuf_auto_background(self, number_of_bufs): # XXX limited to at most 2 pages """ Returns an automatically calculated background color for the current page(s). """ pixbufs = self.get_pixbufs(number_of_bufs) if len(pixbufs) == 1: auto_bg = image_tools.get_most_common_edge_colour(pixbufs[0]) elif len(pixbufs) == 2: left, right = pixbufs if self._window.is_manga_mode: left, right = right, left auto_bg = image_tools.get_most_common_edge_colour((left, right)) else: assert False, "Unexpected pixbuf count" return auto_bg
def _check_button_cb(self, button, preference): """Callback for all checkbutton-type preferences.""" prefs[preference] = button.get_active() if preference == "color box bg" and button.get_active(): if not prefs["smart bg"] or not self._window.filehandler.file_loaded: self._window.set_bg_colour(prefs["bg colour"]) elif preference == "smart bg" and button.get_active(): # if the color is no longer using the smart background then return it to the chosen color if not prefs[preference]: self._window.set_bg_colour(prefs["bg colour"]) else: # draw_image() will set the main background to the smart background self._window.draw_image() elif preference == "color box thumb bg" and button.get_active(): if prefs[preference]: prefs["smart thumb bg"] = False prefs["thumbnail bg uses main colour"] = False self._window.thumbnailsidebar.change_thumbnail_background_color(prefs["thumb bg colour"]) else: self._window.draw_image() elif preference == "smart thumb bg" and button.get_active(): if prefs[preference]: prefs["color box thumb bg"] = False prefs["thumbnail bg uses main colour"] = False pixbuf = self._window.left_image.get_pixbuf() if pixbuf: bg_color = image_tools.get_most_common_edge_colour(pixbuf) self._window.thumbnailsidebar.change_thumbnail_background_color(bg_color) else: self._window.draw_image() elif preference in ( "checkered bg for transparent images", "no double page for wide images", "auto rotate from exif", ): self._window.draw_image() elif preference == "hide all in fullscreen" and self._window.is_fullscreen: self._window.draw_image() elif preference == "show page numbers on thumbnails": self._window.thumbnailsidebar.toggle_page_numbers_visible()
def _check_button_cb(self, button, preference): """Callback for all checkbutton-type preferences.""" prefs[preference] = button.get_active() if preference == 'color box bg' and button.get_active(): if not prefs['smart bg'] or not self._window.filehandler.file_loaded: self._window.set_bg_colour(prefs['bg colour']) elif preference == 'smart bg' and button.get_active(): # if the color is no longer using the smart background then return it to the chosen color if not prefs[preference]: self._window.set_bg_colour(prefs['bg colour']) else: # draw_image() will set the main background to the smart background self._window.draw_image() elif preference == 'color box thumb bg' and button.get_active(): if prefs[preference]: prefs['smart thumb bg'] = False prefs['thumbnail bg uses main colour'] = False self._window.thumbnailsidebar.change_thumbnail_background_color(prefs['thumb bg colour']) else: self._window.draw_image() elif preference == 'smart thumb bg' and button.get_active(): if prefs[preference]: prefs['color box thumb bg'] = False prefs['thumbnail bg uses main colour'] = False pixbuf = image_tools.static_image(image_tools.unwrap_image( self._window.images[0])) # XXX transitional(double page limitation) if pixbuf: bg_color = image_tools.get_most_common_edge_colour(pixbuf) self._window.thumbnailsidebar.change_thumbnail_background_color(bg_color) else: self._window.draw_image() elif preference in ('checkered bg for transparent images', 'no double page for wide images', 'auto rotate from exif'): self._window.draw_image() elif (preference == 'hide all in fullscreen' and self._window.is_fullscreen): self._window.draw_image() elif preference == 'show page numbers on thumbnails': self._window.thumbnailsidebar.toggle_page_numbers_visible()
def _draw_image(self, at_bottom, scroll): self._display_active_widgets() while gtk.events_pending(): gtk.main_iteration(False) if not self.filehandler.file_loaded: self._waiting_for_redraw = False return False area_width, area_height = self.get_visible_area_size() if prefs['zoom mode'] == constants.ZOOM_MODE_HEIGHT: scaled_width = -1 else: scaled_width = area_width if prefs['zoom mode'] == constants.ZOOM_MODE_WIDTH: scaled_height = -1 else: scaled_height = area_height scale_up = prefs['stretch'] self.is_virtual_double_page = \ self.imagehandler.get_virtual_double_page() skip_pixbuf = not self.imagehandler.page_is_available() if self.displayed_double() and not skip_pixbuf: left_pixbuf, right_pixbuf = self.imagehandler.get_pixbufs() if self.is_manga_mode: right_pixbuf, left_pixbuf = left_pixbuf, right_pixbuf left_unscaled_x = left_pixbuf.get_width() left_unscaled_y = left_pixbuf.get_height() right_unscaled_x = right_pixbuf.get_width() right_unscaled_y = right_pixbuf.get_height() left_rotation = prefs['rotation'] right_rotation = prefs['rotation'] if prefs['auto rotate from exif']: left_rotation += image_tools.get_implied_rotation(left_pixbuf) left_rotation = left_rotation % 360 right_rotation += image_tools.get_implied_rotation(right_pixbuf) right_rotation = right_rotation % 360 if prefs['zoom mode'] == constants.ZOOM_MODE_MANUAL: if left_rotation in (90, 270): total_width = left_unscaled_y total_height = left_unscaled_x else: total_width = left_unscaled_x total_height = left_unscaled_y if right_rotation in (90, 270): total_width += right_unscaled_y total_height += right_unscaled_x else: total_width += right_unscaled_x total_height += right_unscaled_y total_width += 2 # For the 2 px gap between images. scaled_width = int(self._manual_zoom * total_width / 100) scaled_height = int(self._manual_zoom * total_height / 100) scale_up = True left_pixbuf, right_pixbuf = image_tools.fit_2_in_rectangle( left_pixbuf, right_pixbuf, scaled_width, scaled_height, scale_up=scale_up, rotation1=left_rotation, rotation2=right_rotation) if prefs['horizontal flip']: left_pixbuf = left_pixbuf.flip(horizontal=True) right_pixbuf = right_pixbuf.flip(horizontal=True) if prefs['vertical flip']: left_pixbuf = left_pixbuf.flip(horizontal=False) right_pixbuf = right_pixbuf.flip(horizontal=False) left_pixbuf = self.enhancer.enhance(left_pixbuf) right_pixbuf = self.enhancer.enhance(right_pixbuf) self.left_image.set_from_pixbuf(left_pixbuf) self.right_image.set_from_pixbuf(right_pixbuf) x_padding = (area_width - left_pixbuf.get_width() - right_pixbuf.get_width()) / 2 y_padding = (area_height - max(left_pixbuf.get_height(), right_pixbuf.get_height())) / 2 if left_rotation in (90, 270): left_scale_percent = (100.0 * left_pixbuf.get_width() / left_unscaled_y) else: left_scale_percent = (100.0 * left_pixbuf.get_width() / left_unscaled_x) if right_rotation in (90, 270): right_scale_percent = (100.0 * right_pixbuf.get_width() / right_unscaled_y) else: right_scale_percent = (100.0 * right_pixbuf.get_width() / right_unscaled_x) self.statusbar.set_resolution( (left_unscaled_x, left_unscaled_y, left_scale_percent), (right_unscaled_x, right_unscaled_y, right_scale_percent)) elif not skip_pixbuf: pixbuf = self.imagehandler.get_pixbufs(single=True)[ 0 ] unscaled_x = pixbuf.get_width() unscaled_y = pixbuf.get_height() rotation = prefs['rotation'] if prefs['auto rotate from exif']: rotation += image_tools.get_implied_rotation(pixbuf) rotation = rotation % 360 if prefs['zoom mode'] == constants.ZOOM_MODE_MANUAL: # If 'Scale small images' is true, scale up the image's base size scale_x = max(scale_up and scaled_width or unscaled_x, unscaled_x) scale_y = max(scale_up and scaled_height or unscaled_y, unscaled_y) scaled_width = int(self._manual_zoom * scale_x / 100) scaled_height = int(self._manual_zoom * scale_y / 100) if rotation in (90, 270): scaled_width, scaled_height = scaled_height, scaled_width scale_up = True pixbuf = image_tools.fit_in_rectangle(pixbuf, scaled_width, scaled_height, scale_up=scale_up, rotation=rotation) if prefs['horizontal flip']: pixbuf = pixbuf.flip(horizontal=True) if prefs['vertical flip']: pixbuf = pixbuf.flip(horizontal=False) pixbuf = self.enhancer.enhance(pixbuf) self.left_image.set_from_pixbuf(pixbuf) self.right_image.clear() x_padding = (area_width - pixbuf.get_width()) / 2 y_padding = (area_height - pixbuf.get_height()) / 2 if rotation in (90, 270): scale_percent = 100.0 * pixbuf.get_width() / unscaled_y else: scale_percent = 100.0 * pixbuf.get_width() / unscaled_x self.statusbar.set_resolution((unscaled_x, unscaled_y, scale_percent)) if prefs['smart bg'] and not skip_pixbuf: bg_colour = self.imagehandler.get_pixbuf_auto_background( not self.displayed_double()) self.set_bg_colour(bg_colour) if prefs['smart thumb bg'] and prefs['show thumbnails']: self.thumbnailsidebar.change_thumbnail_background_color(bg_colour) elif prefs['smart thumb bg'] and prefs['show thumbnails'] and not skip_pixbuf: bg_colour = image_tools.get_most_common_edge_colour( self.left_image.get_pixbuf()) self.thumbnailsidebar.change_thumbnail_background_color(bg_colour) if not skip_pixbuf: self._image_box.window.freeze_updates() self._main_layout.move(self._image_box, max(0, x_padding), max(0, y_padding)) self.left_image.show() if self.displayed_double(): self.right_image.show() else: self.right_image.hide() self._main_layout.set_size(*self._image_box.size_request()) if scroll: if at_bottom: self.scroll_to_fixed(horiz='endsecond', vert='bottom') else: self.scroll_to_fixed(horiz='startfirst', vert='top') self._image_box.window.thaw_updates() else: # If the pixbuf for the current page(s) isn't available, # hide both images to clear any old pixbufs. self.left_image.hide() self.right_image.hide() self._update_page_information() self._waiting_for_redraw = False while gtk.events_pending(): gtk.main_iteration(False) return False
def _draw_image(self, at_bottom, scroll): self._display_active_widgets() if not self.filehandler.file_loaded: self._waiting_for_redraw = False return False self.is_virtual_double_page = self.imagehandler.get_virtual_double_page() skip_pixbuf = not self.imagehandler.page_is_available() if self.displayed_double() and not skip_pixbuf: left_pixbuf, right_pixbuf = self.imagehandler.get_pixbufs() if self.is_manga_mode: right_pixbuf, left_pixbuf = left_pixbuf, right_pixbuf left_unscaled_x = left_pixbuf.get_width() left_unscaled_y = left_pixbuf.get_height() right_unscaled_x = right_pixbuf.get_width() right_unscaled_y = right_pixbuf.get_height() left_rotation = self._get_pixbuf_rotation(left_pixbuf, True) right_rotation = self._get_pixbuf_rotation(right_pixbuf, True) if left_rotation in (90, 270): left_width = left_unscaled_y left_height = left_unscaled_x else: left_width = left_unscaled_x left_height = left_unscaled_y if right_rotation in (90, 270): right_width = right_unscaled_y right_height = right_unscaled_x else: right_width = right_unscaled_x right_height = right_unscaled_y width, height = image_tools.get_double_page_rectangle(left_width, left_height, right_width, right_height) scaled_width, scaled_height = self.zoom.get_zoomed_size((width, height), self.get_visible_area_size()) # Visible area size is recomputed depending on scrollbar visibility self._show_scrollbars((scaled_width, scaled_height), self.get_visible_area_size()) area_width, area_height = self.get_visible_area_size() scaled_width, scaled_height = self.zoom.get_zoomed_size((width, height), (area_width, area_height)) # 100000 just some big enough constant. # We need to ensure that images # are limited only by height during scaling left_pixbuf = image_tools.fit_in_rectangle( left_pixbuf, 100000, scaled_height, prefs["stretch"], left_rotation ) right_pixbuf = image_tools.fit_in_rectangle( right_pixbuf, 100000, scaled_height, prefs["stretch"], right_rotation ) if prefs["horizontal flip"]: left_pixbuf = left_pixbuf.flip(horizontal=True) right_pixbuf = right_pixbuf.flip(horizontal=True) if prefs["vertical flip"]: left_pixbuf = left_pixbuf.flip(horizontal=False) right_pixbuf = right_pixbuf.flip(horizontal=False) left_pixbuf = self.enhancer.enhance(left_pixbuf) right_pixbuf = self.enhancer.enhance(right_pixbuf) self.left_image.set_from_pixbuf(left_pixbuf) self.right_image.set_from_pixbuf(right_pixbuf) x_padding = int(round((area_width - left_pixbuf.get_width() - right_pixbuf.get_width()) / 2.0)) y_padding = int(round((area_height - max(left_pixbuf.get_height(), right_pixbuf.get_height())) / 2.0)) if left_rotation in (90, 270): left_scale_percent = 100.0 * left_pixbuf.get_width() / left_unscaled_y else: left_scale_percent = 100.0 * left_pixbuf.get_width() / left_unscaled_x if right_rotation in (90, 270): right_scale_percent = 100.0 * right_pixbuf.get_width() / right_unscaled_y else: right_scale_percent = 100.0 * right_pixbuf.get_width() / right_unscaled_x self.statusbar.set_resolution( (left_unscaled_x, left_unscaled_y, left_scale_percent), (right_unscaled_x, right_unscaled_y, right_scale_percent), ) elif not skip_pixbuf: pixbuf = self.imagehandler.get_pixbufs(single=True)[0] width, height = pixbuf.get_width(), pixbuf.get_height() rotation = self._get_pixbuf_rotation(pixbuf) if rotation in (90, 270): width, height = height, width scaled_width, scaled_height = self.zoom.get_zoomed_size((width, height), self.get_visible_area_size()) # Visible area size is recomputed depending on scrollbar visibility self._show_scrollbars((scaled_width, scaled_height), self.get_visible_area_size()) area_width, area_height = self.get_visible_area_size() scaled_width, scaled_height = self.zoom.get_zoomed_size((width, height), (area_width, area_height)) pixbuf = image_tools.fit_in_rectangle(pixbuf, scaled_width, scaled_height, scale_up=True, rotation=rotation) if prefs["horizontal flip"]: pixbuf = pixbuf.flip(horizontal=True) if prefs["vertical flip"]: pixbuf = pixbuf.flip(horizontal=False) pixbuf = self.enhancer.enhance(pixbuf) self.left_image.set_from_pixbuf(pixbuf) self.right_image.clear() x_padding = int(round((area_width - pixbuf.get_width()) / 2.0)) y_padding = int(round((area_height - pixbuf.get_height()) / 2.0)) if rotation in (90, 270): scale_percent = 100.0 * pixbuf.get_width() / height else: scale_percent = 100.0 * pixbuf.get_width() / width self.statusbar.set_resolution((width, height, scale_percent)) if prefs["smart bg"] and not skip_pixbuf: bg_colour = self.imagehandler.get_pixbuf_auto_background(not self.displayed_double()) self.set_bg_colour(bg_colour) if prefs["smart thumb bg"] and prefs["show thumbnails"]: self.thumbnailsidebar.change_thumbnail_background_color(bg_colour) elif prefs["smart thumb bg"] and prefs["show thumbnails"] and not skip_pixbuf: bg_colour = image_tools.get_most_common_edge_colour(self.left_image.get_pixbuf()) self.thumbnailsidebar.change_thumbnail_background_color(bg_colour) if not skip_pixbuf: self._image_box.window.freeze_updates() self._main_layout.move(self._image_box, max(0, x_padding), max(0, y_padding)) self.left_image.show() if self.displayed_double(): self.right_image.show() else: self.right_image.hide() self._main_layout.set_size(*self._image_box.size_request()) if scroll: if at_bottom: self.scroll_to_fixed(horiz="endsecond", vert="bottom") else: self.scroll_to_fixed(horiz="startfirst", vert="top") self._image_box.window.thaw_updates() else: # If the pixbuf for the current page(s) isn't available, # hide both images to clear any old pixbufs. self.left_image.hide() self.right_image.hide() self._update_page_information() self._waiting_for_redraw = False return False
def _draw_image(self, at_bottom, scroll): self._display_active_widgets() while gtk.events_pending(): gtk.main_iteration(False) if not self.filehandler.file_loaded: self._waiting_for_redraw = False return False area_width, area_height = self.get_visible_area_size() if prefs['zoom mode'] == constants.ZOOM_MODE_HEIGHT: scaled_width = -1 else: scaled_width = area_width if prefs['zoom mode'] == constants.ZOOM_MODE_WIDTH: scaled_height = -1 else: scaled_height = area_height scale_up = prefs['stretch'] self.is_virtual_double_page = \ self.imagehandler.get_virtual_double_page() skip_pixbuf = not self.imagehandler.page_is_available() if self.displayed_double() and not skip_pixbuf: left_pixbuf, right_pixbuf = self.imagehandler.get_pixbufs() if self.is_manga_mode: right_pixbuf, left_pixbuf = left_pixbuf, right_pixbuf left_unscaled_x = left_pixbuf.get_width() left_unscaled_y = left_pixbuf.get_height() right_unscaled_x = right_pixbuf.get_width() right_unscaled_y = right_pixbuf.get_height() left_rotation = prefs['rotation'] right_rotation = prefs['rotation'] if prefs['auto rotate from exif']: left_rotation += image_tools.get_implied_rotation(left_pixbuf) left_rotation = left_rotation % 360 right_rotation += image_tools.get_implied_rotation( right_pixbuf) right_rotation = right_rotation % 360 if prefs['zoom mode'] == constants.ZOOM_MODE_MANUAL: if left_rotation in (90, 270): total_width = left_unscaled_y total_height = left_unscaled_x else: total_width = left_unscaled_x total_height = left_unscaled_y if right_rotation in (90, 270): total_width += right_unscaled_y total_height += right_unscaled_x else: total_width += right_unscaled_x total_height += right_unscaled_y total_width += 2 # For the 2 px gap between images. scaled_width = int(self._manual_zoom * total_width / 100) scaled_height = int(self._manual_zoom * total_height / 100) scale_up = True left_pixbuf, right_pixbuf = image_tools.fit_2_in_rectangle( left_pixbuf, right_pixbuf, scaled_width, scaled_height, scale_up=scale_up, rotation1=left_rotation, rotation2=right_rotation) if prefs['horizontal flip']: left_pixbuf = left_pixbuf.flip(horizontal=True) right_pixbuf = right_pixbuf.flip(horizontal=True) if prefs['vertical flip']: left_pixbuf = left_pixbuf.flip(horizontal=False) right_pixbuf = right_pixbuf.flip(horizontal=False) left_pixbuf = self.enhancer.enhance(left_pixbuf) right_pixbuf = self.enhancer.enhance(right_pixbuf) self.left_image.set_from_pixbuf(left_pixbuf) self.right_image.set_from_pixbuf(right_pixbuf) x_padding = (area_width - left_pixbuf.get_width() - right_pixbuf.get_width()) / 2 y_padding = (area_height - max(left_pixbuf.get_height(), right_pixbuf.get_height())) / 2 if left_rotation in (90, 270): left_scale_percent = (100.0 * left_pixbuf.get_width() / left_unscaled_y) else: left_scale_percent = (100.0 * left_pixbuf.get_width() / left_unscaled_x) if right_rotation in (90, 270): right_scale_percent = (100.0 * right_pixbuf.get_width() / right_unscaled_y) else: right_scale_percent = (100.0 * right_pixbuf.get_width() / right_unscaled_x) self.statusbar.set_resolution( (left_unscaled_x, left_unscaled_y, left_scale_percent), (right_unscaled_x, right_unscaled_y, right_scale_percent)) elif not skip_pixbuf: pixbuf = self.imagehandler.get_pixbufs(single=True)[0] unscaled_x = pixbuf.get_width() unscaled_y = pixbuf.get_height() rotation = prefs['rotation'] if prefs['auto rotate from exif']: rotation += image_tools.get_implied_rotation(pixbuf) rotation = rotation % 360 if prefs['zoom mode'] == constants.ZOOM_MODE_MANUAL: # If 'Scale small images' is true, scale up the image's base size scale_x = max(scale_up and scaled_width or unscaled_x, unscaled_x) scale_y = max(scale_up and scaled_height or unscaled_y, unscaled_y) scaled_width = int(self._manual_zoom * scale_x / 100) scaled_height = int(self._manual_zoom * scale_y / 100) if rotation in (90, 270): scaled_width, scaled_height = scaled_height, scaled_width scale_up = True pixbuf = image_tools.fit_in_rectangle(pixbuf, scaled_width, scaled_height, scale_up=scale_up, rotation=rotation) if prefs['horizontal flip']: pixbuf = pixbuf.flip(horizontal=True) if prefs['vertical flip']: pixbuf = pixbuf.flip(horizontal=False) pixbuf = self.enhancer.enhance(pixbuf) self.left_image.set_from_pixbuf(pixbuf) self.right_image.clear() x_padding = (area_width - pixbuf.get_width()) / 2 y_padding = (area_height - pixbuf.get_height()) / 2 if rotation in (90, 270): scale_percent = 100.0 * pixbuf.get_width() / unscaled_y else: scale_percent = 100.0 * pixbuf.get_width() / unscaled_x self.statusbar.set_resolution( (unscaled_x, unscaled_y, scale_percent)) if prefs['smart bg'] and not skip_pixbuf: bg_colour = self.imagehandler.get_pixbuf_auto_background( not self.displayed_double()) self.set_bg_colour(bg_colour) if prefs['smart thumb bg'] and prefs['show thumbnails']: self.thumbnailsidebar.change_thumbnail_background_color( bg_colour) elif prefs['smart thumb bg'] and prefs[ 'show thumbnails'] and not skip_pixbuf: bg_colour = image_tools.get_most_common_edge_colour( self.left_image.get_pixbuf()) self.thumbnailsidebar.change_thumbnail_background_color(bg_colour) if not skip_pixbuf: self._image_box.window.freeze_updates() self._main_layout.move(self._image_box, max(0, x_padding), max(0, y_padding)) self.left_image.show() if self.displayed_double(): self.right_image.show() else: self.right_image.hide() self._main_layout.set_size(*self._image_box.size_request()) if scroll: if at_bottom: self.scroll_to_fixed(horiz='endsecond', vert='bottom') else: self.scroll_to_fixed(horiz='startfirst', vert='top') self._image_box.window.thaw_updates() else: # If the pixbuf for the current page(s) isn't available, # hide both images to clear any old pixbufs. self.left_image.hide() self.right_image.hide() self._update_page_information() self._waiting_for_redraw = False while gtk.events_pending(): gtk.main_iteration(False) return False