View Issue Details

IDProjectCategoryView StatusLast Update
0003603Slicer4Core: Extensionspublic2017-06-10 08:51
Reporterjcfr Assigned Tomatthew-woehlke  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.4.0Fixed in VersionSlicer 4.4.0 
Summary0003603: Creation of python extension directly from Slicer.
Description

It should be possible to leverage the ExtensionWizard to create new extension directly from the Slicer python interactor.

TagsNo tags attached.

Activities

matthew-woehlke

matthew-woehlke

2014-04-21 12:06

developer   ~0011635

This has been implemented (as a module) at https://github.com/mwoehlke-kitware/Slicer/tree/3603-in-slicer-extension-wizard.

Note: It is also possible to use SlicerWizard directly via the interactor, e.g.:

from SlicerWizard import TemplateManager
tm = TemplateManager()

add templates

extensionPath = tm.copyTemplate(dest, "extensions", "default", "MyExtension")

jcfr

jcfr

2014-05-13 08:13

administrator   ~0011755

Few remarks / questions:

  • Destination of new extension: Could the default be the home directory ?
  • Associate an icon with the wizard
  • Add a link/button in the extension manager allowing to switch to the extension wizard ?
  • In the settings, what is the difference between "Additional template paths" and the two other entries ?

// --------------------------------------------------------------
On my workstation, I got the following message:

add generic template paths None
add paths None for extensions
Traceback (most recent call last):
File "/home/jchris/Projects/Slicer-1-SuperBuild-Qt485/Slicer-build/lib/Slicer-4.3/qt-scripted-modules/ExtensionWizard.py", line 63, in init
self.setupTemplates()
File "/home/jchris/Projects/Slicer-1-SuperBuild-Qt485/Slicer-build/lib/Slicer-4.3/qt-scripted-modules/ExtensionWizard.py", line 185, in setupTemplates
for path in paths:
TypeError: 'NoneType' object is not iterable

Warning, the module "ExtensionWizard" has no widget representation
Warning, there is no UI for the module "ExtensionWizard"

=> Seems the built-in template are not discovered.

// -----------------

I added a:

if paths is None:
continue

to the ExtensionWizard at line 184 to move further.

// -----------------

After clicking on "Create Extension" ... no templates where listed. I manually added:

/path/to/Slicer/Utilities/Templates/Extensions/Default
/path/to/Slicer/Utilities/Templates/Extensions/SuperBuild

to "Additional template paths for extensions"

and

/path/to/Slicer/Utilities/Templates/Modules/CLI
/path/to/Slicer/Utilities/Templates/Modules/Loadable
/path/to/Slicer/Utilities/Templates/Modules/Scripted

to "Additional template paths for modules"

After restarting, only the "Superbuild" type of extension was listed and clicking create lead to an exception:

Traceback (most recent call last):
File "/home/jchris/Projects/Slicer-1-SuperBuild-Qt485/Slicer-build/lib/Slicer-4.3/qt-scripted-modules/ExtensionWizard.py", line 238, in selectExtension
xd = SlicerWizard.ExtensionDescription(sourcedir=path)
File "/home/jchris/Projects/Slicer-1-SuperBuild-Qt485/Slicer-build/bin/Python/SlicerWizard/ExtensionDescription.py", line 125, in init
p = ExtensionProject(sourcedir)
File "/home/jchris/Projects/Slicer-1-SuperBuild-Qt485/Slicer-build/bin/Python/SlicerWizard/ExtensionProject.py", line 50, in init
raise IOError("CMakeLists.txt not found")
IOError: CMakeLists.txt not found

matthew-woehlke

matthew-woehlke

2014-05-13 09:00

developer   ~0011761

/path/to/Slicer/Utilities/Templates/Extensions/Default
/path/to/Slicer/Utilities/Templates/Extensions/SuperBuild
/path/to/Slicer/Utilities/Templates/Modules/CLI
/path/to/Slicer/Utilities/Templates/Modules/Loadable
/path/to/Slicer/Utilities/Templates/Modules/Scripted

None of these contain templates. They are templates. You should add /path/to/Templates/Extensions and /path/to/Templates/Modules to their respective categories. Or, better, add /path/to/templates to the generic templates paths.

matthew-woehlke

matthew-woehlke

