/usr/share/cinnamon/cinnamon-looking-glass/page_extensions.py is in cinnamon-common 3.6.7-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | import pageutils
import os
from gi.repository import Gtk, Gdk
lookingGlassProxy = None
melangeApp = None
class ModulePage(pageutils.BaseListView):
def __init__(self, parent):
store = Gtk.ListStore(str, str, str, str, str, str, str, bool, str)
pageutils.BaseListView.__init__(self, store)
self.parent = parent
self.createTextColumn(0, "Status")
self.createTextColumn(1, "Type")
self.createTextColumn(2, "Name")
self.createTextColumn(3, "Description")
self.getUpdates()
lookingGlassProxy.connect("ExtensionListUpdate", self.getUpdates)
lookingGlassProxy.addStatusChangeCallback(self.onStatusChange)
self.treeView.set_tooltip_column(8)
self.popup = Gtk.Menu()
self.viewSource = Gtk.MenuItem('View Source')
self.viewSource.connect("activate", self.onViewSource)
self.popup.append(self.viewSource)
reloadCode = Gtk.MenuItem('Reload Code')
reloadCode.connect("activate", self.onReloadCode)
self.popup.append(reloadCode)
self.viewWebPage = Gtk.MenuItem('View Web Page')
self.viewWebPage.connect("activate", self.onViewWebPage)
self.popup.append(self.viewWebPage)
self.popup.show_all()
self.treeView.connect("button-press-event", self.on_button_press_event)
def onViewSource(self, menuItem):
treeIter = self.store.get_iter(self.selectedPath)
folder = self.store.get_value(treeIter, 5)
os.system("xdg-open \"" + folder + "\" &")
def onReloadCode(self, menuItem):
treeIter = self.store.get_iter(self.selectedPath)
uuid = self.store.get_value(treeIter, 4)
xletType = self.store.get_value(treeIter, 1)
lookingGlassProxy.ReloadExtension(uuid, xletType.upper())
def onViewWebPage(self, menuItem):
treeIter = self.store.get_iter(self.selectedPath)
url = self.store.get_value(treeIter, 6)
os.system("xdg-open \"" + url + "\" &")
def on_button_press_event(self, treeview, event):
x = int(event.x)
y = int(event.y)
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
self.selectedPath = path
treeview.grab_focus()
treeview.set_cursor(path, col, 0)
treeIter = self.store.get_iter(self.selectedPath)
if event.button == 3:
if pthinfo is not None:
uuid = self.store.get_value(treeIter, 4)
url = self.store.get_value(treeIter, 6)
self.viewWebPage.set_sensitive(url != "")
self.viewSource.set_label(uuid + " (View Source)")
self.popup.popup(None, None, None, None, event.button, event.time)
return True
elif event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS:
if pthinfo is not None:
error = self.store.get_value(treeIter, 7)
if error:
self.parent.activatePage("log")
def onStatusChange(self, online):
if online:
self.getUpdates()
def getUpdates(self):
success, data = lookingGlassProxy.GetExtensionList()
if success:
self.store.clear()
for item in data:
self.store.append([item["status"], item["type"], item["name"], item["description"], item["uuid"], item["folder"], item["url"], item["error"] == "true", item["error_message"]])
|