python - QT/PySide processEvents call locks up -



python - QT/PySide processEvents call locks up -

why phone call processevents block doing nil 9 seconds?

i have application pyside-based qt interface, ui code sits decoupled layer on lower level actual application logic. when user performs action executes lower level application logic may run while, happens is:

directly on gui thread progress dialog displayed. directly on gui thread, lower level logic starts worker thread. directly on gui thread, lower level logic loops updating progress dialog (indirectly/decoupled) , ticking application event queue via qtgui.qapp.processevents() (again indirectly/decoupled). on worker thread, qt functions invoked (again indirectly/decoupled) in reaction events, , these happen on gui thread via slots/signals, running when gui thread (as mentioned above) calls processevents(). directly on gui thread, before loop exits, lastly processevents() phone call blocks around 9 seconds. after logic on worker thread on , done with, , there no more functions waiting run on via signal/slot calls. nil related application happening in call. doing there? why blocking? i've tried passing in max processing time of 300 ms , seeing if exits, makes no difference. phone call locks long wants to. the progress dialog closes , user gets focus back.

this spread on lot of files, implemented in decoupled manner. i'll seek , provide snippets give image of flow.

the decoupled lower level logic worker loop:

while not completed_event.wait(0.1) , not work_state.is_cancelled(): work_completeness, work_description = work_state.get_completeness(), work_state.get_description() client in self.clients: if work_completeness != last_completeness or work_description != last_description: client.event_prolonged_action_update(client acting_client, work_description, step_count * work_completeness) # lastly phone call next line locks no reason client.event_tick(client acting_client) last_completeness, last_description = work_completeness, work_description

the pyside/qt layer client event_tick function:

def event_tick(self, active_client): # lock happens qtgui.qapp.processevents()

signal/slot usage in pyside/qt layer worker thread calls happening on gui thread:

def event_pre_line_change(self, active_client, line0, line_count): self.pre_line_change_signal.emit((line0, line_count)) def event_post_line_change(self, active_client, line0, line_count): self.post_line_change_signal.emit((line0, line_count)) def event_uncertain_reference_modification(self, active_client, data_type_from, data_type_to, address, length): self.uncertain_reference_modification_signal.emit((data_type_from, data_type_to, address, length))

the reason delegate calls on worker thread on gui thread using signals/slots, pyside/qt requires given update ui.

reproduction case if want dig deeper:

download , the code running according github project readme text. download test file "neuro" (<200kb in size) mega (apologies, easiest site upload to). load neuro in peasauce. go offset 0x1a19e (ctrl-g) change info type code (menu: edit / alter address datatype / code) observe progress dialog come , go. observe ~9 sec lock up.

python qt pyside

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -