Scribus Forums

Scribus => Scripts and Plugins => Topic started by: Darkoni on November 05, 2023, 10:44:13 PM

Title: Unlink Text Frames and Cut Text - with Scribus script
Post by: Darkoni on November 05, 2023, 10:44:13 PM
Hi!

Is there a possibility for the Scribus script to make text frame unlinking?

In Scribus 1.7.0 that can be achieved with menu:

Item :: Text Frame Links :: Unlink Text Frames and Cut Text

Many regards
Title: Re: Unlink Text Frames and Cut Text - with Scribus script
Post by: a.l.e on November 06, 2023, 12:10:41 PM
hi darkoni

in the scripter API there is an "unlinkTextFrames()" and a patch has been proposed by mattmiller to have an optional boolean argument for cutting the text as in the command you're referring to.

https://bugs.scribus.net/view.php?id=16784

you're welcome to try the patch (i would manually apply it with a copy / paste), check if it does what you need and review it.

Title: Re: Unlink Text Frames and Cut Text - with Scribus script
Post by: Darkoni on November 06, 2023, 03:00:33 PM
hi a.l.e

It seams the patch is not in "Checked out revision 25809."

I opened ChangeLog - there is no mention of 16784: Support "Unlink Text Frames and Cut Text"

However, I downloaded patch and compile it, but make install failed:
CMake Error at resources/dicts/cmake_install.cmake:46 (file):
  file INSTALL cannot find
  "/home/svn-scribus/trunk/Scribus/resources/dicts/hyph_nl.dic": No such file or directory.
Call Stack (most recent call first):
  cmake_install.cmake:57 (include)

Google search finds "hyph_nl.dic"

https://bugs.documentfoundation.org/show_bug.cgi?id=139388

https://github.com/opentaal/opentaal-hunspell

wget -O         /home/svn-scribus/trunk/Scribus/resources/dicts/hyph_nl.dic \
 https://raw.githubusercontent.com/OpenTaal/opentaal-hunspell/master/nl.dic

Please, put a right "hyph_nl.dic" in a patch.

PS: when will be patch for 0016784 available?

Many thanks a.l.e & mattmiller !
Title: Re: Unlink Text Frames and Cut Text - with Scribus script
Post by: a.l.e on November 06, 2023, 06:42:19 PM
... probably related to

https://bugs.scribus.net/view.php?id=17037

i have not merged in the latest changes yet... so i can't judge if there is something wrong in your local files or if the repo has something broken.

p.s.: the CI/CD for 1.6 passed... so, if there is something, it's 1.7 specific...
Title: Re: Unlink Text Frames and Cut Text - with Scribus script
Post by: a.l.e on November 07, 2023, 07:55:15 AM
i can confirm that 1.7.0 compiles correctly but fails to install:

https://bugs.scribus.net/view.php?id=17042
CMake Error at resources/dicts/cmake_install.cmake:46 (file):
  file INSTALL cannot find
  "/home/ale/src/scribus/resources/dicts/hyph_nl.dic": No such file or
  directory.
Call Stack (most recent call first):
  cmake_install.cmake:57 (include)


FAILED: CMakeFiles/install.util
Title: Re: Unlink Text Frames and Cut Text - with Scribus script
Post by: MrB on November 07, 2023, 12:55:36 PM
Remove your cmake files Ale, or just nuke your build directory. The hyph file for NL changed name.
Title: Re: Unlink Text Frames and Cut Text - with Scribus script
Post by: a.l.e on November 07, 2023, 07:24:19 PM
yeah, that worked!

not a big issue, but it would be really nice if the build tools could catch that...
(well, maybe they can and it's just that people build the make files by try and error...)
Title: Re: Unlink Text Frames and Cut Text - with Scribus script
Post by: MrB on November 08, 2023, 08:26:45 PM
No, it cannot .. cmake docs even recommend to not use GLOB to collect the source file list.. but the alternative is to type in all the file names.. less interesting compare to a rare event where we change the name of a file
Title: Re: Unlink Text Frames and Cut Text - with Scribus script
Post by: a.l.e on November 09, 2023, 08:21:03 AM
i fully agree that it does not happens often, but it still would be nice if it would never happen : - )

and i also agree that it's probably a pain to manually fill those lists.

i did a quick search and i've found two possible approaches:

- https://stackoverflow.com/questions/45090926/cmake-generate-list-of-source-files-without-glob : creating a script that can update the CMakeLists files.
- https://stackoverflow.com/a/30433150/5239250 : using cog, a python app (simple cog commands are written as CMakeLists comments and cog takes care of updating the generated list "in place").

the third possible approach is to create a script that generates the lists and then let the developer manually fix the list when files change (i guess that then cmake will trigger an error and, most of the time, only very few files are changing at once).


what do you think? would it for you be an option to use such a script if i provide the patches?