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
777b63db
Commit
777b63db
authored
2 years ago
by
Olle Hansson
Browse files
Options
Downloads
Patches
Plain Diff
Added save location for QSettings
parent
f1a283f7
No related branches found
No related tags found
1 merge request
!217
Guirecentfiles
Pipeline
#92760
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/GUI/main_window.py
+26
-15
26 additions, 15 deletions
b_asic/GUI/main_window.py
with
26 additions
and
15 deletions
b_asic/GUI/main_window.py
+
26
−
15
View file @
777b63db
...
@@ -12,7 +12,7 @@ from collections import deque
...
@@ -12,7 +12,7 @@ from collections import deque
from
pprint
import
pprint
from
pprint
import
pprint
from
typing
import
Dict
,
List
,
Optional
,
Tuple
from
typing
import
Dict
,
List
,
Optional
,
Tuple
from
qtpy.QtCore
import
QFileInfo
,
QSettings
,
QSize
,
Qt
from
qtpy.QtCore
import
QCoreApplication
,
QFileInfo
,
QSettings
,
QSize
,
Qt
from
qtpy.QtGui
import
QCursor
,
QIcon
,
QKeySequence
,
QPainter
from
qtpy.QtGui
import
QCursor
,
QIcon
,
QKeySequence
,
QPainter
from
qtpy.QtWidgets
import
(
from
qtpy.QtWidgets
import
(
QAction
,
QAction
,
...
@@ -31,6 +31,7 @@ from qtpy.QtWidgets import (
...
@@ -31,6 +31,7 @@ from qtpy.QtWidgets import (
import
b_asic.core_operations
import
b_asic.core_operations
import
b_asic.special_operations
import
b_asic.special_operations
from
b_asic._version
import
__version__
from
b_asic.GUI._preferences
import
GAP
,
GRID
,
MINBUTTONSIZE
,
PORTHEIGHT
from
b_asic.GUI._preferences
import
GAP
,
GRID
,
MINBUTTONSIZE
,
PORTHEIGHT
from
b_asic.GUI.arrow
import
Arrow
from
b_asic.GUI.arrow
import
Arrow
from
b_asic.GUI.drag_button
import
DragButton
from
b_asic.GUI.drag_button
import
DragButton
...
@@ -57,6 +58,11 @@ from b_asic.special_operations import Input, Output
...
@@ -57,6 +58,11 @@ from b_asic.special_operations import Input, Output
logging
.
basicConfig
(
level
=
logging
.
INFO
)
logging
.
basicConfig
(
level
=
logging
.
INFO
)
QCoreApplication
.
setOrganizationName
(
"
Linköping University
"
)
QCoreApplication
.
setOrganizationDomain
(
"
liu.se
"
)
QCoreApplication
.
setApplicationName
(
"
B-ASIC SFG GUI
"
)
QCoreApplication
.
setApplicationVersion
(
__version__
)
@decorate_class
(
handle_error
)
@decorate_class
(
handle_error
)
class
MainWindow
(
QMainWindow
):
class
MainWindow
(
QMainWindow
):
...
@@ -319,19 +325,20 @@ class MainWindow(QMainWindow):
...
@@ -319,19 +325,20 @@ class MainWindow(QMainWindow):
def
updateRecentActionList
(
self
):
def
updateRecentActionList
(
self
):
settings
=
QSettings
()
settings
=
QSettings
()
rfp
=
settings
.
value
(
"
recentFiles
"
)
rfp
=
settings
.
value
(
"
SFG/recentFiles
"
)
dequelen
=
len
(
rfp
)
if
dequelen
>
0
:
# print(rfp)
for
i
in
range
(
dequelen
):
if
rfp
:
action
=
self
.
recentFilesList
[
i
]
dequelen
=
len
(
rfp
)
action
.
setText
(
rfp
[
i
].
fileName
())
if
dequelen
>
0
:
action
.
setData
(
rfp
[
i
])
for
i
in
range
(
dequelen
):
action
.
setVisible
(
True
)
action
=
self
.
recentFilesList
[
i
]
action
.
setText
(
rfp
[
i
].
fileName
())
action
.
setData
(
rfp
[
i
])
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
):
self
.
_load_from_file
(
action
.
data
().
filePath
())
self
.
_load_from_file
(
action
.
data
().
filePath
())
...
@@ -339,13 +346,17 @@ class MainWindow(QMainWindow):
...
@@ -339,13 +346,17 @@ class MainWindow(QMainWindow):
def
addRecentFile
(
self
,
module
):
def
addRecentFile
(
self
,
module
):
settings
=
QSettings
()
settings
=
QSettings
()
rfp
=
settings
.
value
(
"
recentFiles
"
)
rfp
=
settings
.
value
(
"
SFG/
recentFiles
"
)
recentFile
=
QFileInfo
(
module
)
recentFile
=
QFileInfo
(
module
)
if
recentFile
not
in
rfp
:
if
rfp
:
if
recentFile
not
in
rfp
:
rfp
.
append
(
recentFile
)
else
:
rfp
=
deque
(
maxlen
=
self
.
maxFileNr
)
rfp
.
append
(
recentFile
)
rfp
.
append
(
recentFile
)
settings
.
setValue
(
"
recentFiles
"
,
rfp
)
settings
.
setValue
(
"
SFG/
recentFiles
"
,
rfp
)
self
.
updateRecentActionList
()
self
.
updateRecentActionList
()
...
...
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