Trigger method for new events
This commit is contained in:
@@ -124,8 +124,6 @@ def render_textrect(string, font, rect, text_color, background_color, justificat
|
|||||||
Failure - raises a TextRectException if the text won't fit onto the surface.
|
Failure - raises a TextRectException if the text won't fit onto the surface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pygame
|
|
||||||
|
|
||||||
final_lines = []
|
final_lines = []
|
||||||
|
|
||||||
requested_lines = string.splitlines()
|
requested_lines = string.splitlines()
|
||||||
@@ -202,6 +200,9 @@ class GUI_PyGame:
|
|||||||
def get_size(self):
|
def get_size(self):
|
||||||
return self.size
|
return self.size
|
||||||
|
|
||||||
|
def trigger_event(self, event_id, event_channel):
|
||||||
|
eventmodule.post(eventmodule.Event(event_id, channel=event_channel))
|
||||||
|
|
||||||
def show_picture(self, filename, size=(0,0), offset=(0,0)):
|
def show_picture(self, filename, size=(0,0), offset=(0,0)):
|
||||||
# Use window size if none given
|
# Use window size if none given
|
||||||
if size == (0,0):
|
if size == (0,0):
|
||||||
@@ -400,7 +401,7 @@ def setup_gpio():
|
|||||||
|
|
||||||
def handle_gpio(channel):
|
def handle_gpio(channel):
|
||||||
"""Interrupt handler for GPIO events"""
|
"""Interrupt handler for GPIO events"""
|
||||||
eventmodule.post(eventmodule.Event(gpio_trigger_event, channel=channel))
|
display.trigger_event(gpio_trigger_event, channel)
|
||||||
|
|
||||||
def teardown(exit_code=0):
|
def teardown(exit_code=0):
|
||||||
display.teardown()
|
display.teardown()
|
||||||
|
|||||||
Reference in New Issue
Block a user