-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,301 additions
and
152 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
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
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,67 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<tkinter.Tk xmlns:attr="http://www.hoversetformationstudio.com/styles/" xmlns:layout="http://www.hoversetformationstudio.com/layouts/" xmlns:menu="http://www.hoversetformationstudio.com/menu" name="tk_1" attr:menu="menu_3" attr:layout="place" layout:width="302" layout:height="301" layout:x="30" layout:y="30"> | ||
<meth name="title"> | ||
<arg value="title"/> | ||
</meth> | ||
<meth name="geometry"> | ||
<arg value="302x268+0+0"/> | ||
</meth> | ||
<meta major="7" minor="0" name="version"/> | ||
<tkinter.StringVar attr:name="str_var" attr:value=""/> | ||
<tkinter.Menu name="menu_3" attr:activeborderwidth="1" attr:borderwidth="1" attr:cursor="" attr:font="{Segoe UI} 9"> | ||
<tkinter.Menu attr:activeborderwidth="1" attr:borderwidth="1" attr:font="{Segoe UI} 9" attr:tearoff="0" menu:compound="none" menu:label="cascade_3" menu:state="normal"> | ||
<command menu:compound="none" menu:label="command_11" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_14" menu:state="normal"/> | ||
</tkinter.Menu> | ||
<tkinter.Menu attr:activeborderwidth="1" attr:borderwidth="1" attr:font="{Segoe UI} 9" attr:tearoff="0" menu:compound="none" menu:label="cascade_4" menu:state="normal"> | ||
<command menu:compound="none" menu:label="command_12" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_15" menu:state="normal"/> | ||
</tkinter.Menu> | ||
<tkinter.Menu attr:activeborderwidth="1" attr:borderwidth="1" attr:font="{Segoe UI} 9" attr:tearoff="0" menu:compound="none" menu:label="cascade_5" menu:state="normal"> | ||
<command menu:compound="none" menu:label="command_13" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_16" menu:state="normal"/> | ||
</tkinter.Menu> | ||
</tkinter.Menu> | ||
<tkinter.Menubutton name="menubutton_1" attr:menu="menu_1" attr:padx="5" attr:pady="4" attr:text="menubutton_1" layout:width="166" layout:height="25" layout:x="69" layout:y="36" layout:bordermode="outside"> | ||
<tkinter.Menu name="menu_1" attr:activeborderwidth="1" attr:borderwidth="1" attr:font="{Segoe UI} 9" attr:tearoff="0"> | ||
<command menu:background="green" menu:compound="none" menu:label="command_1" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_2" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_3" menu:state="disabled"/> | ||
<checkbutton menu:variable="str_var" menu:compound="none" menu:label="check button_1" menu:state="normal"/> | ||
<radiobutton menu:value="radio button_1" menu:variable="" menu:compound="none" menu:label="radio button_1" menu:state="normal"/> | ||
<separator/> | ||
<tkinter.Menu attr:activeborderwidth="1" attr:borderwidth="1" attr:font="{Segoe UI} 9" attr:tearoff="0" menu:compound="none" menu:label="cascade_1" menu:state="normal"> | ||
<command menu:compound="none" menu:label="command_4" menu:state="normal"/> | ||
<checkbutton menu:compound="none" menu:label="check button_2" menu:state="normal"/> | ||
<radiobutton menu:value="radio button_2" menu:variable="" menu:compound="none" menu:label="radio button_2" menu:state="normal"/> | ||
<separator/> | ||
<tkinter.Menu attr:activeborderwidth="1" attr:background="red" attr:borderwidth="1" attr:font="{Segoe UI} 9" attr:tearoff="0" menu:compound="none" menu:label="cascade_2" menu:state="normal"> | ||
<command menu:compound="none" menu:label="command_5" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_6" menu:state="normal"/> | ||
</tkinter.Menu> | ||
</tkinter.Menu> | ||
</tkinter.Menu> | ||
</tkinter.Menubutton> | ||
<tkinter.ttk.Menubutton name="menubutton_2" attr:menu="menu_2" attr:text="menubutton_2" layout:width="180" layout:height="25" layout:x="68" layout:y="91" layout:bordermode="outside"> | ||
<tkinter.Menu name="menu_2" attr:activeborderwidth="1" attr:borderwidth="1" attr:font="{Segoe UI} 9" attr:foreground="grey20" attr:postcommand="test_command" attr:tearoffcommand="test_command" attr:title="menu_2"> | ||
<command menu:command="test_command" menu:compound="none" menu:label="command_7" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_8" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_9" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_10" menu:state="normal"/> | ||
</tkinter.Menu> | ||
</tkinter.ttk.Menubutton> | ||
<tkinter.ttk.Menubutton name="menubutton_3" attr:text="menubutton_3" layout:width="185" layout:height="25" layout:x="63" layout:y="149" layout:bordermode="outside"> | ||
<tkinter.Menu attr:activeborderwidth="1" attr:borderwidth="1" attr:font="{Segoe UI} 9"> | ||
<command menu:compound="none" menu:label="command_1" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_2" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_3" menu:state="normal"/> | ||
</tkinter.Menu> | ||
</tkinter.ttk.Menubutton> | ||
<tkinter.ttk.Menubutton name="menubutton_4" attr:text="menubutton_3" layout:width="185" layout:height="25" layout:x="63" layout:y="209" layout:bordermode="outside"> | ||
<tkinter.Menu name="menu_55" attr:activeborderwidth="1" attr:borderwidth="1" attr:font="{Segoe UI} 9"> | ||
<command menu:compound="none" menu:label="command_1" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_2" menu:state="normal"/> | ||
<command menu:compound="none" menu:label="command_3" menu:state="normal"/> | ||
</tkinter.Menu> | ||
</tkinter.ttk.Menubutton> | ||
</tkinter.Tk> |
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,65 @@ | ||
import tkinter | ||
import unittest | ||
|
||
from formation import AppBuilder | ||
from formation.tests.support import get_resource | ||
|
||
|
||
class MenuTestCase(unittest.TestCase): | ||
builder = None | ||
|
||
@classmethod | ||
def setUpClass(cls) -> None: | ||
cls.builder = AppBuilder(path=get_resource("menu.xml")) | ||
|
||
@classmethod | ||
def tearDownClass(cls) -> None: | ||
cls.builder._app.destroy() | ||
|
||
def test_command(self): | ||
pass | ||
|
||
def test_menubutton_legacy(self): | ||
mb1 = self.builder.menubutton_1 | ||
self.assertEqual(mb1.nametowidget(mb1.cget("menu")), self.builder.menu_1) | ||
|
||
def test_menubutton_native(self): | ||
mb2 = self.builder.menubutton_2 | ||
self.assertEqual(mb2.nametowidget(mb2.cget("menu")), self.builder.menu_2) | ||
|
||
def test_toplevel(self): | ||
tk1 = self.builder.tk_1 | ||
self.assertEqual(tk1.nametowidget(tk1.cget("menu")), self.builder.menu_3) | ||
|
||
def test_menuitem_config(self): | ||
m1 = self.builder.menu_1 | ||
self.assertEqual(str(m1.entrycget(0, "background")), "green") | ||
self.assertEqual(m1.entrycget(1, "label"), "command_2") | ||
self.assertEqual(str(m1.entrycget(2, "state")), "disabled") | ||
self.assertEqual(str(m1.entrycget(3, "variable")), str(self.builder.str_var)) | ||
|
||
def test_cascade_menu_config(self): | ||
m1 = self.builder.menu_1 | ||
m2 = m1.nametowidget(m1.entrycget(6, "menu")) | ||
m3 = m2.nametowidget(m2.entrycget(4, "menu")) | ||
self.assertEqual(m3.cget("tearoff"), 0) | ||
self.assertEqual(str(m3.cget("background")), "red") | ||
|
||
def test_menu_config(self): | ||
m2 = self.builder.menu_2 | ||
self.assertEqual(str(m2.cget("foreground")), "grey20") | ||
self.assertEqual(m2.cget("title"), "menu_2") | ||
|
||
def test_command_binding(self): | ||
self.builder.connect_callbacks(self) | ||
m2 = self.builder.menu_2 | ||
self.assertNotEqual(m2.cget("postcommand"), '') | ||
self.assertNotEqual(m2.cget("tearoffcommand"), '') | ||
self.assertNotEqual(m2.entrycget(1, "command"), '') | ||
|
||
def test_old_format_backwards_compatibility(self): | ||
mb3 = self.builder.menubutton_3 | ||
mb4 = self.builder.menubutton_4 | ||
menu55 = self.builder.menu_55 | ||
self.assertIsInstance(mb3.nametowidget(mb3.cget("menu")), tkinter.Menu) | ||
self.assertNotEqual(mb4.nametowidget(mb4.cget("menu")), menu55) |
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
primaryaccent: #3a3a3a; | ||
accent: #3d8aff; | ||
secondary1: #3dff3d; | ||
secondary2: #ff743d; | ||
|
||
} | ||
.spinbox{ | ||
|
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
Oops, something went wrong.