Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/reading status improvements #977

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
295 changes: 148 additions & 147 deletions com.github.geigi.cozy.json
Original file line number Diff line number Diff line change
@@ -1,148 +1,149 @@
{
"app-id": "com.github.geigi.cozy",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"command": "com.github.geigi.cozy",
"finish-args": [
"--share=ipc",
"--share=network",
"--socket=fallback-x11",
"--socket=wayland",
"--socket=pulseaudio",
"--device=dri",
"--filesystem=host",
"--filesystem=xdg-run/gvfs",
"--filesystem=xdg-run/gvfsd",
"--talk-name=org.gtk.vfs.*"
],
"modules": [
{
"name": "python3-distro",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"distro\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl",
"sha256": "7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2"
}
]
},
{
"name": "python3-mutagen",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"mutagen\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/b0/7a/620f945b96be1f6ee357d211d5bf74ab1b7fe72a9f1525aafbfe3aee6875/mutagen-1.47.0-py3-none-any.whl",
"sha256": "edd96f50c5907a9539d8e5bba7245f62c9f520aef333d13392a79a4f70aca719"
}
]
},
{
"name": "python3-peewee",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"peewee>=3.9.6\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/8d/a5/89cdbc4a7f6d7a0624c120be102db770ee717aa371066581e3daf2beb96f/peewee-3.17.1.tar.gz",
"sha256": "e009ac4227c4fdc0058a56e822ad5987684f0a1fbb20fed577200785102581c3"
}
]
},
{
"name": "python3-pytz",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"pytz\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/9c/3d/a121f284241f08268b21359bd425f7d4825cffc5ac5cd0e1b3d82ffd2b10/pytz-2024.1-py2.py3-none-any.whl",
"sha256": "328171f4e3623139da4983451950b28e95ac706e13f3f2630a879749e7a8b319"
}
]
},
{
"name": "python3-requests",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"requests\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/ba/06/a07f096c664aeb9f01624f858c3add0a4e913d6c96257acb4fce61e7de14/certifi-2024.2.2-py3-none-any.whl",
"sha256": "dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/63/09/c1bc53dab74b1816a00d8d030de5bf98f724c52c1635e07681d312f20be8/charset-normalizer-3.3.2.tar.gz",
"sha256": "f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/c2/e7/a82b05cf63a603df6e68d59ae6a68bf5064484a0718ea5033660af4b54a9/idna-3.6-py3-none-any.whl",
"sha256": "c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl",
"sha256": "58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/88/75/311454fd3317aefe18415f04568edc20218453b709c63c58b9292c71be17/urllib3-2.2.0-py3-none-any.whl",
"sha256": "ce3711610ddce217e6d113a2732fafad960a03fd0318c91faa79481e35c11224"
}
]
},
{
"name": "python3-inject",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"inject\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/e9/db/3250e21ff08b3466e1ce8d0b2b09edcd6af7672f709d8625e142e824eb0b/inject-5.2.1-py2.py3-none-any.whl",
"sha256": "e40a5b1bebd8a4050b6f98f3396f3de6e9e2e411ad2a2145f16f351cb6f54e51"
}
]
},
{
"name": "blueprint-compiler",
"buildsystem": "meson",
"cleanup": [ "*" ],
"sources": [
{
"type": "git",
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler.git",
"tag": "v0.12.0"
}
]
},
{
"name": "cozy",
"buildsystem": "meson",
"run-tests": true,
"sources": [
{
"type": "dir",
"path": "."
}
]
}
]
}
"app-id": "com.github.geigi.cozy",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"command": "com.github.geigi.cozy",
"finish-args": [
"--share=ipc",
"--share=network",
"--socket=fallback-x11",
"--socket=wayland",
"--socket=pulseaudio",
"--device=dri",
"--filesystem=host",
"--filesystem=xdg-run/gvfs",
"--filesystem=xdg-run/gvfsd",
"--talk-name=org.gtk.vfs.*"
],
"modules": [
{
"name": "python3-distro",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"distro\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl",
"sha256": "7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2"
}
]
},
{
"name": "python3-mutagen",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"mutagen\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/b0/7a/620f945b96be1f6ee357d211d5bf74ab1b7fe72a9f1525aafbfe3aee6875/mutagen-1.47.0-py3-none-any.whl",
"sha256": "edd96f50c5907a9539d8e5bba7245f62c9f520aef333d13392a79a4f70aca719"
}
]
},
{
"name": "python3-peewee",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"peewee>=3.9.6\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/8d/a5/89cdbc4a7f6d7a0624c120be102db770ee717aa371066581e3daf2beb96f/peewee-3.17.1.tar.gz",
"sha256": "e009ac4227c4fdc0058a56e822ad5987684f0a1fbb20fed577200785102581c3"
}
]
},
{
"name": "python3-pytz",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"pytz\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/9c/3d/a121f284241f08268b21359bd425f7d4825cffc5ac5cd0e1b3d82ffd2b10/pytz-2024.1-py2.py3-none-any.whl",
"sha256": "328171f4e3623139da4983451950b28e95ac706e13f3f2630a879749e7a8b319"
}
]
},
{
"name": "python3-requests",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"requests\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/ba/06/a07f096c664aeb9f01624f858c3add0a4e913d6c96257acb4fce61e7de14/certifi-2024.2.2-py3-none-any.whl",
"sha256": "dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/63/09/c1bc53dab74b1816a00d8d030de5bf98f724c52c1635e07681d312f20be8/charset-normalizer-3.3.2.tar.gz",
"sha256": "f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/c2/e7/a82b05cf63a603df6e68d59ae6a68bf5064484a0718ea5033660af4b54a9/idna-3.6-py3-none-any.whl",
"sha256": "c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl",
"sha256": "58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/88/75/311454fd3317aefe18415f04568edc20218453b709c63c58b9292c71be17/urllib3-2.2.0-py3-none-any.whl",
"sha256": "ce3711610ddce217e6d113a2732fafad960a03fd0318c91faa79481e35c11224"
}
]
},
{
"name": "python3-inject",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"inject\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/e9/db/3250e21ff08b3466e1ce8d0b2b09edcd6af7672f709d8625e142e824eb0b/inject-5.2.1-py2.py3-none-any.whl",
"sha256": "e40a5b1bebd8a4050b6f98f3396f3de6e9e2e411ad2a2145f16f351cb6f54e51"
}
]
},
{
"name": "blueprint-compiler",
"buildsystem": "meson",
"cleanup": [ "*" ],
"sources": [
{
"type": "git",
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler.git",
"tag": "v0.12.0"
}
]
},
{
"name": "cozy",
"buildsystem": "meson",
"run-tests": true,
"sources": [
{
"type": "dir",
"path": "."
}
]
}
]
}

