Giter Club home page Giter Club logo

pyface's Introduction

Pyface: Traits-capable Windowing Framework

The Pyface project contains a toolkit-independent GUI abstraction layer, which is used to support the "visualization" features of the Enthought Tool Suite libraries. Pyface contains Traits-aware wrappers of standard GUI elements such as Windows, Dialogs and Fields, together with the "Tasks" application framework which provides a rich GUI experience with dock panes, tabbed editors, and so forth. This permits you to write cross-platform interactive GUI code without needing to use the underlying GUI backend.

The following GUI backends are supported:

  • PySide2 (stable) and PySide6 (experimental)
  • PyQt5 (stable) and PyQt6 (in development)
  • wxPython 4 (experimental)

Example

The following code creates a window with a simple Python shell:

from pyface.api import ApplicationWindow, GUI, IPythonShell

class MainWindow(ApplicationWindow):
    """ The main application window. """

    #: The PythonShell that forms the contents of the window
    shell = Instance(IPythonShell, allow_none=False)

    def _create_contents(self, parent):
        """ Create the editor. """
        self.shell.create(parent)
        return self.shell.control

    def destroy(self):
        self.shell.destroy()
        super().destroy()

    def _shell_default(self):
        from pyface.api import PythonShell
        return PythonShell()

# Application entry point.
if __name__ == "__main__":
    # Create the GUI.
    gui = GUI()

    # Create and open the main window.
    window = MainWindow(title="Python Shell", size=(640, 480))
    window.open()

    # Start the GUI event loop!
    gui.start_event_loop()

A Pyface GUI window containing a Python shell.

Installation

Pyface is a pure Python package. In most cases Pyface will be installable using a simple pip install command.

To install with a backend, choose one of the following, as appropriate:

$ pip install pyface[pyside2]

$ pip install pyface[pyside6]

$ pip install pyface[pyqt5]

$ pip install pyface[wx]

Some optional functionality uses pillow and numpy and these can be installed using optional dependencies:

$ pip install pyface[pillow]

$ pip install pyface[numpy]

For running tests a few more packages are required:

$ pip install pyface[test]

Documentation

Developing Pyface

The etstool.py script provides utilities to assist developers wanting to work on Pyface. To use it, you will need to have the source checked out via Git, Enthought's EDM distribution manager, and a minimal environment containing at least the Click library.

You can then follow the instructions in etstool.py. In particular:

  • use etstool.py install to create environments for particular toolkits and runtimes
  • use etstool.py shell to activate those environments
  • use etstool.py test to run the tests in those environments
  • use etstool.py flake8 to perform style checks
  • use etstool.py docs to build the documentation
  • use etstool.py test-all to run the tests across all supported runtimes and toolkits

License

Pyface source code is licensed with a BSD-style license. Some default images are licensed with other licenses. See the license files for further information.

pyface's People

Contributors

aaronayres35 avatar achabotl avatar agrawalprash avatar bergtholdt avatar burnpanck avatar cfarrow avatar christianbrodbeck avatar corranwebster avatar dpinte avatar gaelvaroquaux avatar ievacerny avatar itziakos avatar jwiggins avatar kitchoi avatar mdickinson avatar midhun-pm avatar opoplawski avatar palash-vishnani avatar pankajp avatar pberkes avatar prabhuramachandran avatar pradyunsg avatar punchagan avatar rkern avatar robind42 avatar robmcmullen avatar scopatz avatar senganal avatar stefanoborini avatar timdiller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyface's Issues

Is NodeTree supported when running with Qt?

Importing NodeTree when using Qt results in the following tracebackthon

>>> from pyface.tree.api import NodeTree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\runtimes\simphony\lib\site-packages\pyface\tree\api.py", line 18, in <module>
    from node_tree import NodeTree
  File "c:\runtimes\simphony\lib\site-packages\pyface\tree\node_tree.py", line 28, in <module>
    from tree import Tree
  File "c:\runtimes\simphony\lib\site-packages\pyface\tree\tree.py", line 22, in <module>
    import wx
ImportError: No module named wx

The problem is that the node_tree module is tring to import the tree class from wx. So at first glance it looks that the NodeTree class does not support Qt. However, I have labeled this issue as a bug because in https://github.com/enthought/pyface/blob/master/pyface/tree/api.py#L25 there is a specific check on the ets toolkit which means that this module should have support for Qt. I guess that the easy solution would be to import NodeTree only when wx is used.

Closing the first tab leaves focus on wrong tab

Closing the first tab (when active) of EditorAreaWidget shifts the focus to 2 tabs after the current tab, instead of the immediately next tab.

The problem seems to be in line 335 of pyface/ui/qt4/tasks/advanced_editor_area_pane.py but I'm not sure what would be the best way to fix it. Can someone who knows more about this help?

clipboard should support non ascii text

/Users/.../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pyface/ui/qt4/clipboard.pyc in _get_text_data(self)
     80 
     81     def _get_text_data(self):
---> 82         return str(cb.text())
     83 
     84     def _set_text_data(self, data):

UnicodeEncodeError: 'ascii' codec can't encode character u'\xf4' in position 2045: ordinal not in range(128) 

The conversion to str will fail miserably with non-asci characters: https://github.com/enthought/pyface/blob/master/pyface/ui/qt4/clipboard.py#L82

CI testing under wxPython 3

Currently the wxWidgets 3 packages are not white-listed on Travis CI, so we can't use containerized builds (or we need to build wx 3 from source).

Not sure what issues are involved for Appveyor.

Broken IPython example

It seems like the IPython widget is implemented in neither backends. Or is this because I have the wrong version of IPython? In which case the error message is not terribly informative.

