Replace some old signals

This commit is contained in:
Hugo Posnic 2017-11-18 15:45:04 +01:00
parent 420c945f94
commit 063d2b8adb
2 changed files with 9 additions and 5 deletions

View file

@ -66,11 +66,10 @@ class StartQT5(QMainWindow):
self.ui.addfiles.clicked.connect(self.file_dialog) self.ui.addfiles.clicked.connect(self.file_dialog)
self.ui.recompress.clicked.connect(self.recompress_files) self.ui.recompress.clicked.connect(self.recompress_files)
self.quit_shortcut.activated.connect(self.close) self.quit_shortcut.activated.connect(self.close)
# QObject.connect(self.ui.processedfiles, SIGNAL("fileDropEvent"), self.ui.processedfiles.drop_event_signal.connect(self.file_drop)
# self.file_drop)
# QObject.connect(self.thread, SIGNAL("finished()"), self.update_table) # QObject.connect(self.thread, SIGNAL("finished()"), self.update_table)
# QObject.connect(self.thread, SIGNAL("terminated()"), self.update_table) # QObject.connect(self.thread, SIGNAL("terminated()"), self.update_table)
# QObject.connect(self.thread, SIGNAL("updateUi"), self.update_table) self.thread.update_ui_signal.connect(self.update_table)
self.compressing_icon = QIcon(QPixmap(self.ui.get_image("pixmaps/compressing.gif"))) self.compressing_icon = QIcon(QPixmap(self.ui.get_image("pixmaps/compressing.gif")))
@ -460,6 +459,8 @@ class Image:
class Worker(QThread): class Worker(QThread):
update_ui_signal = pyqtSignal()
def __init__(self, parent=None): def __init__(self, parent=None):
QThread.__init__(self, parent) QThread.__init__(self, parent)
self.toDisplay = Queue() self.toDisplay = Queue()
@ -487,7 +488,7 @@ class Worker(QThread):
tp._ThreadPool__jobs.empty()): tp._ThreadPool__jobs.empty()):
image = self.toDisplay.get() image = self.toDisplay.get()
##self.emit(SIGNAL("updateUi")) self.update_ui_signal.emit()
if not self.showapp and self.verbose: # we work via the commandline if not self.showapp and self.verbose: # we work via the commandline
if image.retcode == 0: if image.retcode == 0:

View file

@ -4,6 +4,9 @@ from PyQt5.QtWidgets import *
from os import path from os import path
class TrimageTableView(QTableView): class TrimageTableView(QTableView):
drop_event_signal = pyqtSignal(list)
"""Init the table drop event.""" """Init the table drop event."""
def __init__(self, parent=None): def __init__(self, parent=None):
super(TrimageTableView, self).__init__(parent) super(TrimageTableView, self).__init__(parent)
@ -24,7 +27,7 @@ class TrimageTableView(QTableView):
for url in event.mimeData().urls(): for url in event.mimeData().urls():
filelist.append(url.toLocalFile()) filelist.append(url.toLocalFile())
self.emit(SIGNAL("fileDropEvent"), (filelist)) self.drop_event_signal.emit(filelist)
class Ui_trimage(object): class Ui_trimage(object):