Skip to content
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

Question: Is it possible to fixate ribbon menu, header, and input line? #726

Closed
McLawrence opened this issue Jan 31, 2023 · 15 comments
Closed

Comments

@McLawrence
Copy link

Is there a way to fixate the top dropdown menu, the header and the line that appears when editing a cell?
I want to use dtale to edit lots of cells and the appearing and disappearing input field at the top always shifts cells up and down.

I am talking about these lines:
Screenshot 2023-01-31 at 15 30 45

Would there be an easy way to do this myself in a fork?

Thanks for your help!

@aschonfeld
Copy link
Collaborator

@McLawrence I can definitely see how that could be annoying. Would a suitable solution be if I provided a way to turn off the editor at the top and only use the editor provided within the cell you're editing?

I'd update the styles to hover it above the grid but then you might run into issues when you're trying to edit a cell in the top row and the header editor would hide that row.

Let me know what you think. Apologies for the annoyance.

@McLawrence
Copy link
Author

Hi @aschonfeld, no need to apologize, your tool is really great in general!

Yes, disabling the editor (also with the "Editing Cell [Column ..." part would also work!

Just keeping it always there, with the text field disabled when no cell is selected, is probably more work and might not be as clean. It was just my first thought because there is a way to fixate the menu on the left.

Thanks for your fast response! :)

@aschonfeld
Copy link
Collaborator

@McLawrence so here is a demo of the hiding the header editor using the UI (this will only affect this instance, not all instances loaded):
https://user-images.githubusercontent.com/11547371/216145447-f052c2d4-484a-42c3-8878-e796356e0b1c.mov

You can also turn it off by by specifying hide_header_editor when calling dtale.show (would only affect this piece of data):

import numpy as np
import pandas as pd
import dtale

dtale.show(pd.DataFrame([1,2,3,4,5]), hide_header_editor=True)

Another would be using global configuration. Following this documentation you can add the following to the [app] section for it to be applied to every dataframe you load into D-Tale without specifying parameters in your code. This would be applied to every piece of data you load into D-Tale:

hide_header_editor = True

And lastly you can turn the header editor off for all data loaded into D-Tale thru code using the following:

import numpy as np
import pandas as pd
import dtale
import dtale.global_state as global_state

global_state.set_app_settings(dict(hide_header_editor=True))

dtale.show(pd.DataFrame([1,2,3,4,5]))

@aschonfeld
Copy link
Collaborator

@McLawrence Just released v2.12.0 with this feature, let me know if you have any issues

@McLawrence
Copy link
Author

Thanks so much for the super fast update! Do you know how fast this update will we on conda-forge? Or should I build from source?

@aschonfeld
Copy link
Collaborator

I just pushed it to conda-forge, hopefully should be there in the next 10-15 minutes. Not exactly sure how long a build takes

@McLawrence
Copy link
Author

Thanks! It is built now. Interestingly, using global_state.set_app_settings works for me, while with dtale.show(pd.DataFrame([1,2,3,4,5]), hide_header_editor=True) the header is still displayed.

Setting it globally works for me, though. Thanks so much for the fast update!

@aschonfeld
Copy link
Collaborator

Shoot, sorry about that. I will look into the issue with dtale.show and get it into the next release. Thanks for the feedback

@aschonfeld
Copy link
Collaborator

Just released v2.12.1 to pypi with the fix for dtale.show. Hopefully be on conda-forge within the next 30 minutes

@McLawrence
Copy link
Author

McLawrence commented Feb 6, 2023

Thanks for the update! A final question:

When I change the underlying data, like

d = dtale.show(pd.DataFrame([1,2,3,4,5]), hide_header_editor=True)
d.data = pd.DataFrame([6,7,8,9,10])

and then refresh the browser, the data updates, but the header will pop up again when editing. This also happens when I use
global_state.set_app_settings(dict(hide_header_editor=True)). Is there a way to make this persist?

Update: Figured it out, by using d.update_settings(hide_header_editor=True), just did not expect a change in data to change the settings back.

@aschonfeld
Copy link
Collaborator

Yea neither would I. I will look into this and get back to you

@aschonfeld
Copy link
Collaborator

@McLawrence Ok, so the issue is that app_settings is only read for an instance on startup. So once the instance is created the only way you can change the status of hide_header_editor is by calling d.update_settings(hide_header_editor=True)

If you called global_state.set_app_settings(dict(hide_header_editor=True)) before dtale.show then it would have worked. I can try updating global_state.set_app_settings to persist updates to any running instances as well.

@McLawrence
Copy link
Author

That makes sense. Thanks again for the fast answer! :) No need to persist the updates for me, but I would guess that that would be expected behavior for other people as well.

@aschonfeld
Copy link
Collaborator

Not a big deal, I think I've already got a solution coded up that will persist any updates to 'hide_shutdown' or 'hide_header_editor' when using global_state.set_app_settings to any running instances as well. Will keep you posted about when its made available

@aschonfeld
Copy link
Collaborator

Just released v2.12.2 to pypi, should be available on conda-forge soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants