-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- switching of redeal images (redeal/stopped) corrected. - new wrapper class for options management. Refactorings. - redeal, pause and demo logo style selections updated.
- Loading branch information
Showing
6 changed files
with
162 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/python | ||
# -*- mode: python; coding: utf-8; -*- | ||
# ============================================================================= | ||
# Copyright (C) 2017-2023 LB | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# Flake8: noqa | ||
# | ||
# ============================================================================= | ||
|
||
import logging | ||
|
||
from kivy.event import EventDispatcher | ||
from kivy.properties import BooleanProperty | ||
from kivy.properties import NumericProperty | ||
from kivy.properties import ListProperty | ||
from kivy.properties import StringProperty | ||
|
||
# ============================================================================= | ||
# Joins kivy properties to object members of referenced class. | ||
# Usage: | ||
# - use derived classes LBoolWrap etc. according to type. | ||
# - write: obj.value = <new value> | ||
# - read: <actual value> = obj.value | ||
# - If you need additional functionality on change add a callback function | ||
# as 'command'. It will be called whenever the value changes. | ||
|
||
class LObjWrap(EventDispatcher): | ||
def __init__(self,obj,ref,command=None): | ||
self.obj = obj | ||
self.ref = ref | ||
self.value = getattr(self.obj,self.ref) | ||
# logging.info("LObjWrap: setup for %s" % (self.ref)) | ||
self.bind(value=self.on_value) | ||
if command is not None: | ||
self.bind(value=command) | ||
|
||
def on_value(self,inst,val): | ||
logging.info("LObjWrap: %s = %s" % (self.ref,val)) | ||
setattr(self.obj,self.ref,val) | ||
|
||
class LBoolWrap(LObjWrap): | ||
value = BooleanProperty(False) | ||
|
||
def __init__(self,obj,ref,command=None): | ||
super(LBoolWrap,self).__init__(obj,ref,command) | ||
|
||
class LNumWrap(LObjWrap): | ||
value = NumericProperty(0) | ||
|
||
def __init__(self,obj,ref,command=None): | ||
super(LNumWrap,self).__init__(obj,ref,command) | ||
|
||
class LStringWrap(LObjWrap): | ||
value = StringProperty('') | ||
|
||
def __init__(self,obj,ref,command=None): | ||
super(LStringWrap,self).__init__(obj,ref,command) | ||
|
||
class LListWrap(LObjWrap): | ||
value = ListProperty([]) | ||
|
||
def __init__(self,obj,ref,command=None): | ||
super(LListWrap,self).__init__(obj,ref,command) | ||
|
||
# ============================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.