parietal ~/dev/enthought/ets/pyface/examples $ python ipython_shell.py
Traceback (most recent call last):
  File "ipython_shell.py", line 51, in 
    window.open()
  File "/home/varoquau/dev/enthought/ets/pyface/pyface/i_window.py", line 145, in open
    self._create()
  File "/home/varoquau/dev/enthought/ets/pyface/pyface/ui/wx/application_window.py", line 150, in _create
    contents = self._create_contents(body)
  File "ipython_shell.py", line 39, in _create_contents
    self._shell = IPythonWidget(parent)
  File "/home/varoquau/dev/enthought/ets/pyface/pyface/toolkit.py", line 92, in __init__
    raise NotImplementedError("the %s pyface backend doesn't implement %s" % (ETSConfig.toolkit, oname))
NotImplementedError: the wx pyface backend doesn't implement IPythonWidget
parietal ~/dev/enthought/ets/pyface/examples $ export ETS_TOOLKIT=qt4
parietal ~/dev/enthought/ets/pyface/examples $ python ipython_shell.py
Traceback (most recent call last):
  File "ipython_shell.py", line 51, in 
    window.open()
  File "/home/varoquau/dev/enthought/ets/pyface/pyface/i_window.py", line 145, in open
    self._create()
  File "/home/varoquau/dev/enthought/ets/pyface/pyface/ui/qt4/application_window.py", line 123, in _create
    contents = self._create_contents(self.control)
  File "ipython_shell.py", line 39, in _create_contents
    self._shell = IPythonWidget(parent)
  File "/home/varoquau/dev/enthought/ets/pyface/pyface/toolkit.py", line 92, in __init__
    raise NotImplementedError("the %s pyface backend doesn't implement %s" % (ETSConfig.toolkit, oname))
NotImplementedError: the qt4 pyface backend doesn't implement IPythonWidget

Compatibility with wxWidgets 3.0

I would like to request patching the software to make it compatible with wxWidgets/wxPython 3.0.

(Supporting wxPython 2.8 in MacPorts is a pain since Mac OS X stopped shipping Carbon headers in 10.6.)

test test_editor_area_pane.py hints wx pyface backend doesn't implement EditorAreaPane

version: 4.1.0

PYTHONPATH=build-2.7/lib nosetests --verbosity=1
Xlib: extension "RANDR" missing on display ":10".

...EE..................

ERROR: Does creating an editor work?


Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/pyface-4.1.0/work/pyface-4.1.0/pyface/tasks/tests/test_editor_area_pane.py", line 13, in test_create_editor
area = EditorAreaPane()
File "/mnt/gen2/TmpDir/portage/dev-python/pyface-4.1.0/work/pyface-4.1.0/pyface/toolkit.py", line 92, in init
raise NotImplementedError("the %s pyface backend doesn't implement %s" % (ETSConfig.toolkit, oname))
NotImplementedError: the wx pyface backend doesn't implement EditorAreaPane

ERROR: Does registering and unregistering factories work?


Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/pyface-4.1.0/work/pyface-4.1.0/pyface/tasks/tests/test_editor_area_pane.py", line 20, in test_factories
area = EditorAreaPane()
File "/mnt/gen2/TmpDir/portage/dev-python/pyface-4.1.0/work/pyface-4.1.0/pyface/toolkit.py", line 92, in init
raise NotImplementedError("the %s pyface backend doesn't implement %s" % (ETSConfig.toolkit, oname))
NotImplementedError: the wx pyface backend doesn't implement EditorAreaPane


Ran 23 tests in 1.044s

FAILED (errors=2)

Is it a problem with Xlib: extension "RANDR" missing on display ":10".
or does the test prove the wx pyface backend doesn't implement EditorAreaPane?

Closing editors in workbench raises exception

I've been running the apptools/examples/undo/example.py application under PySide. When I try to close the window, I get this traceback:

Traceback (most recent call last):
  File "/Users/pberkes/egit/ETS/pyface/pyface/ui/qt4/gui.py", line 189, in _dispatch
    self._callable(*self._args, **self._kw)
  File "/Users/pberkes/egit/ETS/pyface/pyface/workbench/workbench_window.py", line 181, in close
    self.destroy_editors(self.editors)
  File "/Users/pberkes/egit/ETS/pyface/pyface/workbench/workbench_window.py", line 330, in destroy_editors
    editor.destroy_control()
  File "/Users/pberkes/egit/ETS/pyface/pyface/ui/qt4/workbench/editor.py", line 60, in destroy_control
    self.control.deleteLater()
AttributeError: 'NoneType' object has no attribute 'deleteLater'

The problem seems to be that there are two things trying to destroy the editors at the same time: the WorkbenchWindow.destroy_editors and the WorkbenchWindowLayout event filter, which captures QCloseEvents and asks the editors to close.

I added these lines to pyface.ui.qt4.workbench.Editor.destroy_control:

            print 'A ---', self, self.control
            from etsdevtools.debug.api import called_from
            called_from()

and I get this output, the second time just before getting the traceback:

A --- Editor(5723cf2621fe448eb5e63053117c4934) <PySide.QtGui.QLabel object at 0xe2e38c8>
'destroy_control' called from:
   destroy_editors (/Users/pberkes/egit/ETS/pyface/pyface/workbench/workbench_window.py: 330)
      editor.destroy_control()
A --- Editor(5723cf2621fe448eb5e63053117c4934) <PySide.QtGui.QLabel object at 0xe2e38c8>
'destroy_control' called from:
   eventFilter (/Users/pberkes/egit/ETS/pyface/pyface/ui/qt4/workbench/workbench_window_layout.py: 589)
      editor.destroy_control()

One of the two closing strategies should be removed, but which one?

Missing RemoveEventHandler on ApplicationWindow.close on Mac OS

OS: OS X 10.11.2
wxPython: 2.9.2.4-1 and 3.0.2.0
Pyface 5.0.0

