View Issue Details

IDProjectCategoryView StatusLast Update
0017360ScribusScripterpublic2025-01-01 11:51
Reporterale Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
Product Version1.7.0.svn 
Summary0017360: deprecate insertHtmlText() and replace it by one or several "better" functions with better arguments
Descriptioncurrently, insertHtmlText():

- can only insert content from files and not from strings
- does not default to utf-8 as encoding
- does not provide a way to set the encoding (and it's not clearly defined how the encoding is detected)
- can insert content from any supported file format (i've tested it with a markdown file)
- the type of the content depends on the extension of the file
- in the UI the corresponding function is found under "import" and "get text", not "insert".

i'd like to suggest to deprecate this function.

in place of it, i'd like to propose a new function with several named optional arguments:

insertFormattedText(
  source: the filename (path) or the content to be inserted
  [name=None]: the name of the target frame (by default the current selected frame)
  [encoding=None]: if not defined, the encoding is automatically detected from the content (if possible; the default should be utf-8)
  [format=None]: if not defined the format is guessed from the extension (default behavior is '.txt')
  [read_file=True]: if true, the source is a filename; otherwise, source contains the content to be inserted
  [style_prefix=None]: if None, the name of the frame is used;
)

this having been said, if i recall correctly, some of the formats supported by scribus have a pop up asking for more settings.
i still have to check if those differ between formats: if it's the case, it might be better to have one function per format...
(if we need multiple functions, we might keep insertHtmlText() and complete it with the additional arguments)
TagsNo tags attached.
PatchNo

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2025-01-01 11:00 ale New Issue
2025-01-01 11:51 ale Summary deprecate insertHtmlText() and replace it by one or several "better" functions with a => deprecate insertHtmlText() and replace it by one or several "better" functions with better arguments