[Gambas-user] WAIT ... is it an (un) necessary evil for my app?

M0E Lnx m0e.lnx at ...626...
Tue May 26 19:46:48 CEST 2009


So, the next version of my vinstall-ng app is really shaping up
nicely, but I'm running into a weird dilemma here.

This is a linux installer, so there is a lot of decompression going on
in the background as packages are being installed using via the gambas
EXEC method.

Here is the problem I'm having though. I have string arrays of package
names to install one at a time.
I have a sub that reads these arrays and processes each package at a time
I have a function that simply installs the package and checks to make
sure the process didn't return an error. Allow me to demonstrate

PUBLIC  INSTALL_FROM_ARRAY(sList as string[])
DIM sPkg as string
DIM i, iRet as Integer

FOR i = 0 to sList.Max
IF  INSTALL_THIS_PACKAGE(trim(sList[i])) > 0 then RETURN
pbprog.value = i / sList.count
NEXT

END

PUBLIC FUNCTION INSTALL_THIS_PACKAGE(sPkgPath as String) as Integer
dim $hproc as Process

$hproc = EXEC ["/sbin/installpkg","-q","-R", ClsGlobal.sTargetPath,
sPkgPath] WAIT
 IF $hproc.value > 0 then
    RETURN $hproc.Value
 ELSE
   RETURN 0
END IF

END

My problem is that the progressbar does not update as every package installs.
I need to add a wait of at least 0.25 before each package gets
installed to give the progressbar time to update.
The background processes do run without the wait instance, but the GUI
seems stuck. On the other hand, if I want the progressbar, I have to
sacrifice performance.

Can anyone think of a way around this?
Using gambas2.2.12 app uses gb.gtk
Any help is welcome.

Thanks




More information about the User mailing list