from pyface.ui.wx.application_window import ApplicationWindow

win = ApplicationWindow()
win.open()
win.close()

gives

Traceback (most recent call last):
  File "failed.py", line 5, in <module>
    win.close()
  File "/Users/kit/ETS/jaguar/.jaguar/envs/test-mayavi/lib/python2.7/site-packages/pyface-5.0.0-py2.7.egg/pyface/ui/wx/application_window.py", line 198, in close
    super(ApplicationWindow, self).close()
  File "/Users/kit/ETS/jaguar/.jaguar/envs/test-mayavi/lib/python2.7/site-packages/pyface-5.0.0-py2.7.egg/pyface/i_window.py", line 181, in close
    self.destroy()
  File "/Users/kit/ETS/jaguar/.jaguar/envs/test-mayavi/lib/python2.7/site-packages/pyface-5.0.0-py2.7.egg/pyface/ui/wx/application_window.py", line 188, in destroy
    self._aui_manager.UnInit()
  File "/Users/kit/ETS/jaguar/.jaguar/envs/test-mayavi/lib/python2.7/site-packages/wx/aui.py", line 596, in UnInit
    return _aui.AuiManager_UnInit(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "Assert failure" failed at /Users/vagrant/pisi-64bit/tmp/wxPython-3.0.2.0-2/work/wxPython-src-3.0.2.0/src/common/wincmn.cpp(1517) in RemoveEventHandler(): where has the event handler gone?

wx SimpleColorEditor segfaults

I have a code:

from traits.api import *
from traitsui.api import *

class ColorPlot(HasTraits):
    color1 = Color('green')
    color2 = Color('blue')

    view = View(Item('color1', style='simple'),
                Item('color2', style='simple'),
                width = 0.2,
                resizable = True)

g = ColorPlot()
g.configure_traits()

When i run the above:

  1. Color box in 'color2' does not appear.
  2. Segfault occurs on closing window when at least a click on color combo box is done before.

I have traits-4.5.0, traitsui-4.5.1, pyface-4.5.2 and wxpython-2.8.12.1 on Linux. On Windows it seems the same occurs...

Regards,
Marek

Font issues under Qt and OS X 10.9 Mavericks

See http://successfulsoftware.net/2013/10/23/fixing-qt-4-for-mac-os-x-10-9-mavericks/ for a discussion. Eventually this should be fixed in Qt itself, but in the interim we need to handle this situation.

Before Pyface code creates a QApplication it should check platform and system version and set the font in this manner. This probably won't help if another piece of code is responsible for creating the QApplication (eg. IPython with --gui=qt), but at least Pyface can do the right thing.

[py3] fixtures not handling all files

How I do build:

+ CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic'
+ /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -s'
running build
running build_py
copying pyface/_version.py -> build/lib/pyface
Fixing build/lib/pyface/_version.py
Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
Fixing build/lib/pyface/_version.py
Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
+ exit 0
writing byte-compilation script '/tmp/tmph4qkobju.py'
/usr/bin/python3 -O /tmp/tmph4qkobju.py
  File "/usr/lib/python3.4/site-packages/pyface/wx/spreadsheet/virtual_model.py", line 67
    print 'Setting value %d %d %s' % (row, col, value)
                                 ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/wx/shell.py", line 126
    raise AttributeError, name
                        ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/ipython_widget.py", line 22
    raise ImportError, '''
                     ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/tree/node_tree.py", line 94
    def _node_right_clicked_changed(self, (obj, point)):
                                          ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/action/action_manager.py", line 366
    print indent, 'Manager', self.id
               ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/ui/wx/ipython_widget.py", line 187
    except Exception, e:
                    ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/ui/wx/grid/trait_grid_model.py", line 237
    print 'firing sort event'
                            ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/ui/wx/dialog.py", line 183
    print 'Heeeeelllllllllllllpppppppppppppppppppp'
                                                  ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/workbench/workbench_window_layout.py", line 469
    raise ValueError, "unknown view position: %s" % position
                    ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/console/console_widget.py", line 653
    except Exception, e:
                    ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/util/testing.py", line 96
    print ' '*level, widget
            ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/wizard/wizard.py", line 115
    print "Show help for", self.help_id
                        ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/util/grid/grid.py", line 254
    print 'Reset'
                ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/util/grid/grid_model.py", line 62
    print "Building default table column model"
                                              ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/dock/dock_sizer.py", line 2808
    print '%sRegion( %08X, active = %s, width = %d, height = %d )' % (
                                                                 ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/viewer/tree_viewer.py", line 191
    print '**** pid is None!!! ****'
                                   ^
SyntaxError: Missing parentheses in call to 'print'

removing /tmp/tmph4qkobju.py
running install_egg_info
running egg_info
writing top-level names to pyface.egg-info/top_level.txt
writing requirements to pyface.egg-info/requires.txt
writing dependency_links to pyface.egg-info/dependency_links.txt
writing pyface.egg-info/PKG-INFO
reading manifest file 'pyface.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
  File "/usr/lib/python3.4/site-packages/pyface/wx/spreadsheet/virtual_model.py", line 67
    print 'Setting value %d %d %s' % (row, col, value)
                                 ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/wx/shell.py", line 126
    raise AttributeError, name
                        ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/ipython_widget.py", line 22
    raise ImportError, '''
                     ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/tree/node_tree.py", line 94
    def _node_right_clicked_changed(self, (obj, point)):
                                          ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/action/action_manager.py", line 366
    print indent, 'Manager', self.id
               ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/ui/wx/ipython_widget.py", line 187
    except Exception, e:
                    ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/ui/wx/grid/trait_grid_model.py", line 237
    print 'firing sort event'
                            ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/ui/wx/dialog.py", line 183
    print 'Heeeeelllllllllllllpppppppppppppppppppp'
                                                  ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/workbench/workbench_window_layout.py", line 469
    raise ValueError, "unknown view position: %s" % position
                    ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/console/console_widget.py", line 653
    except Exception, e:
                    ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/util/testing.py", line 96
    print ' '*level, widget
            ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/wizard/wizard.py", line 115
    print "Show help for", self.help_id
                        ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/util/grid/grid.py", line 254
    print 'Reset'
                ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/util/grid/grid_model.py", line 62
    print "Building default table column model"
                                              ^
SyntaxError: Missing parentheses in call to 'print'

  File "/usr/lib/python3.4/site-packages/pyface/dock/dock_sizer.py", line 2808
    print '%sRegion( %08X, active = %s, width = %d, height = %d )' % (
                                                                 ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.4/site-packages/pyface/viewer/tree_viewer.py", line 191
    print '**** pid is None!!! ****'
                                   ^
SyntaxError: Missing parentheses in call to 'print'

warning: no files found matching '*.svg' under directory 'pyface'
no previously-included directories found matching 'docs/build'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
writing manifest file 'pyface.egg-info/SOURCES.txt'
Copying pyface.egg-info to /builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface-5.0.0-py3.4.egg-info
running install_scripts
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /builddir/build/BUILD/pyface-5.0.0
/usr/lib/rpm/sepdebugcrcfix: Updated 0 CRC32s, 0 CRC32s did match.
find: 'debug': No such file or directory
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
Bytecompiling .py files below /builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python2.7 using /usr/bin/python2.7
Bytecompiling .py files below /builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4 using /usr/bin/python3.4
*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/action/action_manager.py'...
  File "/usr/lib/python3.4/site-packages/pyface/action/action_manager.py", line 366
    print indent, 'Manager', self.id
               ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/dock/dock_sizer.py'...
  File "/usr/lib/python3.4/site-packages/pyface/dock/dock_sizer.py", line 2808
    print '%sRegion( %08X, active = %s, width = %d, height = %d )' % (
                                                                 ^
SyntaxError: invalid syntax

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/ipython_widget.py'...
  File "/usr/lib/python3.4/site-packages/pyface/ipython_widget.py", line 22
    raise ImportError, '''
                     ^
SyntaxError: invalid syntax

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/tree/node_tree.py'...
  File "/usr/lib/python3.4/site-packages/pyface/tree/node_tree.py", line 94
    def _node_right_clicked_changed(self, (obj, point)):
                                          ^
SyntaxError: invalid syntax

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/ui/qt4/console/console_widget.py'...
  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/console/console_widget.py", line 653
    except Exception, e:
                    ^
SyntaxError: invalid syntax

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/ui/qt4/util/testing.py'...
  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/util/testing.py", line 96
    print ' '*level, widget
            ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/ui/qt4/wizard/wizard.py'...
  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/wizard/wizard.py", line 115
    print "Show help for", self.help_id
                        ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/ui/qt4/workbench/workbench_window_layout.py'...
  File "/usr/lib/python3.4/site-packages/pyface/ui/qt4/workbench/workbench_window_layout.py", line 469
    raise ValueError, "unknown view position: %s" % position
                    ^
SyntaxError: invalid syntax

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/ui/wx/dialog.py'...
  File "/usr/lib/python3.4/site-packages/pyface/ui/wx/dialog.py", line 183
    print 'Heeeeelllllllllllllpppppppppppppppppppp'
                                                  ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/ui/wx/grid/trait_grid_model.py'...
  File "/usr/lib/python3.4/site-packages/pyface/ui/wx/grid/trait_grid_model.py", line 237
    print 'firing sort event'
                            ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/ui/wx/ipython_widget.py'...
  File "/usr/lib/python3.4/site-packages/pyface/ui/wx/ipython_widget.py", line 187
    except Exception, e:
                    ^
SyntaxError: invalid syntax

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/util/grid/grid.py'...
  File "/usr/lib/python3.4/site-packages/pyface/util/grid/grid.py", line 254
    print 'Reset'
                ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/util/grid/grid_model.py'...
  File "/usr/lib/python3.4/site-packages/pyface/util/grid/grid_model.py", line 62
    print "Building default table column model"
                                              ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/viewer/tree_viewer.py'...
  File "/usr/lib/python3.4/site-packages/pyface/viewer/tree_viewer.py", line 191
    print '**** pid is None!!! ****'
                                   ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/wx/shell.py'...
  File "/usr/lib/python3.4/site-packages/pyface/wx/shell.py", line 126
    raise AttributeError, name
                        ^
SyntaxError: invalid syntax

*** Error compiling '/builddir/build/BUILDROOT/python-pyface-5.0.0-2.fc24.x86_64/usr/lib/python3.4/site-packages/pyface/wx/spreadsheet/virtual_model.py'...
  File "/usr/lib/python3.4/site-packages/pyface/wx/spreadsheet/virtual_model.py", line 67
    print 'Setting value %d %d %s' % (row, col, value)
                                 ^
SyntaxError: invalid syntax

error: Bad exit status from /var/tmp/rpm-tmp.SydFiu (%install)

Fatal Error while trying to load qt widget

Application closes with a runtime error when I am trying to create the widget from this script in TaskPane:

def create(self, parent):
    self.window = Window(parent)

But this script work for me, so it is not a problem with qt, or opengl. What I am doing worng?

build the docs, what's needed and what's not???

It's not that the docs don't build. They get there, but the output of warnings and msgs of what's deprecated and should have could have been re-written to the newer form and failed imports, I just can't keep up with them all.

https://gist.github.com/idella/0d37681db173995a3886

Now I can't say all of the output from the link above ought go, but it makes for tough reading to sort what's trivial and what ought be found a fix.

RuntimeError: Importing from wx backend after selecting qt4 backend!

these it seems are harmless, but really one would be enough

WARNING:root:DEPRECATED: pyface.grid, use pyface.ui.wx.grid instead.

Well, you're the authors. Can you do just that??? many times???

from pyface.api import HeadingText, LayeredPanel, SplitDialog
ImportError: cannot import name LayeredPanel

What is going on here? pyface can't recognise and import its own modules???

tilt

Now this one really REALLY needs some sorting

 File "/usr/lib64/python2.7/site-packages/pyface/tasks/enaml_dock_pane.py", line 3, in <module>
from enaml.components.constraints_widget import ConstraintsWidget
ImportError: No module named enaml.components.constraints_widget

dev-python/pyface $ find /mnt/gen2/TmpDir/portage/dev-python/pyface-4.3.0-r1/work/pyface-4.3.0 -name enaml

yields

/mnt/gen2/TmpDir/portage/dev-python/pyface-4.3.0-r1/work/pyface-4.3.0/examples/tasks/enaml

Now let's attempt an objective observation here
The building of the docs is importing from enaml found under the top level folder 'examples', and it can't find the modules constraints_widget from enaml anyways.

eeer

tilt

The above was
pyface # USE="script sql webkit xmlpatterns" emerge pyside
which in gentoo speak means pyface can be installed with or without a number of modules which use flags make optional. So when I get a

" from PySide.QtWebKit import *
ImportError: No module named QtWebKit"

It's a gentoo 'thing' because basically the installed form of pyside is a cut down form of the full monty. DO you care? Well the point here is,
If you find something that hints of the full package appears to be missing something,
then you can say that looks a gentoo made issue.

HOWEVER

the main example here

from pyface.api import HeadingText, LayeredPanel, SplitDialog
ImportError: cannot import name LayeredPanel

is pyface building docs from pyface's own source in

dev-python/pyface $ ls /mnt/gen2/TmpDir/portage/dev-python/pyface-4.3.0-r1/work/pyface-4.3.0 
docs  examples  pyface  pyface.egg-info  README.rst  setup.py  TODO.txt

pyface $ find /mnt/gen2/TmpDir/portage/dev-python/pyface-4.3.0-r1/work/pyface-4.3.0  -name api/mnt/gen2/TmpDir/portage/dev-python/pyface-4.3.0-r1/work/pyface-4.3.0/docs/source/api
/mnt/gen2/TmpDir/portage/dev-python/pyface-4.3.0-r1/work/pyface-4.3.0/docs/build/html/api
/mnt/gen2/TmpDir/portage/dev-python/pyface-4.3.0-r1/work/pyface-4.3.0/docs/build/html/_sources/api
/mnt/gen2/TmpDir/portage/dev-python/pyface-4.3.0-r1/work/pyface-4.3.0/docs/build/doctrees/api

This one I am 99% sure is not a gentoo induced issue, but I have to leave that 1% in case I have really missed something.

SplitEditorAreaPane.active_editor not being updated consistently.

SplitAreaEditorPane has the following code to respond to Qt's FocusChanged signal:

    def _focus_changed(self, old, new):
        """Set the active tabwidget after an application-level change in focus.
        """

        if new:
            if isinstance(new, DraggableTabWidget):
                if new.editor_area == self:
                    self.active_tabwidget = new
            elif isinstance(new, QtGui.QTabBar):
                if self.control.isAncestorOf(new):
                    self.active_tabwidget = \
                        self._find_ancestor_draggable_tab_widget(new)
            else:
                # Check if any of the editor widgets have focus.
                # If so, make it active.
                for editor in self.editors:
                    control = editor.control
                    if control is not None and control.isAncestorOf(new):
                        self.active_tabwidget = \
                            self._find_ancestor_draggable_tab_widget(control)
                        self.active_tabwidget.setCurrentWidget(control)
                        # Set active_editor at the end so that the notification
                        # occurs when everything is ready.
                        self.active_editor = editor
                        break

Note that in the third branch, we set the active editor, while in the first two we don't. This is leading to issues in a Tasks application with two separate panes, where it's unpredictable which actions in one pane lead to an active editor update and which don't.

Is there any reason not to update active_editor in all three branches?

OSX PySide issues with unspecified rpath

As specified in #209 we found that in the pip installation of PySide on OSX, the QtCore.so python bindings do not have proper rpath specifications. The result is that the import fails

ImportError: dlopen(/Users/sborini/Work/github/pyface/.tox/py34-backendqt4/lib/python3.4/site-packages/PySide/QtCore.so, 2): Library not loaded: @rpath/libpyside.cpython-34m.1.2.dylib
  Referenced from: /Users/sborini/Work/github/pyface/.tox/py34-backendqt4/lib/python3.4/site-packages/PySide/QtCore.so
  Reason: image not found

we can workaround it with DYLD_LIBRARY_PATH, or set the appropriate rpath. I think that @cournape may have an idea (I checked the recipe for pyside and I don't see any fix on this regard, so there might be some trick I am unaware of).

Tasks VSplitter class does not like HSplitter

When trying to add an HSplitter item in the items attribute of a VSplitter we get a nice traceback.

In [4]: from pyface.tasks.api import PaneItem, VSplitter, HSplitter, Tabbed

In [5]: a = VSplitter(items=[PaneItem()])

In [6]: a = VSplitter(items=[VSplitter()])

In [7]: a = VSplitter(items=[Tabbed()])

In [8]: a = VSplitter(items=[HSplitter()])
---------------------------------------------------------------------------
TraitError                                Traceback (most recent call last)
C:\Users\itziakos\<ipython-input-8-32f64b5996b8> in <module>()
----> 1 a = VSplitter(items=[HSplitter()])

C:\EPD32\73\lib\site-packages\pyface\tasks\task_layout.pyc in __init__(self, *items, **traits)
     75
     76     def __init__(self, *items, **traits):
---> 77         super(LayoutContainer, self).__init__(**traits)
     78         self.items = list(items)
     79

c:\users\itziakos\projects\traits\traits\trait_types.pyc in validate(self, object, name, value)
   2185                 return value
   2186
-> 2187             return TraitListObject( self, object, name, value )
   2188
   2189         self.error( object, name, value )

c:\users\itziakos\projects\traits\traits\trait_handlers.pyc in __init__(self, trait, object, name, value)
   2416             except TraitError, excp:
   2417                 excp.set_prefix( 'Each element of the' )
-> 2418                 raise excp
   2419
   2420         self.len_error( len( value ) )

TraitError: Each element of the 'items' trait of a VSplitter instance must be an implementor of, or can be adapted to im
plement, PaneItem or None or an implementor of, or can be adapted to implement, Tabbed or None or an instance of the sam
e type as the receiver or None, but a value of HSplitter() <class 'pyface.tasks.task_layout.HSplitter'> was specified.

Log exceptions from Qt action item callbacks.

Currently, exceptions from menu and toolbar actions result in a traceback being printed to the console when the corresponding Qt callback exits, but are otherwise ignored. I'd suggest that those exceptions should be logged, perhaps by wrapping _MenuItem._qt4_on_triggered, _Tool._qt4_on_triggered and _PaletteTool._on_tool with a suitable decorator.

[py2] Importing from wx backend after selecting qt4 backend!

======================================================================
ERROR: Failure: RuntimeError (Importing from wx backend after selecting qt4 backend!)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/builddir/build/BUILD/pyface-5.0.0/build/lib/pyface/ui/wx/grid/tests/composite_grid_model_test_case.py", line 4, in <module>
    from pyface.ui.wx.grid.api \
  File "/builddir/build/BUILD/pyface-5.0.0/build/lib/pyface/ui/wx/grid/api.py", line 16, in <module>
    from .grid import Grid
  File "/builddir/build/BUILD/pyface-5.0.0/build/lib/pyface/ui/wx/grid/grid.py", line 38, in <module>
    from traitsui.wx.dnd_editor import FileDropSource
  File "/usr/lib/python2.7/site-packages/traitsui/wx/__init__.py", line 26, in <module>
    import toolkit
  File "/usr/lib/python2.7/site-packages/traitsui/wx/toolkit.py", line 28, in <module>
    assert_toolkit_import('wx')
  File "/usr/lib/python2.7/site-packages/traitsui/toolkit.py", line 60, in assert_toolkit_import
    "backend!" % (name, ETSConfig.toolkit))
RuntimeError: Importing from wx backend after selecting qt4 backend!

======================================================================
ERROR: Failure: RuntimeError (Importing from wx backend after selecting qt4 backend!)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/builddir/build/BUILD/pyface-5.0.0/build/lib/pyface/ui/wx/grid/tests/simple_grid_model_test_case.py", line 4, in <module>
    from pyface.ui.wx.grid.api \
  File "/builddir/build/BUILD/pyface-5.0.0/build/lib/pyface/ui/wx/grid/api.py", line 16, in <module>
    from .grid import Grid
  File "/builddir/build/BUILD/pyface-5.0.0/build/lib/pyface/ui/wx/grid/grid.py", line 38, in <module>
    from traitsui.wx.dnd_editor import FileDropSource
  File "/usr/lib/python2.7/site-packages/traitsui/wx/__init__.py", line 26, in <module>
    import toolkit
  File "/usr/lib/python2.7/site-packages/traitsui/wx/toolkit.py", line 28, in <module>
    assert_toolkit_import('wx')
  File "/usr/lib/python2.7/site-packages/traitsui/toolkit.py", line 60, in assert_toolkit_import
    "backend!" % (name, ETSConfig.toolkit))
RuntimeError: Importing from wx backend after selecting qt4 backend!

----------------------------------------------------------------------

Dialog titles not displaying

from pyface.api import AboutDialog, ConfirmationDialog, FileDialog, MessageDialog, SplitDialog

dialog_cls = [AboutDialog, ConfirmationDialog, FileDialog, MessageDialog, SplitDialog]

for e, cls in enumerate(dialog_cls):
    dl = cls(title=str(e))
    dl.open()

Only in the SplitDialog does the title attribute appear correctly.
image
image
image
image
image

Buttons are not set up correctly in ui/qt4/progress_dialog.py

Issue: when clicked, "Cancel" button closes dialog window but does not return self._user_cancelled = True during update or calls reject function.

Possible solution: replace lines 147, 148:

if self.can_cancel:
    buttons.connect(buttons, QtCore.SIGNAL('rejected()'), dialog, QtCore.SLOT('reject()'))

with

if self.can_cancel:
    buttons.clicked.connect(self.reject)

Use of `logging.warn` in PyFace

PyFace uses logging.warn to warn about deprecated bits and pieces. It should use a logger.warn call instead: logging.warn has the side-effect of calling logging.basicConfig, which means that any subsequent attempts to logging.basicConfig in application code silently do nothing.

pygment_highlighter fails when building Mayavi docs

While building the docs for Mayavi, it exits with the exception:

File ".../venvs/m64/lib/python2.7/site-packages/pyface/ui/qt4/code_editor/pygments_highlighter.p    y", line 39, in get_tokens_unprocessed
for item in action(self, m):                                                                    
TypeError: 'NoneType' object is not callable 

Setting a trace with ipdb, confirmed that the 'action' variable had been set to None.

Broken enaml example

It seems like the example didnd't stay in sync with the current trunk of enaml...

Jonathan

jrocher:enaml jrocher$ ETS_TOOLKIT='qt4' python run.py 
Traceback (most recent call last):
  File "run.py", line 29, in <module>
    main(sys.argv)
  File "run.py", line 18, in main
    window.add_task(task)
  File "/Users/jrocher/Projects/ETS_trunk/pyface/pyface/tasks/task_window.py", line 190, in add_task
    dock_pane.create(self.control)
  File "/Users/jrocher/Projects/ETS_trunk/pyface/pyface/ui/qt4/tasks/dock_pane.py", line 66, in create
    contents = self.create_contents(control)
  File "/Users/jrocher/Projects/ETS_trunk/pyface/pyface/tasks/enaml_dock_pane.py", line 26, in create_contents
    self.component = self.create_component()
  File "/Users/jrocher/Projects/ETS_trunk/pyface/examples/tasks/enaml/enaml_panes.py", line 19, in create_component
    from employee_view import EmployeeView
  File "/Users/jrocher/Projects/ETS_trunk/enaml/enaml/core/import_hooks.py", line 131, in load_module
    exec code in mod.__dict__
  File "/Users/jrocher/Projects/ETS_trunk/pyface/examples/tasks/enaml/employee_view.enaml", line 1, in 
    #------------------------------------------------------------------------------
  File "/Users/jrocher/Projects/ETS_trunk/pyface/examples/tasks/enaml/phone_converter.py", line 7, in <module>
    from enaml.converters import Converter
ImportError: No module named converters

The 'ImageResource' class does not implement the 'create_bitmap' method of the 'IImageResource' interface.

  • Create the following file 'test.py'
import traits.has_traits
traits.has_traits.CHECK_INTERFACES = 2
from traitsui.api import TabularEditor

print "hello"
  • Run ETS_TOOLKIT="qt4" python test.py.

Here is the traceback:

Traceback (most recent call last):
  File "test_pyface.py", line 3, in <module>
    from traitsui.api import TabularEditor
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/traitsui/api.py", line 35, in <module>
    from .editors.api import (ArrayEditor, BooleanEditor, ButtonEditor,
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/traitsui/editors/__init__.py", line 22, in <module>
    from .api import (toolkit, ArrayEditor, BooleanEditor, ButtonEditor,
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/traitsui/editors/api.py", line 29, in <module>
    from .list_str_editor import ListStrEditor
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/traitsui/editors/list_str_editor.py", line 33, in <module>
    from pyface.image_resource import ImageResource
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pyface/image_resource.py", line 19, in <module>
    ImageResource = toolkit_object('image_resource:ImageResource')
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pyface/toolkit.py", line 97, in toolkit_object
    __import__(be_mname)
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pyface/ui/qt4/image_resource.py", line 29, in <module>
    class ImageResource(MImageResource, HasTraits):
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/traits/has_traits.py", line 3802, in wrapped_class
    check_implements(klass, protocols, CHECK_INTERFACES)
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/traits/interface_checker.py", line 194, in check_implements
    return checker.check_implements( cls, interfaces, error_mode )
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/traits/interface_checker.py", line 90, in check_implements
    error_mode ):
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/traits/interface_checker.py", line 111, in _check_has_traits_class
    self._check_methods( cls, interface, error_mode ))
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/traits/interface_checker.py", line 128, in _check_methods
    self._class_name( interface ) ), error_mode )
  File "/Users/David/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/traits/interface_checker.py", line 178, in _handle_error
    raise InterfaceError( msg )
traits.interface_checker.InterfaceError: The 'ImageResource' class does not implement the 'create_bitmap' method of the 'IImageResource' interface.

tkinter

I would be interested in adding tkinter support to pyface. Would patches in this regard be accepted.

Clarify TasksApplication start/stop API

@mchilvers: "The only thing that seems odd in our API is that 'run' seems more suited to 'batch' style programs (i.e. those without an event loop). I think in TasksApplication we should override 'start' to start the event loop etc, and 'stop' to close any open windows (of course if the user is stopping the application by closing the last open window there won't be any of those!). Then any 'Exit' or 'Quit' action in the UI simply calls application.stop..."
-- enthought/envisage#8 (comment)

Broken advanced task example

Running the advanced pyface/task example doesn't work neither with WX nor with Qt.

Admins-MacBook-Pro:advanced jrocher$ ETS_TOOLKIT='qt4' python run.py
Traceback (most recent call last):
File "run.py", line 37, in
main(sys.argv)
File "run.py", line 26, in main
window.add_task(task)
File "/Users/jrocher/Projects/ETS_trunk/pyface/pyface/tasks/task_window.py", line 180, in add_task
state.central_pane = task.create_central_pane()
File "/Users/jrocher/Projects/ETS_trunk/pyface/examples/tasks/advanced/example_task.py", line 67, in create_central_pane
self.editor_area = SplitEditorAreaPane()
File "/Users/jrocher/Projects/ETS_trunk/pyface/pyface/toolkit.py", line 92, in init
raise NotImplementedError("the %s pyface backend doesn't implement %s" % (ETSConfig.toolkit, oname))
NotImplementedError: the qt4 pyface backend doesn't implement SplitEditorAreaPane

SyntaxError: from __future__ imports must occur at the beginning of the file

Trying to port pyface to FreeBSD, during installation I get the following error.

...
byte-compiling /usr/ports/devel/py-pyface/work/stage/usr/local/lib/python2.7/site-packages/pyface/resource_manager.py to resource_manager.pyc
byte-compiling /usr/ports/devel/py-pyface/work/stage/usr/local/lib/python2.7/site-packages/pyface/list_box_model.py to list_box_model.pyc
byte-compiling /usr/ports/devel/py-pyface/work/stage/usr/local/lib/python2.7/site-packages/pyface/ipython_widget.py to ipython_widget.pyc
  File "/usr/local/lib/python2.7/site-packages/pyface/ipython_widget.py", line 27
    You need to have ipython >= 0.9 installed to use the ipython widget.'''
SyntaxError: from __future__ imports must occur at the beginning of the file

byte-compiling /usr/ports/devel/py-pyface/work/stage/usr/local/lib/python2.7/site-packages/pyface/system_metrics.py to system_metrics.pyc
...

To fix the problem, I use the following patch.

 $ cat files/patch-pyface_ipython__widget.py 
--- pyface/ipython_widget.py.orig       2016-01-06 22:56:14 UTC
+++ pyface/ipython_widget.py
@@ -14,6 +14,9 @@
 """ The implementation of an IPython shell. """


+from __future__ import absolute_import
+
+
 # Import the toolkit specific version.
 try:
     import IPython.frontend
@@ -24,7 +27,5 @@ Could not load the Wx frontend for ipyth
 You need to have ipython >= 0.9 installed to use the ipython widget.'''


-from __future__ import absolute_import
-
 from .toolkit import toolkit_object
 IPythonWidget= toolkit_object('ipython_widget:IPythonWidget')

Hope this is useful for somebody.
Vladimir

PS. pyface-5.0.0.tar.gz

 $ python --version
Python 2.7.11
 $ uname -a
FreeBSD vovaasus 9.3-STABLE FreeBSD 9.3-STABLE #63 r293184M: Wed Jan  6 15:16:38 EET 2016     root@vovaasus:/usr/obj/usr/src/sys/VOVA  amd64

importing QtGui or QtCore from pyface.qt causes ctypes to throw WinError 998 when initializing CDLL

I have a 3rd-party dll for controlling a PCI card (a spincore pulseblaster http://spincore.com/products/PulseBlasterESR-PRO/PulseBlasterESR-PRO.shtml).

I can use this fine as a ctypes.CDLL object, but if I import QtGui or QtCore from pyface before loading the dll, I get
WindowsError: [Error 998] Invalid access to memory location
when loading the CDLL object.

loading the dll before importing pyface seems to be ok.
I'm running python 2.7.5 from python(x,y) on windows 7 x64

qApp returns "NoneType" object in PySide 1.0.3

Running the python_shell example in pyface under PySide (version 1.0.3) fails with the following error


python -u "python_shell.py"
Traceback (most recent call last):
File "python_shell.py", line 51, in
window.open()
File "/home/ioannis/projects/ets/pyface/pyface/i_window.py", line 145, in open
self._create()
File "/home/ioannis/projects/ets/pyface/pyface/ui/qt4/application_window.py", line 122, in _create
contents = self._create_contents(self.control)
File "python_shell.py", line 39, in _create_contents
self._shell = PythonShell(parent)
File "/home/ioannis/projects/ets/pyface/pyface/ui/qt4/python_shell.py", line 63, in init
self.control = self._create_control(parent)
File "/home/ioannis/projects/ets/pyface/pyface/ui/qt4/python_shell.py", line 86, in _create_control
return PyfacePythonWidget(self, parent)qApp.
File "/home/ioannis/projects/ets/pyface/pyface/ui/qt4/python_shell.py", line 493, in init
super(PyfacePythonWidget, self).init(_args, *_kw)
File "/home/ioannis/projects/ets/pyface/pyface/ui/qt4/python_shell.py", line 104, in init
super(PythonWidget, self).init(parent)
File "/home/ioannis/projects/ets/pyface/pyface/ui/qt4/console/history_console_widget.py", line 18, in init
super(HistoryConsoleWidget, self).init(_args, *_kw)
File "/home/ioannis/projects/ets/pyface/pyface/ui/qt4/console/console_widget.py", line 170, in init
self.reset_font()
File "/home/ioannis/projects/ets/pyface/pyface/ui/qt4/console/console_widget.py", line 771, in reset_font
font.setPointSize(QtGui.qApp.font().pointSize())
AttributeError: 'NoneType' object has no attribute 'font'

Exit code: 1

It seems that the qApp (used in pyface/ui/qt4/console/console_widget.py) is returning a "NoneType" object. This is corrected by replacing it with a call to QtGui.QApplication

Regards,
Ioannis

Problem locating icons for standalone applications generated by cx_freeze/py2exe

When running traits from a standalone executable, icons are expected to be found inside the executable itself. This is because of the statement
"dirname(getattr( sys.modules.get( module ), 'file' ))" which is used to get the path to the icon folder. The assumption is that the icons resides in subfolders of the module folder (i.e. 'pyface\dock\images', 'pyface\images', 'pyface\ui\wx\grid\images' and 'pyface\ui\wx\images').
When generating a standalone executable, it is convenient to have the icons in a folder OUTSIDE the executable file. Thus, the function 'resource_path' in 'pyface\resource\resource_path.py' has to be modified. The code below is a proposal on how that could be done (see also enthought/traits#228):

def resource_path ( level = 2 ):
    """Returns a resource path calculated from the caller's stack.
    """
    module = sys._getframe( level ).f_globals.get( '__name__', '__main__' )

    if module != '__main__':
        # Return the path to the module:
        try:
            path = dirname(getattr( sys.modules.get( module ), '__file__' ))
        except:
            # Apparently 'module' is not a registered module...treat it like
            # '__main__':
            pass
        else:
            if hasattr(sys, 'frozen'):
                app_dir, app_name = os.path.split(sys.executable)
                sub_dir = path.replace(sys.executable, '')
                path = ''.join(app_dir, sub_dir)
            return path

    # '__main__' is not a real module, so we need a work around:
    for path in [ dirname( sys.argv[0] ), getcwd() ]:
        if exists( path ):
            break

    return path

Pyface has no reference docs

As far as I can see, the online documentation for Pyface is essentially missing.
We could at least run api-doc to get a bare-bones reference in place...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.