Skip to content
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

[WIP] Move Workbench from Pyface #75

Closed
wants to merge 123 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
fe6f19e
* Adding the framework directories for Envisage and PyFace in an egg-…
May 14, 2007
6f626ad
Added the stubs for the PyQt backend for TraitsUI.
Aug 1, 2007
99056c9
Merge remote branch 'traitsbackendwx/master'
Apr 20, 2011
5ea9737
Merge remote branch 'traitsbackendqt/master'
Apr 20, 2011
e421b65
move pyface out of enthought namespace
Apr 20, 2011
dd7d226
fixed imports
Apr 20, 2011
2977d2c
updating __init__.py files
Apr 27, 2011
31a5360
update the few imports to not use etsproxy
Jun 5, 2011
64ae29c
update traits.qt imports
Jun 13, 2011
2264792
BUG: Make sure that the editor area is restored correctly when the pe…
rkern Nov 10, 2011
be3cb3e
BUG: Fix the persistence of WorkbenchWindow geometry for the Qt backend.
rkern Nov 10, 2011
16845ff
BUG: work around a crash when changing the focus in certain tabs.
rkern Nov 10, 2011
7e8ec29
BF: Handle view being closed through close button
Nov 10, 2011
4543fa7
ENH: Added spinner on tab, midddle-click to close tab, and add new ta…
rkern Nov 10, 2011
af8c33b
BUG: Fixed bug with showing spinner when moving tabs between differen…
rkern Nov 10, 2011
998b311
ENH: Update workbench to support showing spinner on tabs.
rkern Nov 10, 2011
0b38eca
ENH: Double-click on an editor tab to change the title.
rkern Nov 10, 2011
a82c8a3
ENH: Tab bar title editing in place
rkern Nov 10, 2011
779faf1
BUG: Use QApplication.instance() instead of qApp because there are so…
rkern Nov 30, 2011
e77ce95
Merge branch 'master' into internal-merge
rkern Dec 15, 2011
9defcc8
Merge pull request #17 from punchagan/python-widget-encoding
Dec 19, 2011
3d9e90e
Merge branch 'internal-merge'
Dec 21, 2011
015e9d2
BF: Reset tab title to foreground color when it receives focus
Jan 20, 2012
21e4eb4
Merge pull request #21 from enthought/fix_workbench_tab_notification
Jan 21, 2012
418d33b
FIX: Workbench editor destruction in PySide.
pberkes Oct 12, 2012
1457fdd
Merge pull request #14 from enthought/view_fix
Oct 19, 2012
872d014
Merge pull request #55 from punchagan/fix-ordered-schemas
Oct 19, 2012
22bdf52
Better comment for this fix.
pberkes Oct 23, 2012
a84aa89
Update pyface/ui/qt4/workbench/editor.py
Oct 24, 2012
7e70829
Merge pull request #51 from enthought/fix_workbench_editor_on_pyside
rkern Oct 24, 2012
8aafd56
replaced deprecated PyProtocols 'implements' by new traits.adaption '…
burnpanck May 26, 2013
a4f660d
Merge branch 'adaption' into python3
burnpanck May 26, 2013
d24d3e4
fixed ETS import convention
burnpanck May 28, 2013
0bfa7e9
Merge pull request #86 from burnpanck/adaption
May 28, 2013
5d9ecc9
Merge branch 'master' into python3
burnpanck Sep 8, 2013
b65a518
Merge branch 'master' into python3
burnpanck Dec 9, 2013
3e52ba4
Merge branch 'python3' of https://github.com/burnpanck/pyface into py…
pradyunsg May 22, 2014
345f101
Merge branch 'python3' of https://github.com/pradyunsg/pyface into fe…
corranwebster Aug 17, 2015
b7bc0da
Hunt down all the relative imports.
corranwebster Aug 17, 2015
4fb85ce
Merge branch 'feature/python3' of https://github.com/enthought/pyface…
corranwebster Aug 17, 2015
0018fd0
Merge pull request #160 from enthought/feature/python3
corranwebster Aug 18, 2015
f16d2ea
A few more fixes.
prabhuramachandran Aug 20, 2015
f5bae5a
BUG: Pickle files should use bytes.
prabhuramachandran Aug 20, 2015
4056d8b
Remove use of 'file' in favour of 'open'.
corranwebster Aug 20, 2015
f0473c6
Fix Qt4 serialization in Python3.
corranwebster Aug 20, 2015
31a0b3c
Merge pull request #162 from enthought/py3-fixes
corranwebster Aug 20, 2015
12e430b
Merge pull request #163 from enthought/enh/python3-examples
corranwebster Aug 20, 2015
cfcdb98
Merge branch 'master' into docs/overview-api
corranwebster Sep 22, 2015
7b22cca
Merge branch 'wx3' of https://github.com/RobinD42/pyface into RobinD4…
corranwebster Sep 24, 2015
3d7025b
Merge pull request #168 from enthought/RobinD42-wx3
corranwebster Sep 25, 2015
71fd9e8
Merge pull request #167 from enthought/fix/logging-warn
corranwebster Sep 25, 2015
ef4ab58
Merge pull request #142 from enthought/docs/overview-api
corranwebster Sep 25, 2015
c6d8a42
the ui parent should be the ViewContainer in the dock widget
kitchoi Feb 18, 2016
ca0dbb6
Merge branch 'master' into fix-workbench-qt4-dock-ui-parent
kitchoi Feb 19, 2016
887eb6c
Merge branch 'master' into fix-workbench-qt4-dock-ui-parent
kitchoi Feb 19, 2016
5805780
Merge pull request #192 from enthought/fix-workbench-qt4-dock-ui-parent
kitchoi Feb 19, 2016
4d4275d
Merge pull request #191 from enthought/add-modal-dialog-flag
kitchoi Feb 19, 2016
c5a5d8e
Fix exception when closing all tabs
stefanoborini Mar 22, 2016
3f20e73
Minor adjustments to test
stefanoborini Mar 22, 2016
be2b936
Review
stefanoborini Mar 22, 2016
514f747
str(qtwindow state) leads to decoding error in python3:
kitchoi Apr 6, 2016
bc01453
added is_editor_area_visible function to qt4 workbench_window_layout
kitchoi Apr 7, 2016
90de4db
added is_editor_area_visible function to wx workbench_window_layout
kitchoi Apr 7, 2016
422759a
added whether the editor area is visible to the perspective_memento
kitchoi Apr 7, 2016
696a0e0
handle saved editor_area_visible while restoring perspective
kitchoi Apr 7, 2016
142c042
attempt some refactoring
kitchoi Apr 7, 2016
b3333cd
user_perspective_manager perspective_mementos should be consistent
kitchoi Apr 7, 2016
1d1b7b6
the refactoring is not needed as the function is only used once
kitchoi Apr 7, 2016
80ee494
removed extra blank lines
kitchoi Apr 7, 2016
ff114b8
tested test for show_editor_area and hide_editor_area
kitchoi Apr 7, 2016
218cf81
added test for show_editor_area and hide_editor_area
kitchoi Apr 7, 2016
1829fc1
amended test for show/hide_editor_area
kitchoi Apr 7, 2016
9ad6215
reverted changes to workbench_window that are no longer needed
kitchoi Apr 8, 2016
2132d0f
amended mock tests
kitchoi Apr 8, 2016
5f17117
make the test more thorough
kitchoi Apr 8, 2016
18d003f
add tests for restoring perspective from file
kitchoi Apr 8, 2016
5af5594
add __init__
kitchoi Apr 8, 2016
dffba80
edited comments
kitchoi Apr 8, 2016
4d8f101
edited warning message
kitchoi Apr 8, 2016
2f1c3c0
Merge pull request #200 from pankajp/newline-in-readonly-code-editor
corranwebster Apr 14, 2016
538ed14
Merge pull request #199 from enthought/feature/fix-exception-when-clo…
corranwebster Apr 14, 2016
513279f
use {} to create dict
kitchoi Apr 14, 2016
586b34c
sanity check for editor in _on_editor_closed
kitchoi Apr 14, 2016
b9f52be
Merge pull request #206 from enthought/workbench-layout-geometry-py3
corranwebster Apr 14, 2016
93c26ed
Merge branch 'master' into enh/clarify-purpose-of-layout-item-args
corranwebster Apr 15, 2016
b3b1a71
Merge pull request #189 from enthought/enh/clarify-purpose-of-layout-…
corranwebster Apr 15, 2016
388dff8
Merge pull request #197 from enthought/document-toolkit-envvar
corranwebster Apr 15, 2016
08b7caa
Merge branch 'master' into maint/default-message-keywords
corranwebster Apr 15, 2016
4446329
Merge pull request #207 from enthought/fix-workbench-save-editor-area…
kitchoi Apr 19, 2016
d1b467a
Merge branch 'master' into release-5.1.0
kitchoi Apr 20, 2016
952bf95
Merge pull request #211 from grlee77/raise_fix
corranwebster Apr 20, 2016
d301cd1
Merge pull request #209 from enthought/release-5.1.0
kitchoi Apr 21, 2016
119f3c5
Merge branch 'master' into maint/default-message-keywords
corranwebster Jul 15, 2016
d864436
Merge pull request #181 from enthought/maint/default-message-keywords
corranwebster Jul 15, 2016
bf69fe9
Merge branch 'master' into enh/less-traitsui
corranwebster Sep 2, 2016
a8a16eb
Merge pull request #221 from enthought/enh/less-traitsui
corranwebster Sep 2, 2016
988f854
Merge pull request #231 from enthought/fix/remove-toolkit-commandline…
corranwebster Sep 2, 2016
0640dcc
Guard traitsui imports to places where we are fairly certain we are d…
corranwebster Jan 9, 2017
f4b43c6
Defer some traitsui imports within Workbench code.
corranwebster Jan 9, 2017
8696148
Remove old-style signals and slots.
corranwebster Jan 11, 2017
8bebeac
Merge branch 'master' into enh/remove-old-signals-slots
corranwebster Jan 11, 2017
6131e7b
Merge pull request #256 from enthought/enh/remove-old-signals-slots
corranwebster Jan 11, 2017
60948bf
Merge branch 'master' into enh/more-traitsui-cleanup
corranwebster Jan 11, 2017
ef72ef7
Merge pull request #217 from enthought/enh/qt-single-choice-dialog
corranwebster Jan 11, 2017
ff3b698
Merge pull request #253 from enthought/fix/module-level-skip-test
corranwebster Jan 11, 2017
813ff51
Merge pull request #216 from enthought/fix/dialog-size-position
corranwebster Jan 11, 2017
30a7f65
Merge branch 'master' into update-gui-test-assistant
corranwebster Jan 11, 2017
6d4b716
Merge pull request #252 from enthought/fix/nosetests-only-setupclass
mdickinson Jan 11, 2017
da86d9f
Merge pull request #248 from enthought/update-gui-test-assistant
mdickinson Jan 12, 2017
e7f40b5
Merge pull request #250 from enthought/enh/more-traitsui-cleanup
corranwebster Jan 12, 2017
196235b
Merge pull request #259 from enthought/enh/setup-extras
corranwebster Jan 16, 2017
564069b
Merge pull request #260 from enthought/enh/entrypoint-toolkits
corranwebster Feb 3, 2017
23f67d0
Merge pull request #262 from enthought/fix/appveyor-badge
corranwebster Feb 3, 2017
c2645e5
BUG: Restore ad hoc signals in SplitTabWidget.
rkern Apr 4, 2017
8161f94
Merge pull request #268 from enthought/fix/hasFocus
corranwebster Apr 4, 2017
ad01954
Merge pull request #267 from enthought/feature/python-36-CI
corranwebster Apr 7, 2017
b38e979
Merge branch 'master' into maint/update-endedit-signature
jvkersch May 26, 2017
4fccb0a
Merge pull request #230 from enthought/maint/update-endedit-signature
corranwebster May 26, 2017
6ededca
Add pending deprecation warning for Workbench.
corranwebster Aug 24, 2017
74cee31
Merge pull request #284 from enthought/enh/widget-visible-enabled
corranwebster Jan 2, 2018
fb87810
Filter history from pyface and rename to apptools directories.
corranwebster Jan 3, 2018
6857403
Merge branch 'master' of ../pyface into feature/workbench
corranwebster Jan 3, 2018
d3947d3
First cut at fixing imports.
corranwebster Jan 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added apptools/workbench/__init__.py
Empty file.
Empty file.
36 changes: 36 additions & 0 deletions apptools/workbench/action/action_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
""" The action controller for workbench menu and tool bars. """


# Enthought library imports.
from pyface.action.api import ActionController
from traits.api import Instance

from apptools.workbench.api import WorkbenchWindow


class ActionController(ActionController):
""" The action controller for workbench menu and tool bars.

The controller is used to 'hook' the invocation of every action on the menu
and tool bars. This is done so that additional (and workbench specific)
information can be added to action events. Currently, we attach a reference
to the workbench window.

"""

#### 'ActionController' interface #########################################

# The workbench window that this is the controller for.
window = Instance(WorkbenchWindow)

###########################################################################
# 'ActionController' interface.
###########################################################################

def perform(self, action, event):
""" Control an action invocation. """

# Add a reference to the window and the application to the event.
event.window = self.window

return action.perform(event)
5 changes: 5 additions & 0 deletions apptools/workbench/action/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from __future__ import absolute_import

from .menu_bar_manager import MenuBarManager
from .tool_bar_manager import ToolBarManager
from .view_menu_manager import ViewMenuManager
79 changes: 79 additions & 0 deletions apptools/workbench/action/delete_user_perspective_action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#-----------------------------------------------------------------------------
#
# Copyright (c) 2005-2006 by Enthought, Inc.
# All rights reserved.
#
# Author: David C. Morrill <dmorrill@enthought.com>
#
#-----------------------------------------------------------------------------
""" An action that deletes a user perspective. """


