MCPcopy Index your code
hub / github.com/rawpython/remi / onkeydown

Method onkeydown

editor/editor.py:1184–1207  ·  view source on GitHub ↗
(self, emitter, key, keycode, ctrl, shift, alt)

Source from the content-addressed store, hash-verified

1182 self.selectedWidget.style[css_key] = gui.to_pix(gui.from_pix(self.selectedWidget.style[css_key]) + value)
1183
1184 def onkeydown(self, emitter, key, keycode, ctrl, shift, alt):
1185 arrow_left = '37'
1186 arrow_right = '39'
1187 arrow_up = '38'
1188 arrow_down = '40'
1189 key_canc = '46'
1190 ctrl = ctrl.lower() == 'true'
1191 shift = shift.lower() == 'true'
1192 if str(keycode) == key_canc: # 46 the delete keycode
1193 self.toolbar_delete_clicked(None)
1194 return
1195
1196 if keycode in (arrow_left, arrow_right, arrow_up, arrow_down):
1197 value = int(self.spin_grid_size.get_value())
1198 value = value if str(keycode) in (arrow_down, arrow_right) else -value
1199 key = 'left' if str(keycode) in (arrow_left, arrow_right) else 'top'
1200 if ctrl:
1201 key = {'left':'width', 'top':'height'}[key]
1202
1203 self.move_widget(key, value)
1204
1205 self.on_drag_resize_end(self)
1206
1207 print("Key pressed: " + str(keycode) + " ctrl: " + str(ctrl) + " shift: " + str(shift))
1208
1209 def show_error_dialog(self, title, message):
1210 error_dialog = gui.GenericDialog(title, message)

Callers

nothing calls this directly

Calls 4

move_widgetMethod · 0.95
on_drag_resize_endMethod · 0.95
get_valueMethod · 0.45

Tested by

no test coverage detected