Esempio n. 1
0
    def Draw(self, grid, attr, dc, rect, row, col, isSelected):
        renderer = grid.get_renderer()
        column_collection = grid.get_column_collection()

        # Draw Background
        renderer.draw_background(grid, dc, rect, row, col, isSelected)

        # Draw Column Highlight
        column_object = column_collection.column_order[col]

        node = grid.get_row_as_node(row)

        if node.repair():
            # This node was in need of repair and was successfully repaired
            pass

        obj = node.get_data_obj()
        obj_val = column_object.get_value(node)

        #obj_locked = ( row in grid.locked_objects )
        obj_locked = grid.is_node_read_only(node)

        isSortColumn = (column_object == column_collection.sort_column)

        # set the bullet color
        # moved the rest to the node
        if obj_val:
            color = self.loaded
        else:
            color = self.unloaded

        dc.SetBrush(wx.Brush(color))
        dc.SetPen(wx.BLACK_PEN)
        x, y = (
            (rect.left + rect.right) / 2.0, (rect.top + rect.bottom) / 2.0
        )  #make this a float if you're using more fancy classes over DC

        dc.DrawCircle(x, y, 6)
Esempio n. 2
0
	def Draw( self, grid, attr, dc, rect, row, col, isSelected ):
		renderer = grid.get_renderer( )
		column_collection = grid.get_column_collection( )

		# Draw Background
		renderer.draw_background( grid, dc, rect, row, col, isSelected )

		# Draw Column Highlight
		column_object = column_collection.column_order[ col ]

		node = grid.get_row_as_node( row )

		if node.repair( ):
			# This node was in need of repair and was successfully repaired
			pass

		obj = node.get_data_obj( )
		obj_val = column_object.get_value( node )

		#obj_locked = ( row in grid.locked_objects )
		obj_locked = grid.is_node_read_only( node )

		isSortColumn = ( column_object == column_collection.sort_column )

		# set the bullet color
		# moved the rest to the node
		if obj_val:
			color = self.loaded
		else:
			color = self.unloaded

		dc.SetBrush( wx.Brush( color ) )
		dc.SetPen( wx.BLACK_PEN )
		x, y = ((rect.left + rect.right) / 2.0, (rect.top + rect.bottom ) / 2.0 ) #make this a float if you're using more fancy classes over DC

		dc.DrawCircle( x, y, 6 )
Esempio n. 3
0
    def Draw(self, grid, attr, dc, rect, row, col, isSelected):

        # Get the column_collection
        column_collection = grid.get_column_collection()

        # Draw Background
        renderer = grid.get_renderer()
        renderer.draw_background(grid, dc, rect, row, col, isSelected)

        # Draw Column Highlight
        column_object = column_collection.column_order[col]

        # Get the node
        node = grid.get_row_as_node(row)
        if node.repair():
            # This node was in need of repair and was successfully repaired
            pass

        obj = node.get_data_obj()
        obj_val = column_object.get_value(node)
        obj_locked = grid.is_node_read_only(node)

        isSortColumn = (column_object == column_collection.sort_column)

        # set the proper bitmap
        bitmap = None

        # if the object is a state machine or blendtree set the appropriate icon
        doc = AnimationEditor.get_active_document()
        if doc:
            if node.is_clip_valid:
                clip_name = obj.get_tag().get_clip_name()
                if clip_name:
                    if doc.is_blend_tree(clip_name):
                        bitmap = self.bmp_blendtree
                    elif doc.is_state_machine(clip_name):
                        bitmap = self.bmp_statemachine

        #clip_name = obj.get_tag( ).get_clip_name( )
        #if clip_name:
        ## get the name lists
        #if clip_name.endswith( ' sm' ):
        #bitmap = self.bmp_statemachine
        #elif clip_name.endswith( ' bt' ):
        #bitmap = self.bmp_blendtree

        # see if the object has an error if it does override the icon with the error
        if not node.is_clip_valid or not node.is_tag_valid:
            bitmap = self.bmp_error

        if bitmap:
            image = wx.MemoryDC()
            image.SelectObject(bitmap)

        # set the bullet color
        if obj_val == True:
            color = wx.GREEN
        else:
            color = wx.LIGHT_GREY

        # set the colors
        dc.SetBrush(wx.Brush(wx.GREEN))
        dc.SetPen(wx.BLACK_PEN)

        #dc.DrawRectangleRect( rect )

        # copy the image but only to the size of the grid cell
        if bitmap:
            width, height = bitmap.GetWidth(), bitmap.GetHeight()

            if width > rect.width - 2:
                width = rect.width - 2

            if height > rect.height - 2:
                height = rect.height - 2

            dc.Blit(rect.x + 6, rect.y + 3, width, height, image, 0, 0,
                    wx.COPY, True)
Esempio n. 4
0
	def Draw( self, grid, attr, dc, rect, row, col, isSelected ):

		# Get the column_collection
		column_collection = grid.get_column_collection( )

		# Draw Background
		renderer = grid.get_renderer( )
		renderer.draw_background( grid, dc, rect, row, col, isSelected )

		# Draw Column Highlight
		column_object = column_collection.column_order[ col ]

		# Get the node
		node = grid.get_row_as_node( row )
		if node.repair( ):
			# This node was in need of repair and was successfully repaired
			pass

		obj = node.get_data_obj( )
		obj_val = column_object.get_value( node )
		obj_locked = grid.is_node_read_only( node )

		isSortColumn = ( column_object == column_collection.sort_column )

		# set the proper bitmap
		bitmap = None

		# if the object is a state machine or blendtree set the appropriate icon
		doc = AnimationEditor.get_active_document( )
		if doc:
			if node.is_clip_valid:
				clip_name = obj.get_tag( ).get_clip_name( )
				if clip_name:
					if doc.is_blend_tree( clip_name ):
						bitmap = self.bmp_blendtree
					elif doc.is_state_machine( clip_name ):
						bitmap = self.bmp_statemachine

		#clip_name = obj.get_tag( ).get_clip_name( )
		#if clip_name:
			## get the name lists
			#if clip_name.endswith( ' sm' ):
				#bitmap = self.bmp_statemachine
			#elif clip_name.endswith( ' bt' ):
				#bitmap = self.bmp_blendtree

		# see if the object has an error if it does override the icon with the error
		if not node.is_clip_valid or not node.is_tag_valid:
			bitmap = self.bmp_error

		if bitmap:
			image = wx.MemoryDC( )
			image.SelectObject( bitmap )

		# set the bullet color
		if obj_val == True:
			color = wx.GREEN
		else:
			color = wx.LIGHT_GREY

		# set the colors
		dc.SetBrush( wx.Brush( wx.GREEN ) )
		dc.SetPen( wx.BLACK_PEN )

		#dc.DrawRectangleRect( rect )

		# copy the image but only to the size of the grid cell
		if bitmap:
			width, height = bitmap.GetWidth(), bitmap.GetHeight()

			if width > rect.width-2:
				width = rect.width-2

			if height > rect.height-2:
				height = rect.height-2

			dc.Blit(rect.x+6, rect.y+3, width, height, image, 0, 0, wx.COPY, True)