File: test_self_interaction.py

package info (click to toggle)
camitk 6.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 389,496 kB
  • sloc: cpp: 103,476; sh: 2,448; python: 1,618; xml: 984; makefile: 128; perl: 84; sed: 20
file content (21 lines) | stat: -rw-r--r-- 723 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# This is a CamiTK python action
#
# Simple test of the interaction between python and the CamiTK application
# using 'self'. 
# This is a simple test where a counter is incremented in the process() method
# using an attribute saved in the action's self dict.
# 
# It demonstrates how state can be preserved between action 'apply' calls using
# internal variables. Note that the parameter is set to 'read only' for this 
# action as a way to prove the internal self.counter increments properly.

import camitk

def init(self:camitk.Action):
    self.counter = 42

def process(self:camitk.Action):    
    self.counter += 1
    self.setParameterValue("Counter", self.counter)
    # to update the GUI
    self.updateWidget()