<commit_before>'''
Author:        <NAME>, <NAME>
Created:       2014.12.16
Last Modified: 2014.12.16

tree of code blocks to be displayed and manipulated through user interaction.

this forms the display of the user code

***  still need to implement drag and drop and display of draggable code blocks  ***   

'''

from kivy.app import App
from kivy.uix.treeview import TreeView, TreeViewNode
from kivy.uix.gridlayout import GridLayout
from codeblock import PrimaryBlock, CodeBlock
from kivy.uix.relativelayout import RelativeLayout


class UserCodeDisplay(RelativeLayout):

	def __init__(self, userProgram):
		super(UserCodeDisplay, self).__init__()
		layout = GridLayout(cols=6)


		program_file = userProgram.replace('(', '( ').replace(')', ' )').split()
		program = program_file		
		for element in program:
			layout.add_widget(PrimaryBlock(element))
		
		self.add_widget(layout)




	def on_textinput(self):
		return True

	# def on_touch_up(self, touch, *args):
	# 	if self.collide_point(*touch.pos):
	# 		pass
	# 	pass
	def on_touch_down(self, touch, *args):
		if self.collide_point(*touch.pos):
			super(UserCodeDisplay, self).on_touch_down(touch)
		pass	

		def on_touch_up(self, touch, *args):
		if self.collide_point(*touch.pos):
			super(UserCodeDisplay, self).on_touch_up(touch)
			 
		pass	

	def valid_syntax(self):
		if 'x' not in program:
			return True
		return False




class testUserCodeDisplay(App):

	

	def build(self):
		return UserCodeDisplay('(test x y')

<commit_msg>touch calls<commit_after>'''
Author:        <NAME>, <NAME>
Created:       2014.12.16
Last Modified: 2014.12.16

tree of code blocks to be displayed and manipulated through user interaction.

this forms the display of the user code

***  still need to implement drag and drop and display of draggable code blocks  ***   

'''

from kivy.app import App
from kivy.uix.treeview import TreeView, TreeViewNode
from kivy.uix.gridlayout import GridLayout
from codeblock import PrimaryBlock, CodeBlock
from kivy.uix.relativelayout import RelativeLayout


class UserCodeDisplay(RelativeLayout):

	def __init__(self, userProgram):
		super(UserCodeDisplay, self).__init__()
		layout = GridLayout(cols=6)


		program_file = userProgram.replace('(', '( ').replace(')', ' )').split()
		program = program_file		
		for element in program:
			layout.add_widget(PrimaryBlock(element))
		
		self.add_widget(layout)




	def on_enter(self):
		
		return True

	# def on_touch_up(self, touch, *args):
	# 	if self.collide_point(*touch.pos):
	# 		pass
	# 	pass
	def on_touch_down(self, touch, *args):
		if self.collide_point(*touch.pos):
			super(UserCodeDisplay, self).on_touch_down(touch)
		pass	

	def on_touch_up(self, touch, *args):
		if self.collide_point(*touch.pos):
			super(UserCodeDisplay, self).on_touch_up(touch)

			 
		pass	

	def valid_syntax(self):
		if 'x' not in program:
			return True
		return False




class testUserCodeDisplay(App):

	

	def build(self):
		return UserCodeDisplay('(test x y')


{'fraction_non_alphanumeric': 0.10705921712947473, 'fraction_numerical': 0.011375041820006692, 'mean_word_length': 4.2364273204903675, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2085694', 'n_tokens_mistral': 1108, 'n_tokens_neox': 977, 'n_words': 269}