Difference: DpHipeTools (31 vs. 32)

Revision 322009-02-04 - JaimeSaiz

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

Adding Tools to HIPE

Line: 42 to 42
  compute=ComputeTask()
Changed:
<
<
To make your task appear in the "Run Tools" view, you need to add the following lines:
>
>
To make your task appear in the "Tasks" view, you need to add the following lines:
 

Changed:
<
<
from herschel.ia.task.views import TaskToolFactory TaskToolFactory.register(compute)
>
>
from herschel.ia.task.views import TaskToolRegistry toolRegistry = TaskToolRegistry.getInstance() toolRegistry.register(compute)
 
Changed:
<
<
For PCSS (PACS' builds) users, this __init__.py file is located at $install_dir/data/toolbox/your_sub_system.
>
>
For PACS users, this __init__.py file is located at $install_dir/data/toolbox/your_sub_system.
  You can also specify that your task belongs to one or more Category :
    from herschel.ia.gui.kernel.Tool import Category

Changed:
<
<
TaskToolFactory.register(compute, [Category.IMAGE, Category.PACS]))
>
>
toolRegistry.register(compute, [Category.IMAGE, Category.PACS]))
  Your task will now be enabled whenever a session variable is selected which matches the type of the first input parameter within your task!
Line: 295 to 296
 

Task compliance

Changed:
<
<
  • write user documentation (jtags)! That will be automatically picked up whenever a user asks the system for help on your task.
  • the name of the task should be a legal variable name in the global name-space. For example your instance of MyTask should report itself as e.g.: "myTask" and not "This is my task".
  • if your prime parameter is not the first parameter in your task, specify the prime parameter using the setPrimeInput method in the signature
  • write a parameter validator for your prime parameter if your task should be listed not only on prime data type but on prime data contents as well.
>
>
  • Write user documentation (jtags)! That will be automatically picked up whenever a user asks the system for help on your task.
  • The name of the task should be a legal variable name in the global name-space. For example your instance of MyTask should report itself as e.g.: "myTask" and not "This is my task".
  • If your prime parameter is not the first parameter in your task, specify the prime parameter using the setPrimeInput method in the signature
  • Write a parameter validator for your prime parameter if your task should be listed not only on prime data type but on prime data contents as well.
 
Changed:
<
<

Some Recommendations of use of simple tasks and its limitations

>
>

Recommendations for simple tasks and limitations

 
Changed:
<
<
  • Use a function that fully initializes TaskParameters: you avoid working with partially initialized data or data with non obvious defaults.
>
>
  • Use a function that fully initializes TaskParameters: you avoid working with partially initialized data or data with non obvious defaults.
 
  • Please take care to register your task properly: otherwise it may half-work, which is much worse than not working at all!
Changed:
<
<
  • Capture exceptions and check your params before trying to properly execute if you want to provide better error reporting than the one provided by default
>
>
  • Capture exceptions and check your params before trying to properly execute, if you want to provide better error reporting than the one provided by default.
 
  • You should not do user interaction after you have started execute() (not on EDT).
Changed:
<
<
  • Validators: you cannot compare multiple parameters, order of execution is not specified, will be executed several times. SO if you need to validate dependent parameters it should be done later.
  • Once you are in execute() console has already been updated with the command : Although you can change the value of TaskParameters, this will not be properly reflected on the UI, so don't do it. So once you are on execute() you can check , possibly abort, and properly execute (nothing else).
>
>
  • Validators: you cannot compare multiple parameters, order of execution is not specified, will be executed several times. So, if you need to validate dependent parameters, it should be done later.
  • Once you are in execute() console has already been updated with the command : Although you can change the value of TaskParameters, this will not be properly reflected on the UI, so don't do it. So once you are on execute() you can check , possibly abort, and properly execute (nothing else).
 

Adding a Tool that is not a Task

Line: 374 to 375
  "herschel.path.to.MyTool"))

# Register the tool so it is automatically available for the proper variables in HIPE

Changed:
<
<
from herschel.ia.gui.kernel import ToolFactory
>
>
from herschel.ia.gui.kernel import ToolRegistry
 from herschel.path.to import MyTool
Changed:
<
<
ToolFactory.register(MyTool())
>
>
ToolRegistry.getInstance().register(MyTool())
 
Line: 496 to 497
  "factory.editor.tool", "herschel.your.package.ButtonTool"))
Changed:
<
<
from herschel.ia.gui.kernel import ToolFactory
>
>
from herschel.ia.gui.kernel import ToolRegistry
 from herschel.your.package import ButtonTool
Changed:
<
<
ToolFactory.register(ButtonTool())
>
>
ToolRegistry().getInstance().register(ButtonTool())
 
Line: 513 to 514
 

Triggering Events

Changed:
<
<
For a full detailed section about triggering events have a look at DpHipeCommonUtilities
>
>
For a full detailed section about triggering events have a look at DpHipeCommonUtilities.
 
<-- Author: JorgoBakker - 21 Dec 2007 -->
 
This site is powered by the TWiki collaboration platform Powered by Perl