<commit_before>from multiprocessing import Queue

__author__ = 'richard'
import sys, pygame
from pygame.locals import *
import time
import subprocess
import os
from pprint import pprint
from collections import defaultdict
from color import *
from button import Button
from label import Label
import time

os.environ["SDL_FBDEV"] = "/dev/fb1"
os.environ["SDL_MOUSEDEV"] = "/dev/input/touchscreen"
os.environ["SDL_MOUSEDRV"] = "TSLIB"
pygame.init()


class CanvasRunner(object):
    def __init__(self):
        self.canvas = {}
        self.default_canvas = ''
        self.canvas_stack = []
        self.current_canvas = ''
        self.render_queue = Queue()

        self.size = width, height = 480, 320
        self.screen = pygame.display.set_mode(self.size)

    def add_canvas(self, name, canvas_obj):
        print "Adding a new canvas the the app with name %s " % (name)
        self.canvas[name] = canvas_obj

        self.canvas[name].set_screen(self.screen)
        self.canvas[name].set_render_queue(self.render_queue)
        self.canvas[name].set_runner(self)

        self.canvas[name].__setup__(self.screen)

        if len(self.canvas.keys()) == 1:
            self.canvas_stack.append(canvas_obj)
            self.default_canvas = name
            self.current_canvas = name

    def change_canvas(self, name):
        print "Changing Canvas from %s to %s" % (self.current_canvas, name)
        self.current_canvas.__on_pause__()
        self.canvas_stack.append(self.current_canvas)
        self.current_canvas = name
        self.current__on_resume__()
        self.__render__()

    def back_canvas(self):

        old_canvas = self.canvas_stack.pop()
        print "Going back to an old canvas, poping %s" % (old_canvas)
        old_canvas.__on_exit__()<commit_msg>added running code<commit_after>from multiprocessing import Queue

__author__ = 'richard'
import sys, pygame
from pygame.locals import *
import time
import subprocess
import os
from pprint import pprint
from collections import defaultdict
from color import *
from button import Button
from label import Label
import time

os.environ["SDL_FBDEV"] = "/dev/fb1"
os.environ["SDL_MOUSEDEV"] = "/dev/input/touchscreen"
os.environ["SDL_MOUSEDRV"] = "TSLIB"
pygame.init()


class CanvasRunner(object):
    def __init__(self):
        self.canvas = {}
        self.default_canvas = ''
        self.canvas_stack = []
        self.current_canvas = ''
        self.render_queue = Queue()

        self.size = width, height = 480, 320
        self.screen = pygame.display.set_mode(self.size)

    def add_canvas(self, name, canvas_obj):
        print "Adding a new canvas the the app with name %s " % (name)
        self.canvas[name] = canvas_obj

        self.canvas[name].set_screen(self.screen)
        self.canvas[name].set_render_queue(self.render_queue)
        self.canvas[name].set_runner(self)

        self.canvas[name].__setup__(self.screen)

        if len(self.canvas.keys()) == 1:
            self.canvas_stack.append(canvas_obj)
            self.default_canvas = name
            self.current_canvas = name

    def change_canvas(self, name):
        print "Changing Canvas from %s to %s" % (self.current_canvas, name)
        self.canvas[self.current_canvas].__on_pause__()
        self.canvas_stack.append(self.current_canvas)
        self.current_canvas = name
        self.canvas[name].__on_resume__()
        self.__render__()

    def back_canvas(self):

        old_canvas = self.canvas_stack.pop()
        print "Going back to an old canvas, poping %s" % (old_canvas)
        old_canvas.__on_exit__()
{'fraction_non_alphanumeric': 0.10567296996662959, 'fraction_numerical': 0.004449388209121246, 'mean_word_length': 2.965821389195149, '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': '7110967', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1106, 'n_words': 253}