Fix: Initialize status bar widgets in MainWindow constructor
This commit is contained in:
@@ -111,9 +111,26 @@ class MainWindow(QMainWindow):
|
||||
|
||||
self.layout.addLayout(center_layout, 1)
|
||||
|
||||
# Status Bar
|
||||
self.status_bar = QStatusBar()
|
||||
self.setStatusBar(self.status_bar)
|
||||
|
||||
self.progress_bar = QProgressBar()
|
||||
self.progress_bar.setFixedWidth(200)
|
||||
self.progress_bar.setVisible(False)
|
||||
self.status_bar.addPermanentWidget(self.progress_bar)
|
||||
|
||||
self.status_label = QLabel("Ready")
|
||||
self.status_bar.addWidget(self.status_label)
|
||||
|
||||
# Menus
|
||||
self.create_menus()
|
||||
|
||||
def update_progress(self, current, total):
|
||||
self.progress_bar.setMaximum(total)
|
||||
self.progress_bar.setValue(current)
|
||||
QApplication.processEvents() # Force UI update
|
||||
|
||||
def create_menus(self):
|
||||
menu_bar = self.menuBar()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user