File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22import sys
33from datetime import datetime
44from functools import wraps
5+ from pathlib import Path
56from time import sleep
67from typing import Callable
78
1213
1314from app .supports .config import cfg
1415
16+ def openFolder (path ):
17+ path = Path (path )
18+ if path .exists ():
19+ folder , file = path .parent , path .name
20+ match sys .platform :
21+ case 'win32' :
22+ os .system (f'explorer.exe /select, "{ path } "' )
23+ case 'linux' :
24+ os .system (f'xdg-open "{ folder } "' )
25+ case 'darwin' :
26+ os .system (f'open -R "{ path } "' )
27+
28+ else :
29+ raise FileNotFoundError (path )
30+
31+
1532def isGreaterEqualWin10 ():
1633 """determine if the Windows version ≥ Win10"""
1734 cv = QOperatingSystemVersion .current ()
Original file line number Diff line number Diff line change 1212from app .bases .models import Task , TaskStatus
1313from app .services .core_service import coreService
1414from app .supports .recorder import taskRecorder
15- from app .supports .utils import openFile , getReadableSize , getReadableTime
15+ from app .supports .utils import openFile , getReadableSize , getReadableTime , openFolder
1616from app .view .components .dialogs import DeleteTaskDialog
1717from app .view .components .labels import IconBodyLabel
1818
@@ -232,7 +232,7 @@ def _refreshIconLabel(self):
232232 def connectSignalToSlot (self ):
233233 self .toggleRunningStatusButton .clicked .connect (self .toggleRunningStatus )
234234 self .openFileButton .clicked .connect (lambda : openFile (self .task .resolvePath ))
235- self .openFolderButton .clicked .connect (lambda : openFile (self .task .path ))
235+ self .openFolderButton .clicked .connect (lambda : openFolder (self .task .resolvePath ))
236236 self .cancelButton .clicked .connect (self ._onDeleteButtonClicked )
237237
238238 def toggleRunningStatus (self ):
You can’t perform that action at this time.
0 commit comments