8 changes: 8 additions & 0 deletions cozy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ def hide_offline(self) -> bool:
def hide_offline(self, new_value: bool):
self._settings.set_boolean("hide-offline", new_value)

@property
def hide_read(self) -> bool:
return self._settings.get_boolean("hide-read")

@hide_read.setter
def hide_read(self, new_value: bool):
self._settings.set_boolean("hide-read", new_value)

@property
def swap_author_reader(self) -> bool:
return self._settings.get_boolean("swap-author-reader")
Expand Down
1 change: 1 addition & 0 deletions cozy/ui/library_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,4 @@ def _on_book_progress_changed(self):
return

self._connected_book_card.update_progress()
self._connected_book_card.update_status_icon()
18 changes: 18 additions & 0 deletions cozy/ui/main_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def __init_actions(self):
self.create_action("remove_book", self.remove_book)

self.create_action("mark_book_as_read", self.mark_book_as_read)
self.create_action("mark_book_as_unread", self.mark_book_as_unread)
self.create_action("jump_to_book_folder", self.jump_to_book_folder)

self.create_action("prefs", self.show_preferences_window, ["<primary>comma"], global_shorcut=True)
Expand All @@ -116,6 +117,12 @@ def __init_actions(self):
self.hide_offline_action.connect("change-state", self.__on_hide_offline)
self.app.add_action(self.hide_offline_action)

self.hide_read_action = Gio.SimpleAction.new_stateful(
"hide_read", None, GLib.Variant.new_boolean(self.application_settings.hide_read)
)
self.hide_read_action.connect("change-state", self.__on_hide_read)
self.app.add_action(self.hide_read_action)

def set_hotkeys_enabled(self, enabled: bool) -> None:
for action in self._actions_to_disable:
action.set_enabled(enabled)
Expand Down Expand Up @@ -166,6 +173,10 @@ def mark_book_as_read(self, *_) -> None:
if self.app.selected_book is not None:
self.app.selected_book.mark_as_read()

def mark_book_as_unread(self, *_) -> None:
if self.app.selected_book is not None:
self.app.selected_book.mark_as_unread()

def jump_to_book_folder(self, *_) -> None:
if self.app.selected_book is not None:
self.app.selected_book.jump_to_folder()
Expand Down Expand Up @@ -251,6 +262,13 @@ def __on_hide_offline(self, action, value):
action.set_state(value)
self.application_settings.hide_offline = value.get_boolean()

def __on_hide_read(self, action, value):
"""
Hide read books from the library view.
"""
action.set_state(value)
self.application_settings.hide_read = value.get_boolean()

def _on_drag_enter(self, *_):
self.drop_revealer.set_reveal_child(True)
self.main_stack.add_css_class("blurred")
Expand Down
Loading