Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Merge requests
!78
Add scheduler GUI
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add scheduler GUI
scheduler-gui
into
master
Overview
0
Commits
69
Pipelines
12
Changes
3
Merged
Oscar Gustafsson
requested to merge
scheduler-gui
into
master
2 years ago
Overview
0
Commits
69
Pipelines
12
Changes
3
Expand
0
0
Merge request reports
Viewing commit
0fb7307e
Prev
Next
Show latest version
3 files
+
247
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
0fb7307e
dump branch
· 0fb7307e
Andreas Bolin
authored
2 years ago
b_asic/schedule-gui/main_window.py
0 → 100644
+
83
−
0
Options
# 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
()
Loading