# Enthought library imports.
from pyface.api import YES

# Local imports.
from .user_perspective_action import UserPerspectiveAction


class DeleteUserPerspectiveAction(UserPerspectiveAction):
""" An action that deletes a user perspective. """

#### 'Action' interface ###################################################

# The action's unique identifier (may be None).
id = 'apptools.workbench.action.delete_user_perspective_action'

# The action's name (displayed on menus/tool bar tools etc).
name = 'Delete Perspective'

###########################################################################
# 'Action' interface.
###########################################################################

def perform(self, event):
""" Perform the action. """

window = event.window
manager = window.workbench.user_perspective_manager

# The perspective to delete.
perspective = window.active_perspective

# Make sure that the user isn't having second thoughts!
message = 'Are you sure you want to delete the "%s" perspective?' % \
perspective.name

answer = window.confirm(message, title='Confirm Delete')
if answer == YES:
# Set the active perspective to be the first remaining perspective.
#
# There is always a default NON-user perspective (even if no
# perspectives are explicitly defined) so we should never(!) not
# be able to find one!
window.active_perspective = self._get_next_perspective(window)

# Remove the perspective from the window.
window.perspectives.remove(perspective)

# Remove it from the user perspective manager.
manager.remove(perspective.id)

return

###########################################################################
# Private interface.
###########################################################################

