diff --git a/requirements.txt b/requirements.txt index 2636faf0..0ce28a21 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,3 @@ -click==8.1.3 -climage==0.1.3 humanfriendly==10.0 opencv_python==4.8.0.74 Pillow==10.3.0 @@ -7,6 +5,5 @@ pillow_avif_plugin==1.3.1 PySide6==6.5.1.1 PySide6_Addons==6.5.1.1 PySide6_Essentials==6.5.1.1 -Requests==2.31.0 typing_extensions==3.10.0.0 ujson==5.8.0 diff --git a/tagstudio/src/cli/ts_cli.py b/tagstudio/src/cli/ts_cli.py index 8e35bf17..560d22b2 100644 --- a/tagstudio/src/cli/ts_cli.py +++ b/tagstudio/src/cli/ts_cli.py @@ -2,7 +2,7 @@ # Licensed under the GPL-3.0 License. # Created for TagStudio: https://github.com/CyanVoxel/TagStudio -"""A basic CLI driver for TagStudio.""" +"""DEPRECIATED: A basic CLI driver for TagStudio.""" import datetime import math @@ -16,8 +16,8 @@ import pillow_avif from pathlib import Path import traceback import cv2 -import climage -import click +# import climage +# import click from datetime import datetime as dt from src.core.ts_core import * from src.core.utils.web import * @@ -664,8 +664,8 @@ class CliDriver: os.get_terminal_size()[0]) if max_width > 0: thumb_width = max_width if thumb_width > max_width else thumb_width - image = climage.convert(final_img_path, is_truecolor=True, is_256color=False, - is_16color=False, is_8color=False, width=thumb_width) + # image = climage.convert(final_img_path, is_truecolor=True, is_256color=False, + # is_16color=False, is_8color=False, width=thumb_width) # Center Alignment Hack spacing = (os.get_terminal_size()[0] - thumb_width) // 2 if not self.args.external_preview or not entry: @@ -2616,8 +2616,9 @@ class CliDriver: # print(self.format_subtitle( # 'Add Remove <#> Open File Close/Done Quit')) - new_content: str = click.edit(self.lib.get_field_attr( - entry.fields[field_index], 'content')) + # new_content: str = click.edit(self.lib.get_field_attr( + # entry.fields[field_index], 'content')) + new_content: str = '' # NOTE: Removing if new_content is not None: if not allow_newlines: new_content = new_content.replace('\r', '').replace('\n', '') @@ -3138,7 +3139,8 @@ class CliDriver: print(self.format_title('Opened with Default Text Editor', f'{BLACK_FG}{BRIGHT_CYAN_BG}')) - new_text: str = click.edit(text) + # new_text: str = click.edit(text) + new_text: str = input() if new_text is not None: if not allow_newlines: new_text = new_text.replace('\r', '').replace('\n', '') diff --git a/tagstudio/src/core/ts_core.py b/tagstudio/src/core/ts_core.py index 211ccfa9..1ef7f028 100644 --- a/tagstudio/src/core/ts_core.py +++ b/tagstudio/src/core/ts_core.py @@ -10,7 +10,7 @@ from types import FunctionType import json from pathlib import Path import traceback -import requests +# import requests # from bs4 import BeautifulSoup as bs from src.core.library import * from src.core.field_template import FieldTemplate @@ -39,7 +39,9 @@ ARCHIVE_TYPES: list[str] = ['zip', 'rar', 'tar', 'tar.gz', 'tgz', '7z'] PROGRAM_TYPES: list[str] = ['exe', 'app'] SHORTCUT_TYPES: list[str] = ['lnk', 'desktop'] -ALL_FILE_TYPES: list[str] = IMAGE_TYPES + VIDEO_TYPES +ALL_FILE_TYPES: list[str] = IMAGE_TYPES + VIDEO_TYPES + AUDIO_TYPES + \ + TEXT_TYPES + SPREADSHEET_TYPES + PRESENTATION_TYPES + \ + ARCHIVE_TYPES + PROGRAM_TYPES BOX_FIELDS = ['tag_box', 'text_box'] TEXT_FIELDS = ['text_line', 'text_box'] diff --git a/tagstudio/src/qt/ts_qt.py b/tagstudio/src/qt/ts_qt.py index fa65d2e0..45ebd0d8 100644 --- a/tagstudio/src/qt/ts_qt.py +++ b/tagstudio/src/qt/ts_qt.py @@ -2113,7 +2113,11 @@ class PreviewPanel(QWidget): frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) image = Image.fromarray(frame) - self.dimensions_label.setText(f"{extension.upper()} • {humanfriendly.format_size(os.stat(filepath).st_size)}\n{image.width} x {image.height} px") + # Stats for specific file types are displayed here. + if extension in (IMAGE_TYPES + VIDEO_TYPES): + self.dimensions_label.setText(f"{extension.upper()} • {humanfriendly.format_size(os.stat(filepath).st_size)}\n{image.width} x {image.height} px") + else: + self.dimensions_label.setText(f"{extension.upper()}") if not image: self.dimensions_label.setText(f"{extension.upper()} • {humanfriendly.format_size(os.stat(filepath).st_size)}") @@ -2563,7 +2567,7 @@ class ItemThumb(FlowWidget): tag_group_icon_128.load() small_text_style = ( - f'background-color:rgba(0, 0, 0, 64);' + f'background-color:rgba(0, 0, 0, 128);' f'font-family:Oxanium;' f'font-weight:bold;' f'font-size:12px;' @@ -2820,10 +2824,11 @@ class ItemThumb(FlowWidget): # pass def set_extension(self, ext: str) -> None: - if ext in VIDEO_TYPES + ['gif', 'apng']: + if ext and ext not in IMAGE_TYPES or ext in ['gif', 'apng']: self.ext_badge.setHidden(False) self.ext_badge.setText(ext.upper()) - self.count_badge.setHidden(False) + if ext in VIDEO_TYPES + AUDIO_TYPES: + self.count_badge.setHidden(False) else: if self.mode == ItemType.ENTRY: self.ext_badge.setHidden(True) @@ -3226,6 +3231,11 @@ class ThumbRenderer(QObject): success, frame = video.read() frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) image = Image.fromarray(frame) + + # TODO: Create placeholder thumbnails for non-media files. + # else: + # image: Image.Image = ThumbRenderer.thumb_loading_512.resize( + # (adj_size, adj_size), resample=Image.Resampling.BILINEAR) if not image: raise UnidentifiedImageError