added confirmation dialog before opening online help
This commit is contained in:
parent
8297911995
commit
1d1fb3c125
|
@ -5,6 +5,8 @@ from hydrus.core import HydrusConstants as HC
|
||||||
from hydrus.core import HydrusGlobals as HG
|
from hydrus.core import HydrusGlobals as HG
|
||||||
from hydrus.core import HydrusPaths
|
from hydrus.core import HydrusPaths
|
||||||
|
|
||||||
|
from hydrus.client.gui import ClientGUIDialogsQuick
|
||||||
|
|
||||||
def DeletePath( path, always_delete_fully = False ):
|
def DeletePath( path, always_delete_fully = False ):
|
||||||
|
|
||||||
delete_to_recycle_bin = HC.options[ 'delete_to_recycle_bin' ]
|
delete_to_recycle_bin = HC.options[ 'delete_to_recycle_bin' ]
|
||||||
|
@ -52,4 +54,10 @@ def OpenDocumentation( documentation_path : str ):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
remote = ClientGUIDialogsQuick.ConfirmOpenOnlineHelpIfLocalDoesntExist( None, remote )
|
||||||
|
|
||||||
|
if remote is None:
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
LaunchURLInWebBrowser( remote )
|
LaunchURLInWebBrowser( remote )
|
||||||
|
|
|
@ -4963,42 +4963,8 @@ class FrameGUI( CAC.ApplicationCommandProcessorMixin, ClientGUITopLevelWindows.M
|
||||||
|
|
||||||
|
|
||||||
def _OpenHelp( self ):
|
def _OpenHelp( self ):
|
||||||
|
|
||||||
help_path = os.path.join( HC.HELP_DIR, 'index.html' )
|
ClientPaths.OpenDocumentation( HC.DOCUMENTATION_INDEX )
|
||||||
|
|
||||||
if os.path.exists( help_path ):
|
|
||||||
|
|
||||||
ClientPaths.LaunchPathInWebBrowser( help_path )
|
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
message = 'You do not have a local help! Are you running from source? Would you like to open the online help or see a guide on how to build your own?'
|
|
||||||
|
|
||||||
yes_tuples = []
|
|
||||||
|
|
||||||
yes_tuples.append( ( 'open online help', 0 ) )
|
|
||||||
yes_tuples.append( ( 'open how to build guide', 1 ) )
|
|
||||||
|
|
||||||
try:
|
|
||||||
|
|
||||||
result = ClientGUIDialogsQuick.GetYesYesNo( self, message, yes_tuples = yes_tuples, no_label = 'forget it' )
|
|
||||||
|
|
||||||
except HydrusExceptions.CancelledException:
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
if result == 0:
|
|
||||||
|
|
||||||
url = 'https://hydrusnetwork.github.io/hydrus/'
|
|
||||||
|
|
||||||
elif result == 1:
|
|
||||||
|
|
||||||
url = 'https://hydrusnetwork.github.io/hydrus/about_docs.html'
|
|
||||||
|
|
||||||
|
|
||||||
ClientPaths.LaunchURLInWebBrowser( url )
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _OpenInstallFolder( self ):
|
def _OpenInstallFolder( self ):
|
||||||
|
|
|
@ -255,4 +255,31 @@ def SelectServiceKey( service_types = None, service_keys = None, unallowed = Non
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def ConfirmOpenOnlineHelpIfLocalDoesntExist( dialog_owner, online_help_link : str ) -> str:
|
||||||
|
|
||||||
|
message = 'You do not have a local help! Are you running from source? Would you like to open the online help or see a guide on how to build your own?'
|
||||||
|
|
||||||
|
yes_tuples = []
|
||||||
|
|
||||||
|
yes_tuples.append( ( 'open online help', 0 ) )
|
||||||
|
yes_tuples.append( ( 'open how to build guide', 1 ) )
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
result = GetYesYesNo( dialog_owner, message, yes_tuples = yes_tuples, no_label = 'forget it' )
|
||||||
|
|
||||||
|
except HydrusExceptions.CancelledException:
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
|
||||||
|
url = online_help_link
|
||||||
|
|
||||||
|
elif result == 1:
|
||||||
|
|
||||||
|
url = "/".join( ( HC.REMOTE_HELP.rstrip("/"), HC.DOCUMENTATION_ABOUT_DOCS.lstrip("/") ) )
|
||||||
|
|
||||||
|
return url
|
||||||
|
|
||||||
|
|
|
@ -1098,6 +1098,7 @@ url_type_string_lookup = {
|
||||||
|
|
||||||
REMOTE_HELP = "https://hydrusnetwork.github.io/hydrus"
|
REMOTE_HELP = "https://hydrusnetwork.github.io/hydrus"
|
||||||
|
|
||||||
|
DOCUMENTATION_INDEX = "index.html"
|
||||||
DOCUMENTATION_CHANGELOG = f"changelog.html#version_{SOFTWARE_VERSION}"
|
DOCUMENTATION_CHANGELOG = f"changelog.html#version_{SOFTWARE_VERSION}"
|
||||||
DOCUMENTATION_DOWNLOADER_GUGS = "downloader_gugs.html"
|
DOCUMENTATION_DOWNLOADER_GUGS = "downloader_gugs.html"
|
||||||
DOCUMENTATION_DOWNLOADER_LOGIN = 'downloader_login.html'
|
DOCUMENTATION_DOWNLOADER_LOGIN = 'downloader_login.html'
|
||||||
|
@ -1113,7 +1114,7 @@ DOCUMENTATION_DOWNLOADER_PARSERS_FORMULAE__COMPOUND_FORMULA = 'downloader_parser
|
||||||
DOCUMENTATION_DOWNLOADER_PARSERS_FORMULAE__CONTEXT_VARIABLE_FORMULA = 'downloader_parsers_formulae.html#context_variable_formula'
|
DOCUMENTATION_DOWNLOADER_PARSERS_FORMULAE__CONTEXT_VARIABLE_FORMULA = 'downloader_parsers_formulae.html#context_variable_formula'
|
||||||
DOCUMENTATION_DOWNLOADER_PARSERS_FORMULAE__HTML_FORMULA = 'downloader_parsers_formulae.html#html_formula'
|
DOCUMENTATION_DOWNLOADER_PARSERS_FORMULAE__HTML_FORMULA = 'downloader_parsers_formulae.html#html_formula'
|
||||||
DOCUMENTATION_DOWNLOADER_PARSERS_FORMULAE__JSON_FORMULA = 'downloader_parsers_formulae.html#json_formula'
|
DOCUMENTATION_DOWNLOADER_PARSERS_FORMULAE__JSON_FORMULA = 'downloader_parsers_formulae.html#json_formula'
|
||||||
|
DOCUMENTATION_ABOUT_DOCS = "about_docs.html"
|
||||||
|
|
||||||
|
|
||||||
# default options
|
# default options
|
||||||
|
|
Loading…
Reference in New Issue