Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
beat.editor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
beat
beat.editor
Commits
d882e95a
Commit
d882e95a
authored
Oct 02, 2019
by
Samuel GAIST
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[widgets][assetwidget] Move load confirmation in own method
This allows to write tests more easily.
parent
fbc0ff83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
beat/editor/widgets/assetwidget.py
beat/editor/widgets/assetwidget.py
+16
-12
No files found.
beat/editor/widgets/assetwidget.py
View file @
d882e95a
...
...
@@ -394,6 +394,21 @@ class AssetWidget(QWidget):
asset
=
Asset
.
from_path
(
self
.
prefix_root_path
,
file_path
)
asset
.
delete
()
def
confirm_loading
(
self
,
errors
):
"""Request loading confirmation"""
message_box
=
QMessageBox
(
QMessageBox
.
Critical
,
self
.
tr
(
"Invalid asset"
),
self
.
tr
(
f"The asset you are trying to load is invalid."
),
)
message_box
.
setDetailedText
(
f"
{
errors
}
"
)
message_box
.
addButton
(
QMessageBox
.
Cancel
)
load_button
=
message_box
.
addButton
(
QMessageBox
.
Ignore
)
load_button
.
setText
(
self
.
tr
(
"Load anyway"
))
return
message_box
.
exec_
()
@
pyqtSlot
(
Asset
)
def
loadAsset
(
self
,
asset
):
""" Load the content of the file given in parameter
...
...
@@ -412,19 +427,8 @@ class AssetWidget(QWidget):
do_load
=
False
if
not
is_valid
:
message_box
=
QMessageBox
(
QMessageBox
.
Critical
,
self
.
tr
(
"Invalid asset"
),
self
.
tr
(
f"The asset you are trying to load is invalid."
),
)
message_box
.
setDetailedText
(
f"
{
errors
}
"
)
message_box
.
addButton
(
QMessageBox
.
Cancel
)
load_button
=
message_box
.
addButton
(
QMessageBox
.
Ignore
)
load_button
.
setText
(
self
.
tr
(
"Load anyway"
))
result
=
message_box
.
exec_
()
result
=
self
.
confirm_loading
(
errors
)
do_load
=
result
==
QMessageBox
.
Ignore
else
:
do_load
=
True
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment