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
6c1f862f
Commit
6c1f862f
authored
3 years ago
by
Florian Bruhin
Browse files
Options
Downloads
Patches
Plain Diff
Prevent link click navigation
Fixes
#18
parent
664e23e8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
commander/gui/notebook.py
+7
-0
7 additions, 0 deletions
commander/gui/notebook.py
with
7 additions
and
0 deletions
commander/gui/notebook.py
+
7
−
0
View file @
6c1f862f
...
...
@@ -3,6 +3,7 @@ from __future__ import annotations
import
pathlib
import
logging
import
functools
from
PyQt6.QtWebEngineCore
import
QWebEngineNavigationRequest
import
nbconvert
import
nbformat
...
...
@@ -19,6 +20,7 @@ class NotebookView(QWebEngineView):
super
().
__init__
(
parent
)
self
.
nodeid_to_tag
=
{}
self
.
_html_cache
=
{}
self
.
page
().
navigationRequested
.
connect
(
self
.
_on_navigation_requested
)
def
_render
(
self
,
path
:
pathlib
.
Path
)
->
str
:
key
=
(
git
.
current_commit
(),
path
)
...
...
@@ -33,6 +35,11 @@ class NotebookView(QWebEngineView):
self
.
_html_cache
[
key
]
=
html
return
html
def
_on_navigation_requested
(
self
,
request
:
QWebEngineNavigationRequest
)
->
None
:
link_clicked
=
QWebEngineNavigationRequest
.
NavigationType
.
LinkClickedNavigation
if
request
.
navigationType
()
==
link_clicked
:
request
.
reject
()
@pyqtSlot
(
pathlib
.
Path
)
def
on_folder_changed
(
self
,
path
:
pathlib
.
Path
)
->
None
:
notebooks
=
list
(
path
.
glob
(
'
*.ipynb
'
))
...
...
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