add initial quick menu support
This commit is contained in:
parent
d1d22897a1
commit
17c2045e46
@ -116,6 +116,12 @@ KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks
|
||||
KEY_FENRIR,KEY_X=set_mark
|
||||
KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text
|
||||
KEY_FENRIR,KEY_F10=toggle_vmenu_mode
|
||||
#=current_quick_menu_entry
|
||||
#=current_quick_menu_value
|
||||
#=next_quick_menu_entry
|
||||
#=next_quick_menu_value
|
||||
#=prev_quick_menu_entry
|
||||
#=prev_quick_menu_value
|
||||
# linux specific
|
||||
KEY_FENRIR,KEY_F7=import_clipboard_from_x
|
||||
KEY_FENRIR,KEY_F8=export_clipboard_to_x
|
||||
|
@ -116,6 +116,12 @@ KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks
|
||||
KEY_FENRIR,KEY_X=set_mark
|
||||
KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text
|
||||
KEY_FENRIR,KEY_F10=toggle_vmenu_mode
|
||||
#=current_quick_menu_entry
|
||||
#=current_quick_menu_value
|
||||
#=next_quick_menu_entry
|
||||
#=next_quick_menu_value
|
||||
#=prev_quick_menu_entry
|
||||
#=prev_quick_menu_value
|
||||
# linux specific
|
||||
KEY_FENRIR,KEY_F7=import_clipboard_from_x
|
||||
KEY_FENRIR,KEY_F8=export_clipboard_to_x
|
||||
|
@ -120,6 +120,12 @@ KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks
|
||||
KEY_FENRIR,KEY_F9=set_mark
|
||||
KEY_FENRIR,KEY_F10=marked_text
|
||||
KEY_FENRIR,KEY_F10=toggle_vmenu_mode
|
||||
#=current_quick_menu_entry
|
||||
#=current_quick_menu_value
|
||||
#=next_quick_menu_entry
|
||||
#=next_quick_menu_value
|
||||
#=prev_quick_menu_entry
|
||||
#=prev_quick_menu_value
|
||||
# linux specific
|
||||
#=import_clipboard_from_x
|
||||
KEY_FENRIR,KEY_F8=export_clipboard_to_x
|
||||
|
@ -120,6 +120,12 @@ KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks
|
||||
KEY_FENRIR,KEY_F9=set_mark
|
||||
KEY_FENRIR,KEY_F10=marked_text
|
||||
KEY_FENRIR,KEY_SHIFT,KEY_F10=toggle_vmenu_mode
|
||||
#=current_quick_menu_entry
|
||||
#=current_quick_menu_value
|
||||
#=next_quick_menu_entry
|
||||
#=next_quick_menu_value
|
||||
#=prev_quick_menu_entry
|
||||
#=prev_quick_menu_value
|
||||
# linux specific
|
||||
#=import_clipboard_from_x
|
||||
KEY_FENRIR,KEY_F8=export_clipboard_to_x
|
||||
|
@ -0,0 +1,26 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('get current quick menu entry')
|
||||
def run(self):
|
||||
menu = ''
|
||||
value = ''
|
||||
menu = self.env['runtime']['quickMenuManager'].getCurrentEntry()
|
||||
if menu != '':
|
||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
||||
self.env['runtime']['outputManager'].presentText(menu + ' ' + value, interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -0,0 +1,22 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('get current quick menu value')
|
||||
def run(self):
|
||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
||||
self.env['runtime']['outputManager'].presentText(value, interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -0,0 +1,29 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('get next quick menu entry')
|
||||
def run(self):
|
||||
menu = ''
|
||||
value = ''
|
||||
if self.env['runtime']['quickMenuManager'].nextEntry():
|
||||
menu = self.env['runtime']['quickMenuManager'].getCurrentEntry()
|
||||
if menu != '':
|
||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
||||
self.env['runtime']['outputManager'].presentText(menu + ' ' + value, interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(_('Quick menu not available'), interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -0,0 +1,25 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('get next quick menu value')
|
||||
def run(self):
|
||||
if self.env['runtime']['quickMenuManager'].nextValue():
|
||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
||||
self.env['runtime']['outputManager'].presentText(value, interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -0,0 +1,29 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('get previous quick menu entry')
|
||||
def run(self):
|
||||
menu = ''
|
||||
value = ''
|
||||
if self.env['runtime']['quickMenuManager'].prevEntry():
|
||||
menu = self.env['runtime']['quickMenuManager'].getCurrentEntry()
|
||||
if menu != '':
|
||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
||||
self.env['runtime']['outputManager'].presentText(menu + ' ' + value, interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(_('Quick menu not available'), interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -0,0 +1,23 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('get previous quick menu value')
|
||||
def run(self):
|
||||
if self.env['runtime']['quickMenuManager'].prevValue():
|
||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
||||
self.env['runtime']['outputManager'].presentText(value, interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -8,9 +8,98 @@ from fenrirscreenreader.core import debug
|
||||
|
||||
class quickMenuManager():
|
||||
def __init__(self):
|
||||
pass
|
||||
self.position = 0
|
||||
self.quickMenu = []
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.env = environment
|
||||
self.loadMenu(self.env['runtime']['settingsManager'].getSetting('menu', 'quickMenu'))
|
||||
def shutdown(self):
|
||||
pass
|
||||
pass
|
||||
def loadMenu(self, menuString):
|
||||
self.position = 0
|
||||
self.quickMenu = []
|
||||
if menuString == '':
|
||||
return
|
||||
entrys = menuString.split(';')
|
||||
for e in entrys:
|
||||
entry = e.split('#')
|
||||
if len(entry) != 2:
|
||||
continue
|
||||
self.quickMenu.append({'section': entry[0], 'setting': entry[1]})
|
||||
def nextEntry(self):
|
||||
if len(self.quickMenu) == 0:
|
||||
return False
|
||||
self.position += 1
|
||||
if self.position >= len(self.quickMenu):
|
||||
self.position = 0
|
||||
return True
|
||||
def prevEntry(self):
|
||||
if len(self.quickMenu) == 0:
|
||||
return False
|
||||
self.position -= 1
|
||||
if self.position < 0:
|
||||
self.position = len(self.quickMenu) - 1
|
||||
return True
|
||||
def nextValue(self):
|
||||
if len(self.quickMenu) == 0:
|
||||
return False
|
||||
try:
|
||||
valueString = self.env['runtime']['settingsManager'].getSetting(self.quickMenu[self.position]['section'], self.quickMenu[self.position]['setting'])
|
||||
except:
|
||||
return False
|
||||
# bool
|
||||
if valueString.upper() in ['TRUE', 'FALSE']:
|
||||
value = valueString.upper() == 'TRUE'
|
||||
value = not value
|
||||
self.env['runtime']['settingsManager'].setSettingAsBool(self.quickMenu[self.position]['section'], self.quickMenu[self.position]['setting'], value)
|
||||
return True
|
||||
# float
|
||||
try:
|
||||
value = float(valueString)
|
||||
value += 0.05
|
||||
if value > 1.0:
|
||||
value = 1.0
|
||||
self.env['runtime']['settingsManager'].setSettingAsFloat(self.quickMenu[self.position]['section'], self.quickMenu[self.position]['setting'], value)
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
return True
|
||||
def prevValue(self):
|
||||
if len(self.quickMenu) == 0:
|
||||
return False
|
||||
try:
|
||||
valueString = self.env['runtime']['settingsManager'].getSetting(self.quickMenu[self.position]['section'], self.quickMenu[self.position]['setting'])
|
||||
except:
|
||||
return False
|
||||
# bool
|
||||
if valueString.upper() in ['TRUE', 'FALSE']:
|
||||
value = valueString.upper() == 'TRUE'
|
||||
value = not value
|
||||
self.env['runtime']['settingsManager'].setSettingAsBool(self.quickMenu[self.position]['section'], self.quickMenu[self.position]['setting'], value)
|
||||
return True
|
||||
# float
|
||||
try:
|
||||
value = float(valueString)
|
||||
value -= 0.05
|
||||
if value < 0.0:
|
||||
value = 0
|
||||
self.env['runtime']['settingsManager'].setSettingAsFloat(self.quickMenu[self.position]['section'], self.quickMenu[self.position]['setting'], value)
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
return True
|
||||
def getCurrentEntry(self):
|
||||
if len(self.quickMenu) == 0:
|
||||
return ''
|
||||
try:
|
||||
return _(self.quickMenu[self.position]['section']) + ' ' + _(self.quickMenu[self.position]['setting'])
|
||||
except:
|
||||
return _('setting invalid')
|
||||
def getCurrentValue(self):
|
||||
if len(self.quickMenu) == 0:
|
||||
return ''
|
||||
try:
|
||||
return self.env['runtime']['settingsManager'].getSetting(self.quickMenu[self.position]['section'], self.quickMenu[self.position]['setting'])
|
||||
except:
|
||||
return _('setting value invalid')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user