Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am looking for a tutorial on writing a scope for simple search from a website. The tutorial at Ubuntu wiki is very complex.

If somebody can explain me the steps to write a scope in a simplest way, that would be very helpful.

share|improve this question

1 Answer

There are some good examples of stand-alone scopes here: https://code.launchpad.net/onehundredscopes

The most basic steps are:

  1. Create your Daemon class
  2. Create an instance of Unity.Scope in your Daemon's init method
  3. Connect your scope variable to the DBus signals for searching
  4. Implement your search method (connected by #3 above) to populate the results model
  5. Run your Daemon in the GLib MainLoop when your script is run (See example code)

If you are targetting 12.04, you can use the Singlet library to write your scope as well, an example of a Singlet scope is: http://bazaar.launchpad.net/~mhall119/onehundredscopes/unity-planetubuntu-scope/view/head:/planetubuntu-scope

Here the basic steps are:

  1. Create a new Scope class that sub-classes singlet.scope.Scope
  2. Implement the search method in your new class
  3. Call singlet.utils.run_scope on your Scope class when your script is run (See example code)
share|improve this answer
1  
I've put together a python script, only I've got one problem: How do I actually use it? – RobinJ Feb 24 '12 at 18:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.