예제 #1
0
 def restore(self):
     print "restore to is %s " % self.restoreTo
     if (len(self.restoreTo)>0):
         getSelf().lines.clear()
         pp = self.restoreTo.pop()
         print "popped %s " % pp
         getSelf().lines.addAll(pp)
         print "lines are %s" % getSelf().lines
예제 #2
0
def Initially(inside, text, glob):
    """Execute this block once per Field session (or until a menu item is selected)"""
    hasExecuted = getattr(getSelf(), inside.name + "_")
    if (not hasExecuted):
        exec text in glob
    else:
        pass
    setattr(getSelf(), inside.name + "_", 1)
예제 #3
0
파일: TextTransforms.py 프로젝트: EQ4/Field
def Initially(inside,text,glob):
    """Execute this block once per Field session (or until a menu item is selected)"""
    hasExecuted = getattr(getSelf(), inside.name+"_")
    if (not hasExecuted):
        exec text in glob
    else:
        pass
    setattr(getSelf(), inside.name+"_", 1)
예제 #4
0
파일: TextTransforms.py 프로젝트: EQ4/Field
def Once(inside,text,glob):
    """Execute this block once (or until a menu item is selected)"""
    #print "exec: about to look up %s inside %s " % (inside.name, getSelf())
    hasExecuted = getattr(getSelf(), inside.name)
    if (not hasExecuted):
        exec text in glob
    else:
        pass
    setattr(getSelf(), inside.name, 1)
예제 #5
0
def Once(inside, text, glob):
    """Execute this block once (or until a menu item is selected)"""
    #print "exec: about to look up %s inside %s " % (inside.name, getSelf())
    hasExecuted = getattr(getSelf(), inside.name)
    if (not hasExecuted):
        exec text in glob
    else:
        pass
    setattr(getSelf(), inside.name, 1)
예제 #6
0
def makeEmbeddedCanvas(name, x=None, y=None, w=500, h=500, background=Vector4()):
	"""Makes a self-enclosed drawing window and places it inside the main Field canvas. Like makeFullscreenCanvas and makeWindowedCanvas, but in this case the window is embedded inside Field"""
	if (x==None): x = getSelf().frame.x
	if (y==None): y = getSelf().frame.y+getSelf().frame.h+25
        print x,y,w,h
	a,b,c = VisualElement.createWithToken(name, getSelf(), Rect(x,y,w,h), VisualElement, PlainDraggableComponent, ThreedComputingOverride)
	a.name = "canvas: "+name
	if (a.where.python_source_v==getSelf()): a.python_source_v=""
	return a.canvas	
예제 #7
0
파일: TextTransforms.py 프로젝트: EQ4/Field
def __Once_paint(inside, g, bounds):
    print "paint: about to look up %s inside %s " % (inside.name, getSelf())
    if (not getattr(getSelf(), inside.name)): return
    g = g.create()
    g.setPaint(GradientPaint(bounds.x, bounds.y, Color(0.4, 0.4, 0.4, 0.8), bounds.x, bounds.y+bounds.h, Color(0.3, 0.3, 0.3, 0.5)))
    g.fillRect(int(bounds.x), int(bounds.y), int(bounds.w-15), int(bounds.h))
    g.setColor(Color(1,1,1,0.1))
    g.setStroke(BasicStroke())
    g.clipRect(int(bounds.x),int(bounds.y), int(bounds.w-15), int(bounds.h))
    for n in range(-20, bounds.w, 10):
        g.drawLine(int(bounds.x+n), int(bounds.y+1), int(bounds.x+20+n), int(bounds.y+bounds.h-3))
예제 #8
0
def __Once_paint(inside, g, bounds):
    print "paint: about to look up %s inside %s " % (inside.name, getSelf())
    if (not getattr(getSelf(), inside.name)): return
    g = g.create()
    g.setPaint(
        GradientPaint(bounds.x, bounds.y, Color(0.4, 0.4, 0.4, 0.8), bounds.x,
                      bounds.y + bounds.h, Color(0.3, 0.3, 0.3, 0.5)))
    g.fillRect(int(bounds.x), int(bounds.y), int(bounds.w - 15), int(bounds.h))
    g.setColor(Color(1, 1, 1, 0.1))
    g.setStroke(BasicStroke())
    g.clipRect(int(bounds.x), int(bounds.y), int(bounds.w - 15), int(bounds.h))
    for n in range(-20, bounds.w, 10):
        g.drawLine(int(bounds.x + n), int(bounds.y + 1),
                   int(bounds.x + 20 + n), int(bounds.y + bounds.h - 3))
예제 #9
0
 def begin(self):
     self.restoreTo = [ArrayList(getSelf().lines or [])]
     self.begun = 1
예제 #10
0
    def save(self):
        self.restoreTo.append(ArrayList(getSelf().lines or [] ))

        print "restore to is now %s " % self.restoreTo
예제 #11
0
파일: TextTransforms.py 프로젝트: EQ4/Field
 def dont():
     setattr(getSelf(), inside.name,1)
예제 #12
0
파일: TextTransforms.py 프로젝트: EQ4/Field
 def rearm():
     setattr(getSelf(), inside.name,0)
예제 #13
0
 def rearm():
     setattr(getSelf(), inside.name, 0)
예제 #14
0
 def dont():
     setattr(getSelf(), inside.name + "_", 1)