From dfbf090fca98aaac9892d0f7e0c5079dad742bf3 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Mon, 16 Nov 2020 11:33:19 -0600 Subject: [PATCH 1/3] removing help subpackage and all references to it in apptools --- README.rst | 2 - apptools/help/__init__.py | 7 - apptools/help/help_plugin/__init__.py | 0 apptools/help/help_plugin/action/__init__.py | 0 .../help/help_plugin/action/demo_action.py | 98 ------ .../help/help_plugin/action/doc_action.py | 118 ------- .../help/help_plugin/action/example_action.py | 82 ----- .../help_plugin/action/images/document.png | Bin 333 -> 0 bytes .../help_plugin/action/images/python_run.png | Bin 720 -> 0 bytes .../help_plugin/action/load_url_action.py | 30 -- apptools/help/help_plugin/action/util.py | 24 -- apptools/help/help_plugin/api.py | 16 - .../help/help_plugin/examples_preferences.py | 32 -- apptools/help/help_plugin/help_code.py | 41 --- apptools/help/help_plugin/help_doc.py | 44 --- apptools/help/help_plugin/help_plugin.py | 306 ------------------ .../help/help_plugin/help_submenu_manager.py | 258 --------------- apptools/help/help_plugin/i_help_code.py | 38 --- apptools/help/help_plugin/i_help_doc.py | 40 --- apptools/help/help_plugin/preferences.ini | 10 - .../help/help_plugin/preferences_pages.py | 188 ----------- apptools/logger/agent/quality_agent_view.py | 6 +- setup.cfg | 1 - setup.py | 4 +- 24 files changed, 2 insertions(+), 1343 deletions(-) delete mode 100644 apptools/help/__init__.py delete mode 100644 apptools/help/help_plugin/__init__.py delete mode 100644 apptools/help/help_plugin/action/__init__.py delete mode 100644 apptools/help/help_plugin/action/demo_action.py delete mode 100644 apptools/help/help_plugin/action/doc_action.py delete mode 100644 apptools/help/help_plugin/action/example_action.py delete mode 100644 apptools/help/help_plugin/action/images/document.png delete mode 100644 apptools/help/help_plugin/action/images/python_run.png delete mode 100644 apptools/help/help_plugin/action/load_url_action.py delete mode 100644 apptools/help/help_plugin/action/util.py delete mode 100644 apptools/help/help_plugin/api.py delete mode 100644 apptools/help/help_plugin/examples_preferences.py delete mode 100644 apptools/help/help_plugin/help_code.py delete mode 100644 apptools/help/help_plugin/help_doc.py delete mode 100644 apptools/help/help_plugin/help_plugin.py delete mode 100644 apptools/help/help_plugin/help_submenu_manager.py delete mode 100644 apptools/help/help_plugin/i_help_code.py delete mode 100644 apptools/help/help_plugin/i_help_doc.py delete mode 100644 apptools/help/help_plugin/preferences.ini delete mode 100644 apptools/help/help_plugin/preferences_pages.py diff --git a/README.rst b/README.rst index 8b5bb6b63..802c5d793 100644 --- a/README.rst +++ b/README.rst @@ -15,8 +15,6 @@ The apptools project includes a set of packages that Enthought has found useful in creating a number of applications. They implement functionality that is commonly needed by many applications -- **apptools.help**: Provides a plugin for displaying documents and examples - and running demos in Envisage Workbench applications. - **apptools.io**: Provides an abstraction for files and folders in a file system. - **apptools.logger**: Convenience functions for creating logging handlers diff --git a/apptools/help/__init__.py b/apptools/help/__init__.py deleted file mode 100644 index b866653d4..000000000 --- a/apptools/help/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) 2005, Enthought, Inc. -# All rights reserved. -# ------------------------------------------------------------------------------ -""" Support for online help in Traits and Envisage. - Part of the AppTools project of the Enthought Tool Suite. -""" diff --git a/apptools/help/help_plugin/__init__.py b/apptools/help/help_plugin/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/apptools/help/help_plugin/action/__init__.py b/apptools/help/help_plugin/action/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/apptools/help/help_plugin/action/demo_action.py b/apptools/help/help_plugin/action/demo_action.py deleted file mode 100644 index 78dbea4e4..000000000 --- a/apptools/help/help_plugin/action/demo_action.py +++ /dev/null @@ -1,98 +0,0 @@ -""" (Pyface) Action for running a help demo. - - :Copyright: 2008, Enthought Inc. - :License: BSD - :Author: Janet Swisher -""" -# This software is provided without warranty under the terms of the BSD -# license included in AppTools/trunk/LICENSE.txt and may be redistributed only -# under the conditions described in the aforementioned license. The license -# is also available online at http://www.enthought.com/licenses/BSD.txt -# Thanks for using Enthought open source! - -# Standard library imports. -import logging -from os.path import isabs, join, normpath -from subprocess import Popen -import sys - -# Enthought library imports. -from envisage.api import IExtensionPointUser, IExtensionRegistry -from pyface.workbench.action.workbench_action import WorkbenchAction -from traits.api import Instance, provides, Property -from pyface.api import ImageResource -from apptools.help.help_plugin.api import HelpCode - -# Logging. -logger = logging.getLogger(__name__) - -# This module's parent package. -PARENT = ".".join(__name__.split(".")[:-2]) - -from .util import get_sys_prefix_relative_filename - -# Implementation of the ImageResource class to be used for the DocAction class. -@provides(IExtensionPointUser) -class DemoImageResource(ImageResource): - """Implementation of the ImageResource class to be used for the DemoAction - class. - Overrides the '_image_not_found' trait in the base ImageResource class. - """ - - # Image to display when the specified image file cannot be located. - _image_not_found = ImageResource("python_run") - - -class DemoAction(WorkbenchAction): - """""" - - ### Action interface ############################################## - - # Image associated with this action instance. - image = Property - - ### IExtensionPointUser interface - extension_registry = Property(Instance(IExtensionRegistry)) - - def _get_extension_registry(self): - return self.window.application.extension_registry - - def _get_image(self): - """Returns the image to be used for this DemoAction instance.""" - # The current implementation searches for an image file matching - # 'name' in all of the image paths. If such a file is not to be found, - # the '_image_not_found' file for the DemoImageResourceClass is used. - return DemoImageResource(self.name) - - ### HelpDemoAction interface - - # Help code associated with this action. - my_help_code = Instance(HelpCode) - - def _my_help_code_default(self): - exns = self.extension_registry.get_extensions(PARENT + ".help_demos") - for hc in exns: - if hc.label == self.name: - return hc - return None - - def perform(self, event): - """Perform the action by running the demo.""" - if self.my_help_code is not None: - if self.my_help_code.filename: - filename = get_sys_prefix_relative_filename( - self.my_help_code.filename - ) - if filename is not None: - try: - Popen([sys.executable, filename]) - except OSError as err: - logger.error( - 'Could not execute Python file for Demo "%s".\n\n' - % self.my_help_code.label - + str(err) - + "\n\nTry changing Demo Preferences." - ) - elif self.my_help_code.code: - exec("%s" % self.my_help_code.code) - return diff --git a/apptools/help/help_plugin/action/doc_action.py b/apptools/help/help_plugin/action/doc_action.py deleted file mode 100644 index b56265417..000000000 --- a/apptools/help/help_plugin/action/doc_action.py +++ /dev/null @@ -1,118 +0,0 @@ -""" (Pyface) Action for displaying a help doc. - - :Copyright: 2008, Enthought Inc. - :License: BSD - :Author: Janet Swisher -""" -# This software is provided without warranty under the terms of the BSD -# license included in AppTools/trunk/LICENSE.txt and may be redistributed only -# under the conditions described in the aforementioned license. The license -# is also available online at http://www.enthought.com/licenses/BSD.txt -# Thanks for using Enthought open source! - - -# Standard library imports. -import logging -from os.path import isabs, join, normpath -from subprocess import Popen -import sys - -# Enthought library imports. -from envisage.api import IExtensionPointUser, IExtensionRegistry -from pyface.workbench.action.workbench_action import WorkbenchAction -from traits.api import Instance, provides, Property -from pyface.api import ImageResource - -from apptools.help.help_plugin.api import HelpDoc - -# Local imports -from .util import get_sys_prefix_relative_filename - -# Logging. -logger = logging.getLogger(__name__) - -# This module's parent package. -PARENT = ".".join(__name__.split(".")[:-2]) - -# Implementation of the ImageResource class to be used for the DocAction class. -@provides(IExtensionPointUser) -class DocImageResource(ImageResource): - """Implementation of the ImageResource class to be used for the DocAction - class. - Overrides the '_image_not_found' trait in the base ImageResource class. - """ - - _image_not_found = ImageResource("document") - - -class DocAction(WorkbenchAction): - """(Pyface) Action for displaying a help doc.""" - - ### Action interface ############################################## - - # Image associated with this action instance. - image = Property - - ### IExtensionPointUser interface - - extension_registry = Property(Instance(IExtensionRegistry)) - - def _get_extension_registry(self): - return self.window.application.extension_registry - - def _get_image(self): - """Returns the image to be used for this DocAction instance.""" - # The current implementation searches for an image file matching - # 'name' in all of the image paths. If such a file is not to be found, - # the '_image_not_found' file for the DocImageResourceClass is used. - return DocImageResource(self.name) - - ### HelpDocAction interface - - # Help doc associated with this action. - my_help_doc = Instance(HelpDoc) - - def _my_help_doc_default(self): - exns = self.extension_registry.get_extensions(PARENT + ".help_docs") - for hd in exns: - if hd.label == self.name: - return hd - return None - - def _get_filename(self, doc): - filename = None - if doc is not None: - if doc.url: - filename = doc.filename - else: - filename = get_sys_prefix_relative_filename(doc.filename) - return filename - - def perform(self, event): - """Perform the action by displaying the document.""" - - filename = self._get_filename(self.my_help_doc) - if filename is not None: - if self.my_help_doc.url or self.my_help_doc.viewer == "browser": - import webbrowser - - try: - webbrowser.open(filename) - except (OSError, webbrowser.Error) as msg: - logger.error( - "Could not open page in browser for " - + 'Document "%s":\n\n' % self.my_help_doc.label - + str(msg) - + "\n\nTry changing Dcoument Preferences." - ) - elif self.my_help_doc.viewer is not None: - # Run the viewer, passing it the filename - try: - Popen([self.my_help_doc.viewer, filename]) - except OSError as msg: - logger.error( - "Could not execute program for Document" - + ' "%s":\n\n ' % self.my_help_doc.label - + str(msg) - + "\n\nTry changing Document Preferences." - ) diff --git a/apptools/help/help_plugin/action/example_action.py b/apptools/help/help_plugin/action/example_action.py deleted file mode 100644 index 3e1f507d5..000000000 --- a/apptools/help/help_plugin/action/example_action.py +++ /dev/null @@ -1,82 +0,0 @@ -""" (Pyface) Action for displaying a help example. - - :Copyright: 2008, Enthought Inc. - :License: BSD - :Author: Janet Swisher -""" -# This software is provided without warranty under the terms of the BSD -# license included in AppTools/trunk/LICENSE.txt and may be redistributed only -# under the conditions described in the aforementioned license. The license -# is also available online at http://www.enthought.com/licenses/BSD.txt -# Thanks for using Enthought open source! - - -# Standard library imports. -import logging -from subprocess import Popen - -# Enthought library imports. -from envisage.api import IExtensionPointUser, IExtensionRegistry -from pyface.workbench.action.workbench_action import WorkbenchAction -from traits.api import Instance, provides, Property - -from apptools.help.help_plugin.api import HelpCode -from apptools.help.help_plugin.examples_preferences import ExamplesPreferences - -# Local import -from .util import get_sys_prefix_relative_filename - -# Logging. -logger = logging.getLogger(__name__) - -# This module's parent package. -PARENT = ".".join(__name__.split(".")[:-2]) - - -@provides(IExtensionPointUser) -class ExampleAction(WorkbenchAction): - """(Pyface) Action for displaying a help example.""" - - ### IExtensionPointUser interface - extension_registry = Property(Instance(IExtensionRegistry)) - - def _get_extension_registry(self): - return self.window.application.extension_registry - - ### HelpExampleAction interface - - # Help code associated with this action. - my_help_code = Instance(HelpCode) - - # Preferences for examples - preferences = Instance(ExamplesPreferences) - - def _my_help_code_default(self): - exns = self.extension_registry.get_extensions( - PARENT + ".help_examples" - ) - for he in exns: - if he.label == self.name: - return he - return None - - def perform(self, event): - """Perform the action by displaying the document.""" - if self.my_help_code is not None: - filename = get_sys_prefix_relative_filename( - self.my_help_code.filename - ) - if filename is not None: - logger.info("Perform ExampleAction on %s" % filename) - if self.preferences.editor is not None: - # Run the editor, passing it the filename - try: - Popen([self.preferences.editor, filename]) - except OSError as err: - logger.error( - 'Could not execute program for Example "%s":\n\n ' - % self.my_help_code.label - + str(err) - + "\n\nTry " - + "changing Examples Preferences." - ) diff --git a/apptools/help/help_plugin/action/images/document.png b/apptools/help/help_plugin/action/images/document.png deleted file mode 100644 index 2d7f2d6017d823bf9f1209d9933faf612dffe9f8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 333 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP$ic-+2*wv2(<2J_t+h+ zs5rlI{^p#SO2-|aiODDi-jZP}W|aE1)~BmOR3$EA(Vi@w>U%ZDa$9qM8}c0HKK>=@ z`d4d)YqwsmShMx=n<-}wTJ%-CXPi)?Z+d)E$Kx3$zTq0>%B>G-<`ESK<06 zKLv;!Rde(>`RU=L2g~Ovo%n1M@bQ?*+>S*Vvl$k=|9v$za@qmb9gNTaiaD`NnxMxo zp5*#q&TW}{<`>WDw{ULpSLj^#x@qe3m+d`GEQ*uw+Md|dvtPsTSdE!)vF)Ukp32Aj azp#b`#_#;I)BX+6mkge+elF{r5}E*#afeO- diff --git a/apptools/help/help_plugin/action/images/python_run.png b/apptools/help/help_plugin/action/images/python_run.png deleted file mode 100644 index 5c2c2d5a79195686685218751bd4e4fe5945048c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 720 zcmV;>0x$iEP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iOS< z79}7fp8kIT00K}+L_t(I%axPOYZFlv#m}2glgT&}MyW{}YFj$BAE`Apw4g*#L}-mpRK}4ku^ovO|O)``Dc<;H0&8CX&UER(7 zanHHu0<8)Ghy&=rA!~0yJ%2x5(1rwU^Rx32K=ZHw>E@H^d#Njl%iR<5jV7v<$~W%^ z0Pnzn^zB4;NBOBl^kZGga}%?nxP8got*=^*i9Qd%`M@?U~e>W`qVY6QJx`FO5S{5H$(tHUrStN%L1beoV8>C z03ifK00Myk1X;qaY1&Qhtg!Bo34n_Lp!I9u9e`(1P>+H7Eg2jff*{~z&j=K#jm6hX zZw$$Q5XkhE)+RrA03iM`5vXvq31L0AC9fB-@OC8R=+j`HpGjq*bA)ie3-*z->)7$BSb&M59RL?n>qAbPc7*fpn` zFXUcyPRE}%dLpY!B15~3d&x0g$c@5~|c5O?%qj^u0qi*g(A_UrsMBI@Jd zt-+UhDemos submenu. It is defined by a preference node that - specifies a UI label and a filename for the demo entry point. - - Each contribution to this extension point must be an instance of a - class that implements IHelpCode. The easiest way to do this is to - create an instance of `apptools.help.help_plugin.api.HelpCode`. - - So, to contribute a help demo: - - 1. Create a preferences file for your plugin if it doesn't already - have one. (Be sure to contribute your preferences file to the - `envisage.preferences` extension point.) - - 2. Define a unique "node" (section heading) in your preferences file - for each demo, and specify values for the 'label' and 'filename' - settings. (Note that the same preferences section can be used for - a help demo and a help example.) - - 3. For each demo, contribute a HelpDemo to this extension point, - and specify its *preferences_path* as the corresponding node - name from your preferences file. - """, - ) - - help_examples = ExtensionPoint( - List(IHelpCode), - id=HELP_EXAMPLES, - desc=""" - - A help example is a Python file that is opened for viewing when it is - selected from the Help>Examples submenu. It is defined by a preference - node that specifies a UI label and a filename for the primary example - file. - - Each contribution to this extension point must be an instance of a - class that implements IHelpCode. The easiest way to do this is to - create an instance of `apptools.help.help_plugin.api.HelpCode`. - - So, to contribute a help example: - - 1. Create a preferences file for your plugin if it doesn't already - have one. (Be sure to contribute your preferences file to the - `envisage.preferences` extension point.) - - 2. Define a unique "node" (section heading) in your preferences file - for each example, and specify values for the 'label' and 'filename' - settings. (Note that the same preferences section can be used for - a help demo and a help example.) - - 3. For each example, contribute a HelpCode to this extension point, - and specify its *preferences_path* as the corresponding node - name from your preferences file. - """, - ) - - help_downloads = ExtensionPoint( - List(IHelpDoc), - id=HELP_DOWNLOADS, - desc=""" - - A help download is a url that is opened in a browser for viewing when it - is selected from the Help>Downloads submenu. It is defined by a - preference node that specifies a UI label and a url for the download. - - Each contribution to this extension point must be an instance of a - class that implements IHelpDoc, and has the url trait set to True. The - easiest way to do this is to create an instance of - `apptools.help.help_plugin.api.HelpDoc`. - - So, to contribute a help doc: - - 1. Create a preferences file for your plugin if it doesn't already - have one. (Be sure to contribute your preferences file to the - `envisage.preferences` extension point.) - - 2. Define a unique "node" (section heading) in your preferences file - for each url, and specify values for the 'label' and 'filename' - settings. Also set 'url' to True. - - 3. For each document, contribute a HelpDoc to this extension point, - and specify its *preferences_path* as the corresponding node - name from your preferences file. - """, - ) - - # FIXME: Ideally, there should be an extension point to allow plugins to - # offer editors to display examples (e.g., TextEditorPlugin or - # RemoteEditorPlugin). For now, examples open in an external editor - # launched with subprocess.Popen. The user can set the editor - # command in the Examples preferences page. - - ###### Contributions to extension points made by this plugin ###### - - help_action_sets = List(contributes_to=WORKBENCH_ACTION_SETS) - - def _help_action_sets_default(self): - """Returns a list containing an action set class whose **actions** - correspond to the help docs in the help_docs extension point. - """ - extension_point_mapping = { - DOCS_MENU: self.help_docs, - EXAMPLES_MENU: self.help_examples, - DEMOS_MENU: self.help_demos, - DOWNLOADS_MENU: self.help_downloads, - } - - # Construct traits for the action set - ns = { - "id": "apptools.help.help_plugin.help_action_set", - "name": "Help Plugin ActionSet", - "groups": [ - Group(id=DOCS_GROUP, before="AboutGroup", path=HELP_MENU) - ], - } - - for (menu_name, items) in extension_point_mapping.items(): - if len(items) > 0: - menu = Menu( - name=menu_name, - class_name=PKG - + ".help_submenu_manager:%sMenuManager" % menu_name, - ) - if menu_name in self.menus: - menu.path = "MenuBar" - menu.before = "Help" - else: - menu.path = HELP_MENU - menu.group = DOCS_GROUP - - # Append the menu. - ns.setdefault("menus", []).append(menu) - - return [type("SPLHelpActionSet", (ActionSet,), ns)] - - preferences = List(contributes_to=PREFERENCES) - - def _preferences_default(self): - return ["pkgfile://%s/preferences.ini" % PKG] - - preferences_pages = List(contributes_to=PREFERENCES_PAGES) - - def _preferences_pages_default(self): - from apptools.help.help_plugin.preferences_pages import ( - DocumentsPreferencesPage, - DemosPreferencesPage, - ExamplesPreferencesPage, - HelpDocPreferencesPage, - HelpDemoPreferencesPage, - HelpExamplePreferencesPage, - ) - - pages = [] - if len(self.help_docs) > 0: - pages.append(DocumentsPreferencesPage) - pages.extend( - [ - type( - doc.preferences_path + "PreferencesPage", - (HelpDocPreferencesPage,), - {"preferences_path": doc.preferences_path}, - ) - for doc in self.help_docs - ] - ) - if len(self.help_demos) > 0: - pages.append(DemosPreferencesPage) - pages.extend( - [ - type( - demo.preferences_path + "PreferencesPage", - (HelpDemoPreferencesPage,), - {"preferences_path": demo.preferences_path}, - ) - for demo in self.help_demos - ] - ) - if len(self.help_examples) > 0: - pages.append(ExamplesPreferencesPage) - pages.extend( - [ - type( - example.preferences_path + "PreferencesPage", - (HelpExamplePreferencesPage,), - {"preferences_path": example.preferences_path}, - ) - for example in self.help_examples - ] - ) - return pages diff --git a/apptools/help/help_plugin/help_submenu_manager.py b/apptools/help/help_plugin/help_submenu_manager.py deleted file mode 100644 index 974dc9eb4..000000000 --- a/apptools/help/help_plugin/help_submenu_manager.py +++ /dev/null @@ -1,258 +0,0 @@ -""" Managers for submenus of the Help menu. - - :Copyright: 2008, Enthought Inc. - :License: BSD - :Author: Janet Swisher -""" -# This software is provided without warranty under the terms of the BSD -# license included in AppTools/trunk/LICENSE.txt and may be redistributed only -# under the conditions described in the aforementioned license. The license -# is also available online at http://www.enthought.com/licenses/BSD.txt -# Thanks for using Enthought open source! - - -# Standard library imports. -import logging - -# Enthought library imports. -from envisage.api import IExtensionPointUser, IExtensionRegistry -from pyface.action.api import Group, MenuManager -from traits.api import Any, provides, Instance, List, Property - -# Local imports. -from .action.doc_action import DocAction -from .action.demo_action import DemoAction -from .action.example_action import ExampleAction -from .action.load_url_action import LoadURLAction -from .examples_preferences import ExamplesPreferences -from .i_help_doc import IHelpDoc -from .i_help_code import IHelpCode - -# Logging. -logger = logging.getLogger(__name__) - -# This module's package. -PKG = ".".join(__name__.split(".")[:-1]) - - -@provides(IExtensionPointUser) -class HelpSubmenuManager(MenuManager): - """Base class for managers of submenus of the Help menu. - - This class is adapted from - pyface.ui.workbench.action.view_menu_manager.ViewMenuManager. - """ - - ### IExtensionPointUser interface - extension_registry = Property(Instance(IExtensionRegistry)) - - def _get_extension_registry(self): - return self.window.application.extension_registry - - #### 'ActionManager' interface ############################################ - - # All of the groups in the manager. - groups = List(Group) - - #### 'Private' interface ################################################## - - # The group containing the actual actions. - _item_group = Any - - ########################################################################### - # 'ActionManager' interface. - ########################################################################### - - def _groups_default(self): - """ Trait initializer. """ - - groups = [] - - # Add a group containing items for all contributed documents. - self._item_group = self._create_item_group(self.window) - groups.append(self._item_group) - - return groups - - ########################################################################### - # Private interface. - ########################################################################### - def _clear_group(self, group): - """ Remove all items in a group. """ - - group.destroy() - group.clear() - - return - - def _create_item_group(self, window): - """ Creates a group containing the items. """ - - group = Group() - self._initialize_item_group(window, group) - - return group - - def _initialize_item_group(self, window, group): - """ Initializes a group containing the items. """ - raise NotImplementedError - - -class DocumentsMenuManager(HelpSubmenuManager): - """Controls the 'Help/Documents' menu.""" - - #### 'ActionManager' interface ############################################ - - # The manager's unique identifier (if it has one). - id = "Documents" - - #### 'MenuManager' interface ############################################## - - # The menu manager's name (if the manager is a sub-menu, this is what its - # label will be). - name = "&Documents" - - #### 'DocMenuManager' interface ########################################## - - # The HelpDocs for which this manager displays menu items. - help_doc_list = List(IHelpDoc, allow_none=True) - - def _help_doc_list_default(self): - return self.extension_registry.get_extensions(PKG + ".help_docs") - - ########################################################################### - # Private interface. - ########################################################################### - - def _initialize_item_group(self, window, group): - """ Initializes a group containing the items. """ - - docs = self.help_doc_list - docs.sort(None, lambda doc: doc.label) - - for doc in docs: - # logger.info('Adding Helpaction for "%s", %s' % (doc.label, str(doc))) - group.append(DocAction(name=doc.label, window=window)) - - return - - -class DemosMenuManager(HelpSubmenuManager): - """Controls the 'Help/Demos' menu.""" - - #### 'ActionManager' interface ############################################ - - # The manager's unique identifier (if it has one). - id = "Demos" - - #### 'MenuManager' interface ############################################## - - # The menu manager's name (if the manager is a sub-menu, this is what its - # label will be). - name = "D&emos" - - #### 'DemoMenuManager' interface ########################################## - - # The HelpCode for which this manager displays menu items. - help_demo_list = List(IHelpCode, allow_none=True) - - def _help_demo_list_default(self): - return self.extension_registry.get_extensions(PKG + ".help_demos") - - ########################################################################### - # Private interface. - ########################################################################### - - def _initialize_item_group(self, window, group): - """ Initializes a group containing the items. """ - - demos = self.help_demo_list - demos.sort(None, lambda demo: demo.label) - - for demo in demos: - group.append(DemoAction(name=demo.label, window=window)) - - return - - -class ExamplesMenuManager(HelpSubmenuManager): - """Controls the 'Help/Examples' menu.""" - - #### 'ActionManager' interface ############################################ - - # The manager's unique identifier (if it has one). - id = "Examples" - - #### 'MenuManager' interface ############################################## - - # The menu manager's name (if the manager is a sub-menu, this is what its - # label will be). - name = "&Examples" - - #### 'ExampleMenuManager' interface ########################################## - - # The HelpCode for which this manager displays menu items. - help_example_list = List(IHelpCode, allow_none=True) - - def _help_example_list_default(self): - return self.extension_registry.get_extensions(PKG + ".help_examples") - - # Preferences for examples - preferences = Instance(ExamplesPreferences, ()) - - ########################################################################### - # Private interface. - ########################################################################### - - def _initialize_item_group(self, window, group): - """ Initializes a group containing the items. """ - - examples = self.help_example_list - examples.sort(None, lambda example: example.label) - - for ex in examples: - group.append( - ExampleAction( - name=ex.label, window=window, preferences=self.preferences - ) - ) - - return - - -class DownloadsMenuManager(HelpSubmenuManager): - """Controls the 'Help/Downloads' or 'Downloads'menu.""" - - #### 'ActionManager' interface ############################################ - - # The manager's unique identifier (if it has one). - id = "Downloads" - - #### 'MenuManager' interface ############################################## - - # The menu manager's name (if the manager is a sub-menu, this is what its - # label will be). - name = "&Downloads" - - #### 'DocMenuManager' interface ########################################## - - # The URLs for which this manager displays menu items. - help_download_list = List(IHelpDoc, allow_none=True) - - def _help_download_list_default(self): - return self.extension_registry.get_extensions(PKG + ".help_downloads") - - ########################################################################### - # Private interface. - ########################################################################### - - def _initialize_item_group(self, window, group): - """ Initializes a group containing the items. """ - - urls = self.help_download_list - # docs.sort(None, lambda doc: doc.label) - - for url in urls: - group.append(LoadURLAction(name=url.label, window=window)) - - return diff --git a/apptools/help/help_plugin/i_help_code.py b/apptools/help/help_plugin/i_help_code.py deleted file mode 100644 index 16261ba5d..000000000 --- a/apptools/help/help_plugin/i_help_code.py +++ /dev/null @@ -1,38 +0,0 @@ -""" The help code interface. - - This may be used to define examples to be displayed or demos to be run. - - :Copyright: 2008, Enthought Inc. - :License: BSD - :Author: Janet Swisher -""" -# This software is provided without warranty under the terms of the BSD -# license included in AppTools/trunk/LICENSE.txt and may be redistributed only -# under the conditions described in the aforementioned license. The license -# is also available online at http://www.enthought.com/licenses/BSD.txt -# Thanks for using Enthought open source! - - -from traits.api import Interface, File, Str - - -class IHelpCode(Interface): - """The interface for help code. - - A help code is defined by a UI label and a filename. - """ - - # The UI label for the demo, which appears in menus or dialogs. - label = Str - - # The path to the file containing the code entry point. This may be - # absolute, or relative to the Python directory (sys.prefix). - filename = File - - # The unique ID of the preferences node that contains the other values for - # this object - preferences_path = Str - - # The code to execute. This is executed when filename is None or an empty - # string. - code = Str diff --git a/apptools/help/help_plugin/i_help_doc.py b/apptools/help/help_plugin/i_help_doc.py deleted file mode 100644 index 87d136781..000000000 --- a/apptools/help/help_plugin/i_help_doc.py +++ /dev/null @@ -1,40 +0,0 @@ -""" The help doc interface. - - :Copyright: 2008, Enthought Inc. - :License: BSD - :Author: Janet Swisher -""" -# This software is provided without warranty under the terms of the BSD -# license included in AppTools/trunk/LICENSE.txt and may be redistributed only -# under the conditions described in the aforementioned license. The license -# is also available online at http://www.enthought.com/licenses/BSD.txt -# Thanks for using Enthought open source! - -from traits.api import Interface, Either, File, Str, Bool - - -class IHelpDoc(Interface): - """The interface for help docs. - - A help doc is defined by a UI label, a filename, and a viewer program. - """ - - # The UI label for the help doc, which appears in menus or dialogs. - label = Str - - # The path to the document, which can be full, or relative to the Python - # installation directory (sys.prefix). - filename = File - - # Is this a url? - url = Bool(False) - - # The program to use to view the document. 'browser' means the platform - # default web browser. Otherwise, it is a command to run, which may be - # in the program search path of the current environment, or an absolute - # path to a program. - viewer = Either("browser", Str) - - # The unique ID of the preferences node that contains the other values for - # this object - preferences_path = Str diff --git a/apptools/help/help_plugin/preferences.ini b/apptools/help/help_plugin/preferences.ini deleted file mode 100644 index bab9027ea..000000000 --- a/apptools/help/help_plugin/preferences.ini +++ /dev/null @@ -1,10 +0,0 @@ - -# Entries for testing purposes -#[enthought.help.help_plugin.TraitsDemo] -#label = Traits Demo -#filename = C:\Documents and Settings\demo\src\Traits_3.0.3\examples\demo\demo.py - -#[enthought.help.help_plugin.AcmeLab] -#label = Envisage AcmeLab -#filename = C:\Documents and Settings\demo\src\EnvisagePlugins_3.0.1\examples\workbench\AcmeLab - diff --git a/apptools/help/help_plugin/preferences_pages.py b/apptools/help/help_plugin/preferences_pages.py deleted file mode 100644 index 1e5b460f7..000000000 --- a/apptools/help/help_plugin/preferences_pages.py +++ /dev/null @@ -1,188 +0,0 @@ -""" Defines classes for preferences pages for the help plugin. - - :Copyright: 2008, Enthought Inc. - :License: BSD - :Author: Janet Swisher -""" -# This software is provided without warranty under the terms of the BSD -# license included in AppTools/trunk/LICENSE.txt and may be redistributed only -# under the conditions described in the aforementioned license. The license -# is also available online at http://www.enthought.com/licenses/BSD.txt -# Thanks for using Enthought open source! - -from apptools.preferences.ui.api import PreferencesPage -from traits.api import Either, File, Str -from traitsui.api import Group, Item, Label, View - -# This module's package. -PKG = ".".join(__name__.split(".")[:-1]) - - -class HelpPreferencesPage(PreferencesPage): - """Base class for root preference pages for the help plugin.""" - - #### 'PreferencesPage' interface ########################################## - - # The page's category (e.g. 'General/Appearance'). The empty string means - # that this is a top-level page. - category = "" - - # The page's help identifier (optional). If a help ID *is* provided then - # there will be a 'Help' button shown on the preference page. - help_id = "" - - # The page name (this is what is shown in the preferences dialog. - name = "Help" - - # The path to the preferences node that contains the preferences. - preferences_path = PKG - - traits_view = View() - - -class DocumentsPreferencesPage(HelpPreferencesPage): - """(Blank) page for the "Documents" preferences tree node.""" - - name = "Documents" - - -class DemosPreferencesPage(HelpPreferencesPage): - """(Blank) page for the "Demos" preferences tree node.""" - - name = "Demos" - - -class ExamplesPreferencesPage(HelpPreferencesPage): - """Page for the "Examples" preferences tree node.""" - - name = "Examples" - preferences_path = PKG + ".Examples" - - #### Preferences ########################################################### - - editor = Str - - traits_view = View( - Item(name="editor", label="Command for external editor"), - ) - - -class HelpDocPreferencesPage(PreferencesPage): - """Base class for preferences pages for help documents.""" - - #### 'PreferencesPage' interface ########################################## - - # The page's category. - category = "Documents" - - # The page's help identifier (optional). - help_id = "" - - # The page name (this is what is shown in the preferences dialog. - name = Str - - def _name_default(self): - return self.label - - # The path to the preferences node that contains the preferences. - preferences_path = Str - - #### Preferences ########################################################### - - # The UI label for the help doc, which appears in menus or dialogs. - label = Str - - # The full path to the document on disk. - filename = File - - # The program to use to view the document. 'browser' means the platform - # default web browser. - viewer = Either("browser", File) - - traits_view = View( - Group( - Item("viewer", show_label=True), - Label("Viewer can be 'browser' or a path to a program."), - show_border=True, - ), - Item("filename", show_label=True), - Label( - "Filename can be absolute, or relative to the Python directory." - ), - ) - - -class HelpDemoPreferencesPage(PreferencesPage): - """Base class for preferences pages for help demos.""" - - #### 'PreferencesPage' interface ########################################## - - # The page's category (e.g. 'General/Appearance'). The empty string means - # that this is a top-level page. - category = "Demos" - - # The page's help identifier (optional). If a help ID *is* provided then - # there will be a 'Help' button shown on the preference page. - help_id = "" - - # The page name (this is what is shown in the preferences dialog. - name = Str - - def _name_default(self): - return self.label - - # The path to the preferences node that contains the preferences. - preferences_path = Str - - #### Preferences ########################################################### - - # The UI label for the help demo, which appears in menus or dialogs. - label = Str - - # The full path to entry point for the demo. - filename = File - - traits_view = View( - Item("filename", show_label=True), - Label( - "Filename can be absolute, or relative to the Python directory." - ), - ) - - -class HelpExamplePreferencesPage(PreferencesPage): - """Base class for preferences pages for help examples.""" - - #### 'PreferencesPage' interface ########################################## - - # The page's category (e.g. 'General/Appearance'). The empty string means - # that this is a top-level page. - category = "Examples" - - # The page's help identifier (optional). If a help ID *is* provided then - # there will be a 'Help' button shown on the preference page. - help_id = "" - - # The page name (this is what is shown in the preferences dialog. - name = Str - - def _name_default(self): - return self.label - - # The path to the preferences node that contains the preferences. - preferences_path = Str - - #### Preferences ########################################################### - - # The UI label for the help demo, which appears in menus or dialogs. - label = Str - - # The full path to the main file of the example. - filename = File - - traits_view = View( - Item("filename", show_label=True), - Label( - "Filename can be absolute, or relative to the Python directory." - ), - ) diff --git a/apptools/logger/agent/quality_agent_view.py b/apptools/logger/agent/quality_agent_view.py index 15edb2964..e5adb3eb4 100644 --- a/apptools/logger/agent/quality_agent_view.py +++ b/apptools/logger/agent/quality_agent_view.py @@ -116,11 +116,7 @@ def _create_buttons(self, parent): def _on_help(self, event): """Called when the 'Help' button is pressed. """ - - hp = self.service.application.get_service("apptools.help.IHelp") - hp.library.show_topic(self.help_id) - - return + pass ### Utility methods ####################################################### diff --git a/setup.cfg b/setup.cfg index ecacd1bcc..b01258b48 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,6 @@ ignore = E266, W503 per-file-ignores = */api.py:F401 exclude = # The following list should eventually be empty. - apptools/help/* apptools/io/* apptools/logger/* apptools/naming/* diff --git a/setup.py b/setup.py index b3d670b23..5616782f2 100644 --- a/setup.py +++ b/setup.py @@ -293,9 +293,7 @@ def get_long_description(): long_description=get_long_description(), long_description_content_type="text/x-rst", include_package_data=True, - package_data={'apptools': ['help/help_plugin/*.ini', - 'help/help_plugin/action/images/*.png', - 'logger/plugin/*.ini', + package_data={'apptools': ['logger/plugin/*.ini', 'logger/plugin/view/images/*.png', 'naming/ui/images/*.png', 'preferences/tests/*.ini' From f51bfe6fd00fb683696a912c0028ab29c57f25d4 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Mon, 16 Nov 2020 11:38:11 -0600 Subject: [PATCH 2/3] remove _on_help function all together as no one calls it --- apptools/logger/agent/quality_agent_view.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/apptools/logger/agent/quality_agent_view.py b/apptools/logger/agent/quality_agent_view.py index e5adb3eb4..9644ed3db 100644 --- a/apptools/logger/agent/quality_agent_view.py +++ b/apptools/logger/agent/quality_agent_view.py @@ -114,10 +114,6 @@ def _create_buttons(self, parent): return sizer - def _on_help(self, event): - """Called when the 'Help' button is pressed. """ - pass - ### Utility methods ####################################################### def _create_error_panel(self, parent): From d5f513cf629fbe31f9910b60d50a774494b38d60 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Mon, 16 Nov 2020 11:41:05 -0600 Subject: [PATCH 3/3] add news fragment --- docs/releases/upcoming/215.removal.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/releases/upcoming/215.removal.rst diff --git a/docs/releases/upcoming/215.removal.rst b/docs/releases/upcoming/215.removal.rst new file mode 100644 index 000000000..86cd1386b --- /dev/null +++ b/docs/releases/upcoming/215.removal.rst @@ -0,0 +1 @@ +Remove ``help`` subpackage (#215) \ No newline at end of file