Re: [Sugar-devel] help about the get_preview function of activity.Activity class to take screenshots

2009-07-20 Thread Martin Sevior
Hi Sumit,

I just fixed the example code in the pyabiword module of abiword to
give an example
of how this works.

The important line in this example is:

 i.props.pixbuf = abi.render_page_to_image(1)

The converts page number 1 to a GdkPixbuf. Once you have a GdkPixbuf,
in this case in
a Gtk.Image you can convert it to whatever format you wish.

From the PyGtk reference manual http://www.pygtk.org/docs/pygtk/
 you convert  this to an image with:

http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html#method-gdkpixbuf--save

So if you wanted the GdkPixbuf directly you would do:

PagePixbuf = abi.render_page_to_image(1)
PagePixbuf.save(filename,png)

Where filename is the name of the file you wish to store to.

Cheers!

Martin

PS. here is test.py which shows the feature in action (thanks for the
patch tomeu!)

--
#!/usr/bin/python

import sys
import pygtk
pygtk.require('2.0')
import gtk
import abiword

window = gtk.Window()
window.set_default_size(640, 480)
window.connect('delete-event', gtk.main_quit)

box = gtk.VBox()
window.add(box)
box.show()

abi = abiword.Canvas()
box.add(abi)
abi.show()

window.show()

b = gtk.Button('render page')
box.add(b)
b.show()

i = gtk.Image()
box.add(i)
i.show()

def _clicked_cb(widget, abi, i):
i.props.pixbuf = abi.render_page_to_image(1)

b.connect('clicked', lambda widget: _clicked_cb(widget, abi, i))

gtk.main()


On Mon, Jul 20, 2009 at 10:43 PM, sumit singhsumit.co...@gmail.com wrote:
 Hi everyone,

 Can anyone please guide me about the proper use of the get_preview function
 of the activity.Activity class of sugar. I had a look at its api, it seems
 to be returning a dictionary sort of thing which is called as the png image.
 What I want to do is to save this image somewhere in the datastore and show
 this image later to the user in my activity. So, what I want to ask is to
 how to load this information in the form of an image later on
 programatically. Can we load it using the gtk.image widget and what is the
 right procedure to save this information.

 Regards,
 sumit

 ___
 Sugar-devel mailing list
 sugar-de...@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel


___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [Sugar-devel] creating your own templates in write activity

2009-07-16 Thread Martin Sevior
Hi Manusheel,
There is no specific pyabiword binding for insert
textbox but your can use the following technique to access the
abiword/src/wp/ap/xp/ap_EditMethods.cpp function that provide the
interface to libabiword.

do:

self._abiword_canvas.invoke_cmd(insTextbox,,0,0)

To invoke the GUI to insert a textbox.

Cheers

Martin

On Fri, Jul 17, 2009 at 3:18 AM, Manusheel Guptam...@laptop.org wrote:
 Tomeu,

 Hope all is well.

 We have been working on developing a template builder tool in write
 activity, and wish to have your pointers on certain features-

 1. Text box - We realize that the text box tool is missing in the current
 write activity, and wish to develop it. We looked at abiwidget.h file
 closely, and it seems to us that there
  is no method (function) provided to add textboxes. We investigated
 deeper into the details, and arrived at an approach to develop the text box
 feature-

    a. Create a textbox class on the lines of tablecreator class-  It
 seems that we need to work on 4 files:

     1. OXML_Element_TextBox.cpp
     2. OXML_Element_TextBox.h
             3. OXMLi_ListenerState_TextBox.cpp
             4. OXMLi_ListenerState_TextBox.h

   b. Use invoke_cmd method to insert Textbox.
   We are not very clear on what all arguments can be passed in this
 method, and their usage. Could you please direct us to a resource, which
 could be helpful in
           understanding this.

 We also wish to ask you about the details of the code, which is used to
 enable menu selections in the advanced abiword activity.

 Thank you.

 Manu

 ___
 Sugar-devel mailing list
 sugar-de...@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel


___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


RE: [sugar] Programming environments on the XO

2008-08-01 Thread Martin Sevior
On Thu, 2008-07-31 at 22:12 +0200, J.M. Maurer wrote:
 On Thu, 2008-07-31 at 21:37 +1000, Martin Edmund Sevior wrote:
  
  Thanks Tomeu and Eben. Yes, we'll need to expand the abiwidget api.
  I'll look to do this if I can can get sugar-jhbuild to work again.
 
 That, or we could just add an 'EditMethod', so we can invoke it using a
 'well known' function name. Not sure what the nicest approach is. I'm
 inclined to expand the api though.
 