2014-05-13 12:49

developer   ~0011815

I pushed a fix for the empty paths; thanks. I'm not entirely sure why this is happening, however; the list of sub-keys should be empty, so a None should only happen in case of an explicit empty value. But of course we should guard against that anyway...

About not finding the "built in" templates, I believe we are still missing install rules, and we can't go looking in the source directory (because end users won't have source). That should be fixed, of course, but for the moment I've been treating it as a separate issue.

jcfr

jcfr

2014-05-13 13:06

administrator   ~0011816

Last edited: 2014-05-13 13:07

For some reason, [1] made me think the template were also installed. Can you add install rules for the template ?

My understanding is that:

1) the section "Additional template paths" is here in case the user want to use an existing extension as model

2) the section "Additional template paths for extensions": Contains the template for just the extension "skeleton": Superbuild or default

3) the section "Additional template paths for modules": Contains the templates for just modules (CLI, Loadable, Scripted, ... or any module the user whis to add)

Is there a way to consolidate (1) and (2) so that the user is presented with only these lists:

Additional template paths for extensions
Additional template paths for modules

[1] https://github.com/mwoehlke-kitware/Slicer/commit/e9db155def891e46b91262cb665b7d6bcce6dd2a

matthew-woehlke

matthew-woehlke

2014-05-13 13:16

developer   ~0011818

It's always possible my memory is out of date :-).

matthew-woehlke

matthew-woehlke

2014-05-23 09:27

developer   ~0011946

Destination of new extension: Could the default be the home directory ?

Yes. However, I'm dubious of making such a change. It is one click to get to the home directory, and the current default is "the current directory", which, at least on KDE, is effectively the last directory used in a file dialog. If one creates several extensions in the same place, this is quite convenient. If the home directory is forced, and the user is creating extensions somewhere else, it will require more effort to select the same directory over and over.

This is not an unusual behavior for such dialogs (e.g. kwrite's open dialog works this way also).

jcfr

jcfr

2014-05-28 20:49

administrator   ~0011983

Few remarks related to topic "3603-in-slicer-extension-wizard" (d7db914ef6) [1]

After creating a package, I was able to use the wizard :) out of the box. The template were all available and everything went really smoothly. Great works.

Before integrating, this one should be addressed:

  • Add command/target to copy template into the Slicer share directory associated with the build tree.

These remarks can be addressed later on:

  • After creating an "Default" extension with a "scripted" module, the wizard ask the user if he would like to load it. This is very nice. Would it be possible to (1) indicate to the user what are the path of the scripted modules and explain that the user can edit them. and (2) ask him if he would like to load the module right way.

  • Add a "publish" and a "contribute" actions allowing to respectively publish on github and contribute to the extension index.

  • MetaData -> Contributors: Remember the last "first" contributor used to create an extension and use it when creating a new one.

  • MetaData -> Category: Autocomplete with list of existing category

[1] https://github.com/mwoehlke-kitware/Slicer/tree/3603-in-slicer-extension-wizard

matthew-woehlke

matthew-woehlke

2014-05-29 07:51

developer   ~0011986

Add command/target to copy template into the Slicer share directory associated with the build tree.

This is already done by r23227. Is it not working?

Add a "publish" and a "contribute" actions allowing to respectively publish on github and contribute to the extension index.

I believe this is (or should be?) covered by 0003606?

matthew-woehlke

matthew-woehlke

2014-05-29 12:18

developer   ~0011993

Add command/target to copy template into the Slicer share directory associated with the build tree.

Sorry; misread. A fix has been pushed to the branch and this should be working now.

jcfr

jcfr

2014-05-30 14:50

administrator   ~0011998

Last edited: 2014-05-30 14:51

Works great. Please integrate 3603-in-slicer-extension-wizard and REBASE-wizard-launcher

matthew-woehlke

matthew-woehlke

2014-05-30 14:50

developer   ~0011999

This is implemented in r23263 - r23293.

jcfr

jcfr

2014-06-03 12:47

administrator   ~0012006

The "Add selected modules to search path" feature lead to error ... see below for step to reproduce.

Start Slicer -> Modules -> ExtensionWizard -> Create Foo extension, added Bar scripted module.

Then, check the option "Add selected module to search path", the following error happen:

