pybee / toga-demo

A demonstration of the capabilities of the Toga widget toolkit.
BSD 3-Clause "New" or "Revised" License
16 stars 9 forks source link

toga-demo 0.2.14 problem with toga.SEPARATOR #15

Closed selasley closed 7 years ago

selasley commented 7 years ago

I tried running the toga-demo 0.2.14 with python3.6.2 under OS X 10.12.6 and got this traceback

Traceback (most recent call last): File "toga214/bin/toga-demo", line 11, in sys.exit(run()) File "/Users/selasley/toga214/lib/python3.6/site-packages/toga_demo/main.py", line 5, in run main().main_loop() File "/Users/selasley/toga214/lib/python3.6/site-packages/toga_cocoa/app.py", line 167, in main_loop self._startup() File "/Users/selasley/toga214/lib/python3.6/site-packages/toga_cocoa/app.py", line 118, in _startup self.startup() File "/Users/selasley/toga214/lib/python3.6/site-packages/toga_demo/app.py", line 55, in startup self.main_window.toolbar = [cmd1, toga.SEPARATOR, cmd2] AttributeError: module 'toga' has no attribute 'SEPARATOR'

The demo runs and buttons and menus work after changing line 55 in toga_demo/app.py from self.main_window.toolbar = [cmd1, toga.SEPARATOR, cmd2] to self.main_window.toolbar.add(cmd1, cmd2)

but it displays this traceback in the Terminal

Traceback (most recent call last): File "_ctypes/callbacks.c", line 234, in 'calling callback function' File "/Users/selasley/toga214/lib/python3.6/site-packages/rubicon/objc/objc.py", line 1050, in _objc_method result = f(py_self, *args) File "/Users/selasley/toga214/lib/python3.6/site-packages/toga_cocoa/app.py", line 55, in applicationopenFiles for i in range(0, len(filenames)): TypeError: object of type 'ObjCInstance' has no len()

This traceback is also displayed for the scripts in the toga tutorial.

Thanks for creating toga and the whole BeeWare project.

freakboy3742 commented 7 years ago

Thanks for the report. Your change to toolbar.add() is clearly correct, which is an oversight on my part. The subsequent error appears to be an issue with Rubicon; can you confirm the version of Rubicon that is installed?

selasley commented 7 years ago

pip list shows rubicon-objc 0.2.7

selasley commented 7 years ago

I added some lines to print the type and dir of filename

<class 'rubicon.objc.objc.ObjCInstance'>

['class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattr', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_asparameter', '_cached_objects', 'objc_class', 'ptr']

csawyerYumaed commented 7 years ago

using latest git head of toga-demo and changing the line per @selasley

I get this: Traceback (most recent call last): File "/usr/local/bin//toga-demo", line 11, in load_entry_point('toga-demo', 'console_scripts', 'toga-demo')() File "~/src/toga-demo/toga_demo/main.py", line 5, in run main().main_loop() File "/usr/local/lib/python3.6/site-packages/toga_cocoa/app.py", line 167, in main_loop self._startup() File "/usr/local/lib/python3.6/site-packages/toga_cocoa/app.py", line 118, in _startup self.startup() File "~/src/toga-demo/toga_demo/app.py", line 55, in startup self.main_window.toolbar = [cmd1, cmd2] AttributeError: can't set attribute

versions from pip3 list: toga (0.2.14) toga-cocoa (0.2.14) toga-core (0.2.14) toga-demo (0.2.13, ~/src/toga-demo)