Skip to content

Commit

Permalink
Add a config to determine whether the graph page is displayed by defa…
Browse files Browse the repository at this point in the history
…ult and a config to set the ratio between the links page and the graph page
  • Loading branch information
gugutu committed Feb 22, 2024
1 parent f48894e commit 6f1fe17
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
4 changes: 3 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def injectPage(self, editor: Editor):
innerSplitter.setOrientation(Qt.Orientation.Vertical)
innerSplitter.addWidget(editor.linksPage)
innerSplitter.addWidget(editor.graphPage)
innerSplitter.setSizes([10000, 10000])
innerSplitter.setSizes([int(r) * 10000 for r in config["splitRatioBetweenLinksPageAndGraphPage"].split(":")])

layout = editor.web.parentWidget().layout()
if layout is None:
Expand Down Expand Up @@ -185,6 +185,8 @@ def injectPage(self, editor: Editor):
layout.insertWidget(web_index, outerSplitter)
if not config['showLinksPageAutomatically']:
editor.linksPage.hide()
if not config['showGraphPageAutomatically']:
editor.graphPage.hide()

def injectButton(self, buttons: list[str], editor: Editor):
if editor.addMode:
Expand Down
2 changes: 2 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"showLinksPageAutomatically": true,
"showGraphPageAutomatically": true,
"splitRatio": "2:1",
"splitRatioBetweenLinksPageAndGraphPage": "1:1",
"location": "right"
}
28 changes: 20 additions & 8 deletions config.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
### Config
- `showLinksPageAutomatically` [boolean (true | false)]:<br/>
&nbsp;&nbsp;&nbsp;Defines if the link page should show up automatically as you enter the Editor (default: true)<br/><br/>
- `splitRatio` [int:int]:<br/>
&nbsp;&nbsp;&nbsp;Defines the default split ratio of the editor view and links page (default: 2:1)<br/>
<br/>
- `location` [string (left | right)]:<br/>
&nbsp;&nbsp;&nbsp;Defines where to render the links page (default: right)
<br/>

`showLinksPageAutomatically` `[boolean (true | false)]`:

- Defines if the link page should show up automatically as you enter the Editor (default: `true`)

`showGraphPageAutomatically` `[boolean (true | false)]`:

- Defines if the graph page should show up automatically as you enter the Editor (default: `true`)

`splitRatio` `[string (int:int)]`:

- Defines the default split ratio of the editor view and links page (default: `"2:1"`)

`splitRatioBetweenLinksPageAndGraphPage` `[string (int:int)]`:

- Defines the default split ratio of the links page and graph page (default: `"1:1"`)

`location` `[string (left | right)]`:

- Defines which side of the editor to display (default: `"right"`)

0 comments on commit 6f1fe17

Please sign in to comment.