View Single Post
Old 04-19-2011, 01:25 PM   #19
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,480
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by meme View Post
Got the most recent source, but it didn't work as self.gui. I noticed in the code that device_signals was a global so I used:

from calibre.gui2.device import device_signals

device_signals.device_metadata_available.connect(s elf.testconnect1)
device_signals.device_connection_changed.connect(s elf.testconnect)


And this works. Is this what you intended?
Yes.

FYI: the problem before is that signals cannot be declared in mixin classes. Well, they can be declared, but emitting one of them corrupts memory and the application falls over dead. Moving them to a global fixes it. Kovid mentioned that I also could have put them into the outer-level gui class, which would be the only solution if we had multiple gui instances.
chaley is offline   Reply With Quote