Skip to content
Snippets Groups Projects
Commit 21a75cb1 authored by Andreas Bolin's avatar Andreas Bolin
Browse files

workspace dump

parent 44eeb1f9
No related branches found
No related tags found
1 merge request!78Add scheduler GUI
Pipeline #72704 passed
This commit is part of merge request !78. Comments created here will be created in the context of that merge request.
......@@ -2,6 +2,8 @@
"""B-ASIC Scheduler-gui Module.
Contains the scheduler-gui class for scheduling operations in an SFG.
Start main-window with start_gui().
"""
......@@ -16,11 +18,11 @@ import qtpy
from qtpy import uic, QtCore, QtGui, QtWidgets
from qtpy.QtCore import Qt, Slot, QSettings
from qtpy.QtGui import QCloseEvent
from qtpy.QtWidgets import QApplication, QMainWindow, QMessageBox
from qtpy.QtWidgets import QApplication, QMainWindow, QMessageBox, QAbstractButton
# QGraphics and QPainter imports
from qtpy.QtWidgets import (
QGraphicsView, QGraphicsScene,
QGraphicsView, QGraphicsScene, QGraphicsWidget,
QGraphicsLayout, QGraphicsLinearLayout, QGraphicsGridLayout, QGraphicsLayoutItem, QGraphicsAnchorLayout,
QGraphicsItem, QGraphicsItemGroup, QGraphicsItemAnimation
)
......@@ -173,20 +175,30 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.menu_node_info.setChecked(True)
################
#### Events ####
################
def _close_event(self, event: QCloseEvent) -> None:
"""Replace QMainWindow default closeEvent(QCloseEvent) event"""
ret = QMessageBox.question(self, self.tr("Application"),
self.tr("Do you want to exit?"))
box = QMessageBox(self)
box.setWindowTitle(self.tr('Confirm Exit'))
box.setText('<h3>' + self.tr('Confirm Exit') + '</h3><p><br>' +
self.tr('Are you sure you want to exit?') +
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></p>')
box.setIcon(QMessageBox.Question)
box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
box.setButtonText(QMessageBox.Yes, self.tr("&Exit"))
box.setButtonText(QMessageBox.No, self.tr("&Cancel"))
ret = box.exec_()
if ret == QMessageBox.StandardButton.Yes:
event.accept()
else:
event.ignore()
#################################
#### Helper member functions ####
#################################
......@@ -204,7 +216,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.statusbar.showMessage(msg)
def start_gui():
app = QApplication(sys.argv)
window = MainWindow()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment