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
10e1b093
Commit
10e1b093
authored
2 years ago
by
Andreas Bolin
Browse files
Options
Downloads
Patches
Plain Diff
workspace dump
parent
c759edd5
No related branches found
Branches containing commit
No related tags found
1 merge request
!78
Add scheduler GUI
Pipeline
#72967
passed
2 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
b_asic/scheduler-gui/graphics_scene.py
+57
-2
57 additions, 2 deletions
b_asic/scheduler-gui/graphics_scene.py
b_asic/scheduler-gui/main_window.py
+6
-8
6 additions, 8 deletions
b_asic/scheduler-gui/main_window.py
b_asic/scheduler-gui/main_window.ui
+10
-5
10 additions, 5 deletions
b_asic/scheduler-gui/main_window.ui
with
73 additions
and
15 deletions
b_asic/scheduler-gui/graphics_scene.py
+
57
−
2
View file @
10e1b093
...
...
@@ -19,14 +19,16 @@ from qtpy import QtWidgets
# QGraphics and QPainter imports
from
qtpy.QtCore
import
(
QObject
,
QRect
,
QRectF
,
QPoint
,
QSize
,
QByteArray
)
Qt
,
QObject
,
QRect
,
QRectF
,
QPoint
,
QSize
,
QByteArray
)
from
qtpy.QtGui
import
(
QPaintEvent
,
QPainter
,
QPainterPath
,
QColor
,
QBrush
,
QPen
,
QFont
,
QPolygon
,
QIcon
,
QPixmap
,
QLinearGradient
)
from
qtpy.QtWidgets
import
(
QGraphicsView
,
QGraphicsScene
,
QGraphicsWidget
,
QGraphicsLayout
,
QGraphicsLinearLayout
,
QGraphicsGridLayout
,
QGraphicsLayoutItem
,
QGraphicsAnchorLayout
,
QGraphicsItem
,
QGraphicsItemGroup
)
QGraphicsItem
,
QGraphicsItemGroup
,
QGraphicsPathItem
)
from
qtpy.QtCore
import
(
QPoint
,
QPointF
)
# B-ASIC
import
logger
...
...
@@ -55,6 +57,59 @@ class GraphicsScene(QGraphicsScene):
print
(
'
From GraphicsScene/self._schedule:
\t
'
,
end
=
''
)
pprint
(
self
.
_schedule
)
# print('')
scale
=
10.0
brush
=
QBrush
(
Qt
.
lightGray
,
bs
=
Qt
.
SolidPattern
)
# pen = QPen(brush, 10, s=Qt.SolidLine, c=Qt.SquareCap, j=Qt.BevelJoin)
pen
=
QPen
(
Qt
.
SolidLine
)
pen
.
setWidthF
(
2
/
scale
)
pen
.
setBrush
(
Qt
.
darkGray
)
# pen.setCapStyle(Qt.RoundCap) # Qt.FlatCap, Qt.SquareCap (default), Qt.RoundCap
pen
.
setJoinStyle
(
Qt
.
RoundJoin
)
# Qt.MiterJoin, Qt.BevelJoin (default), Qt.RoundJoin, Qt.SvgMiterJoin
# the group consist of a time_item and a component_item
item_group
=
QGraphicsItemGroup
()
item_group
.
setScale
(
scale
)
component_path
=
QPainterPath
(
QPoint
(
0
,
0
))
component_path
.
lineTo
(
0
,
10
)
component_path
.
lineTo
(
40
,
10
)
component_path
.
lineTo
(
40
,
0
)
# component_path.lineTo(0, 0)
component_path
.
closeSubpath
()
# pen.setCosmetic(True) # Dont scale pen
component_item
=
QGraphicsPathItem
(
component_path
,
item_group
)
component_item
.
setPen
(
pen
)
component_item
.
setBrush
(
brush
)
# item_group.addToGroup(component_item)
component_item
.
setPos
(
5
,
0
)
# in parent (item_group) coordinates
time_path
=
QPainterPath
(
QPoint
(
0
,
0
))
time_path
.
lineTo
(
0
,
10
)
time_path
.
lineTo
(
10
,
10
)
time_path
.
lineTo
(
10
,
0
)
# time_path.lineTo(0, 0)
time_path
.
closeSubpath
()
green_color
=
QColor
(
Qt
.
magenta
)
green_color
.
setAlpha
(
200
)
# 0-255
pen
.
setColor
(
green_color
)
# pen.setBrush(Qt.green)
time_item
=
QGraphicsPathItem
(
time_path
,
item_group
)
time_item
.
setPen
(
pen
)
# item_group.addToGroup(time_item)
# add the component group to scene
self
.
addItem
(
item_group
)
def
plot_schedule
(
self
):
...
...
This diff is collapsed.
Click to expand it.
b_asic/scheduler-gui/main_window.py
+
6
−
8
View file @
10e1b093
...
...
@@ -144,15 +144,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# Setup event member functions
self
.
closeEvent
=
self
.
_close_event
# Init info sidebar
# self.info_table.insertColumn(0)
# self.info_table.insertRow(0)
# Setup info table
self
.
info_table
.
setHorizontalHeaderLabels
([
'
Property
'
,
'
Value
'
])
# test = '#b085b2'
# self.info_table.setStyleSheet('alternate-background-color: lightGray;background-color: white;');
self
.
info_table
.
setStyleSheet
(
'
alternate-background-color: #fadefb;background-color: #ebebeb;
'
);
for
i
in
range
(
10
):
print
(
i
)
self
.
info_table
.
insertRow
(
i
)
item
=
QTableWidgetItem
(
'
this is a very very very very long string that says abolutly nothing
'
)
self
.
info_table
.
setItem
(
i
,
0
,
QTableWidgetItem
(
'
property {}:
'
.
format
(
i
)))
...
...
@@ -248,10 +245,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
scene
=
GraphicsScene
(
self
.
_scene_count
,
schedule
,
self
)
#scene = QGraphicsScene()
self
.
_scenes
[
self
.
_scene_count
]
=
scene
self
.
graphic_view
.
setScene
(
scene
)
self
.
graphic_view
.
setRenderHint
(
QPainter
.
Antialiasing
)
# self.graphic_view.setGeometry(20, 20, self.width(), self.height())
self
.
graphic_view
.
setDragMode
(
QGraphicsView
.
RubberBandDrag
)
self
.
graphics_view
.
setScene
(
scene
)
self
.
graphics_view
.
setRenderHint
(
QPainter
.
Antialiasing
)
# self.graphics_view.setGeometry(20, 20, self.width(), self.height())
self
.
graphics_view
.
setDragMode
(
QGraphicsView
.
RubberBandDrag
)
self
.
_scene_count
+=
1
...
...
This diff is collapsed.
Click to expand it.
b_asic/scheduler-gui/main_window.ui
+
10
−
5
View file @
10e1b093
...
...
@@ -49,8 +49,10 @@
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<widget
class=
"QWidget"
name=
"horizontalLayoutWidget"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
/>
<widget
class=
"QGraphicsView"
name=
"graphics_view"
>
<property
name=
"alignment"
>
<set>
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
</set>
</property>
</widget>
<widget
class=
"QTableWidget"
name=
"info_table"
>
<property
name=
"editTriggers"
>
...
...
@@ -68,6 +70,9 @@
<property
name=
"columnCount"
>
<number>
2
</number>
</property>
<attribute
name=
"horizontalHeaderHighlightSections"
>
<bool>
false
</bool>
</attribute>
<attribute
name=
"horizontalHeaderStretchLastSection"
>
<bool>
true
</bool>
</attribute>
...
...
@@ -87,7 +92,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
800
</width>
<height>
2
2
</height>
<height>
2
0
</height>
</rect>
</property>
<widget
class=
"QMenu"
name=
"menuFile"
>
...
...
@@ -182,8 +187,8 @@
</property>
<property
name=
"icon"
>
<iconset
resource=
"icons/misc.qrc"
>
<normaloff>
:/icons/misc/right_
filled_
panel.svg
</normaloff>
<normalon>
:/icons/misc/right_panel.svg
</normalon>
:/icons/misc/right_
filled_
panel.svg
</iconset>
<normaloff>
:/icons/misc/right_panel.svg
</normaloff>
<normalon>
:/icons/misc/right_
filled_
panel.svg
</normalon>
:/icons/misc/right_panel.svg
</iconset>
</property>
<property
name=
"text"
>
<string>
&
Node Info
</string>
...
...
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