From f9a696f0f2557db3766a47e84055592149a728af Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Thu, 11 Jun 2020 18:59:27 +0100 Subject: [PATCH] Replace uses of the Unicode trait with Str --- .../action/start_recording_action.py | 4 ++-- .../action/stop_recording_action.py | 4 ++-- apptools/appscripting/i_script_manager.py | 4 ++-- apptools/appscripting/script_manager.py | 4 ++-- apptools/permissions/action/login_action.py | 4 ++-- apptools/permissions/action/logout_action.py | 4 ++-- .../permissions/action/user_menu_manager.py | 4 ++-- apptools/permissions/default/policy_data.py | 10 +++++----- apptools/permissions/default/select_role.py | 6 +++--- apptools/permissions/default/select_user.py | 6 +++--- apptools/permissions/default/user_database.py | 14 +++++++------- apptools/permissions/default/user_manager.py | 4 ++-- apptools/permissions/i_user.py | 6 +++--- apptools/permissions/permission.py | 10 +++++----- apptools/persistence/state_pickler.py | 5 +---- .../persistence/tests/test_state_pickler.py | 4 ++-- apptools/preferences/preference_binding.py | 6 +++--- apptools/preferences/preferences_helper.py | 6 +++--- .../tests/preferences_helper_test_case.py | 18 +++++++++--------- apptools/scripting/recorder.py | 4 ++-- apptools/undo/abstract_command.py | 4 ++-- apptools/undo/command_stack.py | 6 +++--- apptools/undo/i_command.py | 4 ++-- apptools/undo/i_command_stack.py | 6 +++--- apptools/undo/i_undo_manager.py | 6 +++--- apptools/undo/undo_manager.py | 6 +++--- docs/source/permissions/ApplicationAPI.rst | 4 ++-- docs/source/undo/Introduction.rst | 10 +++++----- examples/appscripting/actions.py | 12 ++++++------ examples/appscripting/model.py | 4 ++-- examples/permissions/application/person.py | 4 ++-- examples/undo/commands.py | 12 ++++++------ examples/undo/model.py | 4 ++-- 33 files changed, 103 insertions(+), 106 deletions(-) diff --git a/apptools/appscripting/action/start_recording_action.py b/apptools/appscripting/action/start_recording_action.py index e906decfa..438c656c9 100644 --- a/apptools/appscripting/action/start_recording_action.py +++ b/apptools/appscripting/action/start_recording_action.py @@ -15,7 +15,7 @@ # Enthought library imports. from pyface.action.api import Action -from traits.api import Unicode +from traits.api import Str # Local imports. from apptools.appscripting.package_globals import get_script_manager @@ -27,7 +27,7 @@ class StartRecordingAction(Action): #### 'Action' interface ################################################### - name = Unicode("Start recording") + name = Str("Start recording") ########################################################################### # 'Action' interface. diff --git a/apptools/appscripting/action/stop_recording_action.py b/apptools/appscripting/action/stop_recording_action.py index adf7d17b8..c8225221c 100644 --- a/apptools/appscripting/action/stop_recording_action.py +++ b/apptools/appscripting/action/stop_recording_action.py @@ -15,7 +15,7 @@ # Enthought library imports. from pyface.action.api import Action -from traits.api import Bool, Unicode +from traits.api import Bool, Str # Local imports. from apptools.appscripting.package_globals import get_script_manager @@ -29,7 +29,7 @@ class StopRecordingAction(Action): enabled = Bool(False) - name = Unicode("Stop recording") + name = Str("Stop recording") ########################################################################### # 'object' interface. diff --git a/apptools/appscripting/i_script_manager.py b/apptools/appscripting/i_script_manager.py index cf029ba09..088b802c5 100644 --- a/apptools/appscripting/i_script_manager.py +++ b/apptools/appscripting/i_script_manager.py @@ -14,7 +14,7 @@ # Enthought library imports. -from traits.api import Bool, Event, Instance, Interface, Unicode +from traits.api import Bool, Event, Instance, Interface, Str # Local imports. from .i_bind_event import IBindEvent @@ -43,7 +43,7 @@ class IScriptManager(Interface): # This is the text of the script currently being recorded (or the last # recorded script if none is currently being recorded). It is updated # automatically as the user performs actions. - script = Unicode + script = Str # This event is fired when the recorded script changes. The value of the # event will be the ScriptManager instance. diff --git a/apptools/appscripting/script_manager.py b/apptools/appscripting/script_manager.py index d25260485..9ea3a6854 100644 --- a/apptools/appscripting/script_manager.py +++ b/apptools/appscripting/script_manager.py @@ -20,7 +20,7 @@ # Enthought library imports. from traits.api import Any, Bool, Callable, Dict, Event, HasTraits, \ - implements, Instance, Int, List, Property, Str, Unicode + implements, Instance, Int, List, Property, Str # Local imports. from .bind_event import BindEvent @@ -313,7 +313,7 @@ class ScriptManager(HasTraits): # This is the text of the script currently being recorded (or the last # recorded script if none is currently being recorded). It is updated # automatically as the user performs actions. - script = Property(Unicode) + script = Property(Str) # This event is fired when the recorded script changes. The value of the # event will be the ScriptManager instance. diff --git a/apptools/permissions/action/login_action.py b/apptools/permissions/action/login_action.py index caddc68af..4e0a97b19 100644 --- a/apptools/permissions/action/login_action.py +++ b/apptools/permissions/action/login_action.py @@ -15,7 +15,7 @@ # Enthought library imports. from pyface.action.api import Action -from traits.api import Unicode +from traits.api import Str # Local imports. from apptools.permissions.package_globals import get_permissions_manager @@ -26,7 +26,7 @@ class LoginAction(Action): #### 'Action' interface ################################################### - name = Unicode("Log&in...") + name = Str("Log&in...") ########################################################################### # 'Action' interface. diff --git a/apptools/permissions/action/logout_action.py b/apptools/permissions/action/logout_action.py index 0ff98cd79..60d031d43 100644 --- a/apptools/permissions/action/logout_action.py +++ b/apptools/permissions/action/logout_action.py @@ -15,7 +15,7 @@ # Enthought library imports. from pyface.action.api import Action -from traits.api import Bool, Unicode +from traits.api import Bool, Str # Local imports. from apptools.permissions.package_globals import get_permissions_manager @@ -28,7 +28,7 @@ class LogoutAction(Action): enabled = Bool(False) - name = Unicode("Log&out") + name = Str("Log&out") ########################################################################### # 'object' interface. diff --git a/apptools/permissions/action/user_menu_manager.py b/apptools/permissions/action/user_menu_manager.py index e18e2d95e..15cc52291 100644 --- a/apptools/permissions/action/user_menu_manager.py +++ b/apptools/permissions/action/user_menu_manager.py @@ -15,7 +15,7 @@ # Enthought library imports. from pyface.action.api import Group, MenuManager -from traits.api import Unicode +from traits.api import Str # Local imports. from apptools.permissions.package_globals import get_permissions_manager @@ -31,7 +31,7 @@ class UserMenuManager(MenuManager): id = 'User' - name = Unicode("&User") + name = Str("&User") ########################################################################### # 'object' interface. diff --git a/apptools/permissions/default/policy_data.py b/apptools/permissions/default/policy_data.py index 83d493442..e51b7d669 100644 --- a/apptools/permissions/default/policy_data.py +++ b/apptools/permissions/default/policy_data.py @@ -14,7 +14,7 @@ # Enthought library imports. -from traits.api import HasTraits, Instance, List, Unicode +from traits.api import HasTraits, Instance, List, Str # Local imports. from apptools.permissions.permission import Permission @@ -24,10 +24,10 @@ class Role(HasTraits): """This represents a role.""" # The role name. - name = Unicode + name = Str # The role description. - description = Unicode + description = Str # The permissions that define the role. permissions = List(Instance(Permission)) @@ -46,10 +46,10 @@ class Assignment(HasTraits): """This represents the assignment of roles to a user.""" # The user name. - user_name = Unicode + user_name = Str # The user description. - description = Unicode + description = Str # The list of assigned roles. roles = List(Instance(Role)) diff --git a/apptools/permissions/default/select_role.py b/apptools/permissions/default/select_role.py index c81eb18b1..11bcf04a4 100644 --- a/apptools/permissions/default/select_role.py +++ b/apptools/permissions/default/select_role.py @@ -14,7 +14,7 @@ # Enthought library imports. -from traits.api import HasTraits, Instance, List, Unicode +from traits.api import HasTraits, Instance, List, Str from traitsui.api import Item, TableEditor, View from traitsui.menu import OKCancelButtons from traitsui.table_column import ObjectColumn @@ -26,10 +26,10 @@ class _Role(HasTraits): #### '_RoleModel' interface ############################################### # The role name. - name = Unicode + name = Str # The role description. - description = Unicode + description = Str # The permissions ids. permissions = List diff --git a/apptools/permissions/default/select_user.py b/apptools/permissions/default/select_user.py index f41f0e123..51d2213e1 100644 --- a/apptools/permissions/default/select_user.py +++ b/apptools/permissions/default/select_user.py @@ -14,7 +14,7 @@ # Enthought library imports. -from traits.api import HasTraits, Instance, List, Unicode +from traits.api import HasTraits, Instance, List, Str from traitsui.api import Item, TableEditor, View from traitsui.menu import OKCancelButtons from traitsui.table_column import ObjectColumn @@ -26,10 +26,10 @@ class _User(HasTraits): #### '_User' interface #################################################### # The user name. - name = Unicode + name = Str # The user description. - description = Unicode + description = Str class _UsersView(HasTraits): diff --git a/apptools/permissions/default/user_database.py b/apptools/permissions/default/user_database.py index d7d88824a..ec5ea8f7b 100644 --- a/apptools/permissions/default/user_database.py +++ b/apptools/permissions/default/user_database.py @@ -19,7 +19,7 @@ # Enthought library imports. from pyface.api import confirm, error, YES from traits.api import Bool, Dict, HasTraits, provides, Instance, \ - List, Password, Property, Unicode + List, Password, Property, Str from traitsui.api import Handler, Item, View from traitsui.menu import Action, OKCancelButtons @@ -37,7 +37,7 @@ class _LoginUser(HasTraits): #### '_LoginUser' interface ############################################### # The user name. - name = Unicode + name = Str # The user password. password = Password @@ -53,7 +53,7 @@ class _ChangePassword(HasTraits): #### '_ChangePassword' interface ########################################## # The user name. - name = Unicode + name = Str # The new user password. new_password = Password @@ -73,10 +73,10 @@ class _ViewUserAccount(HasTraits): #### '_ViewUserAccount' interface ######################################### # The name the user uses to identify themselves. - name = Unicode + name = Str # A description of the user (typically their full name). - description = Unicode + description = Str # The password password = Password @@ -249,11 +249,11 @@ class User(HasTraits): #### 'IUser' interface #################################################### - name = Unicode + name = Str authenticated = Bool(False) - description = Unicode + description = Str blob = Dict diff --git a/apptools/permissions/default/user_manager.py b/apptools/permissions/default/user_manager.py index d720f208a..8efc317f7 100644 --- a/apptools/permissions/default/user_manager.py +++ b/apptools/permissions/default/user_manager.py @@ -16,7 +16,7 @@ # Enthought library imports. from pyface.action.api import Action from traits.api import Bool, Event, HasTraits, provides, \ - Instance, List, Unicode + Instance, List, Str # Local imports. from apptools.permissions.i_user import IUser @@ -149,7 +149,7 @@ class _ChangePasswordAction(Action): enabled = Bool(False) - name = Unicode("&Change Password...") + name = Str("&Change Password...") ########################################################################### # 'object' interface. diff --git a/apptools/permissions/i_user.py b/apptools/permissions/i_user.py index f836f936f..9c02b20df 100644 --- a/apptools/permissions/i_user.py +++ b/apptools/permissions/i_user.py @@ -14,7 +14,7 @@ # Enthought library imports. -from traits.api import Bool, Dict, Interface, Unicode +from traits.api import Bool, Dict, Interface, Str class IUser(Interface): @@ -22,7 +22,7 @@ class IUser(Interface): # The user's name, ie. how they identified themselves to the permissions # policy. It is only valid if the authenticated trait is True. - name = Unicode + name = Str # This is set if the user has been authenticated, ie. the name trait is # valid. @@ -30,7 +30,7 @@ class IUser(Interface): # An optional description of the user (eg. their full name). The exact # meaning is defined by the user manager. - description = Unicode + description = Str # This allows application defined, user specific data to be persisted in # the user database. An application (or plugin) should save the data as a diff --git a/apptools/permissions/permission.py b/apptools/permissions/permission.py index c03dcacb3..b20ed20ee 100644 --- a/apptools/permissions/permission.py +++ b/apptools/permissions/permission.py @@ -13,8 +13,8 @@ #------------------------------------------------------------------------------ -# Enthought library imports. -from traits.api import Bool, HasTraits, Property, Str, Unicode +# Enthought library imports +from traits.api import Bool, HasTraits, Property, Str # Locals imports. from .package_globals import get_permissions_manager @@ -32,7 +32,7 @@ class Permission(HasTraits): id = Str # A user friendly description of the permission. - description = Unicode + description = Str # Set if the current user has this permission. This is typically used with # the enabled_when and visible_when traits of a TraitsUI Item object when @@ -88,7 +88,7 @@ class ManagePolicyPermission(Permission): id = Str('ets.permissions.manage_policy') - description = Unicode(u"Manage permissions policy") + description = Str(u"Manage permissions policy") bootstrap = Bool(True) @@ -100,6 +100,6 @@ class ManageUsersPermission(Permission): id = Str('ets.permissions.manage_users') - description = Unicode(u"Manage users") + description = Str(u"Manage users") bootstrap = Bool(True) diff --git a/apptools/persistence/state_pickler.py b/apptools/persistence/state_pickler.py index fb82746f4..01ac670a7 100644 --- a/apptools/persistence/state_pickler.py +++ b/apptools/persistence/state_pickler.py @@ -215,7 +215,7 @@ class StatePickler: will return the dictionary that is pickled. The format of the state dict is quite strightfoward. Basic types - (bool, int, long, float, complex, None, string and unicode) are + (bool, int, long, float, complex, None, string) are represented as they are. Everything else is stored as a dictionary containing metadata information on the object's type etc. and also the actual object in the 'data' key. For example:: @@ -268,9 +268,6 @@ def __init__(self): NumpyArrayType: self._do_numeric, State: self._do_state, } - if PY_VER == 2: - type_map[long] = self._do_basic_type - type_map[unicode] = self._do_basic_type self.type_map = type_map def dump(self, value, file): diff --git a/apptools/persistence/tests/test_state_pickler.py b/apptools/persistence/tests/test_state_pickler.py index e0c98d901..04395f244 100644 --- a/apptools/persistence/tests/test_state_pickler.py +++ b/apptools/persistence/tests/test_state_pickler.py @@ -15,7 +15,7 @@ import numpy from traits.api import Bool, Int, Array, Float, Complex, Any, \ - Str, Unicode, Instance, Tuple, List, Dict, HasTraits + Str, Instance, Tuple, List, Dict, HasTraits try: from tvtk.api import tvtk @@ -69,7 +69,7 @@ class TestTraits(HasTraits): c = Complex(complex(1.01234, 2.3)) n = Any s = Str('String') - u = Unicode(u'Unicode') + u = Str(u'Unicode') inst = Instance(A) tuple = Tuple list = List diff --git a/apptools/preferences/preference_binding.py b/apptools/preferences/preference_binding.py index e9dc29142..6aabaf1b0 100644 --- a/apptools/preferences/preference_binding.py +++ b/apptools/preferences/preference_binding.py @@ -3,7 +3,7 @@ # Enthought library imports. from traits.api import Any, HasTraits, Instance, Str, Undefined -from traits.api import Unicode +from traits.api import Str # Third-party librart imports. import six @@ -102,8 +102,8 @@ def _get_value(self, trait_name, value): if type(handler) is Str: pass - # If the trait type is 'Unicode' then we convert the raw value. - elif type(handler) is Unicode: + # If the trait type is 'Str' then we convert the raw value. + elif type(handler) is Str: value = six.text_type(value) # Otherwise, we eval it! diff --git a/apptools/preferences/preferences_helper.py b/apptools/preferences/preferences_helper.py index 60602b9f5..86c2d7169 100644 --- a/apptools/preferences/preferences_helper.py +++ b/apptools/preferences/preferences_helper.py @@ -5,7 +5,7 @@ import logging # Enthought library imports. -from traits.api import HasTraits, Instance, Str, Unicode +from traits.api import HasTraits, Instance, Str # Local imports. from .i_preferences import IPreferences @@ -128,8 +128,8 @@ def _get_value(self, trait_name, value): trait = self.trait(trait_name) handler = trait.handler - # If the trait type is 'Str' or Unicode then we just take the raw value. - if isinstance(handler, (Str, Unicode)) or trait.is_str: + # If the trait type is 'Str' then we just take the raw value. + if isinstance(handler, Str) or trait.is_str: pass # Otherwise, we eval it! diff --git a/apptools/preferences/tests/preferences_helper_test_case.py b/apptools/preferences/tests/preferences_helper_test_case.py index ba35278b1..fd97b1105 100644 --- a/apptools/preferences/tests/preferences_helper_test_case.py +++ b/apptools/preferences/tests/preferences_helper_test_case.py @@ -12,7 +12,7 @@ from apptools.preferences.api import Preferences, PreferencesHelper from apptools.preferences.api import ScopedPreferences from apptools.preferences.api import set_default_preferences -from traits.api import Any, Bool, HasTraits, Int, Float, List, Str, Unicode +from traits.api import Any, Bool, HasTraits, Int, Float, List, Str def width_listener(obj, trait_name, old, new): @@ -81,7 +81,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper): width = Int ratio = Float visible = Bool - description = Unicode + description = Str offsets = List(Int) names = List(Str) @@ -135,7 +135,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper): width = Int ratio = Float visible = Bool - description = Unicode + description = Str offsets = List(Int) names = List(Str) @@ -191,7 +191,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper): width = Int(50) ratio = Float(1.0) visible = Bool(True) - description = Unicode(u'description') + description = Str(u'description') offsets = List(Int, [1, 2, 3, 4]) names = List(Str, ['joe', 'fred', 'jane']) @@ -225,7 +225,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper): width = Int(50) ratio = Float(1.0) visible = Bool(True) - description = Unicode(u'') + description = Str(u'') offsets = List(Int, [1, 2, 3, 4]) names = List(Str, ['joe', 'fred', 'jane']) @@ -270,7 +270,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper): width = Int ratio = Float visible = Bool - description = Unicode + description = Str offsets = List(Int) names = List(Str) @@ -304,7 +304,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper): width = Int ratio = Float visible = Bool - description = Unicode + description = Str offsets = List(Int) names = List(Str) @@ -423,7 +423,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper): width = Int ratio = Float visible = Bool - description = Unicode + description = Str offsets = List(Int) names = List(Str) @@ -489,7 +489,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper): width = Int ratio = Float visible = Bool - description = Unicode + description = Str offsets = List(Int) names = List(Str) diff --git a/apptools/scripting/recorder.py b/apptools/scripting/recorder.py index d2f4c20da..aad8fa408 100644 --- a/apptools/scripting/recorder.py +++ b/apptools/scripting/recorder.py @@ -15,7 +15,7 @@ import six.moves.builtins from traits.api import (HasTraits, List, Str, Dict, Bool, - Unicode, Property, Int, Instance) + Property, Int, Instance) from traits.util.camel_case import camel_case_to_python @@ -101,7 +101,7 @@ class Recorder(HasTraits): # The Python script we have recorded so far. This is just a # convenience trait for the `get_code()` method. - script = Property(Unicode) + script = Property(Str) ######################################## # Private traits. diff --git a/apptools/undo/abstract_command.py b/apptools/undo/abstract_command.py index 90818a7e3..6f7d12ad1 100644 --- a/apptools/undo/abstract_command.py +++ b/apptools/undo/abstract_command.py @@ -13,7 +13,7 @@ #------------------------------------------------------------------------------ # Enthought library imports. -from traits.api import Any, HasTraits, Unicode, provides +from traits.api import Any, HasTraits, Str, provides # Local imports. from .i_command import ICommand @@ -33,7 +33,7 @@ class AbstractCommand(HasTraits): # This is the name of the command as it will appear in any GUI element. It # may include '&' which will be automatically removed whenever it is # inappropriate. - name = Unicode + name = Str ########################################################################### # 'ICommand' interface. diff --git a/apptools/undo/command_stack.py b/apptools/undo/command_stack.py index 6e6270c14..a967140f1 100644 --- a/apptools/undo/command_stack.py +++ b/apptools/undo/command_stack.py @@ -14,7 +14,7 @@ # Enthought library imports. from traits.api import Bool, HasTraits, Instance, Int, List, Property, \ - Unicode, provides + Str, provides # Local imports. from .abstract_command import AbstractCommand @@ -99,7 +99,7 @@ class CommandStack(HasTraits): # This is the name of the command that can be redone. It will be empty if # there is no command that can be redone. It is maintained by the undo # stack. - redo_name = Property(Unicode) + redo_name = Property(Str) # This is the undo manager that manages this stack. undo_manager = Instance(IUndoManager) @@ -107,7 +107,7 @@ class CommandStack(HasTraits): # This is the name of the command that can be undone. It will be empty if # there is no command that can be undone. It is maintained by the undo # stack. - undo_name = Property(Unicode) + undo_name = Property(Str) #### Private interface #################################################### diff --git a/apptools/undo/i_command.py b/apptools/undo/i_command.py index 7adb7ac5b..e3830cffd 100644 --- a/apptools/undo/i_command.py +++ b/apptools/undo/i_command.py @@ -14,7 +14,7 @@ # Enthought library imports. -from traits.api import Any, Interface, Unicode +from traits.api import Any, Interface, Str class ICommand(Interface): @@ -31,7 +31,7 @@ class ICommand(Interface): # This is the name of the command as it will appear in any GUI element. It # may include '&' which will be automatically removed whenever it is # inappropriate. - name = Unicode + name = Str ########################################################################### # 'ICommand' interface. diff --git a/apptools/undo/i_command_stack.py b/apptools/undo/i_command_stack.py index 9fb6c7310..acbed3461 100644 --- a/apptools/undo/i_command_stack.py +++ b/apptools/undo/i_command_stack.py @@ -13,7 +13,7 @@ #------------------------------------------------------------------------------ # Enthought library imports. -from traits.api import Bool, Instance, Interface, Unicode +from traits.api import Bool, Instance, Interface, Str # Local imports. from .i_undo_manager import IUndoManager @@ -36,7 +36,7 @@ class ICommandStack(Interface): # This is the name of the command that can be redone. It will be empty if # there is no command that can be redone. It is maintained by the undo # stack. - redo_name = Unicode + redo_name = Str # This is the undo manager that manages this stack. undo_manager = Instance(IUndoManager) @@ -44,7 +44,7 @@ class ICommandStack(Interface): # This is the name of the command that can be undone. It will be empty if # there is no command that can be undone. It is maintained by the undo # stack. - undo_name = Unicode + undo_name = Str ########################################################################### # 'ICommandStack' interface. diff --git a/apptools/undo/i_undo_manager.py b/apptools/undo/i_undo_manager.py index 27636a980..750ca13f6 100644 --- a/apptools/undo/i_undo_manager.py +++ b/apptools/undo/i_undo_manager.py @@ -13,7 +13,7 @@ #------------------------------------------------------------------------------ # Enthought library imports. -from traits.api import Bool, Event, Instance, Int, Interface, Unicode +from traits.api import Bool, Event, Instance, Int, Interface, Str class IUndoManager(Interface): @@ -36,7 +36,7 @@ class IUndoManager(Interface): # This is the name of the command that can be redone. It will be empty if # there is no command that can be redone. It is maintained by the undo # manager. - redo_name = Unicode + redo_name = Str # This is the sequence number of the next command to be performed. It is # incremented immediately before a command is invoked (by its 'do()' @@ -50,7 +50,7 @@ class IUndoManager(Interface): # This is the name of the command that can be undone. It will be empty if # there is no command that can be undone. It is maintained by the undo # manager. - undo_name = Unicode + undo_name = Str ########################################################################### # 'IUndoManager' interface. diff --git a/apptools/undo/undo_manager.py b/apptools/undo/undo_manager.py index fb09d10c8..2388d7f62 100644 --- a/apptools/undo/undo_manager.py +++ b/apptools/undo/undo_manager.py @@ -14,7 +14,7 @@ # Enthought library imports. from traits.api import Bool, Event, HasTraits, Instance, Int, Property, \ - Unicode, provides + Str, provides # Local imports. from .i_undo_manager import IUndoManager @@ -40,7 +40,7 @@ class UndoManager(HasTraits): # This is the name of the command that can be redone. It will be empty if # there is no command that can be redone. It is maintained by the undo # manager. - redo_name = Property(Unicode) + redo_name = Property(Str) # This is the sequence number of the next command to be performed. It is # incremented immediately before a command is invoked (by its 'do()' @@ -55,7 +55,7 @@ class UndoManager(HasTraits): # This is the name of the command that can be undone. It will be empty if # there is no command that can be undone. It is maintained by the undo # manager. - undo_name = Property(Unicode) + undo_name = Property(Str) ########################################################################### # 'IUndoManager' interface. diff --git a/docs/source/permissions/ApplicationAPI.rst b/docs/source/permissions/ApplicationAPI.rst index ee67077cd..634ac1e66 100644 --- a/docs/source/permissions/ApplicationAPI.rst +++ b/docs/source/permissions/ApplicationAPI.rst @@ -83,7 +83,7 @@ object that enables the ``age`` item when the user has the has the ``PersonSalaryPerm`` permission:: from apptools.permissions.api import SecureHandler - from traits.api import HasTraits, Int, Unicode + from traits.api import HasTraits, Int, Str from traitsui.api import Item, View from permissions import UpdatePersonAgePerm, PersonSalaryPerm @@ -92,7 +92,7 @@ has the ``PersonSalaryPerm`` permission:: """A simple example of an object model""" # Name. - name = Unicode + name = Str # Age in years. age = Int diff --git a/docs/source/undo/Introduction.rst b/docs/source/undo/Introduction.rst index d182f862d..89dee28d6 100644 --- a/docs/source/undo/Introduction.rst +++ b/docs/source/undo/Introduction.rst @@ -103,12 +103,12 @@ interface. be the currently active stack. ``undo_name`` - This Unicode trait is the name of the command that can be undone, and will + This Str trait is the name of the command that can be undone, and will be empty if there is no such command. It is maintained by the undo manager. ``redo_name`` - This Unicode trait is the name of the command that can be redone, and will + This Str trait is the name of the command that can be redone, and will be empty if there is no such command. It is maintained by the undo manager. @@ -143,12 +143,12 @@ The ``CommandStack`` class is the default implementation of the data is saved to disk for example). ``undo_name`` - This Unicode trait is the name of the command that can be undone, and will + This Str trait is the name of the command that can be undone, and will be empty if there is no such command. It is maintained by the command stack. ``redo_name`` - This Unicode trait is the name of the command that can be redone, and will + This Str trait is the name of the command that can be redone, and will be empty if there is no such command. It is maintained by the command stack. @@ -199,7 +199,7 @@ any undoable/redoable command. operates on. It is not used by the framework itself. ``name`` - This Unicode trait is the name of the command as it will appear in any GUI + This Str trait is the name of the command as it will appear in any GUI element (e.g. in the text of an undo and redo menu entry). It may include ``&`` to indicate a keyboard shortcut which will be automatically removed whenever it is inappropriate. diff --git a/examples/appscripting/actions.py b/examples/appscripting/actions.py index 57550ddc0..682b68185 100644 --- a/examples/appscripting/actions.py +++ b/examples/appscripting/actions.py @@ -14,7 +14,7 @@ # Enthought library imports. -from traits.api import Any, Instance, Str, Unicode +from traits.api import Any, Instance, Str from pyface.action.api import Action from pyface.workbench.api import WorkbenchWindow @@ -149,7 +149,7 @@ class LabelIncrementSizeAction(LabelAction): #### 'Action' interface ################################################### # The name of the action. - name = Unicode("&Increment size") + name = Str("&Increment size") ########################################################################### # 'Action' interface. @@ -167,7 +167,7 @@ class LabelDecrementSizeAction(LabelAction): #### 'Action' interface ################################################### # The name of the action. - name = Unicode("&Decrement size") + name = Str("&Decrement size") ########################################################################### # 'Action' interface. @@ -185,7 +185,7 @@ class LabelNormalFontAction(LabelAction): #### 'Action' interface ################################################### # The name of the action. - name = Unicode("&Normal font") + name = Str("&Normal font") ########################################################################### # 'Action' interface. @@ -203,7 +203,7 @@ class LabelBoldFontAction(LabelAction): #### 'Action' interface ################################################### # The name of the action. - name = Unicode("&Bold font") + name = Str("&Bold font") ########################################################################### # 'Action' interface. @@ -221,7 +221,7 @@ class LabelItalicFontAction(LabelAction): #### 'Action' interface ################################################### # The name of the action. - name = Unicode("&Italic font") + name = Str("&Italic font") ########################################################################### # 'Action' interface. diff --git a/examples/appscripting/model.py b/examples/appscripting/model.py index 8fc4db15f..dfa348929 100644 --- a/examples/appscripting/model.py +++ b/examples/appscripting/model.py @@ -14,7 +14,7 @@ # Enthought library imports. -from traits.api import Enum, HasTraits, Int, Unicode +from traits.api import Enum, HasTraits, Int, Str from apptools.appscripting.api import scriptable, Scriptable @@ -24,7 +24,7 @@ class Label(HasTraits): #### 'Label' interface #################################################### # The name. - name = Unicode + name = Str # The size in points. size = Int(18) diff --git a/examples/permissions/application/person.py b/examples/permissions/application/person.py index 414337a3c..928c59d7b 100644 --- a/examples/permissions/application/person.py +++ b/examples/permissions/application/person.py @@ -3,7 +3,7 @@ # Enthought library imports. from apptools.permissions.api import SecureHandler -from traits.api import HasTraits, Int, Unicode +from traits.api import HasTraits, Int, Str from traitsui.api import Item, View # Local imports. @@ -14,7 +14,7 @@ class Person(HasTraits): """A simple example of an object model""" # Name. - name = Unicode + name = Str # Age in years. age = Int diff --git a/examples/undo/commands.py b/examples/undo/commands.py index 1254a3ddc..f06bfc7bf 100644 --- a/examples/undo/commands.py +++ b/examples/undo/commands.py @@ -14,7 +14,7 @@ # Enthought library imports. -from traits.api import Instance, Int, Unicode +from traits.api import Instance, Int, Str from apptools.undo.api import AbstractCommand # Local imports. @@ -33,7 +33,7 @@ class LabelIncrementSizeCommand(AbstractCommand): data = Instance(Label) # The name of the command. - name = Unicode("&Increment size") + name = Str("&Increment size") #### Private interface #################################################### @@ -76,7 +76,7 @@ class LabelDecrementSizeCommand(AbstractCommand): data = Instance(Label) # The name of the command. - name = Unicode("&Decrement size") + name = Str("&Decrement size") #### Private interface #################################################### @@ -118,7 +118,7 @@ class LabelNormalFontCommand(AbstractCommand): data = Instance(Label) # The name of the command. - name = Unicode("&Normal font") + name = Str("&Normal font") ########################################################################### # 'ICommand' interface. @@ -150,7 +150,7 @@ class LabelBoldFontCommand(AbstractCommand): data = Instance(Label) # The name of the command. - name = Unicode("&Bold font") + name = Str("&Bold font") ########################################################################### # 'ICommand' interface. @@ -182,7 +182,7 @@ class LabelItalicFontCommand(AbstractCommand): data = Instance(Label) # The name of the command. - name = Unicode("&Italic font") + name = Str("&Italic font") ########################################################################### # 'ICommand' interface. diff --git a/examples/undo/model.py b/examples/undo/model.py index 2eee15beb..03d0476dd 100644 --- a/examples/undo/model.py +++ b/examples/undo/model.py @@ -14,7 +14,7 @@ # Enthought library imports. -from traits.api import Enum, HasTraits, Int, Unicode +from traits.api import Enum, HasTraits, Int, Str class Label(HasTraits): @@ -23,7 +23,7 @@ class Label(HasTraits): #### 'Label' interface #################################################### # The name. - name = Unicode + name = Str # The size in points. size = Int(18)