Hi everyone,
   I'm perfectly willing to do this work but how I can be sure
it will actually be used?

What do we need to do to get libabiword updated?

sugar-jhbuild uses an ancient patched tree dating from November last
year. We've released 2.6.4 3 weeks ago with *tons* of bug fixes on that.

What version is actually being shipped with sucrose? What do we need to
do to get it updated?

I'd just like to know what I need to do to get the required libabiword
into the tree so that this feature can be implemented.

Cheers

Martin

   Marc
 

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [sugar] Programming environments on the XO

2008-07-29 Thread Martin Sevior
On Fri, 2008-07-18 at 14:50 +1000, Martin Sevior wrote:
 On Thu, 2008-07-17 at 23:32 -0400, Brian Jordan wrote:
  The open source project Gobby also uses this sort of who-wrote-what
  text highlighting, SJ and I have recently (right before he left for
  Wikimania) been looking into getting similar functionality on the XO.
  Having this highlighting integrated with Write would be fantastic.
  
 
 OK Guys, I get the message :-) I'll look to see how this can be enabled
 by default in the most UI-easy way possible.


OK Guys,
Your wish is my command.

See:

http://msevior.livejournal.com/2008/07/29/

Cheers

Martin


___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [sugar] Programming environments on the XO

2008-07-17 Thread Martin Sevior
On Thu, 2008-07-17 at 20:45 -0400, Walter Bender wrote:
 I'd vote that we not expend too much effort in supporting multiple
 development environments in Pippy at the moment--there are so many
 other high-priority things to be working on. Is there really a lot of
 demand for this from the field?
 
 -walter
 
 On Thu, Jul 17, 2008 at 11:28 AM, Benjamin M. Schwartz
 [EMAIL PROTECTED] wrote:
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
 
  Chris Ball wrote:
  | Another useful feature would be for
  | Write to have unique background colors for collaborators, as Gobby does.
  | I wonder if that would be a small enough task for someone to take on.
 
  See also #7447.  Currently, Write doesn't support background colors at all.
 

Hi Folks,
Just so you know. The only reason for #7447 is because we
haven't put the UI in to enable it. libabiword supports background
colors. If the Powers That Be decide that this is an important feature
for children it is very easy to implement it. Every feature of AbiWord
is present in libabiword, say the word and we'll implement it for Write.

I'm not sure different colors for different users is such a good idea
though. The document will quickly become a mess.  Though if the kids
want to do this they can.

Cheers

Martin
  - --Ben
  -BEGIN PGP SIGNATURE-
  Version: GnuPG v2.0.9 (GNU/Linux)
  Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
  iEYEARECAAYFAkh/ZTUACgkQUJT6e6HFtqSdzwCfXnq/N5tEk/jhuBttxx77vauD
  wtkAnj4JzHOxwswpf/12WKnoPeKA4LBd
  =FTjC
  -END PGP SIGNATURE-
  ___
  Sugar mailing list
  [EMAIL PROTECTED]
  http://lists.laptop.org/listinfo/sugar
 
 ___
 Sugar mailing list
 [EMAIL PROTECTED]
 http://lists.laptop.org/listinfo/sugar

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [sugar] Programming environments on the XO

2008-07-17 Thread Martin Sevior
On Fri, 2008-07-18 at 02:53 +0100, Gary C Martin wrote:
 On 18 Jul 2008, at 02:25, Martin Sevior wrote:
 
  On Thu, Jul 17, 2008 at 11:28 AM, Benjamin M. Schwartz
  [EMAIL PROTECTED] wrote:
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
 
  Chris Ball wrote:
  | Another useful feature would be for
  | Write to have unique background colors for collaborators, as  
  Gobby does.
  | I wonder if that would be a small enough task for someone to  
  take on.
 
  See also #7447.  Currently, Write doesn't support background  
  colors at all.
 
 
  Hi Folks,
 Just so you know. The only reason for #7447 is because we
  haven't put the UI in to enable it. libabiword supports background
  colors. If the Powers That Be decide that this is an important feature
  for children it is very easy to implement it. Every feature of AbiWord
  is present in libabiword, say the word and we'll implement it for  
  Write.
 
  I'm not sure different colors for different users is such a good idea
  though. The document will quickly become a mess.  Though if the kids
  want to do this they can.
 
 
 The codingmonkeys with their great SubEthaEdit also made very good use  
 out of background colour tints to indicate authorship. Works really  
 well:
 
   http://www.codingmonkeys.de/subethaedit/images/sessionbig.png
 
 As I remember, there is a button to toggle the background colours on  
 and off depending what you want to see (and I think mouse over pop-ups  
 in addition to show the authorship of a text block).
 
 Now if I actually had other friends to work with, SubEthaEdit, would  
 have been my editor of choice ;-)
 

