<commit_before>#!/usr/bin/python
# _*_ coding: UTF-8 _*_

__author__ = 'Junhg'

# create: 2016/10/28
# version: 0.0.1
# author: Junhg
# contribute:
# 

from ViewObject import JHViewObject

class JHButtonObject(JHViewObject):
	def __init__(self):
			pass

	def __del__(self):
			pass

	def addSubview(self, attribView, isLoadView):
		# print 'attribView=', attribView
		classViewName = self.attribViewTag(attribView)
		classViewAttrib = self.attribViewTagProperty(attribView)
		textAligment = self.getTextAlignment(classViewAttrib.get('textAlignment', 'NSTextAlignmentLeft'))
		lineAdjustment = self.getBaselineAdjustment(classViewAttrib.get('baselineAdjustment', 'UIBaselineAdjustmentAlignBaselines'))
		font = self.getTextFont(attribView.get('fontDescription', {}))
		textColor = self.getClassColor(attribView.get('textColor', {}))
		controlStates = attribView.get('state', {})
		connections = attribView.get('connections', {})
		frame =  self.getClassFrame(attribView.get('frame', {}))

		describle = JHViewObject.addSubview(self,attribView,False)

		if len(frame) > 0:
			describle +="	"+classViewName+".frame = "+frame+";\n"
			pass
		
		if attribView.has_key('contentVerticalAlignment'):
			if attribView.get('contentVerticalAlignment', 'center') != 'center':
				describle +="	"+classViewName+".contentVerticalAlignment = "+self.getControlContentVerticalAlignment(attribView.get('contentVerticalAlignment', 'center'))+";\n"
				pass
			pass

		if attribView.has_key('contentHorizontalAlignment'):
			if attribView.get('contentHorizontalAlignment', 'center') != 'center':
				describle +="	"+classViewName+".contentHorizontalAlignment = "+self.getControlContentHorizontalAlignment(attribView.get('contentHorizontalAlignment', 'center'))+";\n"
				pass
			pass

		for controlState in controlStates:
			if controlState.has_key('title'):
				describle +="	["+classViewName+" setTitle:@"+"\""+controlState.get('title', '')+"\""+" forState:"+self.getControlState(controlState.get('key','normal'))+"];\n"
				pass
			if controlState.has_key('backgroundImage'):
				describle +="	["+classViewName+" setBackgroundImage:@"+"\""+controlState.get('backgroundImage', '')+"\""+" forState:"+self.getControlState(controlState.get('key','normal'))+"];\n"
				pass
			if controlState.has_key('image'):
				describle +="	["+classViewName+" setImage:@"+"\""+controlState.get('image', '')+"\""+" forState:"+self.getControlState(controlState.get('key','normal'))+"];\n"
				pass
			pass
			
		for connection in connections:
			if connection.has_key('action'):
				action = connection.get('action', {})
				if action.has_key('selector') and action.has_key('eventType'):
					describle +="	["+classViewName+" addTarget:self action:@selector("+action.get('selector','')+") forControlEvents:+"+self.getControlEvent(action.get('eventType', 'touchUpInside'))+"];\n"
					pass
				pass
			pass
			
		return describle
<commit_msg>add backgournd<commit_after>#!/usr/bin/python
# _*_ coding: UTF-8 _*_

__author__ = 'Junhg'

# create: 2016/10/28
# version: 0.0.1
# author: Junhg
# contribute:
# 

from ViewObject import JHViewObject

class JHButtonObject(JHViewObject):
	def __init__(self):
			pass

	def __del__(self):
			pass

	def addSubview(self, attribView, isLoadView):
		# print 'attribView=', attribView
		classViewName = self.attribViewTag(attribView)
		classViewAttrib = self.attribViewTagProperty(attribView)
		textAligment = self.getTextAlignment(classViewAttrib.get('textAlignment', 'NSTextAlignmentLeft'))
		lineAdjustment = self.getBaselineAdjustment(classViewAttrib.get('baselineAdjustment', 'UIBaselineAdjustmentAlignBaselines'))
		font = self.getTextFont(attribView.get('fontDescription', {}))
		textColor = self.getClassColor(attribView.get('textColor', {}))
		controlStates = attribView.get('state', {})
		connections = attribView.get('connections', {})
		frame =  self.getClassFrame(attribView.get('frame', {}))

		describle = JHViewObject.addSubview(self,attribView,False)

		if len(frame) > 0:
			describle +="	"+classViewName+".frame = "+frame+";\n"
			pass
		
		if attribView.has_key('contentVerticalAlignment'):
			if attribView.get('contentVerticalAlignment', 'center') != 'center':
				describle +="	"+classViewName+".contentVerticalAlignment = "+self.getControlContentVerticalAlignment(attribView.get('contentVerticalAlignment', 'center'))+";\n"
				pass
			pass

		if attribView.has_key('contentHorizontalAlignment'):
			if attribView.get('contentHorizontalAlignment', 'center') != 'center':
				describle +="	"+classViewName+".contentHorizontalAlignment = "+self.getControlContentHorizontalAlignment(attribView.get('contentHorizontalAlignment', 'center'))+";\n"
				pass
			pass

		for controlState in controlStates:
			if controlState.has_key('title'):
				describle +="	["+classViewName+" setTitle:@"+"\""+controlState.get('title', '')+"\""+" forState:"+self.getControlState(controlState.get('key','normal'))+"];\n"
				pass
			if controlState.has_key('backgroundImage'):
				describle +="	["+classViewName+" setBackgroundImage:[UIImage imageNamed:@"+"\""+controlState.get('backgroundImage', '')+"\""+"] forState:"+self.getControlState(controlState.get('key','normal'))+"];\n"
				pass
			if controlState.has_key('image'):
				describle +="	["+classViewName+" setImage:[UIImage imageNamed:@"+"\""+controlState.get('image', '')+"\""+"] forState:"+self.getControlState(controlState.get('key','normal'))+"];\n"
				pass
			pass
			
		for connection in connections:
			if connection.has_key('action'):
				action = connection.get('action', {})
				if action.has_key('selector') and action.has_key('eventType'):
					describle +="	["+classViewName+" addTarget:self action:@selector("+action.get('selector','')+") forControlEvents:+"+self.getControlEvent(action.get('eventType', 'touchUpInside'))+"];\n"
					pass
				pass
			pass
			
		return describle

{'fraction_non_alphanumeric': 0.17181895815542272, 'fraction_numerical': 0.0044406490179333905, 'mean_word_length': 6.176470588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1199219', 'n_tokens_mistral': 2105, 'n_tokens_neox': 1872, 'n_words': 269}