All events lost when show() instead of doModal() is using
#16
(2016-12-19, 13:28)Taifxx Wrote: I'm sorry. Forgot define Thrd:

Code:
class Thrd(threading.Thread):
    def __init__(self, t, *args):
        threading.Thread.__init__(self, target=t, args=args)
        self._stop = threading.Event()
        self.start()

Edited code in post

Ok. I will try it tonight. Thank you.
Reply
#17
This worked perfectly
=====================

            <control type="progress" id="20">
                <description>Progress Bar</description>
                <posx>60</posx>
                <posy>315</posy>
                <width>815</width>
                <height>30</height>
                <reveal>true</reveal>
                <texturebg>osd/osd_progress_back.png</texturebg>
                <lefttexture>osd/osd_progress_left.png</lefttexture>
                <midtexture>osd/osd_progress_mid.png</midtexture>
                <righttexture>osd/osd_progress_right.png</righttexture>
                <colordiffuse>DialogProgressBar</colordiffuse>
                <info>-</info>
            </control>
            <control type="grouplist" id="9000">
                <orientation>horizontal</orientation>
                <posx>50</posx>
                <posy>350</posy>
                <width>830</width>
                <align>center</align>
                <control type="button" id="10">
                    <description>Cancel</description>
                    <left>0</left>
                    <top>0</top>
                    <height>52</height>
                    <width>270</width>
                    <align>center</align>
                    <aligny>center</aligny>
                    <font>mono30</font>
                    <textcolor>eeFFFFFF</textcolor>
                    <disabledcolor>FFff5858</disabledcolor>
                    <focusedcolor>eef8cd22</focusedcolor>
                    <selectedcolor>eef8cd22</selectedcolor>
                    <texturefocus>buttonfo.png</texturefocus>
                    <pulseonselect>false</pulseonselect>
                    <onleft>12</onleft>
                    <onright>11</onright>
                    <onup>12</onup>
                    <ondown>11</ondown>
                    <onclick>-</onclick>
                </control>
                <control type="button" id="11">
                    <description>Ok</description>
                    <left>0</left>
                    <top>0</top>
                    <height>52</height>
                    <width>270</width>
                    <align>center</align>
                    <aligny>center</aligny>
                    <font>mono30</font>
                    <textcolor>eeFFFFFF</textcolor>
                    <disabledcolor>FFff5858</disabledcolor>
                    <focusedcolor>eef8cd22</focusedcolor>
                    <selectedcolor>eef8cd22</selectedcolor>
                    <texturefocus>buttonfo.png</texturefocus>
                    <pulseonselect>false</pulseonselect>
                    <onleft>10</onleft>
                    <onright>12</onright>
                    <onup>10</onup>
                    <ondown>12</ondown>
                    <onclick>-</onclick>
                </control>
                <control type="button" id="12">
                    <description>custom</description>
                    <left>0</left>
                    <top>0</top>
                    <height>52</height>
                    <width>270</width>
                    <align>center</align>
                    <aligny>center</aligny>
                    <font>mono30</font>
                    <textcolor>eeFFFFFF</textcolor>
                    <disabledcolor>FFff5858</disabledcolor>
                    <focusedcolor>eef8cd22</focusedcolor>
                    <selectedcolor>eef8cd22</selectedcolor>
                    <texturefocus>buttonfo.png</texturefocus>
                    <pulseonselect>false</pulseonselect>
                    <onleft>11</onleft>
                    <onright>10</onright>
                    <onup>11</onup>
                    <ondown>10</ondown>
                    <onclick>-</onclick>
                </control>
            </control>

========================

text = 'Text message'
button0,button1,button2 = 'b0','b1','b2'
total_time = 8
class MyConfirmDialog(xbmcgui.WindowXMLDialog):
    def __init__(self,*args,**kwargs): self.controlId = -1
    def onClick(self,controlId):
        self.controlId = controlId
        self.close()
dialog = MyConfirmDialog('DialogConfirmThreeButtons.xml',addonfolder,'Default','720p')
dialog.show()
dialog.getControl(9).setText(text)
dialog.getControl(10).setLabel(button0)
dialog.getControl(11).setLabel(button1)
dialog.getControl(12).setLabel(button2)
dialog.getControl(20).setVisible(True)
def updateProgressBar():
    for i in range(1,total_time+1):
        time.sleep(1)
        header= time.strftime("%M:%S",time.gmtime(total_time-i))
        dialog.getControl(1).setLabel(header)
        percent = int(100*i/total_time)
        dialog.getControl(20).setPercent(percent)
        if dialog.controlId>=0: break
    else: dialog.close()
    return
import thread
thread.start_new_thread(updateProgressBar,())
dialog.doModal()
if dialog.controlId>=10: choice = dialog.controlId-10
else: choice = -1
del dialog
xbmcgui.Dialog().ok(str(choice),'')
Reply

Logout Mark Read Team Forum Stats Members Help
All events lost when show() instead of doModal() is using0