Traceback (most recent call last):
File "/home/jchris/Projects/Slicer-1-SuperBuild-Qt485/Slicer-build/lib/Slicer-4.3/qt-scripted-modules/ExtensionWizard.py", line 291, in selectExtension
self.loadModules(path)
File "/home/jchris/Projects/Slicer-1-SuperBuild-Qt485/Slicer-build/lib/Slicer-4.3/qt-scripted-modules/ExtensionWizard.py", line 321, in loadModules
rawSearchPaths = list(settings.value("Modules/AdditionalPaths"))
TypeError: 'NoneType' object is not iterable

jcfr

jcfr

2014-06-03 13:26

administrator   ~0012007

The proposed fixe:
https://github.com/mwoehlke-kitware/Slicer/tree/fix-wizard-settings-list-bug

works well. I tested on linux and I confirm that the error doesn't show up. Looks good to integrate.

matthew-woehlke

matthew-woehlke

2014-06-03 13:29

developer   ~0012009

Thanks for the report. The issue in #0012006 is fixed in r23302.

Related Changesets

Import 2017-06-07 23:51:09: master fd15ae3b

2014-05-30 18:42:57

mwoehlke

Details Diff
ENH: Create in-Slicer Extension Wizard (skeleton)

Create the initial skeleton of the in-Slicer Extension Wizard. This will
provide a graphical front-end to (some of) the Extension Wizard
functions. Right now, only creation is implemented.

Issue 0003603

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23265 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/CMakeLists.txt Diff File
add - Modules/Scripted/ExtensionWizard/CMakeLists.txt Diff File
add - Modules/Scripted/ExtensionWizard/ExtensionWizard.py Diff File
add - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/CreateExtensionDialog.py Diff File
add - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/__init__.py Diff File
add - Modules/Scripted/ExtensionWizard/Resources/Icons/ExtensionWizard.png Diff File

Import 2017-06-07 23:51:09: master 1c219ba9

2014-05-30 18:43:02

mwoehlke

Details Diff
ENH: More work on in-Slicer Extension Wizard

Add some widgets to the 'edit extension' section to show basic
information about the selected extension, and hook up the ability to
select an extension. There is a not-yet-implemented 'edit metadata'
action that will likely be joined eventually by other actions.

Issue 0003603

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23269 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/ExtensionWizard/ExtensionWizard.py Diff File

Import 2017-06-07 23:51:09: master ddf5e9a3

2014-05-30 18:43:08

mwoehlke

Details Diff
ENH: Implement editing of extension metadata

Create dialog for editing extension metadata and hook up to necessary
bi-directional manipulation of the same in the extension project and
description classes.

Issue 0003603

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23275 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/ExtensionWizard/CMakeLists.txt Diff File
mod - Modules/Scripted/ExtensionWizard/ExtensionWizard.py Diff File
add - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/EditExtensionMetadataDialog.py Diff File
mod - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/EditableTreeWidget.py Diff File
mod - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/__init__.py Diff File

Import 2017-06-07 23:51:09: master d9dd1eeb

2014-05-30 18:43:10

mwoehlke

Details Diff
ENH: Select from location of selected extension

Change extension selection in the extension wizard module to use the
location of the currently selected extension (when applicable) as the
initial directory for choosing another extension.

Issue 0003603

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23277 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/ExtensionWizard/ExtensionWizard.py Diff File

Import 2017-06-07 23:51:09: master 8e22b116

2014-05-30 18:43:11

mwoehlke

Details Diff
ENH: Implement creation of extension modules

Add ability to create modules for extensions to extension wizard module.
Refactor CreateExtensionDialog into more generic CreateComponentDialog
so that it can be shared for this purpose.

Issue 0003603

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23278 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/ExtensionWizard/CMakeLists.txt Diff File
mod - Modules/Scripted/ExtensionWizard/ExtensionWizard.py Diff File
add - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/CreateComponentDialog.py Diff File
rm - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/CreateExtensionDialog.py Diff File
mod - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/__init__.py Diff File

Import 2017-06-07 23:51:09: master 37a58f15

2014-05-30 18:43:12

mwoehlke

Details Diff
ENH: Prompt to load extension modules (WIP)

