Skip to content

Commit

Permalink
changed exit button shortcut to prevent users from closing the progra…
Browse files Browse the repository at this point in the history
…m accidentally. shift+q -> control+shift+alt+q
  • Loading branch information
pokepetter committed May 22, 2024
1 parent 6505818 commit 3bdf147
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ursina/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from ursina.scene import instance as scene # for toggling collider visibility
from ursina.string_utilities import print_info, print_warning
from screeninfo import get_monitors
from ursina import input_handler


class Window(WindowProperties):
Expand Down Expand Up @@ -155,10 +156,10 @@ def window_input(key):
self.input_entity = Entity(name = 'window.input_entity', input=window_input)

self.exit_button = Button(parent=self.editor_ui, text='x', eternal=True, ignore_paused=True, origin=(.5, .5), enabled=self.borderless,
position=self.top_right, z=-999, scale=(.05, .025), color=color.red.tint(-.2), on_click=application.quit, name='exit_button')
position=self.top_right, z=-999, scale=(.05, .025), color=color.red.tint(-.2), shortcuts=('control+shift+alt+q', 'alt+f4'), on_click=application.quit, name='exit_button')

def _exit_button_input(key):
if held_keys['shift'] and key == 'q' and not mouse.right:
if input_handler.get_combined_key(key) in self.exit_button.shortcuts:
self.exit_button.on_click()
self.exit_button.input = _exit_button_input

Expand Down

0 comments on commit 3bdf147

Please sign in to comment.