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
f1a283f7
Commit
f1a283f7
authored
2 years ago
by
Olle Hansson
Browse files
Options
Downloads
Patches
Plain Diff
Recent files added to SFG GUI, saves between sessions with QSettings
parent
9bef2549
Branches
Branches containing commit
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/GUI/main_window.py
+20
-13
20 additions, 13 deletions
b_asic/GUI/main_window.py
with
20 additions
and
13 deletions
b_asic/GUI/main_window.py
+
20
−
13
View file @
f1a283f7
...
@@ -101,7 +101,6 @@ class MainWindow(QMainWindow):
...
@@ -101,7 +101,6 @@ class MainWindow(QMainWindow):
self
.
maxFileNr
=
4
self
.
maxFileNr
=
4
self
.
recentFilesList
=
[]
self
.
recentFilesList
=
[]
self
.
recentFilePaths
=
deque
(
maxlen
=
self
.
maxFileNr
)
self
.
recentFilePaths
=
deque
(
maxlen
=
self
.
maxFileNr
)
#self.init_ui()
self
.
add_operations_from_namespace
(
self
.
add_operations_from_namespace
(
b_asic
.
core_operations
,
self
.
ui
.
core_operations_list
b_asic
.
core_operations
,
self
.
ui
.
core_operations_list
...
@@ -139,7 +138,6 @@ class MainWindow(QMainWindow):
...
@@ -139,7 +138,6 @@ class MainWindow(QMainWindow):
self
.
ui
.
custom_operations_list
.
itemClicked
.
connect
(
self
.
ui
.
custom_operations_list
.
itemClicked
.
connect
(
self
.
on_list_widget_item_clicked
self
.
on_list_widget_item_clicked
)
)
self
.
ui
.
file_menu
.
aboutToShow
.
connect
(
self
.
updateRecentActionList
)
self
.
ui
.
save_menu
.
triggered
.
connect
(
self
.
save_work
)
self
.
ui
.
save_menu
.
triggered
.
connect
(
self
.
save_work
)
self
.
ui
.
load_menu
.
triggered
.
connect
(
self
.
load_work
)
self
.
ui
.
load_menu
.
triggered
.
connect
(
self
.
load_work
)
self
.
ui
.
load_operations
.
triggered
.
connect
(
self
.
add_namespace
)
self
.
ui
.
load_operations
.
triggered
.
connect
(
self
.
add_namespace
)
...
@@ -233,8 +231,7 @@ class MainWindow(QMainWindow):
...
@@ -233,8 +231,7 @@ class MainWindow(QMainWindow):
module
,
accepted
=
QFileDialog
().
getOpenFileName
()
module
,
accepted
=
QFileDialog
().
getOpenFileName
()
if
not
accepted
:
if
not
accepted
:
return
return
recentFile
=
QFileInfo
(
module
)
self
.
addRecentFile
(
module
)
self
.
recentFilePaths
.
append
(
recentFile
)
self
.
_load_from_file
(
module
)
self
.
_load_from_file
(
module
)
def
_load_from_file
(
self
,
module
)
->
None
:
def
_load_from_file
(
self
,
module
)
->
None
:
...
@@ -266,9 +263,7 @@ class MainWindow(QMainWindow):
...
@@ -266,9 +263,7 @@ class MainWindow(QMainWindow):
if
positions
is
None
:
if
positions
is
None
:
positions
=
{}
positions
=
{}
# print(sfg)
for
op
in
sfg
.
split
():
for
op
in
sfg
.
split
():
# print(op)
self
.
create_operation
(
self
.
create_operation
(
op
,
op
,
positions
[
op
.
graph_id
][
0
:
2
]
if
op
.
graph_id
in
positions
else
None
,
positions
[
op
.
graph_id
][
0
:
2
]
if
op
.
graph_id
in
positions
else
None
,
...
@@ -324,23 +319,35 @@ class MainWindow(QMainWindow):
...
@@ -324,23 +319,35 @@ class MainWindow(QMainWindow):
def
updateRecentActionList
(
self
):
def
updateRecentActionList
(
self
):
settings
=
QSettings
()
settings
=
QSettings
()
dequelen
=
len
(
self
.
recentFilePaths
)
rfp
=
settings
.
value
(
"
recentFiles
"
)
dequelen
=
len
(
rfp
)
if
dequelen
>
0
:
if
dequelen
>
0
:
for
i
in
range
(
dequelen
):
for
i
in
range
(
dequelen
):
action
=
self
.
recentFilesList
[
i
]
action
=
self
.
recentFilesList
[
i
]
action
.
setText
(
self
.
recentFilePaths
[
i
].
fileName
())
action
.
setText
(
rfp
[
i
].
fileName
())
action
.
setData
(
self
.
recentFilePaths
[
i
])
action
.
setData
(
rfp
[
i
])
action
.
setVisible
(
True
)
action
.
setVisible
(
True
)
for
i
in
range
(
dequelen
,
self
.
maxFileNr
):
for
i
in
range
(
dequelen
,
self
.
maxFileNr
):
self
.
recentFilesList
[
i
].
setVisible
(
False
)
self
.
recentFilesList
[
i
].
setVisible
(
False
)
def
openRecent
(
self
,
action
):
def
openRecent
(
self
,
action
):
print
(
type
(
action
))
self
.
_load_from_file
(
action
.
data
().
filePath
())
print
(
action
)
print
(
action
.
data
())
def
addRecentFile
(
self
,
module
):
print
(
"
openrecent
"
)
settings
=
QSettings
()
rfp
=
settings
.
value
(
"
recentFiles
"
)
recentFile
=
QFileInfo
(
module
)
if
recentFile
not
in
rfp
:
rfp
.
append
(
recentFile
)
settings
.
setValue
(
"
recentFiles
"
,
rfp
)
self
.
updateRecentActionList
()
def
exit_app
(
self
)
->
None
:
def
exit_app
(
self
)
->
None
:
self
.
logger
.
info
(
"
Exiting the application.
"
)
self
.
logger
.
info
(
"
Exiting the application.
"
)
...
...
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