View Issue Details

IDProjectCategoryView StatusLast Update
0004527Slicer4Core: Scripting (Wrapping, Python)public2018-03-30 01:03
ReporterjcfrAssigned Tojcfr 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status assignedResolutionopen 
Product Version 
Target VersionbacklogFixed in Version 
Summary0004527: Streamline management of Qt connection in python object.
Description

Following up on https://github.com/SimpleITK/SlicerSimpleFilters/pull/10/, I wonder if it would be helpful to have a mixin similar to slicer.util.VTKObservationMixin but for Qt connection (may be QConnectionMixin).

Then to establish a connection, you would do:

self.connect(object, signal, callback)

with connect method being provided by the mixin.

In the context of the referenced PR, the class would be declared like this:

class FilterParameters(object, QConnectionMixin):
  def __init__(self, parent=None):
    [...]
    QConnectionMixin.__init__(self)

  def __del__(self):
    self.removeConnections()
    [...]

  def create(self):
    [...]
    self.connect(fiducialSelector, "nodeActivated(vtkMRMLNode*)", lambda node,name=name:self.onFiducialListNode(name,node))
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2018-03-30 01:03 jcfr New Issue
2018-03-30 01:03 jcfr Status new => assigned
2018-03-30 01:03 jcfr Assigned To => jcfr