From 8f658171e2db0bb8ecd13be165f8ca4266528c86 Mon Sep 17 00:00:00 2001 From: chrys Date: Wed, 23 Jan 2019 00:33:11 +0100 Subject: [PATCH] do more work --- .../commands/vmenu/KEY/mc/file/menu-entry.py | 1 + .../commands/vmenu/KEY/mc/file/open.py | 21 +++ .../commands/vmenu/KEY/mc/file/save.py | 21 +++ .../vmenu/KEY/mc/search/menu-entry.py | 1 + .../commands/vmenu/KEY/mc/search/replace.py | 21 +++ .../commands/vmenu/KEY/mc/search/search.py | 21 +++ .../commands/vmenu/KEY/mc/search/test.py | 30 +++++ .../vmenu/KEY/mutt/file/menu-entry.py | 1 + .../commands/vmenu/KEY/mutt/file/open.py | 21 +++ .../commands/vmenu/KEY/mutt/file/save.py | 21 +++ .../vmenu/KEY/mutt/search/menu-entry.py | 1 + .../commands/vmenu/KEY/mutt/search/replace.py | 21 +++ .../commands/vmenu/KEY/mutt/search/search.py | 21 +++ .../commands/vmenu/KEY/mutt/search/test.py | 30 +++++ .../commands/vmenu/KEY/vim/file/menu-entry.py | 1 + .../commands/vmenu/KEY/vim/file/open.py | 21 +++ .../commands/vmenu/KEY/vim/file/save.py | 21 +++ .../vmenu/KEY/vim/search/menu-entry.py | 1 + .../commands/vmenu/KEY/vim/search/replace.py | 21 +++ .../commands/vmenu/KEY/vim/search/search.py | 21 +++ .../commands/vmenu/KEY/vim/search/test.py | 30 +++++ src/fenrirscreenreader/core/vmenuManager.py | 127 ++++++++++++++---- 22 files changed, 450 insertions(+), 25 deletions(-) create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mc/file/menu-entry.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mc/file/open.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mc/file/save.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mc/search/menu-entry.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mc/search/replace.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mc/search/search.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mc/search/test.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/menu-entry.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/open.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/save.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/menu-entry.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/replace.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/search.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/test.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/vim/file/menu-entry.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/vim/file/open.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/vim/file/save.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/vim/search/menu-entry.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/vim/search/replace.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/vim/search/search.py create mode 100644 src/fenrirscreenreader/commands/vmenu/KEY/vim/search/test.py diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mc/file/menu-entry.py b/src/fenrirscreenreader/commands/vmenu/KEY/mc/file/menu-entry.py new file mode 100644 index 00000000..8d1c8b69 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mc/file/menu-entry.py @@ -0,0 +1 @@ + diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mc/file/open.py b/src/fenrirscreenreader/commands/vmenu/KEY/mc/file/open.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mc/file/open.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mc/file/save.py b/src/fenrirscreenreader/commands/vmenu/KEY/mc/file/save.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mc/file/save.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/menu-entry.py b/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/menu-entry.py new file mode 100644 index 00000000..8d1c8b69 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/menu-entry.py @@ -0,0 +1 @@ + diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/replace.py b/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/replace.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/replace.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/search.py b/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/search.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/search.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/test.py b/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/test.py new file mode 100644 index 00000000..e754a03f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mc/search/test.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/menu-entry.py b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/menu-entry.py new file mode 100644 index 00000000..8d1c8b69 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/menu-entry.py @@ -0,0 +1 @@ + diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/open.py b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/open.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/open.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/save.py b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/save.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/file/save.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/menu-entry.py b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/menu-entry.py new file mode 100644 index 00000000..8d1c8b69 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/menu-entry.py @@ -0,0 +1 @@ + diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/replace.py b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/replace.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/replace.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/search.py b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/search.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/search.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/test.py b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/test.py new file mode 100644 index 00000000..e754a03f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/mutt/search/test.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/vim/file/menu-entry.py b/src/fenrirscreenreader/commands/vmenu/KEY/vim/file/menu-entry.py new file mode 100644 index 00000000..8d1c8b69 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/vim/file/menu-entry.py @@ -0,0 +1 @@ + diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/vim/file/open.py b/src/fenrirscreenreader/commands/vmenu/KEY/vim/file/open.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/vim/file/open.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/vim/file/save.py b/src/fenrirscreenreader/commands/vmenu/KEY/vim/file/save.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/vim/file/save.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/menu-entry.py b/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/menu-entry.py new file mode 100644 index 00000000..8d1c8b69 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/menu-entry.py @@ -0,0 +1 @@ + diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/replace.py b/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/replace.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/replace.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/search.py b/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/search.py new file mode 100644 index 00000000..f1101b9f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/search.py @@ -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 diff --git a/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/test.py b/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/test.py new file mode 100644 index 00000000..e754a03f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu/KEY/vim/search/test.py @@ -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 diff --git a/src/fenrirscreenreader/core/vmenuManager.py b/src/fenrirscreenreader/core/vmenuManager.py index 6b7874b7..9979aaf6 100755 --- a/src/fenrirscreenreader/core/vmenuManager.py +++ b/src/fenrirscreenreader/core/vmenuManager.py @@ -11,9 +11,8 @@ import os class vmenuManager(): def __init__(self): self.menuDict = {} - self.currMenu = {} self.currIndex = None - self.currLevel = None + self.currMenu = '' self.active = False def initialize(self, environment): self.env = environment @@ -21,54 +20,102 @@ class vmenuManager(): pass def getActive(self): return self.active - def togglelMode(self): - self.setActive(not self.getActive()) - def setActive(self, active): + def togglelMode(self, currMenu = ''): + self.setActive(not self.getActive(), currMenu) + def setActive(self, active, currMenu = ''): self.active = active + self.currMenu = currMenu if active: - self.createHelpDict() + self.createMenuTree() 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_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: 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_UP']])]) del(self.env['bindings'][str([1, ['KEY_DOWN']])]) 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: pass - def createHelpDict(self, section = 'commands'): - self.menuDict = {} - #for command in sorted(self.env['commands'][section].keys()): - # self.menuDict[len(self.menuDict)] = self.getCommandHelpText(command, section) + + def createMenuTree(self): + self.currIndex = None + self.menuDict = fs_tree_to_dict( '/home/chrys/Projekte/fenrir/src/fenrirscreenreader/commands/vmenu/KEY') if len(self.menuDict) > 0: self.currIndex = 0 - else: - self.currIndex = None - def getHelpForCurrentIndex(self): + def executeMenu(self): if self.currIndex == None: - return '' - return self.menuDict[self.currIndex] + return + 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): if self.currIndex == None: return - self.currIndex += 1 - if self.currIndex >= len(self.menuDict): - self.currIndex = 0 + self.currIndex[len(self.currIndex) - 1] += 1 + if self.currIndex[len(self.currIndex) - 1] >= len(self.getNestedByPath(self.menuDict, self.currIndex[:-1])): + self.currIndex[len(self.currIndex) - 1] = 0 def prevIndex(self): if self.currIndex == None: return - self.currIndex -= 1 - if self.currIndex < 0: - self.currIndex = len(self.menuDict) - 1 + if len(self.currIndex) - 1 < self.currLevel: + return + 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_): for root, dirs, files in os.walk(path_): 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 + 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 level = [0] @@ -78,11 +125,41 @@ def fs_tree_to_dict( path_): for root, dirs, files in os.walk(path_): tree = {d: fs_tree_to_dict(os.path.join(root, d)) for d in 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 -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) ''''