def _create_highlight(self): #init, controls
			
			#Find the position of the current box.
			char = self().character

			x, y = 0,0
			if char in Text_Ref.characters.upper():
				x =Text_Ref.characters.upper().index(char)
				y = 0
			if char in Text_Ref.characters:
				x = Text_Ref.characters.index(char)
				y = 1
			if char in Text_Ref.grammar:
				x = Text_Ref.grammar.index(char)
				y = 2
			if char in Text_Ref.numbers:
				x = Text_Ref.numbers.index(char)
				y = 3

			#Highlight it
			w,h = 8,12
			highlight = RectangleShape((w,h))
			highlight.position = w*x, h*y
			highlight.fill_color = Color(100,100,100,100)
			self.highlight = highlight
		def render(self): #draw
			box = RectangleShape(self.size)
			box.position = self.position
			box.outline_thickness = 1
			box.outline_color = Color(255,0,0,100)
			box.fill_color = Color(0,0,0,10)
			self.box = box
        def _create_highlight(self):  #init, controls

            #Find the position of the current box.
            char = self().character

            x, y = 0, 0
            if char in Text_Ref.characters.upper():
                x = Text_Ref.characters.upper().index(char)
                y = 0
            if char in Text_Ref.characters:
                x = Text_Ref.characters.index(char)
                y = 1
            if char in Text_Ref.grammar:
                x = Text_Ref.grammar.index(char)
                y = 2
            if char in Text_Ref.numbers:
                x = Text_Ref.numbers.index(char)
                y = 3

            #Highlight it
            w, h = 8, 12
            highlight = RectangleShape((w, h))
            highlight.position = w * x, h * y
            highlight.fill_color = Color(100, 100, 100, 100)
            self.highlight = highlight
Example #4
0
	def box(self): #draw
		size = self.w, self.h+self.rise
		b = RectangleShape(size)
		b.position = self.x, self.y-self.rise_offset
		b.outline_thickness = 1
		b.outline_color = self.box_outline
		b.fill_color = self.box_fill
		return b
Example #5
0
 def _create_box_shading(self):  #_create_box
     w = self.w
     x, y = self.x, self.y2 - 2
     #
     Box_shading = RectangleShape((w, 2))
     Box_shading.fill_color = Color(150, 150, 150)
     Box_shading.position = x, y
     #
     self.Box_shading = Box_shading
Example #6
0
 def draw(self, view):
   if self.dragRect == None:
     return
   sprite = RectangleShape(self.dragRect.size)
   sprite.position = self.dragRect.position
   sprite.fill_color = Color.TRANSPARENT
   sprite.outline_color = Color.RED
   sprite.outline_thickness = 0.1
   view.drawList[SelectionController.DRAG_RECT_LAYER].append(sprite)
Example #7
0
    def _create_Lines(self):
        self.Lines = []

        for i in range(self.lines):

            if self.using == "x":
                w = float(self.w) / (self.lines - 1)
                line = RectangleShape((0, self.h))
                x = self.x + (w * (i))
                line.position = x, self.y

            if self.using == "y":
                h = float(self.h) / (self.lines - 1)
                line = RectangleShape((self.w, 0))
                y = self.y + (h * (i))
                line.position = self.x, y

            line.outline_thickness = 1
            line.outline_color = Color.BLACK

            #color
            c = line.outline_color
            c.a = self.alpha
            line.outline_color = c

            self.Lines.append(line)
Example #8
0
    class Cursor(_UI):
        # A blinking line.

        #################################
        # PUBLIC

        def __init__(self):
            _UI.__init__(self)
            self._init_Box()

        def draw(self, target, states):
            self._parent_Box(target, states)
            self._flicker_Box()
            _UI.draw(self, target, states)
            self._draw_Box(target, states)

        #################################
        # PRIVATE

        w, h = 2, 15
        _Box = None
        _Flicker_Clock = None

        def _init_Box(self):
            self._Box = RectangleShape(self.size)
            self._Flicker_Clock = Clock()
            self._Box.fill_color = Color.BLACK

        def _parent_Box(self, target, states):
            x_move = self.x - self.old_pos[0]
            y_move = self.y - self.old_pos[1]
            self._Box.position = \
            self._Box.position[0]+x_move, self._Box.position[1]+y_move

        def _draw_Box(self, target, states):
            self._Box.draw(target, states)

        def _flicker_Box(self):
            if self._Flicker_Clock.elapsed_time.seconds >= 0.5:
                if self._Box.fill_color.a != 0:
                    c = self._Box.fill_color
                    c.a = 0
                    self._Box.fill_color = c
                else:
                    a = self.alpha
                    c = self._Box.fill_color
                    c.a = a
                    self._Box.fill_color = c
                self._Flicker_Clock.restart()
