Plugins: openterminal.py

File openterminal.py, 0.8 kB (added by marianne.promberger@gmail.com, 4 months ago)

Opens an Xfce terminal in the directory containing the file on which you right click. (add to songsmenu plugins directory). I'm a newbie, works for me, may contain errors. I'm pretty sure I wrote this, let me know if you did.

Line 
1 # AFAIR, written by Marianne Promberger, marianne.promberger@gmail.com
2 # If I remember correctly and wrote it, I release it under GPL v2, but
3 # it is so trivial that it really doesn't merit a license in my view.
4
5 # Opens an Xfce terminal in the directory containing the current song:
6
7 import gtk
8 from qltk import ErrorMessage
9 from plugins.songsmenu import SongsMenuPlugin
10 from qltk.entry import ValidatingEntry
11 import util
12 import config
13 import os
14
15 class BrowseFolders(SongsMenuPlugin):
16     PLUGIN_ID = 'Open Terminal'
17     PLUGIN_NAME = _('Open Terminal')
18     PLUGIN_DESC = "Open an XFCE terminal at this location"
19     PLUGIN_ICON = 'gtk-about'
20     PLUGIN_VERSION = '0.1'
21
22     def plugin_songs(self, songs):
23         dirs = dict.fromkeys([song('~dirname') for song in songs]).keys()[0]
24         os.system('xfce4-terminal --working-directory=%s' % dirs)