This is a good idea for coding. We do not do this at present, though we
do have different colored carets.

Cheers

Martin

 --Gary
 
 
 ___
 Sugar mailing list
 [EMAIL PROTECTED]
 http://lists.laptop.org/listinfo/sugar

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [sugar] Programming environments on the XO

2008-07-17 Thread Martin Sevior
On Thu, 2008-07-17 at 18:54 -0700, Edward Cherlin wrote:
 On Thu, Jul 17, 2008 at 6:25 PM, Martin Sevior [EMAIL PROTECTED] wrote:
  On Thu, 2008-07-17 at 20:45 -0400, Walter Bender wrote:
  I'd vote that we not expend too much effort in supporting multiple
  development environments in Pippy at the moment--there are so many
  other high-priority things to be working on. Is there really a lot of
  demand for this from the field?
 
  -walter
 
  On Thu, Jul 17, 2008 at 11:28 AM, Benjamin M. Schwartz
  [EMAIL PROTECTED] wrote:
   -BEGIN PGP SIGNED MESSAGE-
   Hash: SHA1
  
   Chris Ball wrote:
   | Another useful feature would be for
   | Write to have unique background colors for collaborators, as Gobby 
   does.
   | I wonder if that would be a small enough task for someone to take on.
  
   See also #7447.  Currently, Write doesn't support background colors at 
   all.
  
 
  Hi Folks,
 Just so you know. The only reason for #7447 is because we
  haven't put the UI in to enable it. libabiword supports background
  colors. If the Powers That Be decide that this is an important feature
  for children it is very easy to implement it. Every feature of AbiWord
  is present in libabiword, say the word and we'll implement it for Write.
 
  I'm not sure different colors for different users is such a good idea
  though. The document will quickly become a mess.  Though if the kids
  want to do this they can.
 
  Cheers
 
  Martin
 
 It will be much more of a mess if you can't tell who wrote what in a
 collaborative editing session. Does Abiword provide change tracking,
 so that users can turn author coloring on and off at will?
 

AbiWord has change tracking but my experience with it is that it is more
trouble than it's worth. That said, there is a bug in AbiWord-2.6.4 so
that if you turn change tracking on all changes in a collaborative
document are marked with the same colour. I'd better fix this so that
different users get different colours during a collaboration session.

Is there some feedback from the field about how kids are finding
collaborative writing? Do they use it all?

Cheers

Martin


___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [sugar] Programming environments on the XO

2008-07-17 Thread Martin Sevior
On Thu, 2008-07-17 at 23:32 -0400, Brian Jordan wrote:
 The open source project Gobby also uses this sort of who-wrote-what
 text highlighting, SJ and I have recently (right before he left for
 Wikimania) been looking into getting similar functionality on the XO.
 Having this highlighting integrated with Write would be fantastic.
 

OK Guys, I get the message :-) I'll look to see how this can be enabled
by default in the most UI-easy way possible.

In the meantime one can fudge this very simply by having each user agree
to use their own color for writing text.

ie Joe chooses red, Alice choose green, Sarah chooses blue etc.

When everyone is happy with the final document choose select-all and
change all colours to black. This will work immediately.

BTW people might interested in our new service:

http://abicollab.net

As an easy way to share and collaborate on document creation in a
scalable world-wide fashion. With this you can easily setup group
documents and work on them in real-time (just like Write does).

AbiWord-2.6.4 has the code to connect to this but it is not enabled by
default as we're still working on some final bug fixes. You'll have to
compile your own version by passing --enable-abicollab
--with-abicollab-service-backend to the configure stage when you
compile the plugins.

