<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from libavg import avg, gesture
import libavg

RESOLUTION = avg.Point2D(800, 600)

class TextRect(avg.DivNode):
    def __init__(self, text, parent=None, **kwargs):
        super(TextRect, self).__init__(**kwargs)
        self.registerInstance(self, parent)
        self.rect = avg.RectNode(size=self.size, fillopacity=1, fillcolor="000000", 
                color="FFFFFF", parent=self)
        self.words = avg.WordsNode(color="FFFFFF", text=text, alignment="center", 
                parent=self)
        self.words.pos = (self.size-(0,self.words.size.y)) / 2

    def getSize(self):
        return self.__divSize

    def setSize(self, size):
        self.rect.size = size
        self.words.pos = (size-(0,self.words.size.y)) / 2
        self.__divSize = size
    __divSize = avg.DivNode.size
    size = property(getSize, setSize)


class SubclassDemoApp(libavg.AVGApp):

    def init(self):
        self.rect = TextRect(text="Hello World", pos=(20,20), size=(200,120), 
                parent=self._parentNode)
        gesture.TapRecognizer(node=self.rect, detectedHandler=self.onTap)
        
    def onTap(self, event):
        self.rect.size = self.rect.size + (10,10)
<commit_msg>src/samples: Updated subclass.py to current svn.<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from libavg import avg, gesture
import libavg

RESOLUTION = avg.Point2D(800, 600)

class TextRect(avg.DivNode):
    def __init__(self, text, parent=None, **kwargs):
        super(TextRect, self).__init__(**kwargs)
        self.registerInstance(self, parent)
        self.rect = avg.RectNode(size=self.size, fillopacity=1, fillcolor="000000", 
                color="FFFFFF", parent=self)
        self.words = avg.WordsNode(color="FFFFFF", text=text, alignment="center", 
                parent=self)
        self.words.pos = (self.size-(0,self.words.size.y)) / 2

    def getSize(self):
        return self.__divSize

    def setSize(self, size):
        self.rect.size = size
        self.words.pos = (size-(0,self.words.size.y)) / 2
        self.__divSize = size
    __divSize = avg.DivNode.size
    size = property(getSize, setSize)


class SubclassDemoApp(libavg.AVGApp):

    def init(self):
        self.rect = TextRect(text="Hello World", pos=(20,20), size=(200,120), 
                parent=self._parentNode)
        self.__recognizer = gesture.TapRecognizer(node=self.rect, 
                detectedHandler=self.onTap)
        
    def onTap(self):
        self.rect.size = self.rect.size + (10,10)

{'fraction_non_alphanumeric': 0.1405216037368626, 'fraction_numerical': 0.025690930323082912, 'mean_word_length': 2.7031700288184437, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2230715', 'n_tokens_mistral': 906, 'n_tokens_neox': 836, 'n_words': 157}