[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7140 - trunk/gnue-navigator/src/Actions
From: |
kilo |
Subject: |
[gnue] r7140 - trunk/gnue-navigator/src/Actions |
Date: |
Wed, 9 Mar 2005 04:12:17 -0600 (CST) |
Author: kilo
Date: 2005-03-09 04:12:16 -0600 (Wed, 09 Mar 2005)
New Revision: 7140
Modified:
trunk/gnue-navigator/src/Actions/gnome_menu.py
Log:
Cleaned up code.
Menu generator now accepts arguments.
Modified: trunk/gnue-navigator/src/Actions/gnome_menu.py
===================================================================
--- trunk/gnue-navigator/src/Actions/gnome_menu.py 2005-03-08 23:01:39 UTC
(rev 7139)
+++ trunk/gnue-navigator/src/Actions/gnome_menu.py 2005-03-09 10:12:16 UTC
(rev 7140)
@@ -1,7 +1,7 @@
#
-# Copyright 2002-2005 Free Software Foundation
+# Copyright 2001-2005 Free Software Foundation
#
-# This file is part of GNU Enterprise.
+# This file is part of GNU Enterprise
#
# GNU Enterprise is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
@@ -18,37 +18,34 @@
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
-# FILE:
-# gnome-menu.py
+# $Id$
#
-# DESCRIPTION:
-# Install a GNOME menu structure based on a GPD file
-#
-# NOTES:
-# Optional parameters:
-# system[="/path/to/gnomedir] -- Install system-wide (needs root access)
-#
-# menu="Menu/Structure" -- Menu structure... by default,
-# "GNUe Apps/" + the to process's description
-# quiet -- Turn on quiet mode
-#
+"""
+Install a GNOME menu structure based on a GPD file.
+Optional parameters:
+ system[="/path/to/gnomedir] -- Install system-wide (needs root access)
+ menu="Menu/Structure" -- Menu structure... by default,
+ "GNUe Apps/" + the to process's description
+ quiet -- Turn on quiet mode
+"""
+
import string, sys, os
def run(processes, args):
-
- print "Creating GNOME menu structure.."
-
arguments = {}
for argument in args:
if '=' in argument:
param, value = string.split(argument,'=',1)
else:
param, value = (argument, "")
-
+ arguments[param] = value
+
+ if not arguments.has_key('quiet'):
+ print "Creating GNOME menu structure..."
+
directory = "~/.gnome2/vfolders/applications/"
-
if arguments.has_key('menu'):
directory = os.path.join(directory,arguments['menu'])
else:
@@ -59,18 +56,8 @@
buildMenu(processes, directory)
-
def buildMenu(process, location):
-
-# add this assignment as otherwise undeclared variable errors crop up
-# need to be able to build "directory" before building steps
description = ""
-
-# couldn't get this line to work quite right wasn't sure of the python
-# syntax i believe adding parens around process.title or process.description
-# might fix it, but broke it into something simpler because of my unsuredness
-
-# description = process._type == 'GNProcesses' and process.title or
process.description
if process._type == 'GNProcesses':
description = process.title or process.description
@@ -78,11 +65,9 @@
if not os.path.exists(directory):
os.makedirs(directory)
-# this is the section that needs gutting for gnome2 as they have massively
-# changed how to do this. They now use vfolders. There is a tutorial
-# found here http://www.gnome.org/start/2.0/menuediting.html
outfile = open(os.path.join(directory,'.directory'),'w')
- outfile.write("""[Desktop Entry]
+ outfile.write("""\
+[Desktop Entry]
Name=%s
Icon=gnome-folder.png
Terminal=false
@@ -91,7 +76,6 @@
""" % description)
for child in process._children:
-
if child._type == 'GNStep':
makeLinkFile(directory, child)
else:
@@ -99,21 +83,18 @@
def makeLinkFile(directory, step):
-
# changed step.description to step.title as description seemed invalid
- outfile=open(os.path.join(
- directory,string.replace(step.title,"/","") + \
- '.desktop'),'w')
+ print os.path.join(directory, string.replace(step.title, "/", "") +
'.desktop')
+ outfile=open(os.path.join(directory, string.replace(step.title, "/", "") + \
+ '.desktop'), 'w')
-# these two "run commands" have changed, didn't take time to find new names
if step.type == 'form':
- command = "fixme" #gConfig("RunFormCommand")
+ command = gConfig("RunFormCommand", section='navigator')
icon = "gnome-applications.png"
elif step.type == 'report':
- command = "fixme" #gConfig("RunReportCommand")
+ command = gConfig("RunReportCommand", section='navigator')
icon = "gnome-note.png"
-# updated to gnome2 style .desktop entry
outfile.write("""\
[Desktop Entry]
Version=AddLater
@@ -132,6 +113,3 @@
'location': step.location })
outfile.close()
-
-
-
Property changes on: trunk/gnue-navigator/src/Actions/gnome_menu.py
___________________________________________________________________
Name: svn:keywords
+ Id
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7140 - trunk/gnue-navigator/src/Actions,
kilo <=