Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.editor
Merge requests
!48
WIP: Library editor
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
WIP: Library editor
library-editor-178
into
v2
Overview
39
Commits
5
Pipelines
7
Changes
3
Closed
Jaden DIEFENBAUGH
requested to merge
library-editor-178
into
v2
6 years ago
Overview
39
Commits
5
Pipelines
7
Changes
3
Expand
Summary
The MR for the Library editor for the v2 branch.
Relevant issue(s) fixed
#178 (closed)
0
0
Merge request reports
Compare
v2
version 6
09a599ad
6 years ago
version 5
0e5ef07a
6 years ago
version 4
c97779fc
6 years ago
version 3
ed6f8a38
6 years ago
version 2
4e738bcc
6 years ago
version 1
a7f6f2ff
6 years ago
v2 (base)
and
latest version
latest version
9d7deaa3
5 commits,
6 years ago
version 6
09a599ad
4 commits,
6 years ago
version 5
0e5ef07a
4 commits,
6 years ago
version 4
c97779fc
3 commits,
6 years ago
version 3
ed6f8a38
2 commits,
6 years ago
version 2
4e738bcc
51 commits,
6 years ago
version 1
a7f6f2ff
1 commit,
6 years ago
3 files
+
289
−
7
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
beat/editor/widgets/assetwidget.py
+
43
−
6
Options
@@ -29,6 +29,7 @@ from PyQt5.QtWidgets import QTabWidget
from
PyQt5.QtWidgets
import
QTextEdit
from
PyQt5.QtWidgets
import
QVBoxLayout
from
PyQt5.QtWidgets
import
QWidget
from
.library
import
LibraryEditorWidget
class
AssetWidget
(
QWidget
):
@@ -56,18 +57,54 @@ class AssetWidget(QWidget):
self
.
watcher
=
QFileSystemWatcher
()
self
.
watcher
.
fileChanged
.
connect
(
self
.
show_json
)
self
.
watcher
.
fileChanged
.
connect
(
self
.
update_editor_path
)
def
show_json
(
self
,
file_path
):
"""
Display the content of the file given in parameter
def
update_editor_path
(
self
,
file_path
):
"""
Updates the editor to view the given JSON file
:param file_path: path to the json file to
load
:param file_path: path to the json file to
view & edit
"""
files
=
self
.
watcher
.
files
()
if
files
:
self
.
watcher
.
removePaths
(
files
)
self
.
watcher
.
addPath
(
file_path
)
self
.
show_editor_for_path
(
file_path
)
self
.
show_json
(
file_path
)
def
show_json
(
self
,
file_path
):
"""
Display the content of the file given in parameter
:param file_path: path to the json file to load
"""
with
open
(
file_path
)
as
json_file
:
self
.
jsonWidget
.
setText
(
json_file
.
read
())
contents
=
json_file
.
read
()
self
.
jsonWidget
.
setText
(
contents
)
def
show_editor_for_path
(
self
,
file_path
):
"""
Changes the editor tab to the correct editor
:param file_path: path to the json file to edit
"""
self
.
editor
=
QWidget
()
if
"
/databases/
"
in
file_path
:
pass
elif
"
/dataformats/
"
in
file_path
:
pass
elif
"
/libraries/
"
in
file_path
:
self
.
editor
=
LibraryEditorWidget
(
file_path
,
self
)
elif
"
/algorithms/
"
in
file_path
:
pass
elif
"
/toolchains/
"
in
file_path
:
pass
elif
"
/experiments/
"
in
file_path
:
pass
elif
"
/plotters/
"
in
file_path
:
pass
elif
"
/plotterparameters/
"
in
file_path
:
pass
self
.
tabWidget
.
removeTab
(
0
)
self
.
tabWidget
.
insertTab
(
0
,
self
.
editor
,
self
.
tr
(
"
Editor
"
))
self
.
tabWidget
.
setCurrentIndex
(
0
)
Loading