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
8f3a3579
Commit
8f3a3579
authored
1 year ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Store saved files between recent files and documentation
parent
b1b7e2ae
No related branches found
Branches containing commit
No related tags found
1 merge request
!335
Store saved files between recent files and documentation
Pipeline
#96422
passed
1 year ago
Stage: test
Stage: deploy
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/scheduler_gui/main_window.py
+33
-20
33 additions, 20 deletions
b_asic/scheduler_gui/main_window.py
b_asic/scheduler_gui/scheduler_item.py
+9
-0
9 additions, 0 deletions
b_asic/scheduler_gui/scheduler_item.py
with
42 additions
and
20 deletions
b_asic/scheduler_gui/main_window.py
+
33
−
20
View file @
8f3a3579
...
...
@@ -211,13 +211,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
#########
@Slot
()
def
_plot_schedule
(
self
)
->
None
:
# TODO: remove
"""
Callback for plotting schedule using Matplotlib.
"""
if
self
.
schedule
is
None
:
return
self
.
schedule
.
show
()
if
self
.
_graph
is
not
None
:
print
(
f
"
filtersChildEvents():
{
self
.
_graph
.
filtersChildEvents
()
}
"
)
# self._print_button_pressed('callback_pushButton()')
@Slot
()
def
_open_documentation
(
self
)
->
None
:
...
...
@@ -235,27 +232,36 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
@Slot
()
def
_increase_time_resolution
(
self
)
->
None
:
"""
Callback for increasing time resolution.
"""
# Create dialog asking for int
factor
,
ok
=
QInputDialog
.
getInt
(
self
,
"
Increase time resolution
"
,
"
Factor
"
,
1
,
1
)
if
ok
and
factor
>
1
:
self
.
schedule
.
increase_time_resolution
(
factor
)
self
.
open
(
self
.
schedule
)
self
.
update_statusbar
(
f
"
Time resolution increased by a factor
{
factor
}
"
)
if
not
ok
:
# Check return value
if
ok
:
if
factor
>
1
:
self
.
schedule
.
increase_time_resolution
(
factor
)
self
.
open
(
self
.
schedule
)
self
.
update_statusbar
(
f
"
Time resolution increased by a factor
{
factor
}
"
)
else
:
# Cancelled
self
.
update_statusbar
(
"
Cancelled
"
)
@Slot
()
def
_decrease_time_resolution
(
self
)
->
None
:
"""
Callback for decreasing time resolution.
"""
# Get possible factors
vals
=
[
str
(
v
)
for
v
in
self
.
schedule
.
get_possible_time_resolution_decrements
()]
# Create dialog
factor
,
ok
=
QInputDialog
.
getItem
(
self
,
"
Decrease time resolution
"
,
"
Factor
"
,
vals
,
editable
=
False
)
if
ok
and
int
(
factor
)
>
1
:
self
.
schedule
.
decrease_time_resolution
(
int
(
factor
))
self
.
open
(
self
.
schedule
)
self
.
update_statusbar
(
f
"
Time resolution decreased by a factor
{
factor
}
"
)
if
not
ok
:
# Check return value
if
ok
:
if
int
(
factor
)
>
1
:
self
.
schedule
.
decrease_time_resolution
(
int
(
factor
))
self
.
open
(
self
.
schedule
)
self
.
update_statusbar
(
f
"
Time resolution decreased by a factor
{
factor
}
"
)
else
:
# Cancelled
self
.
update_statusbar
(
"
Cancelled
"
)
def
wheelEvent
(
self
,
event
)
->
None
:
...
...
@@ -270,8 +276,6 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
def
_load_schedule_from_pyfile
(
self
)
->
None
:
"""
SLOT() for SIGNAL(menu_load_from_file.triggered)
Load a python script as a module and search for a Schedule object. If
found, opens it.
"""
settings
=
QSettings
()
last_file
=
settings
.
value
(
...
...
@@ -299,6 +303,12 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self
.
_load_from_file
(
abs_path_filename
)
def
_load_from_file
(
self
,
abs_path_filename
):
"""
Import from Python-file.
Load a python script as a module and search for a Schedule object. If
found, opens it.
"""
log
.
debug
(
"
abs_path_filename = {}.
"
.
format
(
abs_path_filename
))
module_name
=
inspect
.
getmodulename
(
abs_path_filename
)
...
...
@@ -408,6 +418,7 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self
.
_schedule
.
_original_sfg
.
_graph_id_generator
=
None
with
open
(
self
.
_file_name
,
'
wb
'
)
as
f
:
pickle
.
dump
(
self
.
_schedule
,
f
)
self
.
_add_recent_file
(
self
.
_file_name
)
self
.
update_statusbar
(
self
.
tr
(
"
Schedule saved successfully
"
))
@Slot
()
...
...
@@ -430,6 +441,7 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self
.
_schedule
.
_original_sfg
.
_graph_id_generator
=
None
with
open
(
self
.
_file_name
,
'
wb
'
)
as
f
:
pickle
.
dump
(
self
.
_schedule
,
f
)
self
.
_add_recent_file
(
self
.
_file_name
)
self
.
update_statusbar
(
self
.
tr
(
"
Schedule saved successfully
"
))
@Slot
()
...
...
@@ -454,6 +466,7 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self
.
_open_schedule_file
(
abs_path_filename
)
def
_open_schedule_file
(
self
,
abs_path_filename
:
str
):
"""
Open a saved schedule (*.bsc-file), which is a pickled Schedule.
"""
self
.
_file_name
=
abs_path_filename
self
.
_add_recent_file
(
abs_path_filename
)
...
...
@@ -802,17 +815,17 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
else
:
self
.
_load_from_file
(
action
.
data
().
filePath
())
def
_add_recent_file
(
self
,
modul
e
):
def
_add_recent_file
(
self
,
filenam
e
):
settings
=
QSettings
()
rfp
=
cast
(
deque
,
settings
.
value
(
"
scheduler/recentFiles
"
))
if
rfp
:
if
modul
e
not
in
rfp
:
rfp
.
append
(
modul
e
)
if
filenam
e
not
in
rfp
:
rfp
.
append
(
filenam
e
)
else
:
rfp
=
deque
(
maxlen
=
self
.
_max_recent_files
)
rfp
.
append
(
modul
e
)
rfp
.
append
(
filenam
e
)
settings
.
setValue
(
"
scheduler/recentFiles
"
,
rfp
)
...
...
This diff is collapsed.
Click to expand it.
b_asic/scheduler_gui/scheduler_item.py
+
9
−
0
View file @
8f3a3579
...
...
@@ -137,6 +137,15 @@ class SchedulerItem(SchedulerEvent, QGraphicsItemGroup): # PySide2 / PyQt5
signal
.
update_path
()
def
set_warnings
(
self
,
warnings
:
bool
=
True
):
"""
Set warnings for long execution times.
Parameters
----------
warnings : bool
Whether to draw processes with execution time longer than schedule time in
a different color.
"""
if
warnings
!=
self
.
_warnings
:
self
.
_warnings
=
warnings
s
=
set
()
...
...
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