mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-13 02:08:50 +01:00
Merge pull request #14 from cuu/master
Merged and add keydown simulation event,for remote operations
This commit is contained in:
commit
e3f1ea453c
@ -1 +0,0 @@
|
|||||||
guu@guu-desktop.5528:1527716105
|
|
||||||
@ -520,7 +520,7 @@ class Page(object):
|
|||||||
self._Screen._CurrentPage = child_page
|
self._Screen._CurrentPage = child_page
|
||||||
elif cur_icon._MyType == ICON_TYPES["FUNC"]:
|
elif cur_icon._MyType == ICON_TYPES["FUNC"]:
|
||||||
print("IconClick API: %d"%(cur_icon._Index))
|
print("IconClick API: %d"%(cur_icon._Index))
|
||||||
print("%s"% cur_icon._CmdPath)
|
#print("%s"% cur_icon._CmdPath)
|
||||||
api_cb = getattr(cur_icon._CmdPath,"API",None)
|
api_cb = getattr(cur_icon._CmdPath,"API",None)
|
||||||
if api_cb != None:
|
if api_cb != None:
|
||||||
if callable(api_cb):
|
if callable(api_cb):
|
||||||
|
|||||||
@ -135,9 +135,7 @@ def event_process(event,main_screen):
|
|||||||
global sound_patch
|
global sound_patch
|
||||||
global everytime_keydown
|
global everytime_keydown
|
||||||
if event != None:
|
if event != None:
|
||||||
|
|
||||||
pygame.event.clear()
|
pygame.event.clear()
|
||||||
|
|
||||||
if event.type == pygame.ACTIVEEVENT:
|
if event.type == pygame.ACTIVEEVENT:
|
||||||
print(" ACTIVEEVENT !")
|
print(" ACTIVEEVENT !")
|
||||||
return
|
return
|
||||||
@ -270,7 +268,14 @@ def socket_thread(main_screen):
|
|||||||
datagram = conn.recv(1024)
|
datagram = conn.recv(1024)
|
||||||
if datagram:
|
if datagram:
|
||||||
tokens = datagram.strip().split()
|
tokens = datagram.strip().split()
|
||||||
|
|
||||||
|
if tokens[0].lower() == "esc":
|
||||||
|
escevent = pygame.event.Event(pygame.KEYDOWN,{'scancode':9,'key': 27, 'unicode': u'\x1b', 'mod': 0})
|
||||||
|
current_page_key_down_cb = getattr(main_screen._CurrentPage,"KeyDown",None)
|
||||||
|
if current_page_key_down_cb != None:
|
||||||
|
if callable( current_page_key_down_cb ):
|
||||||
|
main_screen._CurrentPage.KeyDown(escevent)
|
||||||
|
|
||||||
if tokens[0].lower() == "quit":
|
if tokens[0].lower() == "quit":
|
||||||
conn.close()
|
conn.close()
|
||||||
on_exit_cb = getattr(main_screen,"OnExitCb",None)
|
on_exit_cb = getattr(main_screen,"OnExitCb",None)
|
||||||
@ -282,6 +287,16 @@ def socket_thread(main_screen):
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
if tokens[0].lower() == "poweroff":
|
if tokens[0].lower() == "poweroff":
|
||||||
|
escevent = pygame.event.Event(pygame.KEYDOWN,{'scancode':9,'key': 27, 'unicode': u'\x1b', 'mod': 0})
|
||||||
|
for i in range(0,5):
|
||||||
|
current_page_key_down_cb = getattr(main_screen._CurrentPage,"KeyDown",None)
|
||||||
|
if current_page_key_down_cb != None:
|
||||||
|
if callable( current_page_key_down_cb ):
|
||||||
|
main_screen._CurrentPage.KeyDown(escevent)
|
||||||
|
|
||||||
|
if main_screen._MyPageStack.Length() == 0: ## on Top Level
|
||||||
|
break
|
||||||
|
|
||||||
if main_screen._CurrentPage._Name == "GameShell":
|
if main_screen._CurrentPage._Name == "GameShell":
|
||||||
for i in main_screen._CurrentPage._Icons:
|
for i in main_screen._CurrentPage._Icons:
|
||||||
if i._MyType == ICON_TYPES["FUNC"]:
|
if i._MyType == ICON_TYPES["FUNC"]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user