Skip to content

Commit

Permalink
Merge pull request #63 from Thisal-D/v3.1.1-patch-final-2
Browse files Browse the repository at this point in the history
v3.1.1
  • Loading branch information
Thisal-D authored Dec 24, 2024
2 parents c56aebc + ad1b6ff commit 5d95eb2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '3.1.0'
VERSION = '3.1.1'
33 changes: 28 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,16 @@ def paste_url(self) -> None:
pyautogui.hotkey("ctrl", "v")
self.context_menu.place_forget()

def place_forget_nav_frames(self) -> None:
def place_forget_nav_frames(self, except_frame: Literal["added", "downloading", "downloaded"] = None) -> None:
"""
Hides the navigation frames for added, downloading, and downloaded content.
"""
self.added_content_scroll_frame.place_forget()
self.downloading_content_scroll_frame.place_forget()
self.downloaded_content_scroll_frame.place_forget()
if except_frame != "added":
self.added_content_scroll_frame.place_forget()
if except_frame != "downloading":
self.downloading_content_scroll_frame.place_forget()
if except_frame != "downloaded":
self.downloaded_content_scroll_frame.place_forget()

def place_forget_nav_labels(self) -> None:
"""
Expand Down Expand Up @@ -308,7 +311,7 @@ def place_frame(self, frame: ctk.CTkScrollableFrame, frame_name: str) -> None:
frame (ctk.CTkScrollableFrame): The scrollable frame to be placed.
frame_name (str): The name of the frame ('added', 'downloading', or 'downloaded').
"""
self.place_forget_nav_frames()
self.place_forget_nav_frames(except_frame=frame_name)
frame.place(y=90 * AppearanceSettings.settings["scale_r"], x=10)
self.place_nav_label(frame_name)

Expand Down Expand Up @@ -1198,6 +1201,12 @@ def fade_in(alpha):

fade_out(AppearanceSettings.settings["opacity_r"])

def scroll_frame_to_bottom(self, frame: ctk.CTkScrollableFrame):
"""
Scroll the frame to the bottom.
"""
frame.after(10, frame._parent_canvas.yview_moveto, 1.0)

def add_video_playlist(self) -> None:
"""
Add a video or playlist to the content.
Expand Down Expand Up @@ -1237,6 +1246,11 @@ def add_video_playlist(self) -> None:
video_download_button_click_callback=self.download_video,
playlist_url=yt_url
).pack(fill="x", pady=2)

# Automatically navigate to added frame when new video added
self.place_frame(self.added_content_scroll_frame, "added")
# auot scroll to bottom
self.scroll_frame_to_bottom(self.added_content_scroll_frame)

def download_video(self, video: AddedVideo) -> None:
"""
Expand Down Expand Up @@ -1268,6 +1282,8 @@ def download_video(self, video: AddedVideo) -> None:
download_type_info=video.selected_download_type_info,
video_download_complete_callback=self.downloaded_video,
).pack(fill="x", pady=2)

self.scroll_frame_to_bottom(self.downloading_content_scroll_frame)

def download_playlist(self, playlist: AddedPlayList) -> None:
"""
Expand Down Expand Up @@ -1296,6 +1312,8 @@ def download_playlist(self, playlist: AddedPlayList) -> None:
playlist_download_complete_callback=self.downloaded_playlist,
).pack(fill="x", pady=2)

self.scroll_frame_to_bottom(self.downloading_content_scroll_frame)

def downloaded_video(self, video: DownloadingVideo) -> None:
"""
Handle downloaded video.
Expand Down Expand Up @@ -1323,6 +1341,8 @@ def downloaded_video(self, video: DownloadingVideo) -> None:
download_quality=video.download_quality,
download_type=video.download_type
).pack(fill="x", pady=2)

self.scroll_frame_to_bottom(self.downloaded_content_scroll_frame)

def downloaded_playlist(self, playlist: DownloadingPlayList) -> None:
"""
Expand All @@ -1346,6 +1366,8 @@ def downloaded_playlist(self, playlist: DownloadingPlayList) -> None:
playlist_url=playlist.playlist_url,
videos=playlist.downloaded_videos
).pack(fill="x", pady=2)

self.scroll_frame_to_bottom(self.downloaded_content_scroll_frame)

def open_context_menu(self, _event: tk.Event) -> None:
"""
Expand Down Expand Up @@ -1536,6 +1558,7 @@ def check_for_updates(self) -> None:
# Check the app is updated or not
latest_version = DataRetriveUtility.get_latest_version()
current_version = DataRetriveUtility.get_current_version()

scale = AppearanceSettings.settings["scale_r"]
if latest_version is not None:
if latest_version != current_version:
Expand Down

0 comments on commit 5d95eb2

Please sign in to comment.