-
Notifications
You must be signed in to change notification settings - Fork 31
Merge vnotebook into master to add VNotebook widget #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sbordeyne
wants to merge
15
commits into
master
Choose a base branch
from
vnotebook
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
920de93
Create VNotebook widget
RedFantom 21519fa
Finish VNotebook functionality
RedFantom 906baf0
Fix issues with VNotebook and build tests
RedFantom 079b157
example, entry in authors.md, setup
dogeek 7412030
Merge branch 'master' into vnotebook
dogeek 7aa9775
Fix VNotebook tests
j4321 76fb8d5
Disable Python 2 CI and enable 3.7 and 3.8
RedFantom 8b8085a
fixed syntax warnings, and removed ttkthemes dependancy
dogeek 0cc8a1e
Add VNotebook in sphinx doc
j4321 4c8a4e2
Improve VNotebook docstrings formatting
j4321 79d59c3
fixed a test
dogeek f6dbfeb
test fix (again)?
dogeek 3881a6d
Resolve conflicts with master
j4321 1aa18c8
Remove unused Font import in vnotebook.py
j4321 7754205
fixed odd `add` behavior. Replaced ttk.Frame.configure with super() c…
dogeek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -14,3 +14,4 @@ ttkwidgets.frames | |
Balloon | ||
ScrolledFrame | ||
ToggledFrame | ||
VNotebook |
10 changes: 10 additions & 0 deletions
10
docs/source/ttkwidgets/ttkwidgets.frames/ttkwidgets.frames.VNotebook.rst
This file contains hidden or 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,10 @@ | ||
VNotebook | ||
========= | ||
|
||
.. currentmodule:: ttkwidgets.frames | ||
|
||
.. autoclass:: VNotebook | ||
:show-inheritance: | ||
:members: | ||
|
||
.. automethod:: __init__ |
This file contains hidden or 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,19 @@ | ||
from ttkwidgets import VNotebook | ||
import tkinter.ttk as ttk | ||
import tkinter as tk | ||
|
||
|
||
def callback(): | ||
notebook.hide(id_) | ||
|
||
|
||
root = tk.Tk() | ||
notebook = VNotebook(root, compound=tk.RIGHT) | ||
notebook.add(ttk.Scale(notebook), text="Scale") | ||
notebook.add(ttk.Button(notebook, text="Destroy", command=root.destroy), text="Button") | ||
frame = ttk.Frame(notebook) | ||
id_ = notebook.add(frame, text="Hidden") | ||
ttk.Button(frame, command=callback, text="Hide").grid() | ||
notebook.enable_traversal() | ||
notebook.grid(row=1) | ||
root.mainloop() |
This file contains hidden or 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 hidden or 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,71 @@ | ||
""" | ||
Author: RedFantom | ||
License: GNU GPLv3, as in LICENSE.md | ||
Copyright (C) 2018 RedFantom | ||
""" | ||
from unittest import TestCase | ||
# Basic UI imports | ||
import tkinter as tk | ||
from tkinter import ttk | ||
# Module to test | ||
from ttkwidgets.frames import VNotebook | ||
|
||
|
||
class TestVNotebook(TestCase): | ||
def setUp(self): | ||
self.window = tk.Tk() | ||
|
||
def tearDown(self): | ||
self.window.destroy() | ||
|
||
def test_init(self): | ||
VNotebook(self.window).grid() | ||
self.window.update() | ||
|
||
def _add_test_frame(self, notebook, **kwargs): | ||
notebook.grid() | ||
frame = ttk.Frame(notebook) | ||
ttk.Scale(frame).grid() | ||
frame.grid() | ||
return notebook.add(frame, text="Test", **kwargs) | ||
|
||
def test_add(self): | ||
notebook = VNotebook(self.window) | ||
self._add_test_frame(notebook) | ||
self.window.update() | ||
|
||
def test_compound(self): | ||
for compound in (tk.BOTTOM, tk.TOP, tk.RIGHT, tk.LEFT): | ||
VNotebook(self.window, compound=compound).grid() | ||
self.window.update() | ||
|
||
def test_index(self): | ||
notebook = VNotebook(self.window) | ||
self._add_test_frame(notebook) | ||
frame = ttk.Frame(notebook) | ||
notebook.insert(0, frame) | ||
self.assertEqual(notebook.tabs[0], notebook.get_id_for_tab(frame)) | ||
self.assertEqual(0, notebook.index(frame)) | ||
|
||
def test_enable_traversal(self): | ||
notebook = VNotebook(self.window) | ||
self._add_test_frame(notebook) | ||
self._add_test_frame(notebook) | ||
notebook.enable_traversal() | ||
active = notebook.active | ||
notebook._switch_tab(None) | ||
self.assertNotEqual(active, notebook.active) | ||
|
||
def test_tab_config(self): | ||
notebook = VNotebook(self.window) | ||
id = self._add_test_frame(notebook) | ||
notebook.tab_configure(id, text="Hello") | ||
self.assertEqual(notebook.tab_cget(id, "text"), "Hello") | ||
|
||
def test_activate(self): | ||
notebook = VNotebook(self.window) | ||
self._add_test_frame(notebook) | ||
self._add_test_frame(notebook) | ||
self.assertEqual(notebook.tabs[0], notebook.active) | ||
notebook.activate_index(1) | ||
self.assertEqual(notebook.tabs[1], notebook.active) |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can add some more tests, like for the
configure()
method. I can write some.