Here is my configure line for abiword-plugins (which includes my
favourite plugins).

./configure --with-abiword=../abiword-2.6 --prefix=/home/msevior/abidir
--disable-all --enable-abicollab --with-abicollab-service-backend
--enable-abimathview --enable-abicommand --enable-loadbindings
--enable-presentation --enable-OpenDocument

Cheers,

Martin

 Brian
 
 On Thu, Jul 17, 2008 at 10:30 PM, Martin Sevior [EMAIL PROTECTED] wrote:
  On Thu, 2008-07-17 at 18:54 -0700, Edward Cherlin wrote:
  On Thu, Jul 17, 2008 at 6:25 PM, Martin Sevior [EMAIL PROTECTED] wrote:
   On Thu, 2008-07-17 at 20:45 -0400, Walter Bender wrote:
   I'd vote that we not expend too much effort in supporting multiple
   development environments in Pippy at the moment--there are so many
   other high-priority things to be working on. Is there really a lot of
   demand for this from the field?
  
   -walter
  
   On Thu, Jul 17, 2008 at 11:28 AM, Benjamin M. Schwartz
   [EMAIL PROTECTED] wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
   
Chris Ball wrote:
| Another useful feature would be for
| Write to have unique background colors for collaborators, as Gobby 
does.
| I wonder if that would be a small enough task for someone to take 
on.
   
See also #7447.  Currently, Write doesn't support background colors 
at all.
   
  
   Hi Folks,
  Just so you know. The only reason for #7447 is because we
   haven't put the UI in to enable it. libabiword supports background
   colors. If the Powers That Be decide that this is an important feature
   for children it is very easy to implement it. Every feature of AbiWord
   is present in libabiword, say the word and we'll implement it for Write.
  
   I'm not sure different colors for different users is such a good idea
   though. The document will quickly become a mess.  Though if the kids
   want to do this they can.
  
   Cheers
  
   Martin
 
  It will be much more of a mess if you can't tell who wrote what in a
  collaborative editing session. Does Abiword provide change tracking,
  so that users can turn author coloring on and off at will?
 
 
  AbiWord has change tracking but my experience with it is that it is more
  trouble than it's worth. That said, there is a bug in AbiWord-2.6.4 so
  that if you turn change tracking on all changes in a collaborative
  document are marked with the same colour. I'd better fix this so that
  different users get different colours during a collaboration session.
 
  Is there some feedback from the field about how kids are finding
  collaborative writing? Do they use it all?
 
  Cheers
 
  Martin
 
 
  ___
  Devel mailing list
  Devel@lists.laptop.org
  http://lists.laptop.org/listinfo/devel
 

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [sugar] Programming environments on the XO

2008-07-16 Thread Martin Sevior
Hi Samuel,
  Marc Maurer has done 95% of the work required to do
multi-programming language syntax highlighting in libabiword. The
advantage of using libabiword is that you get collaboration for free. It
is easy enough to embed this in your own canvas and hook up the controls
you need or want, just as we've done for Write.

Marc is a bit of a perfectionist so I'm not sure how usable 95% of the
work is and whether it could be finished by simply using it and
providing bug reports as needed would be.

Hopefully, Marc will chime in soon.

Cheers

Martin


On Thu, 2008-07-17 at 00:39 -0400, Samuel Klein wrote:
 There has been talk about expanding Pippy to support a variety of
 programming languages, perhaps as plugins; to add syntax highlighting;
 and general interest in seeing Develop proceed.  Syntax highlighting
 in Write has been brought up as well.  C and Javascript environments
 have been specifically highlighted, since C is used for a fair bit of
 code that we ship; but enthusiasts of Ruby and many other languages
 have considered providing an intro dev environment as a standalone
 activity, one per language.  And HTML creation is possible in Write
 but without highlighting, and it is not obvious how to put this to
 good use.
 
 Finally, we now have activities for Etoys (Squeak), Scratch, and
 Turtle Art, but not yet a Logo activity; though a few people are
 working on the latter.
 
 Where are we with these developments?  What plans are there to
 complete any of the above this year?  What specific features should we
 schedule to support the above, and which is most important?  
 
 SJ
 ___
 Sugar mailing list
 [EMAIL PROTECTED]
 http://lists.laptop.org/listinfo/sugar

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [sugar] Recent Updates to Sugar Almanac

