Update icons_keyboard.py

• Since 1.7.30, Eric deprecated short-form `# ba_meta export keyboard` and instead encourage modders to directly use module names `export bauiv1.Keyboard`
• But older versions have it at `export babase.Keyboard`
• So until 1.8 releases, I'm using a plugin which manually registers our keyboard class.
This commit is contained in:
! Freaku 2023-12-28 13:45:44 +05:30 committed by GitHub
parent 9dff2945be
commit de86c6da62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@
# ba_meta require api 8 # ba_meta require api 8
import bauiv1
import babase import babase
from babase import charstr from babase import charstr
@ -20,8 +21,7 @@ for i in range(26 - (len(list_of_icons) % 26)):
list_of_icons.append('') list_of_icons.append('')
# ba_meta export keyboard class IconKeyboard(babase.Keyboard if hasattr(babase, 'Keyboard') else bauiv1.Keyboard):
class IconKeyboard(babase.Keyboard):
"""Keyboard go brrrrrrr""" """Keyboard go brrrrrrr"""
name = 'Icons by \ue048Freaku' name = 'Icons by \ue048Freaku'
chars = [(list_of_icons[0:10]), chars = [(list_of_icons[0:10]),
@ -32,3 +32,10 @@ class IconKeyboard(babase.Keyboard):
f'icon{i//26+1}': tuple(list_of_icons[i:i+26]) f'icon{i//26+1}': tuple(list_of_icons[i:i+26])
for i in range(26, len(list_of_icons), 26) for i in range(26, len(list_of_icons), 26)
} }
# ba_meta export plugin
class byFreaku(babase.Plugin):
def __init__(self):
babase.app.meta.scanresults.exports['babase.Keyboard' if hasattr(
babase, 'Keyboard') else 'bauiv1.Keyboard'].append(__name__+'.IconKeyboard')