~sjdv1982/hivesystem/trunk

« back to all changes in this revision

Viewing changes to sparta/actuators/view.py

  • Committer: Sjoerd de Vries
  • Date: 2014-06-09 10:19:38 UTC
  • mfrom: (182.1.43 hive-view)
  • Revision ID: sjdv1982@gmail.com-20140609101938-7ji5g0buo09r0se6
merged with hive-view branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import libcontext, bee
 
2
from bee.segments import *
 
3
from libcontext.socketclasses import *
 
4
from libcontext.pluginclasses import *
 
5
 
 
6
class view(object):
 
7
    """
 
8
    When triggered, the view actuator sets the other view matrix for the "relative" and "offset" view modes
 
9
    The view matrix is first converted to world coordinates; it is not automatically updated when the input matrix changes    
 
10
    """
 
11
    metaguiparams = {
 
12
      "idmode" : "str",
 
13
      "autocreate" : {"idmode" : "bound"},
 
14
    }
 
15
    @classmethod
 
16
    def form(cls, f):
 
17
        f.idmode.name = "ID mode"
 
18
        f.idmode.advanced = True
 
19
        f.idmode.type = "option"        
 
20
        f.idmode.options = "unbound", "bound"
 
21
        f.idmode.default = "bound"
 
22
        f.idmode.optiontitles = "Unbound", "Bound"
 
23
    
 
24
    def __new__(cls, idmode):
 
25
        assert idmode in ("bound", "unbound"), idmode
 
26
        class view(bee.worker):    
 
27
            __doc__ = cls.__doc__
 
28
            
 
29
            if idmode == "unbound":
 
30
                identifier = antenna("pull", ("str", "identifier"))
 
31
            
 
32
            mode = variable("str")
 
33
            parameter(mode)
 
34
            
 
35
            trig = antenna("push", "trigger")
 
36
            view = antenna("pull", ("object", "matrix"))
 
37
                            
 
38
            @staticmethod
 
39
            def form(f):
 
40
                f.mode.name = "Mode"
 
41
                f.mode.type = "option"
 
42
                f.mode.default = "relative"
 
43
                f.mode.options = "relative", "offset"
 
44
                f.mode.optiontitles = "Relative", "Offset"
 
45
                
 
46
            guiparams = {
 
47
              "trig" : {"name": "Trigger"},
 
48
              "identifier" : {"name": "Identifier", "fold" : True},
 
49
              "_memberorder" : ["identifier", "trig"]
 
50
            }
 
51
                
 
52
            def place(self):
 
53
                raise NotImplementedError("sparta.actuators.view has not been implemented yet")
 
54
              
 
55
        return view
 
56
    
 
 
b'\\ No newline at end of file'