Add broken progress bar
This commit is contained in:
parent
d500c8b9dd
commit
f96d420619
@ -23,7 +23,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.status = StatusBar(self.cwidget)
|
self.status = StatusBar(self.cwidget)
|
||||||
self.vbox.addWidget(self.status)
|
self.vbox.addWidget(self.status)
|
||||||
|
|
||||||
self.tabs.cur_progress.connect(self.status.lbl.set_progress)
|
self.tabs.cur_progress.connect(self.status.prog.set_progress)
|
||||||
|
|
||||||
#self.retranslateUi(MainWindow)
|
#self.retranslateUi(MainWindow)
|
||||||
#self.tabWidget.setCurrentIndex(0)
|
#self.tabWidget.setCurrentIndex(0)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from PyQt5.QtWidgets import QLineEdit, QHBoxLayout, QLabel, QWidget, QShortcut
|
from PyQt5.QtWidgets import QLineEdit, QHBoxLayout, QLabel, QWidget, QShortcut, QProgressBar, QSizePolicy
|
||||||
from PyQt5.QtCore import pyqtSignal, Qt
|
from PyQt5.QtCore import pyqtSignal, Qt
|
||||||
from PyQt5.QtGui import QValidator, QKeySequence
|
from PyQt5.QtGui import QValidator, QKeySequence
|
||||||
|
|
||||||
@ -18,6 +18,9 @@ class StatusBar(QWidget):
|
|||||||
self.lbl = StatusText(self)
|
self.lbl = StatusText(self)
|
||||||
self.hbox.addWidget(self.lbl)
|
self.hbox.addWidget(self.lbl)
|
||||||
|
|
||||||
|
self.prog = StatusProgress(self)
|
||||||
|
self.hbox.addWidget(self.prog)
|
||||||
|
|
||||||
def bg_color(self, fg, bg):
|
def bg_color(self, fg, bg):
|
||||||
self.setStyleSheet("""
|
self.setStyleSheet("""
|
||||||
* {
|
* {
|
||||||
@ -30,15 +33,35 @@ class StatusBar(QWidget):
|
|||||||
self.bg_color('white', 'red')
|
self.bg_color('white', 'red')
|
||||||
self.lbl.setText('Error: {}'.format(text))
|
self.lbl.setText('Error: {}'.format(text))
|
||||||
|
|
||||||
|
class StatusProgress(QProgressBar):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.setObjectName(self.__class__.__name__)
|
||||||
|
|
||||||
|
#self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
|
||||||
|
#self.setStyleSheet("padding-right: 1px")
|
||||||
|
self.hide()
|
||||||
|
|
||||||
|
# FIXME this size foo doesn't work right.
|
||||||
|
# Maybe here we should just reimplement the drawing part.
|
||||||
|
|
||||||
|
def minimumSizeHint(self):
|
||||||
|
status_size = parent.size()
|
||||||
|
return QSize(20, status_size.height())
|
||||||
|
|
||||||
|
def sizeHint(self):
|
||||||
|
return minimumSizeHint()
|
||||||
|
|
||||||
|
def set_progress(self, prog):
|
||||||
|
self.show()
|
||||||
|
self.setValue(prog)
|
||||||
|
|
||||||
class StatusText(QLabel):
|
class StatusText(QLabel):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.setObjectName(self.__class__.__name__)
|
self.setObjectName(self.__class__.__name__)
|
||||||
self.setStyleSheet("padding-right: 1px")
|
self.setStyleSheet("padding-right: 1px")
|
||||||
|
|
||||||
def set_progress(self, prog):
|
|
||||||
self.setText('{}%'.format(prog))
|
|
||||||
|
|
||||||
class StatusCommand(QLineEdit):
|
class StatusCommand(QLineEdit):
|
||||||
got_cmd = pyqtSignal(str)
|
got_cmd = pyqtSignal(str)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user