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

New 'Next episode column' in GTK and for MAL (Qt and GTK) + miscellaneous code refactor #722

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

BigBoyBarney
Copy link

@BigBoyBarney BigBoyBarney commented Jan 1, 2024

I now realise this probably should have been a few different PRs instead of one.

Changelist

Screenshots are at the bottom

GTK

UI

  • Implemented 'Next episode' column with custom sorting
  • QoL changes to right-click context menu:
    • Play Next → Play next episode
    • Show details... → Show details
    • Open web site → Open on [website], where [website] is the currently used API. Tested with MAL and Anilist.
    • Set alternate title... → Set alternate title
  • Sorting indicators no longer take up screen space on unsorted columns
  • Centred columns other than 'Title'
  • Increased default window size to 1080x720 (from 740x480). The current default was set in 2015, and it is too small for modern displays.
  • Renamed some column titles (see screenshots). Default visible columns had to be reset in order to accommodate this change:
    • Progress → Watched
    • Percent → Progress
  • Changed default sorting directions for some columns to be more intuitive, defaulting to descending order on the first click.
    E.g: 10, 10, 8, 4 etc. Changed columns:
    • Watched
    • Score
    • Next episode
    • Progress

Code

  • Implemented 'Next episode' column with custom sorting
  • New function to reset visible columns in the config, to ensure the default columns are visible even after being renamed. A more elegant solution would be to completely rewrite how visible columns are handled and not reference the column titles directly.
  • Rewrote parts of ShowTreeView.py:
    • Row data access and general column referencing is done through a TreeConstants class to improve readability and uniformity
    • TreeView model is now set immediately after initialisation
    • Completely rewrote how sorting is set up

Qt

UI

  • Increased default window size to 1080x720 (from 740x480)
  • Implemented 'Next episode' column for MAL (Anilist was already supported)

Code

  • Replaced deprecated datetime.utcnow() with time zone aware datetime.now(datetime.timezone.utc)
  • Implemented 'Next episode' column for MAL. The code to display the datetime object was already written by someone else — most likely Z — and I did not touch that too much, which is why the way Qt displays the time differs from GTK.

Other

  • Minimum python version bumped to 3.10, as it introduces a lot of QoL changes. Currently one of the oldest "major" distros, Ubuntu 22.04, ships with Python 3.10 already, so pretty much every other distro should be at least this or newer.
  • Updated poetry.lock

Screenshots GTK

Default
Default

Next episode sorting down (Anilist)
Next episode sorting down

Next episode sorting up (Anilist)
Next episode sorting up

MAL Support
image

Context menu Anilist
Context menu Anilist

Context menu MAL
Context menu MAL

Screenshots Qt

Anilist
image

MAL
image

BigBoyBarney and others added 17 commits January 1, 2024 11:04
UI:
- QoL changes to the right-click context menu of a show, dynamic site name in particular
- Added "Next episode" column with custom sorting
- Renamed the old "Progress" column (e.g: 7/13) to Watched, and renamed "Percent" column (the progress bar) to "Progress".
- Set minimum width for the progress bar to 200 pixels

Code:
- Refactored a significant part of the list tree (showtreeview.py), making it much easier to read and build upon.
- Unified column / row reference constants
- The tree model is now set immediately after tree initialisation
- Replaced deprecated datetime.utcnow() with timezone aware datetime.now(datetime.UTC).
- Added 'New episode' as default column
- Reset visible columns config to accommodate the new column names
- Remove redundant comments / commented code blocks
- Add comments to new code
- Refactored relative time regex to multiple shorter lines
- Added comments to tree references
- Renamed some local tree variables to be more intuitive
- Changed percentage progress variable type to int
- columns are only sorted when the header is clicked
- Disabled sorting indicators for inactive columns
- Centred columns and contents (except Title)
- Slightly rewrote code for the sorting setup again
- Fixed multiple sort indicator issue
- Sort indicators now have uniform default direction
- Bump required python version to 3.10, as 3.8 is outdated and 3.10 brings a lot of QoL changes. The "oldest" main distro is Ubuntu 22.04 and even that ships with Python 3.10 by default. Pretty much every other distro should be 3.10 or newer as well.
- Increased window size from 740x480 to 1080x720. The default was last changed and set in 2015, which made sense back then, but it's way too small for most modern displays.
- Replaced python >=3.11 exclusive `datetime.timezone.utc` alias `datetime.UTC`. Should run in 3.10 now.
- Displays 'Next episode' for MAL, where applicable
- Added a bunch of comments for clarity
- Indents in `libmal.py` were cleaned up a bit
- Renamed `header_button_press` to `header_right_click` for clarity.
- The state of MAL is pretty sad, it does not give an actual weekly airing time, just a general broadcast schedule, so if an episode gets delayed, there is no way of knowing without 3rd party sites. This is not an issue with the code, but with MAL. Use Anilist.
- Displays 'Next episode' for MAL, where applicable (new in Qt)
- Added a bunch of comments for clarity
- Indents in `libmal.py` were cleaned up a bit
- Renamed `header_button_press` to `header_right_click` for clarity.
- The state of MAL is pretty sad, it does not give an actual weekly airing time, just a general broadcast schedule, so if an episode gets delayed, there is no way of knowing without 3rd party sites. This is not an issue with the code, but with MAL. Use Anilist.
@BigBoyBarney BigBoyBarney changed the title GTK 'next episode column' and miscellaneous code refactor New 'Next episode column' in GTK and for MAL (Qt and GTK) + miscellaneous code refactor Jan 10, 2024
@BigBoyBarney
Copy link
Author

BigBoyBarney commented Jan 10, 2024

Added MAL support, with all of their information. Kitsu provides no information and Shikimori is dead.
'Next episode' functionality can be considered complete at this point IMO.
Updated the OP with Qt images.

The poetry update consists mostly of minor version changes, the only difference being urllib3, but I don't think this is an issue for Trackma, as only barebones urllib functionality is being used.

The other major change is obviously python 3.8 → 3.10, but I think this shouldn't be an issue either.


Could someone take a look? I promise the code is readable and well commented, so it shouldn't take too long. The GTK version is well tested, but Qt should be stable as well.
@z411

@v-fox
Copy link

v-fox commented Apr 2, 2024

Doesn't apply cleanly to master due to some extraneous changes but easy to clean up by hand. Absolutely essential feature, especially now that Qt5 is obsoleted but PyQt6 port is stalled.
But I wish it would show hours too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants