Recent posts

#51
Scripts and Plugins / Re: problem with execution off...
Last post by utnik - March 22, 2024, 04:55:26 AM
hi loudo

you're right. i found a folder called 'tkinter' inside of the 'scribus.app'.



i don't know, why scribus should search for another version...

utnik
#52
Scripts and Plugins / Re: problem with execution off...
Last post by loudo - March 21, 2024, 04:21:25 PM
But I don't install Tcl package.
Scribus don't use its own package ?
#53
General Discussion / Re: [TOC] get an attribute dir...
Last post by a.l.e - March 21, 2024, 11:02:32 AM
Today, I have a bit more time.
Here my first impressions about the TOC in Scribus:



The Config > Tables of Contents dialog is not comfortable to use and some important features are missing.
(Some of the issue might already have been there before introducing the styles in the TOC...)

The top half of the dialog is by default empty and stays most of the time almost empty:
the huge majority of document with a TOC will only have one single TOC.
And when the user gets for the first time into this dialog, the goal is to define a table of contents!

I'm suggesting to pre-fill the list of TOCs with "Table of Contents" (without the "1"! The second one gets a "2") and make the list much smaller.
I guess that the TOC should only be saved in the .sla, if it has a minimal definition (at least one level defined...).

On the other side, the most "important" part of the dialog is probably the matching of heading and toc paragraph styles.

For each level we need (at least):

  • the heading paragraph style,
  • the toc paragraph style (yes, we need different toc styles for each level!),
  • the page number placement.

So the first suggestion is to make the list of TOCs a simple list with two "icon buttons" (+, trashcan) and let the user change the name of the TOC by double clicking the entry in the list (no input field needed).
This list would be shown in the left part and on the rights side the TOC's settings.
The lower part would be for adding the levels with styles (or alternatively the attributes, if after having implemented a "usable" style based TOC you still think that somebody would want to use that...)

