maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Getting hildonhelp to work in Python? (https://talk.maemo.org/showthread.php?t=27042)

BrentDC 2009-02-22 01:13

Getting hildonhelp to work in Python?
 
Over the past few hours I've been, unsuccessfully, trying to integrate hildonhelp into my Python application.

The problem is that I'm unsure what exactly needs to be done to initialize the help system because all the documentation is in C, and I'm not familiar with C at all (hate it).

This is the documentation I've found:

http://maemo.org/api_refs/4.1/libhil...og-help-enable

http://maemo.org/maemo_release_docum...00000000000000

This is my not-yet-working example:
Code:

  def help_test_function(self, widget, data=None):
      dialog = gtk.Dialog("Help!",None,gtk.DIALOG_MODAL)
      dialog.set_size_request(500, 300)
      ok_button = dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
     
      hildonhelp.help_dialog_help_enable(dialog, "osso_quickclip_help", <an "osso.Context" arguement here>)
     
      dialog.show_all()
      dialog.run()   
      dialog.destroy()

This should open a gtk.Dialog that has a little "?" at the top, that when clicked, should open another popup dialog to a certain section in a help file named quickclip.xml.

Problem is, I don't even know what a valid osso.Context arguement is. If I put None there, the dialog will open, but clicking the "?" does nothing.

Any help greatly appreciated.

qwerty12 2009-02-22 09:59

Re: Getting hildonhelp to work in Python?
 
Osso context refers to registering the app from DBUS, I don't know how it works for python but for transmission, I did things like:

Quote:

/* exit the gtk main loop & osso_deinitalize*/
osso_context_t* context = NULL;
context = osso_initialize ("com.transmissionbt.Transmission", VERSION, FALSE, NULL);
osso_deinitialize(context);
(I had previously initialized it with:
osso_initialize ("com.transmissionbt.Transmission", VERSION, FALSE, NULL);
)

In python, it's something like:
import osso
osso.Context('com.whatever.whatever','<version>', False)

(Last param is always false - true is depreciated)

Sorry if this has confused you even more, I'm only familiar with C and I can't even code in C.

BrentDC 2009-02-22 15:46

Re: Getting hildonhelp to work in Python?
 
Quote:

Originally Posted by qwerty12 (Post 266232)
Osso context refers to registering the app from DBUS, I don't know how it works for python but for transmission, I did things like:



(I had previously initialized it with:
osso_initialize ("com.transmissionbt.Transmission", VERSION, FALSE, NULL);
)

In python, it's something like:
import osso
osso.Context('com.whatever.whatever','<version>', False)

(Last param is always false - true is depreciated)

I added my program as a global variable:

Code:

osso_context = osso.Context('com.quickclip.Quickclip','.21', False)
Then just slipped osso_context in as the third argument in my help function, and it....drum roll....WORKED! Yay! :D

Thanks a lot qwerty12!

Quote:

Sorry if this has confused you even more, I'm only familiar with C and I can't even code in C.
You should learn Python ;) I spent 6 months trying to learn C/C++, and nothing. My biggest achievement was a terminal program that computed Heat Index/Wind Chill/Dew Point from the necessary information. Then one day I came across a very informal Python tutorial (it was maybe 6-7 short chapters), spent 30 minutes reading that. The very next day, I wrote my Weather program in Python, the same one it took me 6 months to figure out how to do in C. I immediately began programming in Python. It just makes sense :)


All times are GMT. The time now is 00:59.

vBulletin® Version 3.8.8