Hi,

I would like to modify the following progress dialog which is running ok.
It is called :

dlg = Progreso(self)

dlg.show()


And it call a process (lectora.leerTjtas()) that communicates with a device through a serial interface and retrieves some data. It sends to this process a callback method (informarProgreso()) that will update the dialog.
Two things I would like to change:
i) I would like that the dialog shows itself upon creation (now I have to call dlg.show()). I tried with self.show() in the afterInitAll() but raises an error. ii) I would like to get the call to lectora.leerTjtas() outside of the dialog class.
i.e. I would like to call it like this:
dlg = Progreso(self)
dlg.Gauge.Range = 1000

self.lectora.leerTjtas(dlg.informarProgreso)

Or something similar. Is any of this possible?
Thanks

--------------------------------------------------------------------------------------------------

class Progreso(dabo.ui.dDialog):

def initProperties(self):

self.BorderResizable = False

self.AutoSize = True

self.ReleaseOnEscape = False

self.Center = True

self.Caption = 'Leyendo Tarjetas'



def addControls(self):

self.Sizer = vs = dabo.ui.dSizer('v')

lbl = dabo.ui.dLabel(self,

Caption='Progreso',

FontSize=11,

FontBold=True)

self.Cnt = cnt = dabo.ui.dLabel(self,

Caption='',

FontSize=11,

FontBold=False)

self.Gauge = gge = dabo.ui.dGauge(self, Width=500)

vs.append(lbl, border=5)

vs.append(gge, border=10)

vs.append(cnt, border=5, halign='center')


def afterInitAll(self):

# self.show()

self.Gauge.Range = 1000

self.Parent.lectora.leerTjtas(self.informarProgreso)

self.Close()


def informarProgreso(self, encontradas, leidas):

self.Gauge.Value = leidas

self.Cnt.Caption = 'Encontradas {} tarjetas de {}'.format(encontradas,

leidas)

self.refresh()

dabo.ui.yieldUI()

--------------------------------------------------------------------------------------------------





--- StripMime Report -- processed MIME parts ---
multipart/alternative
 text/plain (text body -- kept)
 text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to