[scribus-dev] trying to figure this out

dockattt katttdoc at gmail.com
Mon May 22 20:18:16 UTC 2017


hi,

sorry Craig about the last message not being clear enough.  I'm working 
on some code to use in the python console.   I've created a function 
that makes TextFrame.  I reused the code in cmdobj.cpp for creating a 
text frame.  That function is called: *scribus_newtext.  It creates a 
text frame with this code:

     int i = 
ScCore->primaryMainWindow()->doc->itemAdd(PageItem::TextFrame, 
PageItem::Unspecified,
                                 pageUnitXToDocX(x),
                                 pageUnitYToDocY(y),
                                 ValueToPoint(w),
                                 ValueToPoint(h),
ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineWidth, 
CommonStrings::None,
ScCore->primaryMainWindow()->doc->itemToolPrefs().textColor);


in the Scribus 1.5.2 python console I write:

createText(40,40,100,100)

and it creates a giant Text Frame way off to the bottom left of the page 
I'm on.   In the 1.4 this doesn't happen.  I've created a new file that 
adds functions to what's available in the Python console.  One of them 
used the code above.  I changed that call in my code to this:

         i = m_doc->itemAdd(PageItem::TextFrame,
                        PageItem::Unspecified,
                           x + m_doc->currentPage()->xOffset(),
                           y + m_doc->currentPage()->yOffset(),
                           w,
                           h,
m_doc->itemToolPrefs().shapeLineWidth,
                           CommonStrings::None,
                           m_doc->itemToolPrefs().textColor);


and my new function is working as I think it should.  It's showing up in 
the right x,y spot and the width and height are right.   What I was 
trying to get at is: am I doing the right thing not following the 
createText code exactly.  I'm kind of new to Scribus so maybe I need to 
call the function differently?

thanks!

doc kattt




More information about the scribus-dev mailing list