def _get_next_perspective(self, window):
""" Return the first perspective that is not the active one! """

if window.active_perspective is window.perspectives[0]:
index = 1

else:
index = 0

return window.perspectives[index]

#### EOF #####################################################################
36 changes: 36 additions & 0 deletions apptools/workbench/action/menu_bar_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
""" The menu bar manager for Envisage workbench windows. """


# Enthought library imports.
from pyface.action.api import MenuBarManager as BaseMenuBarManager
from traits.api import Instance

# Local imports.
from .action_controller import ActionController


class MenuBarManager(BaseMenuBarManager):
""" The menu bar manager for Envisage workbench windows. """

#### 'MenuBarManager' interface ###########################################

# The workbench window that we are the menu bar manager for.
window = Instance('apptools.workbench.api.WorkbenchWindow')

###########################################################################
# 'MenuBarManager' interface.
###########################################################################

def create_menu_bar(self, parent):
""" Creates a menu bar representation of the manager. """

# The controller handles the invocation of every action.
controller = ActionController(window=self.window)

menu_bar = super(MenuBarManager, self).create_menu_bar(
parent, controller=controller
)

return menu_bar

#### EOF ######################################################################
54 changes: 54 additions & 0 deletions apptools/workbench/action/new_user_perspective_action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#-----------------------------------------------------------------------------
#
# Copyright (c) 2005-2006 by Enthought, Inc.
# All rights reserved.
#
# Author: David C. Morrill <dmorrill@enthought.com>
#
#-----------------------------------------------------------------------------
""" An action that creates a new (and empty) user perspective. """


# Local imports.
from .user_perspective_name import UserPerspectiveName
from .workbench_action import WorkbenchAction


class NewUserPerspectiveAction(WorkbenchAction):
""" An action that creates a new (and empty) user perspective. """

#### 'Action' interface ###################################################

# The action's unique identifier.
id = 'apptools.workbench.action.new_user_perspective_action'

# The action's name.
name = 'New Perspective...'

###########################################################################
# 'Action' interface.
###########################################################################

def perform(self, event):
""" Peform the action. """

window = event.window
manager = window.workbench.user_perspective_manager

# Get the details of the new perspective.
upn = UserPerspectiveName(name='User Perspective %d' % manager.next_id)
if upn.edit_traits(view='new_view').result:
# Create a new (and empty) user perspective.
perspective = manager.create_perspective(
upn.name.strip(), upn.show_editor_area
)

# Add it to the window...
window.perspectives.append(perspective)

# ... and make it the active perspective.
window.active_perspective = perspective

return

#### EOF #####################################################################
135 changes: 135 additions & 0 deletions apptools/workbench/action/perspective_menu_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
""" The default perspective menu for a workbench window. """


