Kodi Community Forum

Full Version: Multiple DialogProgress
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I have a problem with DialogProgress. In fact I m trying to make a Progressbar but there is another part in the code that try to make another one too. And

Code:
dialog = cConfig().createDialog('diag 1')
dialog2 = cConfig().createDialog('diag 2')
dialog2.close()

Close all dialogs.So I m trying to detect if there is another progressbar active, and I can't have the same pointer

dialog1 = cConfig().createDialog('diag1')
xbmcgui.Dialog ( xbmcgui.getCurrentWindowId() ) isn't the same values than dialog1, what is the correct command to have it ?
there is only a single instance of the dialog, so the id will always be the same. if you want something with two proggy bars you have to cook your own. if you want to check if it is already active, you can use xbmcgui.getCurrentWindowDialogId()
In fact I don't want 2 progress bar, but I want the second one (who don't realy exist) can return the iscanceled() from the first.
xbmcgui.getCurrentWindowId() return the same Id than xbmcgui.getCurrentWindowDialogId().

I m trying something like that

Code:
def createDialogProgress(self, name):
        if xbmcgui.getCurrentWindowDialogId() == 10101:
            #get the handle of the actual progress bar
            oDialog = gethandle() <<<<< here IDK wich one function to use
            return oDialog
        
        oDialog = xbmcgui.DialogProgress()
        oDialog.create(name)
        return oDialog

I have tried print xbmcgui.DialogProgress ( xbmcgui.getCurrentWindowDialogId() ) but impossible to have the first progressDialog handle.

And I can't memorise it, not the same file, not the same addon part.
(2015-10-27, 20:49)TmpName Wrote: [ -> ]...
And I can't memorise it, not the same file, not the same addon part.

Why can't you memorise it? If its still the same addon, you can access variables from different files in python.

For example:
Code:
#vars.py
currentdialog = 'something'

#addon.py
import vars

print(vars.currentdialog) #output: something

#someotherfileinyouraddon.py
import vars

print(vars.currentdialog) #output: something

So you can make a global variable that holds the information about the current window dialog and that way check if there is 1 active. If i'm not mistaken you can also store the handle in that global variable, so you can manipulate and grab userinput later on.

I would agree that it would be better / nice if there is a way to grab the handle of the one currently running. But i'm not sure how to accomplish that..
Ha nice, I don't know a lot python, IDK it was possible.
IDK how much the different files are interleaved one in the other, but I will make a try with that.

Edit: ok, I don't think it's the perfect method, but it works, thx.
You're welcome Smile! Yeah, like I said, I think there should be a better way. But hey, working is better then not working Wink