Skip to content

Commit

Permalink
Wrapped up major developments on QtIfwOnFinishedCheckbox for now. Add…
Browse files Browse the repository at this point in the history
…ed TODOs for known issues / holes left in that class. (Will circle back to address those later.) Added example "Hello Dynamic Finish" (split from the Packages example, which simplified back towards what it was originally).
  • Loading branch information
BuvinJ committed Nov 17, 2020
1 parent c6a5d33 commit c688a4b
Show file tree
Hide file tree
Showing 9 changed files with 284 additions and 173 deletions.
2 changes: 1 addition & 1 deletion distbuilder/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.8.17"
__version__ = "0.7.8.18"
34 changes: 21 additions & 13 deletions distbuilder/qt_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,7 @@ def _genLib( self ):
TAB + 'return installer.executeDetached( binPath, args )' + END +
EBLK + NEW +
'function executeShellCmdDetached( cmd ) ' + SBLK +
TAB + 'cmd = "\\"" + cmd + "\\""' + END +
#TAB + 'cmd = "\\"" + cmd + "\\""' + END +
TAB + _QtIfwScript.log( '"Executing Command Detached: " + cmd', isAutoQuote=False ) +
TAB + 'return installer.executeDetached( ' +
('"cmd.exe", ["/c", cmd]' if IS_WINDOWS else
Expand Down Expand Up @@ -2927,6 +2927,7 @@ def __genPageChangeCallbackBody( self ):
QtIfwControlScript._purgeTempFiles() +
EBLK )

# TODO: Test this
if self.widgets:
for w in self.widgets:
onEnter = w._onEnterSnippet()
Expand Down Expand Up @@ -5638,13 +5639,14 @@ class QtIfwWidget( _QtIfwInterface ):
# QtIfwWidget
def __init__( self, name, pageName, position=None,
sourcePath=None, content=None,
onLoad=None, onEnter=None ) :
onLoad=None, onEnter=None ) :
# TODO: Test onEnter
_QtIfwInterface.__init__( self,
name, sourcePath, content, onLoad, onEnter )
self.pageName =( pageName if pageName in _DEFAULT_PAGES
else None )
self.position = position

