multithreading - Threading: Dynamic GUI Refresh and Speed issue with PyQt4 -


the playthread emits signals movephead() move play head. updated smoothly until dynamicthread needed, needs lot of processing while playback proceeds, such move , create objects in gui.

two things happen when dynamicthread created:

  1. playback slows down intermittently, while processing

  2. after dynamicthread finished processing, screen ceases update automatically, updating when scrolled off on.

i have tried following @ various points in each process no results:

  • app.processevents(), update(), , repaint()

  • removing calls data structures in main window making them global in dynamicthread's run() function

i new threading, maybe there simple structural problem.

please let me know missing.

i using open source sequencer template: https://github.com/rhetr/seq-gui

def movephead(x):     playhead.setpos(qtcore.qpointf(x, 0))     y = main.view.verticalscrollbar().sliderposition() + 125      main.view.centeron(x, y)  class dynamicthread(qtcore.qthread):     def __init__(self, v1, v2, v3, v4, v5):         super(dynamitethread , self).__init__()         self.signal = qtcore.signal("signal")         self.v1, self.v2, self.v3, self.v4, self.v5 = v1, v2, v3, v4, v5         self.start()      def stop(self):         self.terminate()      def run(self):         self.process(self.v1, self.v2, self.v3, self.v4, self.v5)         self.stop()  class playthread(qtcore.qthread):     def __init__(self):         super(playthread , self).__init__()         self.signal = qtcore.signal("signal")      def stop(self):         self.terminate()      def run(self):         global xloctonoteitems         global xloctorhythms         global currentllindex          xloc in xrange(currentllindex + 1, len(orderedxlocations)):             currentllindex = xloc             noteitem in xloctonoteitems[orderedxlocations[xloc]]:                 player.note_on(noteitem.note[0], noteitem.note[3], 1)              self.emit(self.signal, orderedxlocations[xloc] - 31.5)              offtime = xloctorhythms[orderedxlocations[xloc]]             time.sleep(offtime / 2.0)              noteitem in xloctonoteitems[orderedxlocations[xloc]]:                 player.note_off(noteitem.note[0], noteitem.note[3], 1) 


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -