ui: "open in explorer" action follows os name (#370)

* Update item_thumb.py

* Update preview_panel.py

* Update video_player.py

* made it so preview_panel.py uses self.open_explorer_action instead of just normal open_explorer_action
This commit is contained in:
SupKittyMeow
2024-08-31 16:47:26 -07:00
committed by GitHub
parent 569390ea72
commit dcb8ded987
3 changed files with 32 additions and 3 deletions

View File

@@ -4,6 +4,7 @@
import contextlib
import logging
import os
import platform
import time
import typing
from pathlib import Path
@@ -195,7 +196,16 @@ class ItemThumb(FlowWidget):
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()
open_explorer_action = QAction(
"Open in explorer", self
) # Default (mainly going to be for linux)
if system == "Darwin":
open_explorer_action = QAction("Reveal in Finder", self)
elif system == "Windows":
open_explorer_action = QAction("Open 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)

View File

@@ -4,6 +4,7 @@
import logging
from pathlib import Path
import platform
import time
import typing
from datetime import datetime as dt
@@ -97,7 +98,15 @@ class PreviewPanel(QWidget):
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()
self.open_explorer_action = QAction(
"Open in explorer", self
) # Default (mainly going to be for linux)
if system == "Darwin":
self.open_explorer_action = QAction("Reveal in Finder", self)
elif system == "Windows":
self.open_explorer_action = QAction("Open in Explorer", self)
self.preview_img = QPushButtonWrapper()
self.preview_img.setMinimumSize(*self.img_button_size)

View File

@@ -4,6 +4,7 @@
import logging
from pathlib import Path
import platform
import typing
from PySide6.QtCore import (
@@ -129,7 +130,16 @@ class VideoPlayer(QGraphicsView):
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()
open_explorer_action = QAction(
"Open in explorer", self
) # Default (mainly going to be for linux)
if system == "Darwin":
open_explorer_action = QAction("Reveal in Finder", self)
elif system == "Windows":
open_explorer_action = QAction("Open in Explorer", self)
open_explorer_action.triggered.connect(self.opener.open_explorer)
self.addAction(open_file_action)
self.addAction(open_explorer_action)