def _onLoadSnippet( self ):
snippet = _QtIfwScript.TAB + _QtIfwScript.log(
"%s Widget Loaded" % (self.name,) )
Expand Down Expand Up @@ -5692,8 +5694,7 @@ class QtIfwOnFinishedCheckbox( QtIfwWidget ):
__EXEC_DETACHED_TMPLT=(
'executeDetached( resolveQtIfwPath( "%s" ), %s );\n' )
__EXEC_CMD_DETACHED_TMPLT=(
'executeShellCmdDetached( Dir.toNativeSeparator( '
' resolveDynamicVars( "%s" ) ) );\n' )
'executeShellCmdDetached( resolveDynamicVars( "%s" ) );\n' )
__EXEC_BAT_DETACHED_TMPLT=(
'executeBatchDetached( resolveNativePath( "%s" ), null, %s );\n' )
__EXEC_VBS_DETACHED_TMPLT=(
Expand All @@ -5709,16 +5710,17 @@ class QtIfwOnFinishedCheckbox( QtIfwWidget ):

__REBOOT_TEXT = "REBOOT NOW."

# TODO: Test in NIX/MAC - sudo?
__REBOOT_CMD = "shutdown /r -t 2" if IS_WINDOWS else "reboot"
# TODO: Test in NIX/MAC - handle elevation ?
__REBOOT_CMD =( "shutdown /r -t %d" if IS_WINDOWS else
"sleep %d; sudo reboot" )

# QtIfwOnFinishedCheckbox
def __init__( self, name, text=None, position=None,
ifwPackage=None,
runProgram=None, argList=None,
shellCmd=None, script=None,
openViaOsPath=None,
isReboot=False,
isReboot=False, rebootDelaySecs=2,
isVisible=True, isEnabled=True, isChecked=True ) :
QtIfwWidget.__init__( self, name, QtIfwOnFinishedCheckbox.__PAGE_ID,
position=( position if position else
Expand All @@ -5738,18 +5740,21 @@ def __init__( self, name, text=None, position=None,

if isReboot:
self.text = QtIfwOnFinishedCheckbox.__REBOOT_TEXT
self._action =( QtIfwOnFinishedCheckbox.__EXEC_CMD_DETACHED_TMPLT
% (QtIfwOnFinishedCheckbox.__REBOOT_CMD,) )
cmd = QtIfwOnFinishedCheckbox.__REBOOT_CMD % (rebootDelaySecs,)
self._action =(
QtIfwOnFinishedCheckbox.__EXEC_CMD_DETACHED_TMPLT % (cmd,) )
elif isinstance( ifwPackage, QtIfwPackage ):
self.__setFromPackage( ifwPackage, argList )
elif isinstance( script, ExecutableScript ):
self.__setFromScript( script, argList )
elif openViaOsPath:
self._action = QtIfwControlScript.openViaOs( openViaOsPath )
elif shellCmd:
# Escape quotes and flip backslashes for the QScript generation.
# On Windows, the slashes will flipped back at runtime.
shellCmd = shellCmd.replace('\\','/').replace('"','\\"')
# TODO: Figure out how to use quotes in the commands here!
# It seems they never work - around paths in the command
# or around entire commands.
# Escape quotes & backslashes for the QScript literal.
shellCmd = shellCmd.replace('\\','\\\\').replace('"','\\"')
self._action =( QtIfwOnFinishedCheckbox.__EXEC_CMD_DETACHED_TMPLT
% (shellCmd,) )
else :
Expand All @@ -5769,6 +5774,7 @@ def __init__( self, name, text=None, position=None,
})

# TODO: Bind this logic with that in QtIfwConfigXml
# TODO: Test implementation of QtIfwExeWrapper
def __setFromPackage( self, ifwPackage, argList ) :
self.text =( QtIfwOnFinishedCheckbox.__RUN_PROG_DESCR_TMPLT
% (ifwPackage.pkgXml.DisplayName,) )
Expand All @@ -5788,6 +5794,8 @@ def __setFromPackage( self, ifwPackage, argList ) :
else: self.runProgram = programPath
self.__setSimpleExecDetachedAction()

# TODO: Finish testing and filling in the use of arguments in each script
# type context
def __setFromScript( self, script, argList ):
self.script = script
self.runProgram = joinPathQtIfw( _ENV_TEMP_DIR, script.fileName() )
Expand Down
2 changes: 1 addition & 1 deletion docs/ConfigClasses.md
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ Constructor:
runProgram=None, argList=None,
shellCmd=None, script=None,
openViaOsPath=None,
isReboot=False,
isReboot=False, rebootDelaySecs=2,
isVisible=True, isEnabled=True, isChecked=True )

Attributes & default values:
Expand Down
28 changes: 28 additions & 0 deletions docs/Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ produced by, [QtIfwConfigXml](ConfigClasses.md#qtifwpackage) and
[QtIfwPackageXml](ConfigClasses.md#qtifwpackage) objects to give you further
insight into the design patterns and functionality of the library.

## Hello Dynamic Finish Example

TODO: FILL IN!

## Hello Installer UI Example

A QtIwf installer is extremely customizable. In addition to simply copying
Expand Down Expand Up @@ -309,6 +313,30 @@ are running in an "elevated" context, etc.
If desired, you may also wish to test running these demo programs post installation in
"debug mode". See the documentation on the [run](LowLevel.md#run) function.

## Hello Operations Examples

TODO: FILL IN!

### Embedded Script Operations Example

TODO: FILL IN!

### Embedded Convenience Operations Example

TODO: FILL IN!

## Hello Startup Example

TODO: FILL IN!

## Hello Opy Example

TODO: FILL IN!

## Hello Opy Bundle Example

TODO: FILL IN!

## Hello World Qt Example

The [Hello World Qt Example](QtCpp.md#hello-world-qt-example) demos the
Expand Down
4 changes: 3 additions & 1 deletion docs/ToDo.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Dependency installation for QtIFW via Linux package managers (partially developed already), and Homebrew on Mac

* Add she bang respect / a Windows equivalent to ExecutableScript / QtIwfExternalOp
embedded scripting mechanism, allowing interepter paths / options to be defined. Thus
embedded scripting mechanism, allowing interpreter paths / options to be defined. Thus
allowing options for embedding Python, Java, ect.

* Code signing for Mac / Linux
Expand Down Expand Up @@ -53,6 +53,8 @@ during uninstallation, so it seems an uninstaller couldn't support such ui custo
## v.0.8.1

* Revisit "QtIfwExeWrapper" details. Specifically: NON gui on Windows? Used with QtIfwOnFinishedCheckbox?

* Revisit QtIfwOnFinishedCheckbox. It has several TODOs documented in the code.

* Add option for appending platform suffix onto installer file names.

Expand Down

0 comments on commit c688a4b

Please sign in to comment.