<commit_before>import time
from pymouse import PyMouse
import cwiid

print( "Connect with the 1+2 buttons and wait." )

wm = cwiid.Wiimote( )
ms = PyMouse( )

msens = 1

time.sleep( 1 )

wm.rumble = 1
time.sleep( 0.2 )
wm.rumble = 0

wm.rpt_mode = cwiid.RPT_BTN

def mvms( xa, ya ):
	cx = ms.position( )[ 0 ]
	cy = ms.position( )[ 1 ]
	ms.move( cx + xa, cy + ya )
	
def clms( btn ):
	cx = ms.position( )[ 0 ]
	cy = ms.position( )[ 1 ]
	ms.click( cx, cy, btn )

print( "You can use it now." )

while True :
	button = wm.state['buttons']
	if button == 2048:
		mvms( 0, -msens )
	elif button == 1024:
		mvms( 0, msens )
	elif button == 256:
		mvms( -msens, 0 )
	elif button == 512:
		mvms( msens, 0 )
	elif button == 4:
		clms( 1 )
	elif button == 8:
		clms( 2 )
		
<commit_msg>Added wiimote exception that retries connection, made a start on mouse sensitivity changing.<commit_after>import time
from pymouse import PyMouse
import cwiid

ms = PyMouse( )
msens = 1

print( "Connect with the 1+2 buttons and wait." )

while True:
	try:
		wm = cwiid.Wiimote( )
		time.sleep( 1 )
	except RuntimeError:
		print( "No wiimote found, trying again." )
	else:
		break

wm.rumble = 1
time.sleep( 0.2 )
wm.rumble = 0

wm.rpt_mode = cwiid.RPT_BTN

def mvms( xa, ya ):
	cx = ms.position( )[ 0 ]
	cy = ms.position( )[ 1 ]
	ms.move( cx + xa, cy + ya )
	
def clms( btn ):
	cx = ms.position( )[ 0 ]
	cy = ms.position( )[ 1 ]
	ms.click( cx, cy, btn )

print( "You can use it now." )

while True :
	button = wm.state['buttons']
	
	# Mouse Movement
	
	if button == 2048:
		mvms( 0, -msens )
	elif button == 1024:
		mvms( 0, msens )
	elif button == 256:
		mvms( -msens, 0 )
	elif button == 512:
		mvms( msens, 0 )
		
	# Mouse Clicks
		
	elif button == 4:
		clms( 1 )
	elif button == 8:
		clms( 2 )
		
	# Mouse Sensitivity
	
	elif button == 4096:
		msens += 1
	elif button == 16:
		if msens > 1:
			msens -= 1
		

{'fraction_non_alphanumeric': 0.14255431902490726, 'fraction_numerical': 0.04080551139374669, 'mean_word_length': 2.731225296442688, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4345412', 'n_tokens_mistral': 901, 'n_tokens_neox': 788, 'n_words': 252}