It could look somehow like that:

                                                                                                               
++---------------------------+-+-+-+-----------------------+-+                                                 
||table of contents         || |+| | type: [style |v]      | |                                                 
||                          || +-+ | source: [frame |v]    | |                                                 
||                          || +-+ | [ ] non printing      | |                                                 
||                          || |-| |                       | |                                                 
|+---------------------------+ +-+ +-----------------------+ |                                                 
|+---------------------------------------------------------+ |                                                 
||[h style |v] [toc style |v] [page number |v]             | |                                                 
||                                                         | |                                                 
||                                                         | |                                                 
||                                                         | |                                                 
||                                                         | |                                                 
||                                                         | |                                                 
|+---------------------------------------------------------+ |                                                 
|+-+ +-+                                                     |                                                 
||+| |-|                                                     |                                                 
|+-+ +-+                                                     |                                                 
+------------------------------------------------------------+                                                 
(https://textik.com/#153e79c2edb01a7a)

By the way, as you might have noticed, my TOC Python script does not have a UI.
The main reason for it, is that it's indeed not easy to create a good UI and opted for default values and using the attributes.
But here now we have a UI and, as it is now, it forces lot of unnecessary mouse movements and scrolling that can be avoided.



One further important issue: picking the destination frame!
Do you really expect the user to know the name?
I see two possible solutions (which are not mutually exclusive):

  • If a frame is selected when opening the settings, propose or use that frame as the target one
  • If a frame is selected when running "Generate TOC" rename the menu entry to "Generate TOC in this frame" (or add such an entry)
  • (Adding a "pick a frame" button is probably way to complicated and -- while being a nice idea -- it's way to complicated to implemented for its use)



I leave it open, if the TOC definition should stay in the document configuration, or if it should be moved to a separate dialog that can be triggered when a frame (the one containing the table of contents!) is selected.

In my script, I went for defining the TOC as a set of attributes on the target frame, so it seems to be possible to define it outside of the settings and it might be even easier to do so!

It might also be necessary to individually update the TOCs, which might be easier with a separate dialog.



Still the UI: the "Generate Table of Contents" menu entry is disabled by default.
I'm not sure if would be a good idea to start the Document Settings, since the user then would expect to use that menu entry for modifying the settings.

It might be worth exploring the idea to add tooltips to menu entries that are deactivated for non trivial reasons (we do not need to explain why you can't load an image on a text frame...).

This seems to to be possible with Qt 6 (not tested):

https://stackoverflow.com/questions/60484006/how-to-include-tooltips-for-menu-items-in-qt

(This is probably not needed if we get two menu entries, one for defining the current TOC, the other for generating all TOCs.)



On top of that, there are features that have been requested and are implemented in the script:

  • Optionally, remove the end of lines from the title (per level or for the whole TOC; strip them or truncate after the first one).
  • Remove the end of frame / end of column signs from the titles (yes, depending on how you define them, they will be part of the title)-
  • It should be possible to create the paragraph styles from the TOC dialog (it's not necessary to  define them, just ask for the and create the style; maybe ask for a base style, since it might be painful to change it later; the script creates a set of pre-defined styles)



Finally, a few bugs I stumbled upon:

  • In my screenshots you see that -- for reasons that are unknown to me -- some entries are repeated multiple times.
  • In the settings dialog, the first (and default) entry is "[Default Paragraph Style]" and when hitting "Add" while it's selected, an empty entry is added to the list styles (i guess that the list should only contain real styles...)
  • The frames are read in z-order: by default they should be read top down and left to right (of course in an official tool we should consider RTL...)
  • For linked frames, the order on the page should be ignored (what comes first, shows up first: what counts is the position of the first frame of the chain on the given page).



Lot of text, sorry... Probably, just reading the README, the code and the other thread would have been shorter : - )
#54
Scripts and Plugins / Re: problem with execution off...
Last post by utnik - March 21, 2024, 04:52:15 AM
hi loudo

i never managed to run one of the tkinter related scribus scripts under mac os. there are some open bug reports on this topic and a request to include tkinter in the dmg.
it looks as your version of tcl is not exactly the one scribus is looking for to run the script.

Quote from: loudo on March 20, 2024, 11:05:44 PM...version conflict for package "Tcl": have 8.6.13, need exactly 8.6.12
    while executing
"package require -exact Tcl 8.6.12"

utnik
#55
Scripts and Plugins / problem with execution officie...
Last post by loudo - March 20, 2024, 11:05:44 PM
Hi, I'm using Scribus 1.6.1 MacOs M1 Sonoma 14.1.1
and when I want to use script like calendarWizard for example I have this message :


Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "<string>", line 677, in <module>
  File "<string>", line 667, in main
  File "/Applications/Scribus.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tkinter/__init__.py", line 2326, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
    /Library/Frameworks/Python.framework/Versions/3.11/lib/tcl8.6 /usr/lib/tcl8.6 /lib/tcl8.6 /usr/library /library /tcl8.6.13/library /tcl8.6.13/library

/Library/Frameworks/Python.framework/Versions/3.11/lib/tcl8.6/init.tcl: version conflict for package "Tcl": have 8.6.13, need exactly 8.6.12
version conflict for package "Tcl": have 8.6.13, need exactly 8.6.12
    while executing
"package require -exact Tcl 8.6.12"
    (file "/Library/Frameworks/Python.framework/Versions/3.11/lib/tcl8.6/init.tcl" line 19)
    invoked from within
"source /Library/Frameworks/Python.framework/Versions/3.11/lib/tcl8.6/init.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list source $tclfile]"


This probably means that Tcl wasn't installed properly.


I don't know how to solve it [/list]
#56
Scripts and Plugins / Re: Import scribus module for ...
Last post by loudo - March 20, 2024, 10:51:46 PM
Ok thanks for that clarification. I understand better
#57
General Discussion / Re: [TOC] get an attribute dir...
Last post by a.l.e - March 19, 2024, 10:37:59 PM
i can attach my file, but it won't really show you, the few essential things you likely need to take into consideration for a "useful" TOC in scribus.

as i wrote, it would probably be helpful if you could go through:

you will then have a list of things that people actually using scribus need for creating a TOC (their feedback has been very very useful to me!) and have a rather simple reference implementation.
#58
General Discussion / Re: [TOC] get an attribute dir...
Last post by MrB - March 19, 2024, 06:52:59 PM
#59
General Discussion / Re: [TOC] get an attribute dir...
Last post by MrB - March 19, 2024, 06:39:37 PM
I also uploaded a sample file on
https://bugs.scribus.net/view.php?id=5975

Working well there

#60
General Discussion / Re: [TOC] get an attribute dir...
Last post by MrB - March 19, 2024, 06:31:42 PM
Please share those files. It looks like you have a text frame style and a style on text.