├── .gitignore ├── AUTHORS ├── CONTRIBUTING.md ├── LICENSE ├── MANIFEST.in ├── README.rst ├── setup.py └── toga_demo ├── __init__.py ├── __main__.py ├── app.py └── icons └── brutus-32.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *~ 3 | .*.sw[op] 4 | *.egg-info 5 | dist 6 | build 7 | _build 8 | distribute-* 9 | macOS 10 | iOS 11 | android 12 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Toga Demo was originally created in July 2014. 2 | 3 | The PRIMARY AUTHORS are (and/or have been): 4 | Russell Keith-Magee 5 | 6 | And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- 7 | people who have submitted patches, reported bugs, added translations, helped 8 | answer newbie questions, and generally made Toga Demo that much better: 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | PyBee <3's contributions! 4 | 5 | Please be aware, PyBee operates under a Code of Conduct. 6 | 7 | See [CONTRIBUTING to PyBee](http://pybee.org/contributing) for details. 8 | 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Russell Keith-Magee. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of Toga Demo nor the names of its contributors may 15 | be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.rst 2 | include AUTHORS 3 | include LICENSE 4 | recursive-include toga_demo *.png -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | **THIS REPOSITORY IS IN THE ATTIC** 2 | 3 | This functionality has been merged into the main `Toga `__ repository. 4 | 5 | Toga Demo 6 | ========= 7 | 8 | A demonstration of the capabilities of the `Toga widget toolkit`_. 9 | 10 | **Toga requires Python 3** 11 | 12 | Quickstart 13 | ---------- 14 | 15 | For details of Toga's pre-requisites, see the `toga repository on GitHub`_. 16 | 17 | Once those pre-requisites have been met, in your virtualenv, install Toga Demo, 18 | and then run it:: 19 | 20 | $ pip install toga-demo 21 | $ toga-demo 22 | 23 | This will pop up a GUI window. 24 | 25 | If you have cloned the toga-demo repository, you can run the demo like this:: 26 | 27 | $ pip install toga 28 | $ python -m toga_demo 29 | 30 | Community 31 | --------- 32 | 33 | Toga Demo is part of the `BeeWare suite`_. You can talk to the community through: 34 | 35 | * `@pybeeware on Twitter`_ 36 | 37 | * The `pybee/general`_ channel on Gitter. 38 | 39 | Contributing 40 | ------------ 41 | 42 | If you experience problems with Toga Demo, `log them on GitHub`_. If you 43 | want to contribute code, please `fork the code`_ and `submit a pull request`_. 44 | 45 | .. _BeeWare suite: http://pybee.org 46 | .. _Read The Docs: http://toga-demo.readthedocs.org 47 | .. _Toga widget toolkit: http://pybee.org/toga 48 | .. _toga repository on GitHub: https://github.com/pybee/toga 49 | .. _@pybeeware on Twitter: https://twitter.com/pybeeware 50 | .. _pybee/general: https://gitter.im/pybee/general 51 | .. _log them on Github: https://github.com/pybee/toga-demo/issues 52 | .. _fork the code: https://github.com/pybee/toga-demo 53 | .. _submit a pull request: https://github.com/pybee/toga-demo/pulls 54 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #/usr/bin/env python 2 | import io 3 | import re 4 | from setuptools import setup, find_packages 5 | import sys 6 | 7 | 8 | if sys.version_info[:3] < (3, 4): 9 | raise SystemExit("Toga requires Python 3.4+.") 10 | 11 | 12 | with io.open('./toga_demo/__init__.py', encoding='utf8') as version_file: 13 | version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file.read(), re.M) 14 | if version_match: 15 | version = version_match.group(1) 16 | else: 17 | raise RuntimeError("Unable to find version string.") 18 | 19 | 20 | with io.open('README.rst', encoding='utf8') as readme: 21 | long_description = readme.read() 22 | 23 | 24 | setup( 25 | name='toga-demo', 26 | version=version, 27 | description='A demonstration of the capabilities of the Toga widget toolkit.', 28 | long_description=long_description, 29 | author='Russell Keith-Magee', 30 | author_email='russell@keith-magee.com', 31 | url='http://pybee.org/toga-demo', 32 | include_package_data=True, 33 | packages=find_packages(), 34 | package_data={ 35 | 'toga_demo': ['icons/*.icns', 'icons/*.png'], 36 | }, 37 | install_requires=[ 38 | 'toga==%s' % version 39 | ], 40 | entry_points={ 41 | 'console_scripts': [ 42 | 'toga-demo = toga_demo.__main__:run', 43 | ] 44 | }, 45 | license='New BSD', 46 | classifiers=[ 47 | 'Development Status :: 4 - Beta', 48 | 'Intended Audience :: Developers', 49 | 'License :: OSI Approved :: BSD License', 50 | 'Operating System :: OS Independent', 51 | 'Programming Language :: Python :: 3', 52 | 'Programming Language :: Python :: 3.4', 53 | 'Programming Language :: Python :: 3.5', 54 | 'Programming Language :: Python :: 3 :: Only', 55 | 'Topic :: Software Development', 56 | 'Topic :: Utilities', 57 | ], 58 | options={ 59 | 'app': { 60 | 'formal_name': 'Toga Demo', 61 | 'bundle': 'org.pybee', 62 | # 'icon': 'icons/macos', 63 | }, 64 | # 'ios': { 65 | # 'app_requires': [ 66 | # 'toga-ios' 67 | # ] 68 | # }, 69 | 'django': { 70 | 'app_requires': [ 71 | 'toga-django' 72 | ] 73 | }, 74 | 'macos': { 75 | 'app_requires': [ 76 | ] 77 | }, 78 | 'linux': { 79 | 'app_requires': [ 80 | ] 81 | }, 82 | 'windows': { 83 | 'app_requires': [ 84 | ] 85 | }, 86 | # 'android': { 87 | # 'app_requires': [ 88 | # 'toga-android' 89 | # ] 90 | # } 91 | } 92 | ) 93 | -------------------------------------------------------------------------------- /toga_demo/__init__.py: -------------------------------------------------------------------------------- 1 | # Examples of valid version strings 2 | # __version__ = '1.2.3.dev1' # Development release 1 3 | # __version__ = '1.2.3a1' # Alpha Release 1 4 | # __version__ = '1.2.3b1' # Beta Release 1 5 | # __version__ = '1.2.3rc1' # RC Release 1 6 | # __version__ = '1.2.3' # Final Release 7 | # __version__ = '1.2.3.post1' # Post Release 1 8 | 9 | __version__ = '0.2.14' 10 | -------------------------------------------------------------------------------- /toga_demo/__main__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from toga_demo.app import main 3 | 4 | def run(): 5 | main().main_loop() 6 | 7 | if __name__ == '__main__': 8 | run() -------------------------------------------------------------------------------- /toga_demo/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import toga 5 | from colosseum import CSS 6 | 7 | 8 | class TogaDemo(toga.App): 9 | 10 | def startup(self): 11 | # Create the main window 12 | self.main_window = toga.MainWindow(self.name) 13 | self.main_window.app = self 14 | 15 | left_container = toga.OptionContainer() 16 | 17 | left_table = toga.Table(['Hello', 'World']) 18 | 19 | left_table.insert(None, 'root1', 'value1') 20 | left_table.insert(None, 'root2', 'value2') 21 | left_table.insert(None, 'root3', 'value3') 22 | left_table.insert(1, 'root4', 'value4') 23 | 24 | left_tree = toga.Tree(['Navigate']) 25 | 26 | left_tree.insert(None, None, 'root1') 27 | 28 | root2 = left_tree.insert(None, None, 'root2') 29 | 30 | left_tree.insert(root2, None, 'root2.1') 31 | root2_2 = left_tree.insert(root2, None, 'root2.2') 32 | 33 | left_tree.insert(root2_2, None, 'root2.2.1') 34 | left_tree.insert(root2_2, None, 'root2.2.2') 35 | left_tree.insert(root2_2, None, 'root2.2.3') 36 | 37 | left_container.add('Table', left_table) 38 | left_container.add('Tree', left_tree) 39 | 40 | right_content = toga.Box() 41 | for b in range(0, 10): 42 | right_content.add(toga.Button('Hello world %s' % b, on_press=self.button_handler, style=CSS(margin=20))) 43 | 44 | right_container = toga.ScrollContainer() 45 | 46 | right_container.content = right_content 47 | 48 | split = toga.SplitContainer() 49 | 50 | split.content = [left_container, right_container] 51 | 52 | cmd1 = toga.Command(self.action1, 'Action 1', tooltip='Perform action 1', icon=os.path.join(os.path.dirname(__file__), 'icons/brutus-32.png')) 53 | cmd2 = toga.Command(self.action2, 'Action 2', tooltip='Perform action 2', icon=toga.TIBERIUS_ICON) 54 | 55 | self.main_window.toolbar = [cmd1, toga.SEPARATOR, cmd2] 56 | 57 | self.main_window.content = split 58 | 59 | # Show the main window 60 | self.main_window.show() 61 | 62 | def button_handler(self, widget): 63 | print("button press") 64 | for i in range(0, 10): 65 | yield 1 66 | print ('still running... (iteration %s)' % i) 67 | 68 | def action1(self, widget): 69 | self.main_window.info_dialog('Toga', 'THIS! IS! TOGA!!') 70 | 71 | def action2(self, widget): 72 | if self.main_window.question_dialog('Toga', 'Is this cool or what?'): 73 | self.main_window.info_dialog('Happiness', 'I know, right! :-)') 74 | else: 75 | self.main_window.info_dialog('Shucks...', "Well aren't you a spoilsport... :-(") 76 | 77 | 78 | def main(): 79 | return TogaDemo('Toga Demo', 'org.pybee.toga-demo') 80 | -------------------------------------------------------------------------------- /toga_demo/icons/brutus-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pybee/toga-demo/e9ad0c29bb6ae6935f7a6f1f0907bbc28fe71d28/toga_demo/icons/brutus-32.png --------------------------------------------------------------------------------