Create a dialog to prompt the user if they want to load modules
available from a selected extension. (Also used to ask the user if they
want to load a newly-created module immediately.) The UI is implemented,
but the actual loading requires changes to the C++ interfaces, and so is
not hooked up yet.

Issue 0003603

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23279 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/ExtensionWizard/CMakeLists.txt Diff File
mod - Modules/Scripted/ExtensionWizard/ExtensionWizard.py Diff File
add - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/LoadModulesDialog.py Diff File
add - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/ModuleInfo.py Diff File
mod - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/__init__.py Diff File

Import 2017-06-07 23:51:09: master caaf8b43

2014-05-30 18:43:15

mwoehlke

Details Diff
ENH: Implement loading of extension modules

Hook up the loading of modules in the Extension Wizard when requesting
to do so. (See previous two commits.)

Issue 0003603

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23281 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/ExtensionWizard/ExtensionWizard.py Diff File

Import 2017-06-07 23:51:09: master f2d48933

2014-05-30 18:43:18

mwoehlke

Details Diff
ENH: Add UI for modifying template paths

Create a settings panel for the Extension Wizard module that allows
editing the list of paths used to find templates. Change how we read
settings to work with the way ctkSettingsPanel stores lists.

Issue 0003603

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23284 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/ExtensionWizard/CMakeLists.txt Diff File
mod - Modules/Scripted/ExtensionWizard/ExtensionWizard.py Diff File
add - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/SettingsPanel.py Diff File
mod - Modules/Scripted/ExtensionWizard/ExtensionWizardLib/__init__.py Diff File

Issue History

Date Modified Username Field Change
2014-02-28 07:16 jcfr New Issue
2014-02-28 07:16 jcfr Status new => assigned
2014-02-28 07:16 jcfr Assigned To => jcfr
2014-02-28 07:17 jcfr Assigned To jcfr => matthew-woehlke
2014-02-28 07:17 jcfr Target Version => Slicer 4.4.0
2014-04-15 07:31 matthew-woehlke Status assigned => acknowledged
2014-04-21 12:06 matthew-woehlke Note Added: 0011635
2014-04-21 12:06 matthew-woehlke Status acknowledged => feedback
2014-05-13 08:13 jcfr Note Added: 0011755
2014-05-13 09:00 matthew-woehlke Note Added: 0011761
2014-05-13 12:49 matthew-woehlke Note Added: 0011815
2014-05-13 13:06 jcfr Note Added: 0011816
2014-05-13 13:07 jcfr Note Edited: 0011816
2014-05-13 13:16 matthew-woehlke Note Added: 0011818
2014-05-19 11:33 jcfr Status feedback => assigned
2014-05-23 09:27 matthew-woehlke Note Added: 0011946
2014-05-28 20:49 jcfr Note Added: 0011983
2014-05-29 07:51 matthew-woehlke Note Added: 0011986
2014-05-29 07:51 matthew-woehlke Status assigned => feedback
2014-05-29 12:18 matthew-woehlke Note Added: 0011993
2014-05-30 14:50 jcfr Note Added: 0011998
2014-05-30 14:50 matthew-woehlke Note Added: 0011999
2014-05-30 14:50 matthew-woehlke Status feedback => resolved
2014-05-30 14:50 matthew-woehlke Resolution open => fixed
2014-05-30 14:51 jcfr Note Edited: 0011998
2014-06-03 12:47 jcfr Note Added: 0012006
2014-06-03 13:26 jcfr Note Added: 0012007
2014-06-03 13:29 matthew-woehlke Note Added: 0012009
2014-06-04 06:07 jcfr Status resolved => closed
2014-06-04 06:07 jcfr Fixed in Version => Slicer 4.4.0
2017-06-10 08:51 Changeset attached => Slicer master f2d48933
2017-06-10 08:51 Changeset attached => Slicer master caaf8b43
2017-06-10 08:51 Changeset attached => Slicer master 37a58f15
2017-06-10 08:51 Changeset attached => Slicer master 8e22b116
2017-06-10 08:51 Changeset attached => Slicer master d9dd1eeb
2017-06-10 08:51 Changeset attached => Slicer master ddf5e9a3
2017-06-10 08:51 Changeset attached => Slicer master 1c219ba9
2017-06-10 08:51 Changeset attached => Slicer master fd15ae3b