Skip to content

Commit

Permalink
added some other types for testing
Browse files Browse the repository at this point in the history
 * https://kivy.org/doc/stable/api-kivy.uix.settings.html#create-a-panel-from-json

As I cleanup and remove chunks of code that probably aren't necessary, I want to make sure that I don't break functionality with the other built-in kivy types. Currently we're only using my custom "ComplexOption", but I may want to use some of these in the future.

For example, to set auxiliary triggers, I may want to use the "path" type, which allows the user to pick a file on their computer (eg a script) to execute when the trigger executes

 * #62

So far I tested all of these and they seem to work. There was an additional "Color" picker type, but that failed with an error. Maybe I have too old a version of kivy, but I'm content if our app doesn't allow users to pick colors for now..
  • Loading branch information
maltfield committed Jun 10, 2023
1 parent c76a70d commit a4b6837
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/buskill_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,6 @@ def on_value(self, instance, value):
value = str(value)
panel.set_value(self.section, self.key, value)

# TODO: actually define a complex option here
class BusKillSettingComplexOptions(BusKillSettingItem):
icon = ObjectProperty(None)
'''Implementation of an option list on top of a :class:`SettingItem`.
Expand Down Expand Up @@ -1157,7 +1156,13 @@ def build_config(self, config):
Config.read( self.bk.CONF_FILE )
Config.setdefaults('buskill', {
'trigger': 'lock-screen',
# TODO: remove these (just for testing future options & types)
'drive': 'all',
'flag': True,
'count': 42,
'which': "medium",
'name': "John Smith",
'file': "/tmp/some_file"
})
Config.set('kivy', 'exit_on_escape', '0')
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
Expand Down
36 changes: 36 additions & 0 deletions src/packages/buskill/settings_buskill.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,41 @@
"options_long": ["v1 long description", "v2 long description" ],
"options_icons": ["\ue8b8","\ue8b8"],
"confirmation": ["", "", ""]
},
{
"type": "bool",
"title": "On or Off?",
"desc": "Test of boolean types",
"section": "buskill",
"key": "flag"
},
{
"type": "numeric",
"title": "How many?",
"desc": "Test of numeric type",
"section": "buskill",
"key": "count"
},
{
"type": "options",
"title": "Which one?",
"desc": "Test of built-in kivy 'options' type",
"section": "buskill",
"key": "which",
"options": ["short","medium","tall"]
},
{
"type": "string",
"title": "What's your name?",
"desc": "Test of string type",
"section": "buskill",
"key": "name"
},
{
"type": "path",
"title": "Where is it?",
"desc": "Test of path type",
"section": "buskill",
"key": "file"
}
]

0 comments on commit a4b6837

Please sign in to comment.