Re: Implementing shapes using pyabiword in write activity of olpc laptops

From: Ryan Pavlik <abiryan_at_ryand.net>
Date: Wed Jul 22 2009 - 15:28:59 CEST

sumit singh wrote:
> Hi Martin,
>
>
>> I've finally finished documenting the outline of all the methods
>> available to pyabiword on our wiki here:
>>
>> http://abiword.snt.utwente.nl/wiki/AbiWidget
>>
>> You can insert an image at the current caret position this command:
>>
>> insert_image( gchar* szFile, gboolean positioned)
>>
>> Where szFile is the file containing the image you wish to insert. If
>> "positioned" is true
>> the text wraps around the image. Otherwise it is placed inline with the text.
>>
>> This is implemented in Write in toolbar.py here:
>> -------------------------------------------------------------------------
>> class ImageToolbar(gtk.Toolbar):
>> def __init__(self, toolbox, abiword_canvas, parent):
>> gtk.Toolbar.__init__(self)
>>
>> self._toolbox = toolbox
>> self._abiword_canvas = abiword_canvas
>> self._parent = parent
>>
>> self._image = ToolButton('insert-image')
>> self._image.set_tooltip(_('Insert Image'))
>> self._image_id = self._image.connect('clicked', self._image_cb)
>> self.insert(self._image, -1)
>> self._image.show()
>>
>> self._abiword_canvas.connect('image-selected', self._image_selected_cb)
>> ---------------------------------------------------------------------------------------------------
>
> Thank you Martin for such a well explained answer. Actually, I have
> tried inserting images earlier also so was aware of this function, I
> was trying to ask if there was a possible way to insert shapes in a
> way we insert textboxes in pyabiword. In any case, your reply has
> given me the idea that we might think of adding pictures, png images
> of some common shapes in different sizes and different colors, and
> whenever the user want to insert them , we can ask him to select from
> the available images. I think this is what you wanted to explain.
>
> On a seperate note, I was also thinking if it is possible to integrate
> gtk.drawingarea somehow with abiwidget , though I don't have much idea
> about how to do it as of now.
>
>
>> On Wed, Jul 22, 2009 at 4:55 AM, sumit singh<sumit.coder@gmail.com> wrote:
>>> Hi everyone,
>>>
>>> I am currently working on integrating a template builder tool with the write
>>> activity of olpc laptops with Manusheel Gupta under Seeta organisation.
>>> Write activity is based on the pyabiword module of abiword. Currently I am
>>> trying to look for a way to insert figures or shapes like a circle, star,
>>> straight lines etc where we can write or insert pictures using the
>>> pyabiword module, however insertion of pictures doesn't seem to have been
>>> integrated as of now in pyabiword. Is there any possible way to do so using
>>> pyabiword or by any other means?
>>>
>> Yes there is. See above.
> Thanx.
>>> I am also attaching 2 sample templates , the type of which I would like to
>>> make using this template builder tool. Kindly have a look. Here is the
>>> status from my end--
>>>
>>> In the 1st template----
>>> 1. the textboxes can be easily added using the insTextBox command with
>>> invoke_cmd.
>>> 2. They can have colored borders, colored background and pictures can be
>>> inserted using the dlgFormatFrame with invoke_cmd.
>>> 3. Is there any way to add such borders with a direct command from
>>> pyabiword?
>>>
>> No there isn't right now. Please think very carefully about how you
>> would present such a level of detail to a primary school Child.
>
> No problem, I will try to think of some method to do so , if possible,
> and would be integrating it only in case the UI for adding it
> is simple enough to be used by children.
>>> In the 2nd template---
>>> 1. I think almost everything can be implemented except the colored stars and
>>> shapes. Is their any way to insert such shapes?
>>>
>> Yes. See above.
>>
>> Cheers
>>
>> Martin
>>
>
>
> Also, I had to attach msword attachments because there was no way to
> draw such figures and borders in a short time on abiword and I just
> wanted to ask you by showing the templates. Otherwise , I am using
> abiword now-a-days. Still, I realize that it might not be right to
> post msword documents on abiword mailing list. I apologize for that.
>
> Regards,
> sumit.
>

If you're just looking to insert shapes, you could draw some basic
shapes in SVG and insert those, rather than PNGs.

-- 
Ryan Pavlik
www.cleardefinition.com
#282  +  (442) -  [X]
A programmer started to cuss
Because getting to sleep was a fuss
As he lay there in bed
Looping 'round in his head
was: while(!asleep()) sheep++;
Received on Wed Jul 22 15:29:31 2009

This archive was generated by hypermail 2.1.8 : Wed Jul 22 2009 - 15:29:31 CEST