def LookUpCommand(self,command): print command if command.lower() == 'home': command= os.path.expanduser("~") return 'caja %s &' % command if command.lower() == 'network': command = "network:///" return 'caja %s &' % command elif command.lower() == 'computer': command = "computer:///" return 'caja %s &' % command elif command.lower() == 'trash': command = "trash:///" return 'caja %s &' % command if utils.xdg_dir("XDG_%s_DIR" % str(command).upper()) != False: command = utils.xdg_dir("XDG_%s_DIR" % str(command).upper()) command = urllib.unquote(command) return 'caja %s &' % command for i in range(0,len(Globals.MenuActions)): if Globals.MenuActions[i]==command: return '%s &' % Globals.MenuCommands[i] if command.find(':ALLAPPS:') != -1: self.emit('special-command') return "" print "%s - Running custom command" % str(command) return Globals.SecurityCheck('%s &' % command)
def addshort(self,widget,event,name, execs,ico,typ,desk='desktop'): """Add Desktop shortcut""" if desk =='desktop':desk = utils.xdg_dir("XDG_DESKTOP_DIR") starter = '%s/%s.desktop' % (desk, name) code = ['#!/usr/bin/env xdg-open','[Desktop Entry]'] code.append('Name=%s' % name) code.append('StartupNotify=true') code.append('Terminal=false') code.append('Version=1.0') code.append('Icon=%s' % ico) code.append('Type=Application') if int(typ) == 1: code.append('Exec= %s' % execs) else: code.append('Exec= xdg-open %s' % execs) code.append('X-MATE-Autostart-enabled=true') #print code f = open(starter, 'w') if f: for l in code: f.write(l + '\n') f.close()
def addshort(self, widget, event, name, execs, ico, typ, desk="desktop"): """Add Desktop shortcut""" if desk == "desktop": desk = utils.xdg_dir("XDG_DESKTOP_DIR") starter = "%s/%s.desktop" % (desk, name) code = ["#!/usr/bin/env xdg-open", "[Desktop Entry]"] code.append("Name=%s" % name) code.append("StartupNotify=true") code.append("Terminal=false") code.append("Version=1.0") code.append("Icon=%s" % ico) code.append("Type=Application") if int(typ) == 1: code.append("Exec= %s" % execs) else: code.append("Exec= xdg-open %s" % execs) code.append("X-MATE-Autostart-enabled=true") # print code f = open(starter, "w") if f: for l in code: f.write(l + "\n") f.close()