Converter Deskbar

Another thing for Gnome Deskbar: a converter that converts one unit to another. Enter “23m in feet” and immediately get the answer that that distance is 75.46ft. Inspired by Google Calculator’s similar behaviour, you can download the program and drop it into your ~/.gnome2/deskbar-applet/handlers folder. You’ll need to have GNU Units installed as well (install the “units” package in Ubuntu). Some examples:

Convert '$50000 in pounds', '4 lightseconds in furlongs', and '4 litres in teaspoons'

Download Converter Deskbar now!

20 Responses to “Converter Deskbar”

  1. Does this only work for a specific version of Deskbar? I have 2.14.2 (Ubuntu 6.06) and it’s not doing anything.

    joeljkp
  2. joeljkp: that’s the version I’ve got. Have you enabled the plugin in the preferences window for Deskbar?

    sil
  3. Ah, forgot about that. Thanks!

    joeljkp
  4. Your download link above is broken, it gives a WebDAV error: “Could not open the requested SVN filesystem”.

    Alex
  5. Am I doing something wrong? I had this working back when you first released it, but I can’t get it going now on feisty (Deskbar 2.17.90). I can’t see it in the list of plugins in the preferences.

    sheepeatingtaz
  6. I have much the same problem as the last poster (fiesty beta). The converter entry does not appear in the list of plugins in the preferences. Note I have tried a different plugin (hostname lookup I think) which works ok.

    Would you mind checking this issue out?

    Thanks for writing this - it saves me running ‘units’ in a terminal.

    Aaron Hochwimmer
  7. I’ll take a look when I upgrade to feisty, which will be shortly.

    sil
  8. Hi

    Just alter line 14 of the script. Turn
    import deskbar.Handler, deskbar
    into
    import deskbar.Handler, deskbar.Match

    to make the script work under feisty. Don’t forget to install the units package and enable the plugin in the preferencies dialog.

    Stuart, thanks for that cool plugin :)

    papo
  9. The suggestion from papo don’t work for me in Feisty.
    Converter is always hidden.

    Nick
  10. Hi

    You can run
    /usr/lib/deskbar-applet/deskbar-applet -w
    from a shell to gather more information about the problem. This runs th deskbar applet in standalone mode and gives a lot of information about what’s going on. No need to instsall the debug package.

    With the original plugin, I got this:
    Error loading the file: /home/mathias/.gnome2/deskbar-applet/handlers/converter.py.
    Traceback (most recent call last):
    File "/usr/lib/python2.5/site-packages/deskbar/ModuleLoader.py", line 91, in import_module
    mod = pydoc.importfile (filename)
    File "pydoc.py", line 259, in importfile
    raise ErrorDuringImport(path, sys.exc_info())
    ErrorDuringImport: problem in /home/mathias/.gnome2/deskbar-applet/handlers/converter.py - : 'module' object has no attribute 'Match'

    After having altered line 14 as discussed, I get this:
    Loading module 'Converter' from file /home/mathias/.gnome2/deskbar-applet/handlers/converter.py.
    Providing your output would be a big help to whomever is going to debug this.

    Please also note that Converter is hidden as long as the regexp does not match: Here be dragons does not trigger Converter, while as 10 ly in parsecs does.

    Also note that Converter has to be enabled in the prefs.

    papo
  11. Great stuff. Thanks for that.

    Any way to make it support the “€” character for euros ?

    Romain
  12. About the plugin not showing on Feisty, it seems that Python requires a line:
    # coding=utf-8
    added at the top of the file as per PEP 0263: http://www.python.org/dev/peps/pep-0263/

    Kudos for writing such an awesomely useful plugin, by the way. :)

    zanglang
  13. Thanks zanglang–that worked perfectly!!

    Robby
  14. In addition to the line 14 change and the utf-8 change, if you just installed units, you have to restart to get it to work.

    To really emulate Google Calculator, you need to get together with this guy and make a plugin that does both, like Google Calculator. Then I can type “3+4″ and get “7″, type “2 inches in mm” and get “50.8 millimeters”, or mix it up and type “15 V / 3 ohm” and get “5 amperes”. ;-)

    (And while you’re at it, recognize things like uF that Google doesn’t recognize.)

    Endolith
  15. And a date and time calculator would be good. Like http://www.timeanddate.com

    Google calculator can’t do this yet, but it’s hard to do this stuff in your head.

    Endolith
  16. [...] Pero aún hay más y es que si esto del terminal no es lo tuyo o no te termina de convencer, también existe un plugin para el deskbar-applet, llamado converter deskbar. [...]

    La otra bola de cristal -
  17. [...] Fuente-> La Otra Bola De Cristal Fuente del Script-> Converter Deskbar Enlace Relacionado->Curioseando Con Units [...]

    Linux Music » Blog Archive » Instalando el applet Converter en Ubuntu
  18. [...] La Otra Bola De Cristal Fuente del Script-> Converter Deskbar Enlace Relacionado->Curioseando Con [...]

    Instalando el applet Converter en Ubuntu: Linux Music 2.0
  19. Hi! I kinda stole this from you and made it 2.20-compatible (new API).
    And I changed the link in live.gnome.org.

    Feel free to steal it back if you want to update it.

    ;-) Johannes

    JohannesBuchner
  20. Johannes: that’s absolutely fine with me! Good work.

    sil

Leave a Reply