Example #9
0
    def _create_baseLine(self):

        if self.using == "x":
            self.baseLine = RectangleShape((self.w, 0))
            self.baseLine.position = self.x, self.center[1]
        if self.using == "y":
            self.baseLine = RectangleShape((0, self.h))
            self.baseLine.position = self.center[0], self.y

        self.baseLine.outline_thickness = 1
        self.baseLine.outline_color = Color(0, 0, 0)

        #color
        b = self.baseLine
        c = b.outline_color
        c.a = self.alpha
        b.outline_color = c
Example #10
0
	def _create_Lines(self):
		self.Lines = []

		for i in range(self.lines):

			if self.using == "x":
				w = float(self.w)/(self.lines-1)
				line = RectangleShape((0,self.h))
				x = self.x+(w*(i))
				line.position = x, self.y
			
			if self.using == "y":
				h = float(self.h)/(self.lines-1)
				line = RectangleShape((self.w,0))
				y = self.y+(h*(i))
				line.position = self.x, y

			line.outline_thickness = 1
			line.outline_color = Color.BLACK

			#color
			c=line.outline_color;c.a=self.alpha
			line.outline_color=c

			self.Lines.append(line)
Example #11
0
	class Cursor(_UI):
	# A blinking line.
		
		#################################
		# PUBLIC

		def __init__(self):
			_UI.__init__(self)
			self._init_Box()

		def draw(self, target, states):
			self._parent_Box(target, states)
			self._flicker_Box()
			_UI.draw(self, target, states)
			self._draw_Box(target, states)

		#################################
		# PRIVATE

		w,h = 2,15
		_Box = None
		_Flicker_Clock = None

		def _init_Box(self):
			self._Box = RectangleShape(self.size)
			self._Flicker_Clock = Clock()
			self._Box.fill_color = Color.BLACK

		def _parent_Box(self, target, states):
			x_move = self.x - self.old_pos[0]
			y_move = self.y - self.old_pos[1]
			self._Box.position = \
			self._Box.position[0]+x_move, self._Box.position[1]+y_move

		def _draw_Box(self, target, states):
			self._Box.draw(target, states)

		def _flicker_Box(self):
			if self._Flicker_Clock.elapsed_time.seconds >= 0.5:
				if self._Box.fill_color.a != 0:
					c=self._Box.fill_color;c.a=0;self._Box.fill_color=c
				else:
					a = self.alpha
					c=self._Box.fill_color;c.a=a;self._Box.fill_color=c
				self._Flicker_Clock.restart()
Example #12
0
def line(size=(1,1), outline_color = Color.BLACK, x=0, y=0, rotate = 0, outline_thickness = 1):
    l = RectangleShape()
    l.size = size
    l.outline_color = outline_color
    l.outline_thickness = outline_thickness
    l.x = x
    l.y = y
    if rotate != 0:
        l.rotate(rotate)

    return l
Example #13
0
def line(size=(1, 1),
         outline_color=Color.BLACK,
         x=0,
         y=0,
         rotate=0,
         outline_thickness=1):
    l = RectangleShape()
    l.size = size
    l.outline_color = outline_color
    l.outline_thickness = outline_thickness
    l.x = x
    l.y = y
    if rotate != 0:
        l.rotate(rotate)

    return l
Example #14
0
def dot(x, y, size=(1, 1), outline_color=Color.RED, outline_thickness=1):
    d = RectangleShape()
    d.size = size
    d.outline_color = outline_color
    d.outline_thickness = outline_thickness
    d.x = x
    d.y = y

    return d
Example #15
0
 def render(self):  #draw
     box = RectangleShape(self.size)
     box.position = self.position
     box.outline_thickness = 1
     box.outline_color = Color(255, 0, 0, 100)
     box.fill_color = Color(0, 0, 0, 10)
     self.box = box
Example #16
0
    def _create_Lines(self):

        self._columns = []
        for x in range(self.tile_w + 1):
            r = RectangleShape((1, self.h))
            r.fill_color = self.color
            r.position = self.x + (TILE * x), self.y
            self._columns.append(r)

        self._rows = []
        for y in range(self.tile_h + 1):
            r = RectangleShape((self.w, 1))
            r.fill_color = self.color
            r.position = self.x, self.y + (TILE * y)
            self._rows.append(r)
Example #17
0
 def box(self):  #draw
     size = self.w, self.h + self.rise
     b = RectangleShape(size)
     b.position = self.x, self.y - self.rise_offset
     b.outline_thickness = 1
     b.outline_color = self.box_outline
     b.fill_color = self.box_fill
     return b
