Well it doesnt work yet, but its gonna!
i've tested it with a little app. There is my main app (called it
server) wich contains a thread. This thread listens to a mm (memory
mapping) when an other program sets a flag
(finished_producing_event.set() ) it just calls self.iconize(false)
I'm not sure what pieces of code i have to post here.. posting all of
it makes it too large i believe
From server:
ID_MESSAGECH = wxNewId()
def EVT_RESULT(win, func):
win.Connect(-1, -1, ID_MESSAGECH, func)
class ResultEvent(wxPyEvent):
def __init__(self):
wxPyEvent.__init__(self)
self.SetEventType(ID_MESSAGECH)
class listener(Thread):
def __init__(self, frame):
Thread.__init__(self)
self.frame = frame
self.setDaemon(1)
self.stopped = False
#shared_memory = mmap.mmap (0, common.SHARED_MEMORY_SIZE,
common.SHARED_MEMORY_NAME)
#ready_to_consume_event = events.Win32Event
(common.READY_TO_CONSUME)
#finished_producing_event = events.Win32Event
(common.FINISHED_PRODUCING)
def run(self):
while not self.stopped:
try:
finished_producing_event.wait()
wxPostEvent(self.frame,ResultEvent(None))
except Exception,e:
print "Error: " , e
def stop(self):
self.stopped = True
within the frame:
[code:1:080343f1b1]
listen = listener(self)
listen.start()
EVT_RESULT(self, self.OnChange)
def OnChange(self, event):
shared_memory.seek(0)
tekstding = shared_memory.readline()
if(tekstding.strip() ==
"maximize"):
self.Iconize(False)
self.Show(False)
elif(tekstding.strip() ==
"minimize"):
self.Iconize(True)
self.Show(True)
self.panel.tekst.SetValue(tekstding)
[/code:1:080343f1b1]
Hope you can see now how it works! Greetz