Ver Fonte

fix tab order based off user defined order

Daniel Sheffield há 2 anos atrás
pai
commit
df8bf99a9b
1 ficheiros alterados com 6 adições e 6 exclusões
  1. 6 6
      app/widgets.py

+ 6 - 6
app/widgets.py

@@ -9,7 +9,7 @@ from typing import Any, Callable, Iterable, List, Union
 
 import urwid
 from additional_urwid_widgets import IndicativeListBox
-from itertools import chain
+from itertools import chain, product
 from urwid import numedit
 from urwid.wimp import PopUpLauncher
 
@@ -170,13 +170,13 @@ class FocusWidget(urwid.WidgetWrap):
             for idx, w in enumerate(c.contents):
                 yield self.find_widget(widget=w[0]), [*path, idx]
 
-
     def advance_focus(self, reverse=False):
         _c = self.container.get_focus_path()
-        _p = [
-             x[1] for x in filter(lambda x: x[0] is not None,
-                self.iter_focus_paths())
-        ]
+        _p = [ x[1] for w,x in product(self._focus_widgets, [x for x in filter(
+            lambda x: x[0] is not None,
+            self.iter_focus_paths()
+        )]) if x[0] is w ]
+
         for _prev, _cur, _next in zip([_p[-1], *_p[:-1]], _p, [*_p[1:], _p[0]]):
             if list(_c) == list(_cur):
                 break