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

Reload in same Viewer #8

Open
hwinkel opened this issue Apr 26, 2013 · 12 comments
Open

Reload in same Viewer #8

hwinkel opened this issue Apr 26, 2013 · 12 comments
Assignees
Labels

Comments

@hwinkel
Copy link

hwinkel commented Apr 26, 2013

Any way to reload the resulting PNG in the same viewer window. In this case the PNG can also be overwritten IMHO. Would be better in fast iteration developing mode.

@jvantuyl
Copy link
Owner

Unfortunately, this is difficult to do automatically for Preview. I'm fairly sure it would require AppleScript (at least) and it would likely be buggy.

I'll leave this open for now, but I'm not sure how best to do this.

That said, comments / patches are welcome.

@ghost ghost assigned jvantuyl Apr 27, 2013
@kstrauser
Copy link
Collaborator

Actually, it looks pretty easy. You can replace the contents the file Preview is currently displaying and it will re-render. The problem is how to handle the case of multiple diagrams

@kstrauser
Copy link
Collaborator

being displayed at once. I could see the algorithm being something like:

if len(last_diagrams) == 1 and len(diagrams) == 1:
    reload(diagrams[0])
if lastlen != 1 and thislen == 1:
    ????

What's the right thing to do there?

@jvantuyl
Copy link
Owner

It'll automatically reload, sure (kpdf does the same thing). However, how to tell if it's already open? What if they closed it?

Preview is Mac-only, so the solution doesn't have to be portable. But I'm not clear on how to ensure there's an open Preview that's viewing what you want to reload, and I don't want to accidentally suppress times that we really do need to open a Preview again to accommodate the, IMO, less important "reload" case.

@kstrauser
Copy link
Collaborator

I can't verify right now, but doesn't calling Preview on the same file raise the window that's already open, meaning it's "free" to explicitly call it again?

A second question: how to uniquely distinguish diagrams so that rendering diagram B doesn't cause preview to replace the contents of diagram A that it was already displaying? It's easy when Diagram is rendering an entire file, but less obvious when Diagram is rendering a selection within a file.

@homeway
Copy link

homeway commented Sep 21, 2013

I had appended a new feature to solve it.
When I use a title in a diagram ,and specified the<<sub-title>> in the title, it can generate diagram's filename instead of NamedTemplatefile.

homeway@df74279

@jvantuyl
Copy link
Owner

#14 does indeed address this, though not quite to my liking. Mulling this one over.

@anion155
Copy link

anion155 commented Apr 6, 2015

Why you doesn't using Sublime Text as a image viewer? On generating new diagram use the same file that was already opened in another tab and ST will automatically reload this.

@smwht
Copy link

smwht commented Aug 13, 2015

Has this been merged in? I can't get it to work with title <> boop

@jvantuyl
Copy link
Owner

@homeway FYI, I merged in a modified version your feature. It will come out in the next release. Basically, using a file named something like name.py:

title <<subname>> Some File

Will output name-subname.png and give you the title rendered as 'Some File'.

It should be on develop (as of 268f3a7).

@jvantuyl
Copy link
Owner

@smwht When the next release comes out, title <<beep>> boop should work.

@zeigerpuppy
Copy link

I don't quite understand how this works,
I have checked out the develop branch and
made a PlantUML diagram named name.py
and added title <<subname>> to the top.

However, when rednering, it still outputs unique png files
called name-nmg308.png,name-tvypyt.png, etc.

Is there something I'm missing it getting them always to overwrite the same file name?

OS X 10.9.5
SublimeText 3 (Latest)

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

No branches or pull requests

7 participants