View Issue Details

IDProjectCategoryView StatusLast Update
0014723ScribusGeneralpublic2020-01-07 12:51
Reporterale Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Summary0014723: [PATCH] Add variable for document directory to render-frame processing
Descriptionon github, filmor is suggesting :

I'd like to include in a Lilypond render-frame a file that is relative to the Scribus document. However, the information about this is apparently not forwarded at all.

I propose adding a variable $scribus_doc_dir$ that would allow me to change the Lilypond call to lilypond --pdf -I$scribus_doc_dir$.

a patch is attached:

https://patch-diff.githubusercontent.com/raw/scribusproject/scribus/pull/86.patch
TagsNo tags attached.
PatchNo

Activities

ale

2017-04-07 09:03

manager   ~0043718

... maybe with $scribus_doc_path$ instead?

jghali

2017-04-07 09:33

administrator   ~0043719

Hmmm... that path does not exist until the document is saved. So it looks like it won't work.

ale

2017-04-07 15:40

manager   ~0043721

mmmm... i guess that in 99% of the cases the document will be saved before a render frame will be created...

and if it has not been saved yet, you could use the current directory (if any) or the default document path(). or do anything somehow meaningful...
no idea what absolutePath() does in that case...

filmor

2018-07-25 10:10

reporter   ~0045354

Hey, will this get merged at some point? Should I change anything? I have been using my patched version of Scribus since quite a while, it works fine. I could try to test the case of a new unsaved document.

The use-case is that I want to build my Lilypond files in Frescobaldi and just reference them in Scribus using an `\include` in the render-frame.

filmor

2018-07-25 10:11

reporter   ~0045355

Also, I disagree with `$scribus_doc_path$`, the path of the document includes the document file name, which I don't care about.

filmor

2018-10-18 10:53

reporter   ~0045516

Is there anything I can do to help? It's literally a two-line patch that does not interfere with anything that doesn't use the functionality, but forces me to build my own patched Scribus for 1.5 years now, it hasn't even progressed past "new"...

ale

2018-10-18 15:39

manager   ~0045518

@filmor, as you read above, jean has concerns about the case where a file is not save yet... do you have an idea how to solve that case?

filmor

2018-10-18 17:52

reporter   ~0045519

Well, it could indeed just default to `.` or something like this. Would that be enough for you?

ale

2018-10-20 14:39

manager   ~0045522

i guess a good solution is required that convinces jean... `.` will be for sure not defined, since the document has not been saved yet and it does not have a path...

Luna Nightshade

2018-10-21 18:24

reporter   ~0045528

What about having it point to the temp directory until it is saved? Which would be the default behavior for scribus until the patch is implemented.

filmor

2019-10-07 08:05

reporter   ~0046751

This is a new version of the patch that checks whether the file has been saved before and applies against current master.
scribus-renderframe.patch (606 bytes)   
diff --git a/scribus/pageitem_latexframe.cpp b/scribus/pageitem_latexframe.cpp
index 05d4a8bee..1a6840feb 100644
--- a/scribus/pageitem_latexframe.cpp
+++ b/scribus/pageitem_latexframe.cpp
@@ -308,6 +308,15 @@ void PageItem_LatexFrame::runApplication()
 		i.next();
 		full_command.replace("$scribus_"+i.key()+"$", i.value());
 	}
+
+	QString docDir = ".";
+	if (doc()->hasName)
+	{
+		QFileInfo fi(doc()->documentFileName());
+		docDir = fi.absoluteDir().absolutePath();
+	}
+
+	full_command.replace("$scribus_doc_dir$", docDir);
 	
 	imageFile = tempFileBase + config->imageExtension();
 
scribus-renderframe.patch (606 bytes)   

Issue History

Date Modified Username Field Change
2017-04-07 09:02 ale New Issue
2017-04-07 09:03 ale Note Added: 0043718
2017-04-07 09:33 jghali Note Added: 0043719
2017-04-07 09:35 jghali Category - => General
2017-04-07 15:40 ale Note Added: 0043721
2018-07-25 10:10 filmor Note Added: 0045354
2018-07-25 10:11 filmor Note Added: 0045355
2018-10-18 10:53 filmor Note Added: 0045516
2018-10-18 15:39 ale Note Added: 0045518
2018-10-18 17:52 filmor Note Added: 0045519
2018-10-20 14:39 ale Note Added: 0045522
2018-10-21 18:24 Luna Nightshade Note Added: 0045528
2019-10-07 08:05 filmor File Added: scribus-renderframe.patch
2019-10-07 08:05 filmor Note Added: 0046751