do more work
This commit is contained in:
parent
8285ccaaed
commit
8f658171e2
@ -0,0 +1 @@
|
|||||||
|
|
21
src/fenrirscreenreader/commands/vmenu/KEY/mc/file/open.py
Normal file
21
src/fenrirscreenreader/commands/vmenu/KEY/mc/file/open.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
21
src/fenrirscreenreader/commands/vmenu/KEY/mc/file/save.py
Normal file
21
src/fenrirscreenreader/commands/vmenu/KEY/mc/file/save.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
30
src/fenrirscreenreader/commands/vmenu/KEY/mc/search/test.py
Normal file
30
src/fenrirscreenreader/commands/vmenu/KEY/mc/search/test.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from fenrirscreenreader.core import debug
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
def getDescription(self):
|
||||||
|
return _('presents the date')
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
||||||
|
|
||||||
|
# get the time formatted
|
||||||
|
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
|
||||||
|
|
||||||
|
# present the time via speak and braile, there is no soundicon, interrupt the current speech
|
||||||
|
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True)
|
||||||
|
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -0,0 +1 @@
|
|||||||
|
|
21
src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/open.py
Normal file
21
src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/open.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
21
src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/save.py
Normal file
21
src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/save.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from fenrirscreenreader.core import debug
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
def getDescription(self):
|
||||||
|
return _('presents the date')
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
||||||
|
|
||||||
|
# get the time formatted
|
||||||
|
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
|
||||||
|
|
||||||
|
# present the time via speak and braile, there is no soundicon, interrupt the current speech
|
||||||
|
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True)
|
||||||
|
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -0,0 +1 @@
|
|||||||
|
|
21
src/fenrirscreenreader/commands/vmenu/KEY/vim/file/open.py
Normal file
21
src/fenrirscreenreader/commands/vmenu/KEY/vim/file/open.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
21
src/fenrirscreenreader/commands/vmenu/KEY/vim/file/save.py
Normal file
21
src/fenrirscreenreader/commands/vmenu/KEY/vim/file/save.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -0,0 +1,21 @@
|
|||||||
|
#!/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 'No description found'
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
30
src/fenrirscreenreader/commands/vmenu/KEY/vim/search/test.py
Normal file
30
src/fenrirscreenreader/commands/vmenu/KEY/vim/search/test.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from fenrirscreenreader.core import debug
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
def getDescription(self):
|
||||||
|
return _('presents the date')
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
||||||
|
|
||||||
|
# get the time formatted
|
||||||
|
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
|
||||||
|
|
||||||
|
# present the time via speak and braile, there is no soundicon, interrupt the current speech
|
||||||
|
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True)
|
||||||
|
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -11,9 +11,8 @@ import os
|
|||||||
class vmenuManager():
|
class vmenuManager():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.menuDict = {}
|
self.menuDict = {}
|
||||||
self.currMenu = {}
|
|
||||||
self.currIndex = None
|
self.currIndex = None
|
||||||
self.currLevel = None
|
self.currMenu = ''
|
||||||
self.active = False
|
self.active = False
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
@ -21,54 +20,102 @@ class vmenuManager():
|
|||||||
pass
|
pass
|
||||||
def getActive(self):
|
def getActive(self):
|
||||||
return self.active
|
return self.active
|
||||||
def togglelMode(self):
|
def togglelMode(self, currMenu = ''):
|
||||||
self.setActive(not self.getActive())
|
self.setActive(not self.getActive(), currMenu)
|
||||||
def setActive(self, active):
|
def setActive(self, active, currMenu = ''):
|
||||||
self.active = active
|
self.active = active
|
||||||
|
self.currMenu = currMenu
|
||||||
if active:
|
if active:
|
||||||
self.createHelpDict()
|
self.createMenuTree()
|
||||||
self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_TUTORIAL_MODE'
|
self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_TUTORIAL_MODE'
|
||||||
self.env['bindings'][str([1, ['KEY_UP']])] = 'PREV_HELP'
|
self.env['bindings'][str([1, ['KEY_UP']])] = 'PREV_HELP'
|
||||||
self.env['bindings'][str([1, ['KEY_DOWN']])] = 'NEXT_HELP'
|
self.env['bindings'][str([1, ['KEY_DOWN']])] = 'NEXT_HELP'
|
||||||
self.env['bindings'][str([1, ['KEY_SPACE']])] = 'CURR_HELP'
|
self.env['bindings'][str([1, ['KEY_SPACE']])] = 'CURR_HELP'
|
||||||
|
self.env['bindings'][str([1, ['KEY_LEFT']])] = 'NEXT_HELP'
|
||||||
|
self.env['bindings'][str([1, ['KEY_RIGHT']])] = 'CURR_HELP'
|
||||||
|
self.env['bindings'][str([1, ['KEY_ENTER']])] = 'CURR_HELP'
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
self.menuDict = {}
|
||||||
|
self.currIndex = None
|
||||||
|
self.currMenu = ''
|
||||||
|
self.currLevel = 0
|
||||||
|
self.active = False
|
||||||
del(self.env['bindings'][str([1, ['KEY_ESC']])])
|
del(self.env['bindings'][str([1, ['KEY_ESC']])])
|
||||||
del(self.env['bindings'][str([1, ['KEY_UP']])])
|
del(self.env['bindings'][str([1, ['KEY_UP']])])
|
||||||
del(self.env['bindings'][str([1, ['KEY_DOWN']])])
|
del(self.env['bindings'][str([1, ['KEY_DOWN']])])
|
||||||
del(self.env['bindings'][str([1, ['KEY_SPACE']])])
|
del(self.env['bindings'][str([1, ['KEY_SPACE']])])
|
||||||
|
del(self.env['bindings'][str([1, ['KEY_LEFT']])])
|
||||||
|
del(self.env['bindings'][str([1, ['KEY_RIGHT']])])
|
||||||
|
del(self.env['bindings'][str([1, ['KEY_ENTER']])])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def createHelpDict(self, section = 'commands'):
|
|
||||||
self.menuDict = {}
|
def createMenuTree(self):
|
||||||
#for command in sorted(self.env['commands'][section].keys()):
|
self.currIndex = None
|
||||||
# self.menuDict[len(self.menuDict)] = self.getCommandHelpText(command, section)
|
self.menuDict = fs_tree_to_dict( '/home/chrys/Projekte/fenrir/src/fenrirscreenreader/commands/vmenu/KEY')
|
||||||
if len(self.menuDict) > 0:
|
if len(self.menuDict) > 0:
|
||||||
self.currIndex = 0
|
self.currIndex = 0
|
||||||
else:
|
def executeMenu(self):
|
||||||
self.currIndex = None
|
|
||||||
def getHelpForCurrentIndex(self):
|
|
||||||
if self.currIndex == None:
|
if self.currIndex == None:
|
||||||
return ''
|
return
|
||||||
return self.menuDict[self.currIndex]
|
def incLevel(self):
|
||||||
|
if self.currIndex == None:
|
||||||
|
return
|
||||||
|
if len(self.currIndex) == 1:
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
r = self.getValueByPath(self.menuDict, self.currIndex +[0]):
|
||||||
|
if not r:
|
||||||
|
return
|
||||||
|
if not isinstance(r, dict):
|
||||||
|
return
|
||||||
|
if r == {}:
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
self.currIndex.append(0)
|
||||||
|
def decLevel(self):
|
||||||
|
if self.currIndex == None:
|
||||||
|
return
|
||||||
|
if len(self.currIndex) == 1:
|
||||||
|
return
|
||||||
|
self.currIndex.remove(len(self.currIndex) - 1)
|
||||||
def nextIndex(self):
|
def nextIndex(self):
|
||||||
if self.currIndex == None:
|
if self.currIndex == None:
|
||||||
return
|
return
|
||||||
self.currIndex += 1
|
self.currIndex[len(self.currIndex) - 1] += 1
|
||||||
if self.currIndex >= len(self.menuDict):
|
if self.currIndex[len(self.currIndex) - 1] >= len(self.getNestedByPath(self.menuDict, self.currIndex[:-1])):
|
||||||
self.currIndex = 0
|
self.currIndex[len(self.currIndex) - 1] = 0
|
||||||
def prevIndex(self):
|
def prevIndex(self):
|
||||||
if self.currIndex == None:
|
if self.currIndex == None:
|
||||||
return
|
return
|
||||||
self.currIndex -= 1
|
if len(self.currIndex) - 1 < self.currLevel:
|
||||||
if self.currIndex < 0:
|
return
|
||||||
self.currIndex = len(self.menuDict) - 1
|
self.currIndex[len(self.currIndex) - 1] -= 1
|
||||||
|
if self.currIndex[len(self.currIndex) - 1] < 0:
|
||||||
|
self.currIndex[len(self.currIndex) - 1] = len(self.getNestedByPath(self.menuDict, self.currIndex[:-1])) - 1
|
||||||
def fs_tree_to_dict(self, path_):
|
def fs_tree_to_dict(self, path_):
|
||||||
for root, dirs, files in os.walk(path_):
|
for root, dirs, files in os.walk(path_):
|
||||||
tree = {d: fs_tree_to_dict(os.path.join(root, d)) for d in dirs}
|
tree = {d: fs_tree_to_dict(os.path.join(root, d)) for d in dirs}
|
||||||
tree.update({f: root + f for f in files})
|
tree.update({f: root + '/' + f for f in files})
|
||||||
return tree # note we discontinue iteration trough os.walk
|
return tree # note we discontinue iteration trough os.walk
|
||||||
|
def getKeysByPath(self, complete, path):
|
||||||
|
if not isinstance(complete, dict):
|
||||||
|
return[]
|
||||||
|
d = complete
|
||||||
|
for i in path[:-1]:
|
||||||
|
d = d[list(d.keys())[i]]
|
||||||
|
return list(d.keys())
|
||||||
|
|
||||||
|
def getValueByPath(self, complete, path):
|
||||||
|
if not isinstance(complete, dict):
|
||||||
|
return None
|
||||||
|
d = complete.copy()
|
||||||
|
for i in path:
|
||||||
|
d = d[list(d.keys())[i]]
|
||||||
|
return d
|
||||||
''''
|
''''
|
||||||
import os
|
import os
|
||||||
level = [0]
|
level = [0]
|
||||||
@ -78,11 +125,41 @@ def fs_tree_to_dict( path_):
|
|||||||
for root, dirs, files in os.walk(path_):
|
for root, dirs, files in os.walk(path_):
|
||||||
tree = {d: fs_tree_to_dict(os.path.join(root, d)) for d in dirs}
|
tree = {d: fs_tree_to_dict(os.path.join(root, d)) for d in dirs}
|
||||||
print(files, root, dirs)
|
print(files, root, dirs)
|
||||||
tree.update({f: root + f for f in files})
|
tree.update({f: root + '/' + f for f in files})
|
||||||
return tree # note we discontinue iteration trough os.walk
|
return tree # note we discontinue iteration trough os.walk
|
||||||
|
|
||||||
v = fs_tree_to_dict( '/home/chrys/Projekte/fenrir/src/fenrirscreenreader/commands/vmenu')
|
|
||||||
|
v = fs_tree_to_dict( '/home/chrys/Projekte/fenrir/src/fenrirscreenreader/commands/vmenu/KEY')
|
||||||
|
|
||||||
|
|
||||||
|
def getNestedByPath(complete, path):
|
||||||
|
path = path.copy()
|
||||||
|
if path != []:
|
||||||
|
index = list(complete.keys())[path[0]]
|
||||||
|
path.remove(0)
|
||||||
|
nested = getNestedByPath(complete[index], path)
|
||||||
|
return nested
|
||||||
|
else:
|
||||||
|
return complete
|
||||||
|
|
||||||
|
def getKeysByPath(complete, path):
|
||||||
|
d = complete
|
||||||
|
for i in path[:-1]:
|
||||||
|
d = d[list(d.keys())[i]]
|
||||||
|
return list(d.keys())
|
||||||
|
|
||||||
|
|
||||||
|
def getValueByPath(complete, path):
|
||||||
|
d = complete
|
||||||
|
for i in path:
|
||||||
|
d = d[list(d.keys())[i]]
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
c = [0,0,0]
|
||||||
|
|
||||||
|
|
||||||
|
getKeysByPath(v,c)
|
||||||
|
getValueByPath(v,c)
|
||||||
|
|
||||||
''''
|
''''
|
||||||
|
Loading…
Reference in New Issue
Block a user