コード例 #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
ファイル: AdvancedGraphics.py プロジェクト: wswenyue/Field
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)