-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #345 from jitseniesen/config-theme
PR: Allow user to config notebook theme
- Loading branch information
Showing
4 changed files
with
105 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (c) Spyder Project Contributors | ||
# Licensed under the terms of the MIT License | ||
|
||
"""Spyder configuration page for notebook plugin.""" | ||
|
||
# Qt imports | ||
from qtpy.QtWidgets import QGridLayout, QGroupBox, QVBoxLayout | ||
|
||
# Spyder imports | ||
from spyder.api.preferences import PluginConfigPage | ||
|
||
# Local imports | ||
from spyder_notebook.utils.localization import _ | ||
|
||
|
||
class NotebookConfigPage(PluginConfigPage): | ||
"""Widget with configuration options for notebook plugin.""" | ||
|
||
def setup_page(self): | ||
"""Fill configuration page with widgets.""" | ||
themes = ['Same as Spyder', 'Light', 'Dark'] | ||
theme_choices = list(zip(themes, | ||
[theme.lower() for theme in themes])) | ||
theme_combo = self.create_combobox( | ||
_('Notebook theme'), theme_choices, 'theme', restart=True) | ||
|
||
interface_layout = QGridLayout() | ||
interface_layout.addWidget(theme_combo.label, 0, 0) | ||
interface_layout.addWidget(theme_combo.combobox, 0, 1) | ||
interface_group = QGroupBox(_('Interface')) | ||
interface_group.setLayout(interface_layout) | ||
|
||
vlayout = QVBoxLayout() | ||
vlayout.addWidget(interface_group) | ||
vlayout.addStretch(1) | ||
self.setLayout(vlayout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright © Spyder Project Contributors | ||
# Licensed under the terms of the MIT License | ||
# | ||
|
||
"""Tests for config.py""" | ||
|
||
# Third-party library imports | ||
import pytest | ||
|
||
# Spyder imports | ||
from spyder.preferences.configdialog import ConfigDialog | ||
|
||
# Local imports | ||
from spyder_notebook.config import NotebookConfigPage | ||
from spyder_notebook.tests.test_plugin import plugin_no_server | ||
|
||
|
||
def test_config(mocker, plugin_no_server, qtbot): | ||
"""Test that config page can be created and shown.""" | ||
dlg = ConfigDialog() | ||
page = NotebookConfigPage(plugin_no_server, parent=plugin_no_server) | ||
page.initialize() | ||
dlg.add_page(page) | ||
dlg.show() | ||
qtbot.addWidget(dlg) | ||
# no assert, just check that the config page can be created | ||
|
||
|
||
if __name__ == "__main__": | ||
pytest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters