hydrus/hydrus/client/ClientPaths.py

40 lines
886 B
Python
Raw Normal View History

2020-05-20 21:36:02 +00:00
import webbrowser
2020-04-22 21:00:35 +00:00
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusPaths
2018-05-09 20:23:00 +00:00
2024-02-14 21:20:24 +00:00
from hydrus.client import ClientGlobals as CG
2018-06-06 21:27:02 +00:00
def DeletePath( path, always_delete_fully = False ):
2018-05-16 20:09:50 +00:00
2023-07-05 20:52:58 +00:00
delete_to_recycle_bin = HC.options[ 'delete_to_recycle_bin' ]
if delete_to_recycle_bin and not always_delete_fully:
2018-05-16 20:09:50 +00:00
HydrusPaths.RecyclePath( path )
else:
HydrusPaths.DeletePath( path )
2023-08-09 21:12:17 +00:00
2018-05-09 20:23:00 +00:00
def LaunchPathInWebBrowser( path ):
LaunchURLInWebBrowser( 'file:///' + path )
2023-08-09 21:12:17 +00:00
2018-05-09 20:23:00 +00:00
def LaunchURLInWebBrowser( url ):
2024-02-14 21:20:24 +00:00
web_browser_path = CG.client_controller.new_options.GetNoneableString( 'web_browser_path' )
2018-05-09 20:23:00 +00:00
if web_browser_path is None:
webbrowser.open( url )
else:
HydrusPaths.LaunchFile( url, launch_path = web_browser_path )