-
-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix renaming and saving of HtmlTableSheets from HtmlTablesSheets #1343
Conversation
visidata/basesheet.py
Outdated
@@ -91,7 +91,7 @@ def options(self): | |||
|
|||
def __init__(self, *names, **kwargs): | |||
self._name = None # initial cache value necessary for self.options | |||
self.names = names | |||
self.names = list(names) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking at this report and found the same bugs. I do not know the code very well, and was wondering does the getter/setter from visidata/sheets line 949 work? Will changing the name from the Index sheet change the name of the file that is saved? It updates names[] but it doesn't update name. I don't know how the two fields names and name are supposed to interact. It seems like one is calculated from the other looking at this line and the next.
Line 949 in fb0a6ad
Column('name', getter=lambda c,r: r.names[-1], setter=lambda c,r,v: setitem(r.names, -1, v)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are absolutely right! It changes the sheet name through the SheetsSheet
, but not for html tables, at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I think I got a much better fix now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad I could help! Yes, I like this fix better, and I learned something.
Only saving selectedRows, so the sheet names should be pulled from there. Not all IndexSheets carry their sub-sheets in their `source`. Closes #1339
Closes #1339