mirror of https://git.sr.ht/~michalr/menu
Add ability to hide the mouse cursor
This commit is contained in:
parent
1dd3e4b22d
commit
b8b2cb61f4
8
menu.py
8
menu.py
|
@ -186,7 +186,8 @@ class App:
|
|||
SHOW_REQUEST_MESSAGE_FOR_AT_LEAST_S = 5
|
||||
IGNORE_EVENTS_FOR_TICKS_AFTER_SCREENSAVER = 5
|
||||
|
||||
def __init__(self, actions: List[Action], theme: Dict, fullscreen: bool, screensaver_delay: int):
|
||||
def __init__(self, actions: List[Action], theme: Dict, fullscreen: bool, screensaver_delay: int,
|
||||
hide_cursor: bool):
|
||||
pygame.init()
|
||||
info = pygame.display.Info()
|
||||
flags = 0
|
||||
|
@ -201,6 +202,8 @@ class App:
|
|||
self.task_q = Queue()
|
||||
self.screensaver = ClockScreensaver()
|
||||
self.TICKS_UNTIL_SCREENSAVER = screensaver_delay * self.FPS
|
||||
if hide_cursor:
|
||||
pygame.mouse.set_visible(False)
|
||||
|
||||
def get_screen_rect(self) -> pygame.Rect:
|
||||
return pygame.Rect(0, 0, self.screen.get_width(), self.screen.get_height())
|
||||
|
@ -317,6 +320,7 @@ if __name__ == '__main__':
|
|||
parser.add_argument("--no-fullscreen", help="Fullscreen", action='store_true')
|
||||
parser.add_argument("--screensaver-delay", help="Screensaver delay, in seconds. Default=30",
|
||||
type=int, default=30)
|
||||
parser.add_argument("--no-cursor", help="Hide the mouse cursor", action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
url_defs: List[Action] = []
|
||||
|
@ -325,5 +329,5 @@ if __name__ == '__main__':
|
|||
url_defs = get_url_defs(data)
|
||||
|
||||
app = App(url_defs, theme=data["theme"], fullscreen=not args.no_fullscreen,
|
||||
screensaver_delay=args.screensaver_delay)
|
||||
screensaver_delay=args.screensaver_delay, hide_cursor=args.no_cursor)
|
||||
app.loop()
|
||||
|
|
Loading…
Reference in New Issue