~sjdv1982/hivesystem/trunk

« back to all changes in this revision

Viewing changes to sparta/rerouters/hop_out.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 bee.types import stringtupleparser
 
4
 
 
5
class hop_out(object):
 
6
    """
 
7
    The hop_out rerouter has its output forwarded from a hop_in rerouter of the same name
 
8
    """
 
9
    metaguiparams = {
 
10
      "mode": "str",
 
11
      "type_" : "str",
 
12
      "autocreate" : {"mode": "pull", "type_" : "bool"},
 
13
      "_memberorder" : ["mode", "type_"]
 
14
    }
 
15
    @classmethod
 
16
    def form(cls, f):
 
17
        f.mode.name = "Mode"
 
18
        f.mode.type = "option"
 
19
        f.mode.options = "push", "pull"
 
20
        f.mode.optiontitles = "Push", "Pull"
 
21
        
 
22
        f.type_.name = "Type"
 
23
        f.type_.type = "option"        
 
24
        f.type_.options = "bool", "int", "float", "(str,identifier)", "(str,action)", "(str,keycode)", "(str,message)", "(str,property)", "(str,process)", "str", "(object,matrix)", "(object,bge)", "object", "custom"
 
25
        f.type_.optiontitles = "Bool", "Integer", "Float", "ID String", "Action String", "Key String", "Message String", "Property String", "Process ID String",  "Generic String", "Matrix Object", "BGE Object", "Generic Object", "Custom"
 
26
        f.type_.default = "bool"
 
27
    
 
28
    def __new__(cls, mode, type_):
 
29
        type_ = stringtupleparser(type_)
 
30
        class hop_out(bee.worker):    
 
31
            __doc__ = cls.__doc__
 
32
 
 
33
            name_ = variable("str")
 
34
            parameter(name_)
 
35
            
 
36
            outp = output(mode, type_)
 
37
            b_outp = buffer(mode, type_)
 
38
            connect(b_outp, outp)
 
39
            trig_outp = triggerfunc(b_outp)
 
40
                            
 
41
            @staticmethod
 
42
            def form(f):
 
43
                f.name_.name = "Name"
 
44
                
 
45
            guiparams = {
 
46
              "outp" : {"name": "Output"},
 
47
            }
 
48
            def place(self):
 
49
                raise NotImplementedError("sparta.assessors.hop_out has not been implemented yet")
 
50
                              
 
51
        return hop_out
 
52
    
 
 
b'\\ No newline at end of file'