[bugfix] progressText not updating in progressBar

This commit is contained in:
Marcel Paffrath 2018-07-18 11:13:29 +02:00
parent 37da7327d0
commit ed7ee5d944
3 changed files with 21 additions and 18 deletions

View File

@ -80,7 +80,7 @@ from pylot.core.io.location import create_creation_info, create_event
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \ from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
PylotCanvas, WaveformWidgetPG, PropertiesDlg, HelpForm, createAction, PickDlg, \ PylotCanvas, WaveformWidgetPG, PropertiesDlg, HelpForm, createAction, PickDlg, \
getDataType, ComparisonWidget, TuneAutopicker, PylotParaBox, AutoPickDlg, CanvasWidget, AutoPickWidget, \ getDataType, ComparisonWidget, TuneAutopicker, PylotParaBox, AutoPickDlg, CanvasWidget, AutoPickWidget, \
CompareEventsWidget CompareEventsWidget, ProgressBarWidget
from pylot.core.util.array_map import Array_map from pylot.core.util.array_map import Array_map
from pylot.core.util.structure import DATASTRUCTURE from pylot.core.util.structure import DATASTRUCTURE
from pylot.core.util.thread import Thread, Worker from pylot.core.util.thread import Thread, Worker
@ -609,7 +609,8 @@ class MainWindow(QMainWindow):
self.tabs.currentChanged.connect(self.refreshTabs) self.tabs.currentChanged.connect(self.refreshTabs)
# add progressbar # add progressbar
self.mainProgressBarWidget = QtGui.QWidget() self.mainProgressBarWidget = ProgressBarWidget(self)
self.mainProgressBarWidget.hide()
self._main_layout.addWidget(self.mainProgressBarWidget) self._main_layout.addWidget(self.mainProgressBarWidget)
# add scroll area used in case number of traces gets too high # add scroll area used in case number of traces gets too high

View File

@ -41,23 +41,13 @@ class Thread(QThread):
def showProgressbar(self): def showProgressbar(self):
if self.progressText: if self.progressText:
# generate widget if not given in init # # generate widget if not given in init
if not self.pb_widget: # if not self.pb_widget:
self.pb_widget = QDialog(self.parent()) # self.pb_widget = ProgressBarWidget(self.parent())
self.pb_widget.setWindowFlags(Qt.SplashScreen) # self.pb_widget.setWindowFlags(Qt.SplashScreen)
self.pb_widget.setModal(True) # self.pb_widget.setModal(True)
# add button self.pb_widget.label.setText(self.progressText)
delete_button = QPushButton('X')
delete_button.clicked.connect(self.exit)
hl = QHBoxLayout()
pb = QProgressBar()
pb.setRange(0, 0)
hl.addWidget(pb)
hl.addWidget(QLabel(self.progressText))
if self.abortButton:
hl.addWidget(delete_button)
self.pb_widget.setLayout(hl)
self.pb_widget.show() self.pb_widget.show()
def hideProgressbar(self): def hideProgressbar(self):

View File

@ -119,6 +119,18 @@ def createAction(parent, text, slot=None, shortcut=None, icon=None,
return action return action
class ProgressBarWidget(QtGui.QWidget):
def __init__(self, parent=None):
super(ProgressBarWidget, self).__init__(parent)
self.hlayout = QtGui.QHBoxLayout()
self.pb = QtGui.QProgressBar()
self.pb.setRange(0, 0)
self.label = QLabel()
self.hlayout.addWidget(self.pb)
self.hlayout.addWidget(self.label)
self.setLayout(self.hlayout)
class ComparisonWidget(QWidget): class ComparisonWidget(QWidget):
def __init__(self, c, parent=None, windowflag=1): def __init__(self, c, parent=None, windowflag=1):
self._data = c self._data = c