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
cb7fc792
Commit
cb7fc792
authored
11 months ago
by
Robier Al Kaadi
Browse files
Options
Downloads
Patches
Plain Diff
Solve Preference dialogue for scheduler GUI
parent
d0d9edf3
No related branches found
No related tags found
No related merge requests found
Pipeline
#134296
passed
11 months ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
b_asic/scheduler_gui/main_window.py
+59
-13
59 additions, 13 deletions
b_asic/scheduler_gui/main_window.py
with
60 additions
and
14 deletions
.gitlab-ci.yml
+
1
−
1
View file @
cb7fc792
...
@@ -130,7 +130,7 @@ run-doc-test:
...
@@ -130,7 +130,7 @@ run-doc-test:
-
pip install black velin
-
pip install black velin
-
velin . --check --black
-
velin . --check --black
-
pip install ruff
-
pip install ruff
-
ruff b_asic --output-format=gitlab > ruff.json
-
ruff
check
b_asic --output-format=gitlab > ruff.json
artifacts
:
artifacts
:
name
:
"
${CI_PROJECT_NAME}_code_quality"
name
:
"
${CI_PROJECT_NAME}_code_quality"
when
:
always
when
:
always
...
...
This diff is collapsed.
Click to expand it.
b_asic/scheduler_gui/main_window.py
+
59
−
13
View file @
cb7fc792
...
@@ -1146,7 +1146,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1146,7 +1146,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
dialog
.
exec_
()
dialog
.
exec_
()
def
creat_color_button
(
self
,
color
:
ColorDataType
)
->
ColorButton
:
def
creat_color_button
(
self
,
color
:
ColorDataType
)
->
ColorButton
:
"""
Create a colored button to be used to modify a certain color
"""
"""
Create a colored button to be used to modify a certain color
color_type: ColorDataType
The color_type assigned to the butten to be created.
"""
button
=
ColorButton
(
color
.
DEFAULT
)
button
=
ColorButton
(
color
.
DEFAULT
)
button
.
setText
(
color
.
name
)
button
.
setText
(
color
.
name
)
if
color
.
name
==
"
Latency Color
"
:
if
color
.
name
==
"
Latency Color
"
:
...
@@ -1162,7 +1165,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1162,7 +1165,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
return
button
return
button
def
set_latency_color_by_type_name
(
self
,
all
:
bool
):
def
set_latency_color_by_type_name
(
self
,
all
:
bool
):
"""
Set latency color based on operation type names
"""
"""
Set latency color based on operation type names
all: bool
Indicates if the color of all type names to be modified.
"""
if
Latency_Color
.
changed
:
if
Latency_Color
.
changed
:
current_color
=
Latency_Color
.
current_color
current_color
=
Latency_Color
.
current_color
else
:
else
:
...
@@ -1203,7 +1209,7 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1203,7 +1209,7 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
for
type
in
self
.
_schedule
.
get_used_type_names
():
for
type
in
self
.
_schedule
.
get_used_type_names
():
if
Latency_Color
.
changed
and
not
self
.
_color_changed_perType
:
if
Latency_Color
.
changed
and
not
self
.
_color_changed_perType
:
self
.
_color_per_type
[
type
]
=
Latency_Color
.
current_color
self
.
_color_per_type
[
type
]
=
Latency_Color
.
current_color
elif
not
(
Latency_Color
.
changed
and
self
.
_color_changed_perType
)
:
elif
not
Latency_Color
.
changed
and
not
self
.
_color_changed_perType
:
self
.
_color_per_type
[
type
]
=
Latency_Color
.
DEFAULT
self
.
_color_per_type
[
type
]
=
Latency_Color
.
DEFAULT
elif
not
Latency_Color
.
changed
and
self
.
_color_changed_perType
:
elif
not
Latency_Color
.
changed
and
self
.
_color_changed_perType
:
if
type
in
self
.
changed_operation_colors
.
keys
():
if
type
in
self
.
changed_operation_colors
.
keys
():
...
@@ -1240,7 +1246,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1240,7 +1246,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
)
)
def
Color_button_clicked
(
self
,
color_type
:
ColorDataType
):
def
Color_button_clicked
(
self
,
color_type
:
ColorDataType
):
"""
Open a color dialog to select a color based on the specified color type
"""
"""
Open a color dialog to select a color based on the specified color type
color_type: ColorDataType
The color_type to be changed.
"""
settings
=
QSettings
()
settings
=
QSettings
()
if
color_type
.
changed
:
if
color_type
.
changed
:
current_color
=
color_type
.
current_color
current_color
=
color_type
.
current_color
...
@@ -1264,7 +1273,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1264,7 +1273,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
def
font_clicked
(
def
font_clicked
(
self
,
Sizeline
:
QLineEdit
,
italicbutton
:
ColorButton
,
boldbutton
:
ColorButton
self
,
Sizeline
:
QLineEdit
,
italicbutton
:
ColorButton
,
boldbutton
:
ColorButton
):
):
"""
Open a font dialog to select a font and update the current font
"""
"""
Open a font dialog to select a font and update the current font
Sizeline: QLineEdit
The line displaying the text size to be matched with the chosen font.
italicbutton: ColorButton
The button displaying the italic state to be matched with the chosen font.
boldbutton: ColorButton
The button displaying the bold state to be matched with the chosen font.
"""
if
Font
.
changed
:
if
Font
.
changed
:
current_font
=
Font
.
current_font
current_font
=
Font
.
current_font
else
:
else
:
...
@@ -1358,13 +1374,19 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1358,13 +1374,19 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self
.
_graph
.
_font_color_change
(
Font
.
color
)
self
.
_graph
.
_font_color_change
(
Font
.
color
)
def
set_fontSize_clicked
(
self
,
size
):
def
set_fontSize_clicked
(
self
,
size
):
"""
Set the font size to the specified size and update the font
"""
"""
Set the font size to the specified size and update the font
size
The font size to be set.
"""
Font
.
size
=
int
(
size
)
if
(
not
size
==
""
)
else
6
Font
.
size
=
int
(
size
)
if
(
not
size
==
""
)
else
6
Font
.
current_font
.
setPointSizeF
(
Font
.
size
)
Font
.
current_font
.
setPointSizeF
(
Font
.
size
)
self
.
Update_font
()
self
.
Update_font
()
def
Italic_font_clicked
(
self
,
button
:
ColorButton
):
def
Italic_font_clicked
(
self
,
button
:
ColorButton
):
"""
Toggle the font style to italic if not already italic, otherwise remove italic
"""
"""
Toggle the font style to italic if not already italic, otherwise remove italic
button: ColorButton
The clicked button. Used to indicate state on/off.
"""
Font
.
italic
=
not
Font
.
italic
Font
.
italic
=
not
Font
.
italic
Font
.
current_font
.
setItalic
(
Font
.
italic
)
Font
.
current_font
.
setItalic
(
Font
.
italic
)
(
(
...
@@ -1375,7 +1397,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1375,7 +1397,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self
.
Update_font
()
self
.
Update_font
()
def
Bold_font_clicked
(
self
,
button
:
ColorButton
):
def
Bold_font_clicked
(
self
,
button
:
ColorButton
):
"""
Toggle the font style to bold if not already bold, otherwise unbold
"""
"""
Toggle the font style to bold if not already bold, otherwise unbold
button: ColorButton
The clicked button. Used to indicate state on/off.
"""
Font
.
bold
=
not
Font
.
bold
Font
.
bold
=
not
Font
.
bold
Font
.
current_font
.
setBold
(
Font
.
bold
)
Font
.
current_font
.
setBold
(
Font
.
bold
)
Font
.
current_font
.
setWeight
(
50
)
Font
.
current_font
.
setWeight
(
50
)
...
@@ -1387,15 +1412,22 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1387,15 +1412,22 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self
.
Update_font
()
self
.
Update_font
()
def
Incr_font_clicked
(
self
,
line
:
QLineEdit
):
def
Incr_font_clicked
(
self
,
line
:
QLineEdit
):
"""
Increase the font size by 1
"""
"""
(
Increase the font size by 1.
line: QLineEdit
The line displaying the text size to be matched.
"""
(
line
.
setText
(
str
(
Font
.
size
+
1
))
line
.
setText
(
str
(
Font
.
size
+
1
))
if
Font
.
size
<=
71
if
Font
.
size
<=
71
else
line
.
setText
(
str
(
Font
.
size
))
else
line
.
setText
(
str
(
Font
.
size
))
)
)
def
Decr_font_clicked
(
self
,
line
:
QLineEdit
):
def
Decr_font_clicked
(
self
,
line
:
QLineEdit
):
"""
Decrease the font size by 1
"""
"""
Decrease the font size by 1.
line: QLineEdit
The line displaying the text size to be matched.
"""
(
(
line
.
setText
(
str
(
Font
.
size
-
1
))
line
.
setText
(
str
(
Font
.
size
-
1
))
if
Font
.
size
>=
7
if
Font
.
size
>=
7
...
@@ -1432,7 +1464,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1432,7 +1464,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
def
reset_font_clicked
(
def
reset_font_clicked
(
self
,
Sizeline
:
QLineEdit
,
italicbutton
:
ColorButton
,
boldbutton
:
ColorButton
self
,
Sizeline
:
QLineEdit
,
italicbutton
:
ColorButton
,
boldbutton
:
ColorButton
):
):
"""
Reset the font settings
"""
"""
Reset the font settings.
Sizeline: QLineEdit
The line displaying the text size to be matched with the chosen font.
italicbutton: ColorButton
The button displaying the italic state to be matched with the chosen font.
boldbutton: ColorButton
The button displaying the bold state to be matched with the chosen font.
"""
Font
.
current_font
=
QFont
(
"
Times
"
,
12
)
Font
.
current_font
=
QFont
(
"
Times
"
,
12
)
Font
.
changed
=
False
Font
.
changed
=
False
Font
.
color
=
Font
.
DEFAULT_COLOR
Font
.
color
=
Font
.
DEFAULT_COLOR
...
@@ -1453,7 +1492,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1453,7 +1492,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
def
Match_Dialog_Font
(
def
Match_Dialog_Font
(
self
,
Sizeline
:
QLineEdit
,
italicbutton
:
ColorButton
,
boldbutton
:
ColorButton
self
,
Sizeline
:
QLineEdit
,
italicbutton
:
ColorButton
,
boldbutton
:
ColorButton
):
):
"""
Update the widgets on the pref dialog to match the current font
"""
"""
Update the widgets on the pref dialog to match the current font
Sizeline: QLineEdit
The line displaying the text size to be matched with the current font.
italicbutton: ColorButton
The button displaying the italic state to be matched with the current font.
boldbutton: ColorButton
The button displaying the bold state to be matched with the current font.
"""
Sizeline
.
setText
(
str
(
Font
.
size
))
Sizeline
.
setText
(
str
(
Font
.
size
))
(
(
...
...
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