Skip to content
Open
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
28 changes: 23 additions & 5 deletions app/ui/widgets/widget_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,17 @@ def delete_target_media_to_trash(self):

def open_target_path_by_explorer(self):
if os.path.exists(self.media_path):
# Normalize path
normalized_path = os.path.normpath(os.path.abspath(self.media_path))

if sys.platform == 'win32':
# Windows
subprocess.run(f'explorer /select,"{self.media_path}"', shell=True)
# Windows - use full path to explorer.exe to avoid PATH issues
try:
# Method 1: Using subprocess without shell (more secure and reliable)
subprocess.Popen(['explorer', '/select,', normalized_path])
except FileNotFoundError:
# Fallback: Use full path to explorer.exe
subprocess.Popen([r'C:\Windows\explorer.exe', '/select,', normalized_path])
elif sys.platform == 'darwin':
# macOS
subprocess.run(['open', '-R', self.media_path])
Expand All @@ -341,6 +349,7 @@ def open_target_path_by_explorer(self):
directory = os.path.dirname(os.path.abspath(self.media_path))
subprocess.run(['xdg-open', directory])


def create_context_menu(self):
self.popMenu = QtWidgets.QMenu(self)
remove_action = QtGui.QAction('Remove from list', self)
Expand Down Expand Up @@ -730,12 +739,20 @@ def delete_input_face_to_trash(self):
print(f"{self.media_path} does not exist.")

self.deleteLater()

def open_target_path_by_explorer(self):
if os.path.exists(self.media_path):
# Normalize path
normalized_path = os.path.normpath(os.path.abspath(self.media_path))

if sys.platform == 'win32':
# Windows
subprocess.run(f'explorer /select,"{self.media_path}"', shell=True)
# Windows - use full path to explorer.exe to avoid PATH issues
try:
# Method 1: Using subprocess without shell (more secure and reliable)
subprocess.Popen(['explorer', '/select,', normalized_path])
except FileNotFoundError:
# Fallback: Use full path to explorer.exe
subprocess.Popen([r'C:\Windows\explorer.exe', '/select,', normalized_path])
elif sys.platform == 'darwin':
# macOS
subprocess.run(['open', '-R', self.media_path])
Expand Down Expand Up @@ -1606,3 +1623,4 @@ def __init__(self, main_window:'MainWindow', title="Form Group", parent=None,):
self.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
self.setFlat(True)