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

dump branch

parent 8c9bfcab
No related branches found
No related tags found
1 merge request!78Add scheduler GUI
Pipeline #72565 passed
This commit is part of merge request !78. Comments created here will be created in the context of that merge request.
......@@ -109,4 +109,6 @@ venv/
_b_asic_debug_log.txt
.idea/
.qt_for_python/
*.user
\ No newline at end of file
*.pyproject.user
*.pyproject
*/schedule-gui/ui/
\ No newline at end of file
# This Python file uses the following encoding: utf-8
"""B-ASIC Schedule-gui Main Window Module.
This file opens the main window of the schedule-gui for B-ASIC when run.
"""
import os
#from pathlib import Path
import sys
from typing import Any
#from matplotlib.pyplot import bar
from qtpy.QtWidgets import QApplication, QMainWindow, QMessageBox
#from qtpy.QtCore import QFile
class MainWindow(QMainWindow):
_test: int
_ui: Any
def __init__(self):
super(MainWindow, self).__init__()
self._test = 5
self.init_ui()
def init_ui(self):
from qtpy import uic
#uic.compileUiDir('.', False, \
# lambda dir, file : [dir+str('/ui/'), str('ui_')+file],)
_ui = uic.loadUi("main_window.ui", self) # Load the .ui file
_ui.pushButton.clicked.connect(self.callback_pushButton)
_ui.actionLoad_SFG.triggered.connect(self.callback_menu_load_SFG)
_ui.actionSave_schedule.triggered.connect(self.callback_menu_save_schedule)
_ui.actionQuit.triggered.connect(self.close)
_ui.actionNode_info.triggered.connect(self.callback_menu_node_info)
#_ui.actionNode_info.triggered.connect(self.update_statusbar)
print(type(_ui))
#_ui, _base_class = uic.loadUiType("main_window_ui.ui", None) # Load the .ui file
#print(type(_base_class))
print(type(self._test))
QT_API = os.environ.get('QT_API')
print("QT_API: " + QT_API)
def callback_pushButton(self):
self.printButtonPressed('callback_pushButton')
def callback_menu_load_SFG(self):
self.printButtonPressed('callback_menu_load_SFG')
self.update_statusbar('SFG loaded successfully')
def callback_menu_save_schedule(self):
self.printButtonPressed('callback_menu_save_schedule')
self.update_statusbar('Schedule saved successfully')
def callback_menu_node_info(self, checked: bool):
#if _ui.actionNode_info.
print(type(checked))
print(checked)
self.printButtonPressed('callback_menu_node_info')
#self.update_statusbar()
def printButtonPressed(self, func_name: str):
self.label_2.setText("hello")
alert = QMessageBox(self)
alert.setText("Called from " + func_name + '!')
alert.exec_()
def update_statusbar(self, msg: str):
self.statusbar.showMessage(msg)
def start_gui():
app = QApplication(sys.argv)
widget = MainWindow()
widget.show()
sys.exit(app.exec_())
if __name__ == "__main__":
start_gui()
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QScrollArea" name="scrollArea">
<property name="geometry">
<rect>
<x>150</x>
<y>90</y>
<width>461</width>
<height>351</height>
</rect>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>459</width>
<height>349</height>
</rect>
</property>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>120</x>
<y>110</y>
<width>83</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>50</x>
<y>40</y>
<width>62</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>label_2</string>
</property>
</widget>
</widget>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>110</x>
<y>50</y>
<width>62</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>label</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="actionLoad_SFG"/>
<addaction name="actionSave_schedule"/>
<addaction name="separator"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
<string>&amp;View</string>
</property>
<addaction name="actionNode_info"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuView"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionLoad_SFG">
<property name="text">
<string>&amp;Load SFG...</string>
</property>
<property name="toolTip">
<string>Load Signal Flow Graph</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="actionSave_schedule">
<property name="text">
<string>&amp;Save schedule...</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="actionQuit">
<property name="text">
<string>&amp;Quit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionNode_info">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Node info</string>
</property>
<property name="shortcut">
<string>Ctrl+I</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment