Fix bug caused by change in collections.UserList.
- Collections.UserList changed betweeen python 3.7.3 and 3.7.5, requiring the constructor of Entry to be a like that for a list. - Solved by not using UserList and defining __getitem__ and __len__.
This commit is contained in:
parent
cde7402708
commit
04c5bf3d56
2 changed files with 10 additions and 4 deletions
3
TODO
3
TODO
|
|
@ -264,7 +264,6 @@ Ideas
|
||||||
- Let the mouse click on the actions in the status bar?
|
- Let the mouse click on the actions in the status bar?
|
||||||
- Let the mouse click the filenames. Try to show a result from the same type
|
- Let the mouse click the filenames. Try to show a result from the same type
|
||||||
of tool.
|
of tool.
|
||||||
- Check if class Entry is really working correctly as a collections.UserList.
|
|
||||||
- Docstrings
|
- Docstrings
|
||||||
- Add ESC as an alternative to 'q' for quit. If looking at Help, ESC should just
|
- Add ESC as an alternative to 'q' for quit. If looking at Help, ESC should just
|
||||||
exit the help screen.
|
exit the help screen.
|
||||||
|
|
@ -439,3 +438,5 @@ Shelved
|
||||||
- Not necessary since git_diff was removed.
|
- Not necessary since git_diff was removed.
|
||||||
- Cache tools._python_version.
|
- Cache tools._python_version.
|
||||||
- Not supporting python2 anymore.
|
- Not supporting python2 anymore.
|
||||||
|
- Check if class Entry is really working correctly as a collections.UserList.
|
||||||
|
- Entry is no longer a UserList.
|
||||||
|
|
@ -80,15 +80,14 @@ KEYS_DOC = """Keys:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class Entry(collections.UserList):
|
class Entry:
|
||||||
|
|
||||||
def __init__(self, path, results, summary, highlighted=None,
|
def __init__(self, path, results, summary, highlighted=None,
|
||||||
set_results=True):
|
set_results=True):
|
||||||
collections.UserList.__init__(self, results)
|
|
||||||
self.path = path
|
self.path = path
|
||||||
self.summary = summary
|
self.summary = summary
|
||||||
self.highlighted = highlighted
|
self.highlighted = highlighted
|
||||||
self.widgets = self.data
|
self.widgets = results
|
||||||
if set_results:
|
if set_results:
|
||||||
# FIX: this is missed for entries appended later
|
# FIX: this is missed for entries appended later
|
||||||
for result in results:
|
for result in results:
|
||||||
|
|
@ -96,6 +95,12 @@ class Entry(collections.UserList):
|
||||||
self.widget = fill3.Row(results)
|
self.widget = fill3.Row(results)
|
||||||
self.appearance_cache = None
|
self.appearance_cache = None
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return len(self.widgets)
|
||||||
|
|
||||||
|
def __getitem__(self, index):
|
||||||
|
return self.widgets.__getitem__(index)
|
||||||
|
|
||||||
def _get_cursor(self):
|
def _get_cursor(self):
|
||||||
result_selected = self.widget[self.highlighted]
|
result_selected = self.widget[self.highlighted]
|
||||||
status_color = tools._STATUS_COLORS.get(
|
status_color = tools._STATUS_COLORS.get(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue