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

Add option to set default preview state #435

Merged
merged 2 commits into from
Jan 26, 2019

Conversation

red-kite
Copy link
Contributor

@red-kite red-kite commented Jan 8, 2019

Simultaneously remove obsolete option for default live-preview

New tabs get additional triggerPreviewUpdate

red-kite and others added 2 commits January 8, 2019 23:59
Simultaneously remove obsolete option for default live-preview

New tabs get additional triggerPreviewUpdate
@mitya57
Copy link
Member

mitya57 commented Jan 26, 2019

Thanks for the pull request!

I have changed the setting to be string, and changed the labels to be better readable.

Also I have added a line to make sure empty document is not created in preview mode. It has a drawback that if you set mode to normal-preview, and then open a document in the existing (empty) tab, it will be open in edit mode (since the createTab() method is not called). But we can solve it later if you want.

@mitya57 mitya57 merged commit 62f632c into retext-project:master Jan 26, 2019
@red-kite
Copy link
Contributor Author

Also I have added a line to make sure empty document is not created in preview mode.

Great thought! (already had this in my mind for another commit)
Your implementation works for New File but existing, empty files open in preview.

In window.py:

from os import stat

		#if previewState == PreviewNormal and not fileName:
		if previewState == PreviewNormal and (not fileName or stat(fileName).st_size == 0):

does the trick for me.

I could follow your mentioned drawback by opening a file from the menu in a new tab. I have never done this bevor. Think this is a very special case we can live with for now.

Thank you very much!

@mitya57
Copy link
Member

mitya57 commented Jan 27, 2019

I think opening existing, empty files is also a very special use case. And you can always disable preview for them manually.

@red-kite
Copy link
Contributor Author

As I'm already using "Ask to create missing files #436" extensively this happens quite often. But for the current issue this doesn't matter. Close accepted :-)

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

Successfully merging this pull request may close these issues.

2 participants