def remove_photo_from_favourites(slideshow_widget): """ Remove the currently displayed photo from the favourites. :param slideshow_widget: pisak slideshow instance """ path = slideshow_widget.slide.photo_path model.get_library().remove_item_from_favourites(path)
def remove_photo_from_favourites(slideshow_widget): """ Remove the currently displayed photo from the favourites. :param slideshow_widget: pisak slideshow instance. """ path = slideshow_widget.slide.photo_path model.get_library().remove_item_from_favourites(path)
def add_photo_to_favourites(slideshow_widget): """ Add the currently displayed photo to the favourites. :param slideshow_widget: pisak slideshow instance. """ path = slideshow_widget.slide.photo_path model.get_library().add_item_to_favourites(path)
def add_photo_to_favourites(slideshow_widget): """ Add the currently displayed photo to the favourites. :param slideshow_widget: pisak slideshow instance """ path = slideshow_widget.slide.photo_path model.get_library().add_item_to_favourites(path)
def prepare_viewer_about_me_album_view(app, window, script, data): """ View preparator. :param app: reference to the application, :see: :module:`pisak.application`. :param window: application main window, :class:`pisak.window.Window` instance. :param script: ClutterScript with the view description. :param data: some specific data. """ library = viewer_model.get_library() def pick_photo(tile): try: wordpress.blog.update_about_me_photo(tile.preview_path) except socket.timeout: window.load_popup(MESSAGES['too-slow-connection'], 'main_panel/main') else: window.load_view("blog/about_me") handlers.button_to_view(window, script, "button_library", "blog/viewer_about_me_library") handlers.button_to_view(window, script, "button_start") album_id = data["album_id"] header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) album_data = script.get_object("album_data") album_data.item_handler = lambda tile, photo_id, album_id: pick_photo(tile) album_data.data_set_idx = album_id
def prepare_viewer_album_view(app, window, script, data): """ View preparator. :param app: reference to the application, :see: :module:`pisak.application`. :param window: application main window, :class:`pisak.window.Window` instance. :param script: ClutterScript with the view description. :param data: some specific data. """ library = viewer_model.get_library() def attach_photo(tile): wordpress.blog.post_images.append(tile.preview_path) handlers.button_to_view(window, script, "button_library", "blog/viewer_library") handlers.button_to_view(window, script, "button_publish_blog", "blog/all_posts") handlers.button_to_view(window, script, "button_start") album_id = data["album_id"] header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) album_data = script.get_object("album_data") album_data.item_handler = lambda tile, photo_id, album_id: \ attach_photo(tile) album_data.data_set_idx = album_id
def prepare_viewer_contact_album_view(app, window, script, data): """ View preparator. :param app: reference to the application, :see: :module:`pisak.application`. :param window: application main window, :class:`pisak.window.Window` instance. :param script: ClutterScript with the view description. :param data: some specific data. """ contact_id = data["contact_id"] handlers.button_to_view(window, script, "button_exit") handlers.button_to_view(window, script, "button_library", "email/viewer_contact_library", {"contact_id": contact_id}) album_id = data["album_id"] library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) data_source = script.get_object("album_data") def photo_tile_handler(tile, photo_id, album_id): try: app.box["address_book"].edit_contact_photo( contact_id, library.get_item_by_id(photo_id).path) except address_book.AddressBookError: pass # TODO: display warning window.load_view("email/contact", {"contact_id": contact_id}) data_source.item_handler = photo_tile_handler data_source.data_set_idx = album_id
def prepare_photo_view(app, window, script, data): """ View preparator. :param app: reference to the application, :see: :module:`pisak.application`. :param window: application main window, :class:`pisak.window.Window` instance. :param script: ClutterScript with the view description. :param data: some specific data. """ album_id = data["album_id"] photo_id = data["photo_id"] data_source = script.get_object("photo_data_source") data_source.data_set_idx = album_id slideshow = script.get_object("slideshow_widget") slideshow.show_initial_photo_id(photo_id) handlers.button_to_view(window, script, "button_edition", "viewer/photo_editing", (slideshow, album_id, photo_id)) handlers.button_to_view(window, script, "button_album", "viewer/album", {"album_id": album_id}) handlers.button_to_view(window, script, "button_library", "viewer/main") library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name)
def prepare_viewer_album_view(app, window, script, data): """ View preparator. :param app: reference to the application, :see: :module:`pisak.application`. :param window: application main window, :class:`pisak.window.Window` instance. :param script: ClutterScript with the view description. :param data: some specific data. """ library = viewer_model.get_library() def attach_photo(tile): wordpress.blog.post_images.append(tile.preview_path) handlers.button_to_view( window, script, "button_library", "blog/viewer_library") handlers.button_to_view( window, script, "button_publish_blog", "blog/all_posts") handlers.button_to_view(window, script, "button_start") album_id = data["album_id"] header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) album_data = script.get_object("album_data") album_data.item_handler = lambda tile, photo_id, album_id: \ attach_photo(tile) album_data.data_set_idx = album_id
def prepare_album_view(app, window, script, data): """ View preparator. :param app: reference to the application, :see: :module:`pisak.application`. :param window: application main window, :class:`pisak.window.Window` instance. :param script: ClutterScript with the view description. :param data: some specific data. """ album_id = data["album_id"] handlers.button_to_view(window, script, "button_library", "viewer/main") handlers.button_to_view(window, script, "button_start") library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) data_source = script.get_object("library_data") def photo_tile_handler(tile, photo_id, album_id): window.load_view("viewer/photo", { "photo_id": photo_id, "album_id": album_id }) data_source.item_handler = photo_tile_handler data_source.data_set_idx = album_id data_source.emit('data-is-ready')
def prepare_album_view(app, window, script, data): """ View preparator. :param app: reference to the application, :see: :module:`pisak.application`. :param window: application main window, :class:`pisak.window.Window` instance. :param script: ClutterScript with the view description. :param data: some specific data. """ album_id = data["album_id"] handlers.button_to_view(window, script, "button_library", "viewer/main") handlers.button_to_view(window, script, "button_start") library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) data_source = script.get_object("library_data") def photo_tile_handler(tile, photo_id, album_id): window.load_view( "viewer/photo", {"photo_id": photo_id, "album_id": album_id}) data_source.item_handler = photo_tile_handler data_source.data_set_idx = album_id data_source.emit('data-is-ready')
def prepare_viewer_contact_album_view(app, window, script, data): """ View preparator. :param app: reference to the application, :see: :module:`pisak.application`. :param window: application main window, :class:`pisak.window.Window` instance. :param script: ClutterScript with the view description. :param data: some specific data. """ contact_id = data["contact_id"] handlers.button_to_view(window, script, "button_exit") handlers.button_to_view( window, script, "button_library", "email/viewer_contact_library", {"contact_id": contact_id}) album_id = data["album_id"] library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) data_source = script.get_object("album_data") def photo_tile_handler(tile, photo_id, album_id): try: app.box["address_book"].edit_contact_photo( contact_id, library.get_item_by_id(photo_id).path) except address_book.AddressBookError: pass # TODO: display warning window.load_view("email/contact", {"contact_id": contact_id}) data_source.item_handler = photo_tile_handler data_source.data_set_idx = album_id
def __init__(self): super().__init__() self.item_ratio_height = 0.7 self.item_ratio_width = 0.68 self.library = model.get_library() self.data_generator = lambda value: \ self.library.get_category_by_id(value).get_all_items() self.data_sets_count = len(self.library.get_all_categories())
def show_initial_photo_id(self, photo_id): """ Display some arbitrary photo. :param photo_index: index of the photo to be shown. """ library = model.get_library() photo = library.get_item_by_id(photo_id) index = self.data_source.data.index(photo) self.show_initial_slide(index)
def add_or_remove_from_favs(slideshow_widget): """ Add or remove the currently displayed photo from the favourites. :param slideshow_widget: pisak slideshow instance """ path = slideshow_widget.slide.photo_path lib = model.get_library() if lib.is_in_favourites(path): lib.remove_item_from_favourites(path) else: lib.add_item_to_favourites(path)
def add_or_remove_from_favs(slideshow_widget): """ Add or remove the currently displayed photo from the favourites. :param slideshow_widget: pisak slideshow instance. """ path = slideshow_widget.slide.photo_path lib = model.get_library() if lib.is_in_favourites(path): lib.remove_item_from_favourites(path) else: lib.add_item_to_favourites(path)
def save_buffer(self): """ Save the current image buffer. """ if self._image_buffer is not None: path = self._image_buffer.save() if path: library = model.get_library() album = library.get_category_by_id(self.album_id) item_id = library.get_id_for_new_item() lib_item = media_library.Item(item_id, path, {}) album.append_item(lib_item) library.append_item(lib_item)
def prepare_viewer_about_me_album_view(app, window, script, data): library = viewer_model.get_library() def pick_photo(tile): wordpress.blog.update_about_me_photo(tile.preview_path) window.load_view("blog/about_me") handlers.button_to_view(window, script, "button_library", "blog/viewer_about_me_library") handlers.button_to_view(window, script, "button_start") album_id = data["album_id"] header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) album_data = script.get_object("album_data") album_data.item_handler = lambda tile, photo_id, album_id: pick_photo(tile) album_data.data_set_idx = album_id
def prepare_album_view(stage, script, data): album_id = data["album_id"] button_to_stage(stage, script, "button_library", "viewer/library") button_to_stage(stage, script, "button_start", "main_panel/main") library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) data_source = script.get_object("library_data") def photo_tile_handler(tile, photo_id, album_id): stage.load_view( "viewer/photo", {"photo_id": photo_id, "album_id": album_id}) data_source.tiles_handler = photo_tile_handler data_source.album = album_id
def prepare_viewer_album_view(app, window, script, data): library = viewer_model.get_library() def attach_photo(tile): wordpress.blog.post_images.append(tile.preview_path) handlers.button_to_view( window, script, "button_library", "blog/viewer_library") handlers.button_to_view( window, script, "button_publish_blog", "blog/all_posts") handlers.button_to_view(window, script, "button_start") album_id = data["album_id"] header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) album_data = script.get_object("album_data") album_data.item_handler = lambda tile, photo_id, album_id: \ attach_photo(tile) album_data.data_set_idx = album_id
def prepare_viewer_album_view(app, window, script, data): library = viewer_model.get_library() def attach_photo(tile): wordpress.blog.post_images.append(tile.preview_path) handlers.button_to_view(window, script, "button_library", "blog/viewer_library") handlers.button_to_view(window, script, "button_publish_blog", "blog/all_posts") handlers.button_to_view(window, script, "button_start") album_id = data["album_id"] header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) album_data = script.get_object("album_data") album_data.item_handler = lambda tile, photo_id, album_id: \ attach_photo(tile) album_data.data_set_idx = album_id
def prepare_album_view(app, window, script, data): album_id = data["album_id"] handlers.button_to_view(window, script, "button_library", "viewer/main") handlers.button_to_view(window, script, "button_start") library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) data_source = script.get_object("library_data") def photo_tile_handler(tile, photo_id, album_id): window.load_view( "viewer/photo", {"photo_id": photo_id, "album_id": album_id}) data_source.item_handler = photo_tile_handler data_source.data_set_idx = album_id data_source.emit('data-is-ready')
def prepare_photo_view(app, window, script, data): album_id = data["album_id"] photo_id = data["photo_id"] data_source = script.get_object("photo_data_source") data_source.data_set_idx = album_id slideshow = script.get_object("slideshow_widget") slideshow.show_initial_photo_id(photo_id) handlers.button_to_view(window, script, "button_edition", "viewer/photo_editing", (slideshow, album_id, photo_id)) handlers.button_to_view(window, script, "button_album", "viewer/album", {"album_id": album_id}) handlers.button_to_view(window, script, "button_library", "viewer/main") library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name)
def prepare_album_view(app, window, script, data): album_id = data["album_id"] handlers.button_to_view(window, script, "button_library", "viewer/main") handlers.button_to_view(window, script, "button_start") library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) data_source = script.get_object("library_data") def photo_tile_handler(tile, photo_id, album_id): window.load_view("viewer/photo", { "photo_id": photo_id, "album_id": album_id }) data_source.item_handler = photo_tile_handler data_source.data_set_idx = album_id data_source.emit('data-is-ready')
def prepare_viewer_contact_album_view(app, window, script, data): contact_id = data["contact_id"] handlers.button_to_view(window, script, "button_exit") handlers.button_to_view( window, script, "button_library", "email/viewer_contact_library", {"contact_id": contact_id} ) album_id = data["album_id"] library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) data_source = script.get_object("album_data") def photo_tile_handler(tile, photo_id, album_id): try: app.box["address_book"].edit_contact_photo(contact_id, library.get_item_by_id(photo_id).path) except address_book.AddressBookError as e: pass # TODO: display warning window.load_view("email/contact", {"contact_id": contact_id}) data_source.item_handler = photo_tile_handler data_source.data_set_idx = album_id
def prepare_viewer_contact_album_view(app, window, script, data): contact_id = data["contact_id"] handlers.button_to_view(window, script, "button_exit") handlers.button_to_view( window, script, "button_library", "email/viewer_contact_library", {"contact_id": contact_id}) album_id = data["album_id"] library = model.get_library() header = script.get_object("header") header.set_text(library.get_category_by_id(album_id).name) data_source = script.get_object("album_data") def photo_tile_handler(tile, photo_id, album_id): try: app.box["address_book"].edit_contact_photo( contact_id, library.get_item_by_id(photo_id).path) except address_book.AddressBookError as e: pass # TODO: display warning window.load_view("email/contact", {"contact_id": contact_id}) data_source.item_handler = photo_tile_handler data_source.data_set_idx = album_id
def __init__(self): super().__init__() self.slide_ratio_height = 0.7 self.slide_ratio_width = 0.68 self.album = None self.library = model.get_library()
def __init__(self): super().__init__() self.data = list(model.get_library().get_all_categories())
def __init__(self): super().__init__() self.library = model.get_library() self.albums = list(self.library.categories) self.data_length = len(self.albums)
def __init__(self): super().__init__() self.album = None self.photos = [] self.library = model.get_library()
def show_initial_photo_id(self, photo_id): library = model.get_library() photo = library.get_photo_by_id(photo_id) index = self.data_source.photos.index(photo) self.show_initial_slide(index)