LINUX.ORG.RU

История изменений

Исправление fang90, (текущая версия) :

Суть проблемы - интерфейс подвисает,

QThread

try:
import thread
except ImportError:
import _thread as thread

А что это, что за хрень?!

В общем, просто делаешь так

waitthread = ParseComThread()
waitthread.parent = self
waitthread.notifyProgress.connect(self.update_data)
waitthread.start()
Бахаешь тред
class ParseComThread(QtCore.QThread):
    notifyProgress = QtCore.pyqtSignal(str)
    def run(self):
      some_magic_with_comPort()
      self.notifyProgress.emit('magic found')
и все. ЗЫ: тред иногда надо добавить в какой-нибудь list, а то может схлопнуться в самый неподходящий момент

Исправление fang90, :

Суть проблемы - интерфейс подвисает,

QThread

try:
import thread
except ImportError:
import _thread as thread

А что это, что за хрень?!

В общем, просто делаешь так

waitthread = ParseComThread()
waitthread.parent = self
waitthread.notifyProgress.connect(self.update_data)
waitthread.start()
Бахаешь тред
class ParseComThread(QtCore.QThread):
    notifyProgress = QtCore.pyqtSignal(dict)
    def run(self):
      some_magic_with_comPort()
      self.notifyProgress.emit('magic found')
и все. ЗЫ: тред иногда надо добавить в какой-нибудь list, а то может схлопнуться в самый неподходящий момент

Исправление fang90, :

Суть проблемы - интерфейс подвисает,

QThread

try:
import thread
except ImportError:
import _thread as thread

А что это, что за хрень?!

В общем, просто делаешь так

waitthread = ParseComThread()
waitthread.parent = self
waitthread.notifyProgress.connect(self.update_data)
waitthread.start()
Бахаешь тред
class ParseAnswersThread(QtCore.QThread):
    notifyProgress = QtCore.pyqtSignal(dict)
    def run(self):
      some_magic_with_comPort()
      self.notifyProgress.emit('magic found')
и все. ЗЫ: тред иногда надо добавить в какой-нибудь list, а то может схлопнуться в самый неподходящий момент

Исходная версия fang90, :

Суть проблемы - интерфейс подвисает,

QThread

try:
import thread
except ImportError:
import _thread as thread

А что это, что за хрень?!

В общем, просто делаешь так

waitthread = ParseComThread()
waitthread.parent = self
waitthread.notifyProgress.connect(self.update_data)
Бахаешь тред
class ParseAnswersThread(QtCore.QThread):
    notifyProgress = QtCore.pyqtSignal(dict)
    def run(self):
      some_magic_with_comPort()
      self.notifyProgress.emit('magic found')
и все