2008-06-13 Thread Martin Sevior
Hi Faisal,
   You might want to gather together the documentation we wrote
for abiwidget which explains how to embed the collaborative Rich Text
widget (as used by write) in python programs.

The links are on our wiki here:


http://www.abisource.com/wiki/AbiWidget

http://www.abisource.com/wiki/PyAbiWord

Cheers

Martin


On Fri, 2008-06-13 at 17:34 -0400, Faisal Anwar wrote:
 Hello All,
 
 As many of you know, I'm writing up a sugar almanac to help new
 sugar/python developers get up and running with creating useful
 activities. I will try to send frequent updates in terms of what has
 been added. In addition to using the documentation, I'd appreciate it
 if people familiar with the different modules I am writing can send
 any better or alternative code examples to the ones that I have
 written. Review and feedback is ALWAYS appreciated.
 
 This week, I have updated the section on how to do many of the basic
 activity creation tasks (see
 http://wiki.laptop.org/go/Sugar.activity.activity). In addition, I've
 provided some basic examples of how to read and write your activity to
 the datastore so that it can be resumed later from the journal. Below
 is a list of the different how to's contained in this section of the
 almanac. Hope some of these ring a bell in terms of what you all are
 trying to get done!
   * 1 Helper Functions in sugar.activity.activity 
   * 1.1 How do I get the file path for my activity bundle?
   * 1.2 How do I get the file path where I can write files
 programmatically?
   * 1.3 How do I get the name of my activity?
   * 2 Class: Activity 
   * 2.1 How do I set the canvas (main work area) of my
 activity to a specific UI widget?
   * 2.2 What are activity id's? How do I obtain the
 activity id for an instance of my activity?
   * 2.3 How do I create a new activity that is derived
 from the base Activity class?
   * 2.4 How do I implement a write_file method for my
 activity in order to persist my activity in the
 journal?
   * 2.5 How do I implement a read_file method for my
 activity so that I can resume activities from the
 sugar journal?
   * 3 Class: ActivityToolbox (Toolbox) 
   * 3.1 What is the standard toolbox needed in most
 activities and how do I create it?
   * 3.2 How do I get a handle on the standard activity
 toolbar given an ActivityToolbox object?
   * 4 Class: ActivityToolbar (gtk.Toolbar)
   * 5 Class: EditToolbar (gtk.Toolbar) 
   * 5.1 How do I add a standard edit toolbar to my
 activity?
   * 5.2 How do I hide a button in the edit toolbar that is
 not needed in my activity?
   * 5.3 How do I disable and enable a button on the edit
 toolbar?
 
 You can also find the homepage for the documentation at
 http://wiki.laptop.org/go/Sugar-api-doc. 
 
 
 Best,
 
 
 Faisal
 ___
 Sugar mailing list
 [EMAIL PROTECTED]
 http://lists.laptop.org/listinfo/sugar

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [Production] Amharic input

2008-05-08 Thread Martin Sevior
Hi Kim,
  Judging by the fact that AbiWord (Write) won't let you enter
English characters, I suspect that the Gtk IM is permently triggered.
I would guess that somehow we need to overide the locale seen by
environment for the English characters to be entered.

With regards to Write, I don't believe that setting the locale
accessible from UI as it currently stands. However if you manage to
set the locale to en_US and start a new Write session it will likely
accept English.

Cheers

Martin


2008/5/1 Kim Quirk [EMAIL PROTECTED]:
 Using Build 703 + G1G1 activities; the terminal acitivity, pippy, and
 abiword were all tested and I can't figure out how to get English
 characters. US/English characters show up only in linux virtual terminal.

 Even after a cleaninstall to 703, typing in the NAME: is only available in
 ahmeric.

 I set the mfg-data just as Quanta is setting it, based on the values from
 the mfg-data table:

 KMKLKVLOSKU(s)KA Reference
 olpcus,etolpc2,basicam_ET.UTF-811us
 Then do the cleaninstall (Arjun - did you do a cleaninstall after you set
 the values for keyboard??).

 Can't get US/English characters in Pippy, Terminal, AbiWord activities. But
 I did get English numbers (top row). The other characters look like I am
 getting an alternate font when I toggle the character change key... just not
 the one I want to match the keyboard (English).

 Thanks for any ideas,
 Kim


___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel