Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Commander
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
INS Courses
AutPy
Commander
Commits
bd0529ae
Commit
bd0529ae
authored
3 years ago
by
Florian Bruhin
Browse files
Options
Downloads
Patches
Plain Diff
Add ext opening for report
Notebook is more involved as it's not a file on-disk See
#7
parent
6c1f862f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
commander/gui/report.py
+4
-1
4 additions, 1 deletion
commander/gui/report.py
commander/gui/utils.py
+13
-2
13 additions, 2 deletions
commander/gui/utils.py
with
17 additions
and
3 deletions
commander/gui/report.py
+
4
−
1
View file @
bd0529ae
...
...
@@ -9,6 +9,8 @@ from PyQt6.QtWidgets import QWidget, QTextEdit, QStackedLayout
from
PyQt6.QtGui
import
QTextCursor
,
QTextDocument
from
PyQt6.QtCore
import
QUrl
,
pyqtSlot
from
commander.gui
import
utils
class
ReportView
(
QWidget
):
...
...
@@ -24,6 +26,8 @@ class ReportView(QWidget):
self
.
_webview
=
QWebEngineView
()
self
.
_layout
.
addWidget
(
self
.
_webview
)
utils
.
init_open_action
(
self
,
self
.
_webview
.
url
)
@pyqtSlot
(
str
)
def
scroll_to_nodeid
(
self
,
nodeid
:
str
)
->
None
:
if
self
.
_layout
.
currentWidget
()
is
self
.
_webview
:
...
...
@@ -94,4 +98,3 @@ class ReportView(QWidget):
self
.
_webview
.
setUrl
(
QUrl
.
fromLocalFile
(
str
(
path
)))
self
.
_layout
.
setCurrentWidget
(
self
.
_webview
)
self
.
setFocusProxy
(
self
.
_webview
)
This diff is collapsed.
Click to expand it.
commander/gui/utils.py
+
13
−
2
View file @
bd0529ae
import
pathlib
from
typing
import
Callable
from
PyQt6.QtCore
import
Qt
from
PyQt6.QtGui
import
QColor
from
PyQt6.QtCore
import
Qt
,
QUrl
from
PyQt6.QtGui
import
QAction
,
QColor
,
QDesktopServices
,
QKeySequence
from
PyQt6.QtWidgets
import
QWidget
REPO_DIR
=
pathlib
.
Path
(
__file__
).
parents
[
2
]
...
...
@@ -33,3 +35,12 @@ def removeprefix(s: str, prefix: str) -> str:
return
s
[
len
(
prefix
):]
else
:
return
s
[:]
def
init_open_action
(
widget
:
QWidget
,
url_getter
:
Callable
[[],
QUrl
])
->
QAction
:
open_action
=
QAction
(
widget
)
open_action
.
setShortcut
(
QKeySequence
(
'
Ctrl+Return
'
))
open_action
.
setShortcutContext
(
Qt
.
ShortcutContext
.
WidgetWithChildrenShortcut
)
open_action
.
triggered
.
connect
(
lambda
:
QDesktopServices
.
openUrl
(
url_getter
()))
widget
.
addAction
(
open_action
)
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