Skip to content

Commit b6d2fef

Browse files
author
bas524
committed
add nautilus extension
1 parent a457174 commit b6d2fef

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This example is contributed by Martin Enlund
2+
import os, os.path
3+
import urllib
4+
5+
from gi.repository import Nautilus, GObject, GConf
6+
7+
QLDD_KEY = '/usr/bin/Qldd'
8+
9+
class OpenQlddExtension(Nautilus.MenuProvider, GObject.GObject):
10+
def __init__(self):
11+
pass
12+
13+
def _open_qldd(self, file):
14+
filename = urllib.unquote(file.get_uri()[7:])
15+
qldd = QLDD_KEY
16+
os.system('%s %s &' % (qldd, filename))
17+
18+
def menu_activate_cb(self, menu, file):
19+
self._open_qldd(file)
20+
21+
def get_file_items(self, window, files):
22+
if len(files) != 1:
23+
return
24+
25+
file = files[0]
26+
if file.is_directory() or file.get_uri_scheme() != 'file':
27+
return
28+
29+
item = Nautilus.MenuItem(name='NautilusPython::openqldd_file_item',
30+
label='View dependecy' ,
31+
tip='View dependecy of %s' % file.get_name())
32+
item.connect('activate', self.menu_activate_cb, file)
33+
return item,
File renamed without changes.

0 commit comments

Comments
 (0)