Plugins and DialogProgress
#1
Hello guys!

Kinda new to Python and addons development, so please bear with me!

I'm on windows, using the latest nightly build of XBMC.

I'm trying to launch a plugin from a .strm file (like the IceLibrary addon does, for example). The code works fine as long as I don't use any progress dialog; as soon as I create a DialogProgress, the GUI freezes completely.

I do realize a progress dialog is automatically popped up when launching the strm file, but as far as I know it cannot be updated or customized in any way from within python, correct ?

Any help would be appreciated Smile
Reply
#2
To better illustrate the issue I'm referring to, I have uploaded a simple script:
http://www.mediafire.com/download.php?t7a1jt682q1gd4c

Install it in XBMC, then play the included Test.strm file (either by adding it to the library or from the files view, both have the same problem). XBMC gui will hang indefinitely. The logic keeps going (as can be seen by opening the log file); commenting the line that creates the progress dialog in default.py will 'fix' the freezing.
Reply
#3
Zelgadis87 Wrote:To better illustrate the issue I'm referring to, I have uploaded a simple script:
http://www.mediafire.com/download.php?t7a1jt682q1gd4c

Install it in XBMC, then play the included Test.strm file (either by adding it to the library or from the files view, both have the same problem). XBMC gui will hang indefinitely. The logic keeps going (as can be seen by opening the log file); commenting the line that creates the progress dialog in default.py will 'fix' the freezing.

There are other methods to the DialogProgress class, besides create.

Code:
    Methods defined here:

close(...)
    close() -- Close the progress dialog.
    
    example:
      - pDialog.close()

create(...)
    create(heading[, line1, line2, line3]) -- Create and show a progress dialog.
    
    heading        : string or unicode - dialog heading.
    line1          : string or unicode - line #1 text.
    line2          : [opt] string or unicode - line #2 text.
    line3          : [opt] string or unicode - line #3 text.
    
    *Note, Use update() to update lines and progressbar.
    
    example:
      - pDialog = xbmcgui.DialogProgress()
      - ret = pDialog.create('XBMC', 'Initializing script...')

iscanceled(...)
    iscanceled() -- Returns True if the user pressed cancel.
    
    example:
      - if (pDialog.iscanceled()): return

update(...)
    update(percent[, line1, line2, line3]) -- Update's the progress dialog.
    
    percent        : integer - percent complete. (0:100)
    line1          : [opt] string or unicode - line #1 text.
    line2          : [opt] string or unicode - line #2 text.
    line3          : [opt] string or unicode - line #3 text.
    
    *Note, If percent == 0, the progressbar will be hidden.
    
    example:
      - pDialog.update(25, 'Importing modules...')

So changing your script to this:
Code:
import xbmc, xbmcgui

progress = xbmcgui.DialogProgress()
progress.create('Progress', 'This is a progress bar.')

i = 0
while i < 11:
    percent = int( ( i / 10.0 ) * 100)
    message = "Message " + str(i) + " out of 10"
    progress.update( percent, "", message, "" )
    print "Message " + str(i) + " out of 10"
    xbmc.sleep( 1000 )
    if progress.iscanceled():
        break
    i = i + 1

progress.close()

Uses all the methods.
Reply
#4
Yes but my problem is the progress bar is never actually displayed on screen: the interface freezes completely on the create line. Only solution in that case is to close XBMC from the task manager.. :/
Reply
#5
Zelgadis87 Wrote:Yes but my problem is the progress bar is never actually displayed on screen: the interface freezes completely on the create line. Only solution in that case is to close XBMC from the task manager.. :/

I guess you found a bug.. I put the code I had posted in my testing script and it worked flawlessly. But I guess calling it from the strm file causes problems.

You will need to post a ticket on trac.
Reply
#6
giftie Wrote:I guess you found a bug.. I put the code I had posted in my testing script and it worked flawlessly. But I guess calling it from the strm file causes problems.

You will need to post a ticket on trac.

I have created a ticket on trac (http://trac.xbmc.org/ticket/12274), thanks for confirming the issue.
Reply

Logout Mark Read Team Forum Stats Members Help
Plugins and DialogProgress0