mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-08-01 19:36:05 -04:00
User interface skeleton
This commit is contained in:
parent
9fdcbf11b8
commit
fbc151060e
8 changed files with 136 additions and 15 deletions
|
@ -1,5 +1,37 @@
|
|||
import os
|
||||
import glob
|
||||
import RNS
|
||||
import nomadnet
|
||||
|
||||
from .MenuUI import MenuUI
|
||||
from .TextUI import TextUI
|
||||
from .GraphicalUI import GraphicalUI
|
||||
from .WebUI import WebUI
|
||||
|
||||
UI_NONE = 0x00
|
||||
UI_MENU = 0x01
|
||||
UI_TEXT = 0x02
|
||||
UI_GRAPHICAL = 0x03
|
||||
UI_WEB = 0x04
|
||||
|
||||
UI_MODES = [UI_MENU, UI_TEXT, UI_GRAPHICAL, UI_WEB]
|
||||
|
||||
modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
||||
__all__ = [ os.path.basename(f)[:-3] for f in modules if not f.endswith('__init__.py')]
|
||||
__all__ = [ os.path.basename(f)[:-3] for f in modules if not f.endswith('__init__.py')]
|
||||
|
||||
def spawn(uimode):
|
||||
if uimode in UI_MODES:
|
||||
RNS.log("Starting user interface...", RNS.LOG_INFO)
|
||||
if uimode == UI_MENU:
|
||||
return MenuUI()
|
||||
elif uimode == UI_TEXT:
|
||||
return TextUI()
|
||||
elif uimode == UI_GRAPHICAL:
|
||||
return GraphicalUI()
|
||||
elif uimode == UI_WEB:
|
||||
return WebUI()
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
RNS.log("Invalid UI mode", RNS.LOG_ERROR)
|
||||
nomadnet.panic()
|
Loading…
Add table
Add a link
Reference in a new issue