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
Commits
416cf53c
Commit
416cf53c
authored
2 years ago
by
Andreas Bolin
Browse files
Options
Downloads
Patches
Plain Diff
fix bugs related to PyQt5
parent
0ae3c517
No related branches found
No related tags found
1 merge request
!78
Add scheduler GUI
Pipeline
#72790
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/scheduler-gui/main_window.py
+17
-11
17 additions, 11 deletions
b_asic/scheduler-gui/main_window.py
with
17 additions
and
11 deletions
b_asic/scheduler-gui/main_window.py
+
17
−
11
View file @
416cf53c
...
...
@@ -28,18 +28,18 @@ from qtpy.QtCore import QCoreApplication, Qt, Slot, QSettings, QStandardPaths
#QtCore QSize, QPoint
from
qtpy.QtGui
import
QCloseEvent
from
qtpy.QtWidgets
import
(
QApplication
,
QMainWindow
,
QMessageBox
,
QFileDialog
,
QInputDialog
,
QCheckBox
)
QApplication
,
QMainWindow
,
QMessageBox
,
QFileDialog
,
QInputDialog
,
QCheckBox
,
QAbstractButton
)
# QGraphics and QPainter imports
from
qtpy.QtWidgets
import
(
QGraphicsView
,
QGraphicsScene
,
QGraphicsWidget
,
QGraphicsLayout
,
QGraphicsLinearLayout
,
QGraphicsGridLayout
,
QGraphicsLayoutItem
,
QGraphicsAnchorLayout
,
QGraphicsItem
,
QGraphicsItemGroup
,
QGraphicsItemAnimation
)
QGraphicsItem
,
QGraphicsItemGroup
)
from
qtpy.QtGui
import
(
QPaintEvent
,
QPainter
,
QPainterPath
,
QColor
,
QBrush
,
QPen
,
QFont
,
QPolygon
,
QLinearGradient
)
from
qtpy.QtCore
import
(
QRect
)
QRect
,
QPoint
,
QSize
,
QByteArray
)
# B-ASIC
import
logger
...
...
@@ -62,7 +62,8 @@ if __debug__:
import
PySide2
print
(
'
PySide version:
'
,
PySide2
.
__version__
)
if
QT_API
.
lower
().
startswith
(
'
pyqt
'
):
print
(
'
PyQt version:
'
,
str
(
Qt
.
PYQT_VERSION_STR
))
from
qtpy.QtCore
import
PYQT_VERSION_STR
print
(
'
PyQt version:
'
,
PYQT_VERSION_STR
)
print
(
'
QtPy version:
'
,
qtpy
.
__version__
)
# Autocompile the .ui form to a python file.
...
...
@@ -73,9 +74,11 @@ if __debug__:
# return (dir+'/ui/', file_base+'_ui.py')
# uic.compileUiDir('.', map=_map_func)
uic
.
compileUiDir
(
'
.
'
,
map
=
(
lambda
dir
,
file
:
dir
,
'
ui_
'
+
file
))
uic
.
compileUiDir
(
'
.
'
,
map
=
(
lambda
dir
,
file
:
(
dir
,
'
ui_
'
+
file
))
)
except
:
try
:
# PySide2, try manual compile
print
(
"
fail!
"
)
exit
(
1
)
import
subprocess
os_
=
sys
.
platform
if
os_
.
startswith
(
'
linux
'
):
...
...
@@ -271,9 +274,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
'
<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
"
))
checkbox
=
QCheckBox
(
'
Don
\'
t ask again
'
)
buttons
:
list
[
QAbstractButton
]
=
box
.
buttons
()
buttons
[
0
].
setText
(
self
.
tr
(
'
&Exit
'
))
buttons
[
1
].
setText
(
self
.
tr
(
'
&Cancel
'
))
#box.setButtonText(QMessageBox.Yes, self.tr('&Exit'))
#box.setButtonText(QMessageBox.No, self.tr('&Cancel'))
checkbox
=
QCheckBox
(
self
.
tr
(
'
Don
\'
t ask again
'
))
box
.
setCheckBox
(
checkbox
)
ret
=
box
.
exec_
()
...
...
@@ -319,10 +325,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def
_read_settings
(
self
)
->
None
:
"""
Read settings from Settings to MainWindow.
"""
s
=
QSettings
()
self
.
restoreGeometry
(
s
.
value
(
'
mainwindow/geometry
'
))
self
.
restoreState
(
s
.
value
(
'
mainwindow/state
'
))
self
.
restoreGeometry
(
s
.
value
(
'
mainwindow/geometry
'
,
type
=
QByteArray
))
self
.
restoreState
(
s
.
value
(
'
mainwindow/state
'
,
type
=
QByteArray
))
self
.
menu_node_info
.
setChecked
(
s
.
value
(
'
mainwindow/menu/node_info
'
,
True
,
type
=
bool
))
self
.
splitter_center
.
restoreState
(
s
.
value
(
'
mainwindow/splitter/state
'
))
self
.
splitter_center
.
restoreState
(
s
.
value
(
'
mainwindow/splitter/state
'
,
type
=
QByteArray
))
log
.
debug
(
'
Settings read from
\'
{}
\'
.
'
.
format
(
s
.
fileName
()))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment