mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-14 20:30:06 +01:00
Whitespace
This commit is contained in:
@@ -23,11 +23,11 @@ class NumpadInput(object):
|
||||
def on_key_press(self, event):
|
||||
numpad = list(string.ascii_lowercase[0:19])
|
||||
|
||||
if event.char is 'h': # DISP button
|
||||
#self.root.after(60, lambda:self.on_key_press_delay(event.char))
|
||||
#return
|
||||
if event.char is 'h': # DISP button
|
||||
# self.root.after(60, lambda:self.on_key_press_delay(event.char))
|
||||
# return
|
||||
if self.data.is_display_held:
|
||||
return # ignore spurious message if already held"""
|
||||
return # ignore spurious message if already held"""
|
||||
self.data.is_display_held = True
|
||||
if self.in_0_event:
|
||||
return
|
||||
@@ -47,35 +47,35 @@ class NumpadInput(object):
|
||||
print('{} is not in keypad map'.format(event.char))
|
||||
|
||||
def on_key_release(self, event):
|
||||
numpad = list(string.ascii_lowercase[0:19])
|
||||
if event.char in numpad:
|
||||
self.check_key_release_settings(event.char)
|
||||
numpad = list(string.ascii_lowercase[0:19])
|
||||
if event.char in numpad:
|
||||
self.check_key_release_settings(event.char)
|
||||
|
||||
##print ("--- releasing %s" % event.char)
|
||||
# lag for 60ms to check that this is not a 'stream of 000' bullshit job from the keypad
|
||||
if event.char is 'h' and not self.in_0_event:
|
||||
self.root.after(self.KEY_000_DELAY+5, self.on_key_disp_release_delay)
|
||||
#self.data.is_display_held = False
|
||||
##print ("--- releasing %s" % event.char)
|
||||
# lag for 60ms to check that this is not a 'stream of 000' bullshit job from the keypad
|
||||
if event.char is 'h' and not self.in_0_event:
|
||||
self.root.after(self.KEY_000_DELAY + 5, self.on_key_disp_release_delay)
|
||||
# self.data.is_display_held = False
|
||||
|
||||
def on_mouse_move(self, event):
|
||||
if self.data.settings['user_input'].setdefault(
|
||||
'MOUSE_INPUT',
|
||||
self.data.default_settings.get('MOUSE_INPUT',{'value': 'enabled'})).get('value') != 'enabled':
|
||||
self.data.default_settings.get('MOUSE_INPUT', {'value': 'enabled'})).get('value') != 'enabled':
|
||||
return
|
||||
if event.x > 480 or event.y > 320:
|
||||
return
|
||||
width = 480
|
||||
height = 320 # hard coded since display is fixed , and reading screen is more work
|
||||
height = 320 # hard coded since display is fixed , and reading screen is more work
|
||||
|
||||
self.root.after(0, self.run_action_for_mapped_key, 'x_m', event.x / width)
|
||||
self.root.after(0, self.run_action_for_mapped_key, 'y_m', event.y / height)
|
||||
#self.run_action_for_mapped_key(event.char)
|
||||
# self.run_action_for_mapped_key(event.char)
|
||||
|
||||
def select_display_mode_index(self, index):
|
||||
if index >= len(self.data.get_display_modes_list()):
|
||||
self.message_handler.set_message('ERROR', 'No page %s to display!' % index)
|
||||
else:
|
||||
self.actions.call_method_name("set_display_mode_%s"%self.data.get_display_modes_list()[index])
|
||||
self.actions.call_method_name("set_display_mode_%s" % self.data.get_display_modes_list()[index])
|
||||
|
||||
def run_action_for_mapped_key(self, key, value=-1):
|
||||
this_mapping = self.key_mappings[key]
|
||||
@@ -101,7 +101,7 @@ class NumpadInput(object):
|
||||
else:
|
||||
print('the numpad action being called for \'{}\' is {} (mode is {})'.format(key, this_mapping[mode][is_function], mode))
|
||||
if value != -1:
|
||||
self.actions.call_method_name(this_mapping[mode][is_function],value)
|
||||
self.actions.call_method_name(this_mapping[mode][is_function], value)
|
||||
else:
|
||||
self.actions.call_method_name(this_mapping[mode][is_function])
|
||||
|
||||
@@ -111,10 +111,8 @@ class NumpadInput(object):
|
||||
if not value:
|
||||
self.display.refresh_display()
|
||||
|
||||
|
||||
|
||||
def check_key_release_settings(self, key):
|
||||
|
||||
|
||||
this_mapping = self.key_mappings[key]
|
||||
if self.data.settings['sampler']['ACTION_GATED']['value'] == 'on':
|
||||
if self.data.control_mode == 'PLAYER' and 'PLAYER' in this_mapping:
|
||||
@@ -127,7 +125,7 @@ class NumpadInput(object):
|
||||
self.run_action_for_mapped_key(key)
|
||||
|
||||
def on_key_disp_release_delay(self):
|
||||
if not self.in_0_event:# and self.additional_0_in_event==0:
|
||||
if not self.in_0_event: # and self.additional_0_in_event==0:
|
||||
print("releasing !")
|
||||
self.data.is_display_held = False
|
||||
else:
|
||||
@@ -140,36 +138,35 @@ class NumpadInput(object):
|
||||
else:
|
||||
print("ignoring press!")"""
|
||||
|
||||
def on_0_key_press(self) :
|
||||
print ("on_0_key_press!")
|
||||
if(not self.in_0_event ):
|
||||
print (" first 0 received!")
|
||||
self.in_0_event = True
|
||||
def on_0_key_press(self):
|
||||
print("on_0_key_press!")
|
||||
if (not self.in_0_event):
|
||||
print(" first 0 received!")
|
||||
self.in_0_event = True
|
||||
self.additional_0_in_event = 0
|
||||
self.root.after(self.KEY_000_DELAY, self.check_event_outcome)
|
||||
else:
|
||||
print (" additional 0 received making %s!" % str(self.additional_0_in_event + 1))
|
||||
self.additional_0_in_event = self.additional_0_in_event + 1
|
||||
print(" additional 0 received making %s!" % str(self.additional_0_in_event + 1))
|
||||
self.additional_0_in_event = self.additional_0_in_event + 1
|
||||
|
||||
def check_event_outcome(self):
|
||||
if(self.additional_0_in_event == 0 ):
|
||||
print (" no additional events, sending s")
|
||||
self.in_0_event = False
|
||||
if (self.additional_0_in_event == 0):
|
||||
print(" no additional events, sending s")
|
||||
self.in_0_event = False
|
||||
self.run_action_for_mapped_key('s')
|
||||
elif(self.additional_0_in_event > 1):
|
||||
print (" %s additional events, sending n"%self.additional_0_in_event)
|
||||
self.in_0_event = False
|
||||
elif (self.additional_0_in_event > 1):
|
||||
print(" %s additional events, sending n" % self.additional_0_in_event)
|
||||
self.in_0_event = False
|
||||
self.run_action_for_mapped_key('n')
|
||||
elif(self.additional_0_in_event == 1):
|
||||
elif (self.additional_0_in_event == 1):
|
||||
print('this doesnt happen - may not be needed')
|
||||
self.root.after(self.KEY_000_DELAY, self.second_check_event_outcome)
|
||||
|
||||
def second_check_event_outcome(self):
|
||||
print("not supposed to happen?")
|
||||
if(self.additional_0_in_event == 1 ):
|
||||
self.in_0_event = False
|
||||
if (self.additional_0_in_event == 1):
|
||||
self.in_0_event = False
|
||||
self.run_action_for_mapped_key('s')
|
||||
elif(self.additional_0_in_event > 1):
|
||||
self.in_0_event = False
|
||||
elif (self.additional_0_in_event > 1):
|
||||
self.in_0_event = False
|
||||
self.run_action_for_mapped_key('n')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user