Skip to content

Fix ts_qt empty file bug, show more file previews, and rename "Show file in explorer" to vary based on OS #358

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

Closed
wants to merge 6 commits into from
Closed
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
5 changes: 5 additions & 0 deletions tagstudio/src/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,17 @@
".json",
".js",
".ts",
".py",
".c",
".cpp",
".cs",
".ini",
".htm",
".csv",
".php",
".sh",
".bat",
".yml"
]
SPREADSHEET_TYPES: list[str] = [".csv", ".xls", ".xlsx", ".numbers", ".ods"]
PRESENTATION_TYPES: list[str] = [".ppt", ".pptx", ".key", ".odp"]
Expand Down
4 changes: 2 additions & 2 deletions tagstudio/src/qt/ts_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ def update_thumbs(self):
base_size: tuple[int, int] = (self.thumb_size, self.thumb_size)

for i, item_thumb in enumerate(self.item_thumbs, start=0):
if i < len(self.nav_frames[self.cur_frame_idx].contents):
if self.nav_frames[self.cur_frame_idx].contents and i < len(self.nav_frames[self.cur_frame_idx].contents):
# Set new item type modes
# logging.info(f'[UPDATE] Setting Mode To: {self.nav_stack[self.cur_page_idx].contents[i][0]}')
item_thumb.set_mode(self.nav_frames[self.cur_frame_idx].contents[i][0])
Expand Down Expand Up @@ -1245,7 +1245,7 @@ def update_thumbs(self):
self.main_window.update()

for i, item_thumb in enumerate(self.item_thumbs, start=0):
if i < len(self.nav_frames[self.cur_frame_idx].contents):
if self.nav_frames[self.cur_frame_idx].contents and i < len(self.nav_frames[self.cur_frame_idx].contents):
filepath = ""
if self.nav_frames[self.cur_frame_idx].contents[i][0] == ItemType.ENTRY:
entry = self.lib.get_entry(
Expand Down
11 changes: 10 additions & 1 deletion tagstudio/src/qt/widgets/item_thumb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import contextlib
import logging
import os
import platform
import time
import typing
from pathlib import Path
Expand Down Expand Up @@ -194,7 +195,15 @@ def __init__(
self.opener = FileOpenerHelper("")
open_file_action = QAction("Open file", self)
open_file_action.triggered.connect(self.opener.open_file)
open_explorer_action = QAction("Open file in explorer", self)

system = platform.system()
if system == "Darwin":
open_explorer_action = QAction("Reveal file in Finder", self)
elif system == "Linux":
open_explorer_action = QAction("Open file in filesystem", self) # TODO: Rename to whatever the Linux explorer is
else:
open_explorer_action = QAction("Open file in explorer", self)

open_explorer_action.triggered.connect(self.opener.open_explorer)
self.thumb_button.addAction(open_file_action)
self.thumb_button.addAction(open_explorer_action)
Expand Down
11 changes: 10 additions & 1 deletion tagstudio/src/qt/widgets/preview_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import logging
from pathlib import Path
import platform
import time
import typing
from datetime import datetime as dt
Expand Down Expand Up @@ -83,7 +84,15 @@ def __init__(self, library: Library, driver: "QtDriver"):
image_layout.setContentsMargins(0, 0, 0, 0)

self.open_file_action = QAction("Open file", self)
self.open_explorer_action = QAction("Open file in explorer", self)

system = platform.system()

if system == "Darwin":
self.open_explorer_action = QAction("Reveal file in Finder", self)
elif system == "Linux":
self.open_explorer_action = QAction("Open file in filesystem", self) # TODO: Rename to whatever the Linux explorer is
else:
self.open_explorer_action = QAction("Open file in explorer", self)

self.preview_img = QPushButtonWrapper()
self.preview_img.setMinimumSize(*self.img_button_size)
Expand Down
11 changes: 10 additions & 1 deletion tagstudio/src/qt/widgets/video_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging

from pathlib import Path
import platform
import typing

from PySide6.QtCore import (
Expand Down Expand Up @@ -129,7 +130,15 @@ def __init__(self, driver: "QtDriver") -> None:

open_file_action = QAction("Open file", self)
open_file_action.triggered.connect(self.opener.open_file)
open_explorer_action = QAction("Open file in explorer", self)

system = platform.system()
if system == "Darwin":
open_explorer_action = QAction("Reveal file in Finder", self)
elif system == "Linux":
open_explorer_action = QAction("Open file in filesystem", self) # TODO: Rename to whatever the Linux explorer is
else:
open_explorer_action = QAction("Open file in explorer", self)

open_explorer_action.triggered.connect(self.opener.open_explorer)
self.addAction(open_file_action)
self.addAction(open_explorer_action)
Expand Down
Loading