Example #18
0
def dot(x, y, size=(1,1), outline_color = Color.RED, outline_thickness = 1):
    d = RectangleShape()
    d.size = size
    d.outline_color = outline_color
    d.outline_thickness = outline_thickness
    d.x = x
    d.y = y

    return d
Example #19
0
    def _create_Lines(self):  #init

        self._columns = []
        for x in range(self.tile_w + 1):
            w = 1
            if x == 0 or x == self.tile_w: w = 5
            r = RectangleShape((w, self.h))
            r.fill_color = self.color
            r.position = self.x + (TILE * x) - (w / 2), self.y
            self._columns.append(r)

        self._rows = []
        for y in range(self.tile_h + 1):
            h = 1
            if y == 0 or y == self.tile_h: h = 5
            r = RectangleShape((self.w, h))
            r.fill_color = self.color
            r.position = self.x, self.y + (TILE * y) - (h / 2)
            self._rows.append(r)
Example #20
0
 def _create_box(self):  #draw
     size = self.size
     position = self.position
     #
     Box = RectangleShape(size)
     Box.position = position
     Box.fill_color = Color(255, 255, 255)
     Box.outline_color = Color(0, 0, 0)
     Box.outline_thickness = 1
     #
     self.Box = Box
     #
     self._create_box_shading()
Example #21
0
	def _create_Lines(self):
		
		self._columns = []
		for x in range(self.tile_w+1):
			r = RectangleShape((1,self.h))
			r.fill_color = self.color
			r.position = self.x+(TILE*x), self.y
			self._columns.append(r)

		self._rows = []
		for y in range(self.tile_h+1):
			r = RectangleShape((self.w,1))
			r.fill_color = self.color
			r.position = self.x, self.y+(TILE*y)
			self._rows.append(r)
Example #22
0
 def draw(self, view):
   if Options.NGUI_FOCUS_DEBUG:
     if self._mouseWithin == True:
       r = RectangleShape()
       r.outline_color = Color.RED
       r.outline_thickness = 3
       r.fill_color = Color.TRANSPARENT
       r.position = (self._ax, self._ay)
       r.size = (self._w, self._h)
       view.drawSprite(r)
     if self._mouseFocus:
       view.drawLine(Color.RED, (self._ax, self._ay),
                                (self._ax + self._w, self._ay + self._h))
       view.drawLine(Color.RED, (self._ax + self._w, self._ay),
                                (self._ax, self._ay + self._h))
Example #23
0
  def drawButton(self, view, bacgroundColour, outlineColour, style):
    r = RectangleShape()
    r.outline_color = outlineColour
    r.outline_thickness = 1
    r.fill_color = bacgroundColour
    r.position = (self._ax, self._ay)
    r.size = (self._w, self._h)
    view.drawSprite(r)
    
    textSprite = TextManager.renderText(self.text, style)
    rect = textSprite.local_bounds
    # Needs rect.left and stuff because text local bounds are apparently non-0.
    # Something to do with text alignment, perhaps? :)
    textSprite.position = (self._ax + self._w // 2 - (rect.width // 2) - rect.left,
                           self._ay + self._h // 2 - (rect.height // 2) - rect.top)

    view.drawSprite(textSprite)
Example #24
0
	def _create_Lines(self): #init
		
		self._columns = []
		for x in range(self.tile_w+1):
			w = 1
			if x == 0 or x == self.tile_w: w = 5
			r = RectangleShape((w,self.h))
			r.fill_color = self.color
			r.position = self.x+(TILE*x)-(w/2), self.y
			self._columns.append(r)

		self._rows = []
		for y in range(self.tile_h+1):
			h = 1
			if y == 0 or y == self.tile_h: h = 5
			r = RectangleShape((self.w,h))
			r.fill_color = self.color
			r.position = self.x, self.y+(TILE*y)-(h/2)
			self._rows.append(r)
Example #25
0
 def shadow(self):  #draw
     w, h = self.size
     b = RectangleShape((w, self.rise))
     b.position = self.x, self.y2
     b.fill_color = Color(0, 0, 0, 255)
     return b
Example #26
0
 def _create_drawables(self):  #init
     f = Font("speech")
     self.Text = Text(f)
     self.Box = RectangleShape((0, 0))
     self.Box_shading = RectangleShape((0, 0))
Example #27
0
 def _init_Box(self):
     self._Box = RectangleShape(self.size)
     self._Flicker_Clock = Clock()
     self._Box.fill_color = Color.BLACK
Example #28
0
		def _init_Box(self):
			self._Box = RectangleShape(self.size)
			self._Flicker_Clock = Clock()
			self._Box.fill_color = Color.BLACK
Example #29
0
	def shadow(self): #draw
		w,h = self.size
		b = RectangleShape((w,self.rise))
		b.position = self.x, self.y2
		b.fill_color = Color(0,0,0,255)
		return b