# Enthought library imports.
from pyface.action.api import Group, MenuManager
from traits.api import Instance, List, on_trait_change

# Local imports.
from .delete_user_perspective_action import DeleteUserPerspectiveAction
from .new_user_perspective_action import NewUserPerspectiveAction
from .rename_user_perspective_action import RenameUserPerspectiveAction
from .reset_all_perspectives_action import ResetAllPerspectivesAction
from .reset_active_perspective_action import ResetActivePerspectiveAction
from .save_as_user_perspective_action import SaveAsUserPerspectiveAction
from .set_active_perspective_action import SetActivePerspectiveAction


class PerspectiveMenuManager(MenuManager):
""" The default perspective menu for a workbench window. """

#### 'ActionManager' interface ############################################

# All of the groups in the manager.
groups = List(Group)

# The manager's unique identifier.
id = 'PerspectivesMenu'

#### 'MenuManager' interface ##############################################

# The menu manager's name.
name = 'Perspectives'

#### 'PerspectiveMenuManager' interface ###################################

# The workbench window that the manager is part of.
window = Instance('apptools.workbench.api.WorkbenchWindow')

###########################################################################
# 'ActionManager' interface.
###########################################################################

def _groups_default(self):
""" Trait initializer. """

groups = [
# Create a group containing the actions that switch to specific
# perspectives.
self._create_perspective_group(self.window),

# Create a group containing the user perspective create/save/rename
# /delete actions.
self._create_user_perspective_group(self.window),

# Create a group containing the reset actions.
self._create_reset_perspective_group(self.window)

]

return groups

###########################################################################
# 'PerspectiveMenuManager' interface.
###########################################################################

@on_trait_change('window.perspectives')
@on_trait_change('window.perspectives_items')
def rebuild(self):
""" Rebuild the menu.

This is called when user perspectives have been added or removed.

"""

# Clear out the old menu. This gives any actions that have trait
# listeners (i.e. the rename and delete actions!) a chance to unhook
# them.
self.destroy()

# Resetting the trait allows the initializer to run again (which will
# happen just as soon as we fire the 'changed' event).
self.reset_traits(['groups'])

# Let the associated menu know that we have changed.
self.changed = True

return

###########################################################################
# Private interface.
###########################################################################

def _create_perspective_group(self, window):
""" Create the actions that switch to specific perspectives. """

# fixme: Not sure if alphabetic sorting is appropriate in all cases,
# but it will do for now!
perspectives = window.perspectives[:]
perspectives.sort(key=lambda x:x.name)

# For each perspective, create an action that sets the active
# perspective to it.
group = Group()
for perspective in perspectives:
group.append(
SetActivePerspectiveAction(
perspective=perspective, window=window
)
)

return group

def _create_user_perspective_group(self, window):
""" Create the user perspective create/save/rename/delete actions. """

group = Group(
NewUserPerspectiveAction(window=window),
SaveAsUserPerspectiveAction(window=window),
RenameUserPerspectiveAction(window=window),
DeleteUserPerspectiveAction(window=window)
)

return group

def _create_reset_perspective_group(self, window):
""" Create the reset perspective actions. """

group = Group(
ResetActivePerspectiveAction(window=window),
ResetAllPerspectivesAction(window=window)
)

return group

#### EOF ######################################################################
45 changes: 45 additions & 0 deletions apptools/workbench/action/rename_user_perspective_action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#-----------------------------------------------------------------------------
#
# Copyright (c) 2005-2006 by Enthought, Inc.
# All rights reserved.
#
# Author: David C. Morrill <dmorrill@enthought.com>
#
#-----------------------------------------------------------------------------
""" An action that renames a user perspective. """


# Local imports.
from .user_perspective_action import UserPerspectiveAction
from .user_perspective_name import UserPerspectiveName


class RenameUserPerspectiveAction(UserPerspectiveAction):
""" An action that renames a user perspective. """

#### 'Action' interface ###################################################

# The action's unique identifier (may be None).
id = 'apptools.workbench.action.rename_user_perspective_action'

# The action's name (displayed on menus/tool bar tools etc).
name = 'Rename Perspective...'

###########################################################################
# 'Action' interface.
###########################################################################

def perform( self, event):
""" Perform the action. """

window = event.window
manager = window.workbench.user_perspective_manager

# Get the new name.
upn = UserPerspectiveName(name=window.active_perspective.name)
if upn.edit_traits(view='rename_view').result:
manager.rename(window.active_perspective, upn.name.strip())

return

#### EOF #####################################################################
Loading