Skip to content

Commit

Permalink
Added QT_IFW_DEFAULT_TARGET_DIR constant / implementation. Patched in…
Browse files Browse the repository at this point in the history
…staller target dir page input such that if the textedit is left empty, and wizard the page is advanced, it reverts to the default.
  • Loading branch information
BuvinJ committed Jan 11, 2021
1 parent 03e428c commit d91388d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
1 change: 1 addition & 0 deletions distbuilder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
, QT_IFW_VERBOSE_SWITCH \
, QT_IFW_DYNAMIC_VARS \
, QT_IFW_TARGET_DIR \
, QT_IFW_DEFAULT_TARGET_DIR \
, QT_IFW_HOME_DIR \
, QT_IFW_DESKTOP_DIR \
, QT_IFW_APPS_DIR \
Expand Down
35 changes: 28 additions & 7 deletions distbuilder/qt_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@
QT_IFW_INSTALLER_DIR = "@InstallerDirPath@"
QT_IFW_INTALLER_PATH = "@InstallerFilePath@"

_QT_IFW_DEFAULT_TARGET_DIR = "DefaultTargetDir" # CUSTOM!
_QT_IFW_SCRIPTS_DIR = "ScriptsDir" # CUSTOM!
_QT_IFW_INSTALLER_TEMP_DIR = "InstallerTempDir" # CUSTOM!
_QT_IFW_MAINTENANCE_TEMP_DIR = "MaintenanceTempDir" # CUSTOM!

_QT_IFW_VAR_TMPLT = "@%s@"

QT_IFW_DEFAULT_TARGET_DIR = _QT_IFW_VAR_TMPLT % (_QT_IFW_DEFAULT_TARGET_DIR,) # CUSTOM!
QT_IFW_SCRIPTS_DIR = _QT_IFW_VAR_TMPLT % (_QT_IFW_SCRIPTS_DIR,) # CUSTOM!
QT_IFW_INSTALLER_TEMP_DIR = _QT_IFW_VAR_TMPLT % (_QT_IFW_INSTALLER_TEMP_DIR,) # CUSTOM!
QT_IFW_MAINTENANCE_TEMP_DIR = _QT_IFW_VAR_TMPLT % (_QT_IFW_MAINTENANCE_TEMP_DIR,) # CUSTOM!
Expand Down Expand Up @@ -152,6 +154,7 @@

QT_IFW_DYNAMIC_PATH_VARS = [
"TargetDir"
, "DefaultTargetDir"
, "RootDir"
, "HomeDir"
, "DesktopDir"
Expand Down Expand Up @@ -756,6 +759,7 @@ class _QtIfwScript:
"maintenancetool", isGui=True )

VERBOSE_CMD_SWITCH_ARG = "-v"
DEFAULT_TARGET_DIR_KEY = "DefaultTargetDir"
TARGET_DIR_KEY = "TargetDir"
STARTMENU_DIR_KEY = "StartMenuDir"
PRODUCT_NAME_KEY = "ProductName"
Expand Down Expand Up @@ -3382,6 +3386,11 @@ def __genPageChangeCallbackBody( self ):
prepend =(
TAB + _QtIfwScript.log( '"page changed to id: " + pageId', isAutoQuote=False ) +
TAB + _QtIfwScript.ifInstalling( isMultiLine=True ) +
(2*TAB) + _QtIfwScript.ifCondition( _QtIfwScript.lookupValue(
_QtIfwScript.TARGET_DIR_KEY ) + '==""' ) +
(3*TAB) + _QtIfwScript.setValue( '"%s"' % (_QtIfwScript.TARGET_DIR_KEY,),
_QtIfwScript.lookupValue( _QtIfwScript.DEFAULT_TARGET_DIR_KEY ),
isAutoQuote=False ) +
(2*TAB) + ('if( pageId == %s )' % (
QtIfwControlScript.toDefaultPageId(
QT_IFW_INTRO_PAGE),)) + SBLK +
Expand Down Expand Up @@ -3539,12 +3548,17 @@ def __genControllerConstructorBody( self ):
TAB + 'makeDir( Dir.temp() )' + END +
TAB + 'installer.setValue( ' +
('"%s"' % (_QT_IFW_SCRIPTS_DIR,)) + ', Dir.temp() )' + END +
# TODO: Negate this "patch" by eliminating the redundant command line arg!
_QtIfwScript.ifCmdLineArg( _QtIfwScript.TARGET_DIR_CMD_ARG ) +
_QtIfwScript.TAB + _QtIfwScript.setValue(
'"%s"' % (_QtIfwScript.TARGET_DIR_KEY,),
_QtIfwScript.cmdLineArg( _QtIfwScript.TARGET_DIR_CMD_ARG ),
isAutoQuote=False ) +
_QtIfwScript.ifInstalling( isMultiLine=True ) +
_QtIfwScript.setValue( '"%s"' % (_QT_IFW_DEFAULT_TARGET_DIR,),
_QtIfwScript.lookupValue( _QtIfwScript.TARGET_DIR_KEY ),
isAutoQuote=False ) +
TAB + _QtIfwScript.ifCmdLineArg(
_QtIfwScript.TARGET_DIR_CMD_ARG ) +
(2*TAB) + _QtIfwScript.setValue(
'"%s"' % (_QtIfwScript.TARGET_DIR_KEY,),
_QtIfwScript.cmdLineArg( _QtIfwScript.TARGET_DIR_CMD_ARG ),
isAutoQuote=False ) +
EBLK +
# currently the entire point of the watchdog is purge temp files,
# so when _keeptemp is enabled, just drop that entire mechanism!
TAB + _QtIfwScript.ifCmdLineSwitch( _KEEP_TEMP_SWITCH,
Expand Down Expand Up @@ -6606,8 +6620,15 @@ def __init__( self ):
page.targetChooser.released.connect(this, this.%s);
""") % ( ON_TARGET_CHANGED_NAME, ON_TARGET_BROWSE_CLICKED_NAME )

ON_ENTER = (
"""
page.targetDirectory.setText(
Dir.toNativeSeparator(installer.value("TargetDir")));
""")

QtIfwUiPage.__init__( self, QtIfwTargetDirPage.NAME,
sourcePath=QtIfwTargetDirPage.__SRC, onLoad=ON_LOAD )
sourcePath=QtIfwTargetDirPage.__SRC,
onLoad=ON_LOAD, onEnter=ON_ENTER )

self.eventHandlers.update({
ON_TARGET_CHANGED_NAME: ON_TARGET_CHANGED
Expand Down
6 changes: 4 additions & 2 deletions docs/LowLevel.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ and attributes for many higher level functions and objects in this library.

QT_IFW_DYNAMIC_VARS <LIST CONTAINING ALL OF THESE>

QT_IFW_TARGET_DIR
QT_IFW_TARGET_DIR
QT_IFW_DEFAULT_TARGET_DIR

QT_IFW_ROOT_DIR

Expand Down Expand Up @@ -482,7 +483,8 @@ Static Constants :
MAINTENANCE_TOOL_NAME

VERBOSE_CMD_SWITCH_ARG
TARGET_DIR_KEY
TARGET_DIR_KEY
DEFAULT_TARGET_DIR_KEY
PRODUCT_NAME_KEY

ERR_LOG_PATH_CMD_ARG
Expand Down

0 comments on commit d91388d

Please sign in to comment.