Update vmenuManager.py
This commit is contained in:
parent
da33a951a4
commit
4e254d7115
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
from fenrirscreenreader.utils import module_utils
|
from fenrirscreenreader.utils import module_utils
|
||||||
import os, inspect
|
import os, inspect, time
|
||||||
|
|
||||||
currentdir = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe()))))
|
currentdir = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe()))))
|
||||||
fenrirPath = os.path.dirname(currentdir)
|
fenrirPath = os.path.dirname(currentdir)
|
||||||
@ -17,6 +17,8 @@ class vmenuManager():
|
|||||||
self.currIndex = None
|
self.currIndex = None
|
||||||
self.currMenu = ''
|
self.currMenu = ''
|
||||||
self.active = False
|
self.active = False
|
||||||
|
self.searchText = ''
|
||||||
|
self.lastSearchTime = time.time()
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
self.defaultVMenuPath = fenrirPath+ "/commands/vmenu-profiles/" + self.env['runtime']['inputManager'].getShortcutType()
|
self.defaultVMenuPath = fenrirPath+ "/commands/vmenu-profiles/" + self.env['runtime']['inputManager'].getShortcutType()
|
||||||
@ -24,6 +26,21 @@ class vmenuManager():
|
|||||||
self.closeAfterAction = False
|
self.closeAfterAction = False
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
|
def searchEntry(self, value):
|
||||||
|
if self.currIndex == None:
|
||||||
|
return False
|
||||||
|
if time.time() - self.lastSearchTime > 1:
|
||||||
|
self.searchText = ''
|
||||||
|
self.searchText += value
|
||||||
|
self.lastSearchTime = time.time()
|
||||||
|
startIndex = 0
|
||||||
|
while True:
|
||||||
|
entry = self.getCurrentEntry()
|
||||||
|
if entry.startswith(self.searchText):
|
||||||
|
return True
|
||||||
|
if not self.nextIndex():
|
||||||
|
return False
|
||||||
|
if
|
||||||
def setCurrMenu(self, currMenu = ''):
|
def setCurrMenu(self, currMenu = ''):
|
||||||
self.currIndex = None
|
self.currIndex = None
|
||||||
self.currMenu = ''
|
self.currMenu = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user