commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7141 - trunk/gnue-navigator/src/Actions


From: kilo
Subject: [gnue] r7141 - trunk/gnue-navigator/src/Actions
Date: Wed, 9 Mar 2005 04:27:53 -0600 (CST)

Author: kilo
Date: 2005-03-09 04:27:52 -0600 (Wed, 09 Mar 2005)
New Revision: 7141

Modified:
   trunk/gnue-navigator/src/Actions/gnome_menu.py
   trunk/gnue-navigator/src/Actions/kde_menu.py
Log:
Code cleanup.
Menu generator now accepts arguments.

Modified: trunk/gnue-navigator/src/Actions/gnome_menu.py
===================================================================
--- trunk/gnue-navigator/src/Actions/gnome_menu.py      2005-03-09 10:12:16 UTC 
(rev 7140)
+++ trunk/gnue-navigator/src/Actions/gnome_menu.py      2005-03-09 10:27:52 UTC 
(rev 7141)
@@ -83,8 +83,6 @@
 
 
 def makeLinkFile(directory, step):
-# changed step.description to step.title as description seemed invalid
-  print os.path.join(directory, string.replace(step.title, "/", "") + 
'.desktop')
   outfile=open(os.path.join(directory, string.replace(step.title, "/", "") + \
       '.desktop'), 'w')
 

Modified: trunk/gnue-navigator/src/Actions/kde_menu.py
===================================================================
--- trunk/gnue-navigator/src/Actions/kde_menu.py        2005-03-09 10:12:16 UTC 
(rev 7140)
+++ trunk/gnue-navigator/src/Actions/kde_menu.py        2005-03-09 10:27:52 UTC 
(rev 7141)
@@ -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,38 +18,34 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# FILE:
-# kde-menu.py
+# $Id$
 #
-# DESCRIPTION:
-# Set of classes that provide a menuing interface via line-mode
-# text.
-#
-# NOTES:
-# Optional parameters:
-#   system[="/path/to/kdedir]   -- 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
-#
+"""
+Set of classes that provide a menuing interface via line-mode text.
 
+Optional parameters:
+  system[="/path/to/kdedir]     -- 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 KDE2 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 KDE2 menu structure.."
 
   directory = "~/.kde/share/applnk"
-
   if arguments.has_key('menu'):
     directory = os.path.join(directory,arguments['menu'])
   else:
@@ -62,11 +58,11 @@
 
 
 def buildMenu(process, location):
-
-  description = process._type == 'GNProcesses' and \
-         process.title or process.description
+  description = ""
+  if process._type == 'GNProcesses':
+    description = process.title or process.description
+    
   directory = os.path.join(location, string.replace(description,'/',''))
-
   if not os.path.exists(directory):
     os.makedirs(directory)
 
@@ -74,7 +70,6 @@
   outfile.write('[Desktop Entry]\nIcon=package\nName=%s\n' % description)
 
   for child in process._children:
-
     if child._type == 'GNStep':
       makeLinkFile(directory, child)
     else:
@@ -82,16 +77,14 @@
 
 
 def makeLinkFile(directory, step):
-
-  outfile=open(os.path.join(
-      directory,string.replace(step.description,"/","") + \
+  outfile=open(os.path.join(directory, string.replace(step.title, "/", "") + \
       '.desktop'),'w')
 
   if step.type == 'form':
-    command = gConfig("RunFormCommand")
+    command = gConfig("RunFormCommand", section='navigator')
     icon = "konsole"
   elif step.type == 'report':
-    command = gConfig("RunReportCommand")
+    command = gConfig("RunReportCommand", section='navigator')
     icon = "klpq"
 
   outfile.write("""\
@@ -108,10 +101,7 @@
 X-KDE-Username=
 """ % { 'executable': command,
         'icon': icon,
-        'description': step.description,
+        'description': step.title,
         'location': step.location })
 
   outfile.close()
-
-
-


Property changes on: trunk/gnue-navigator/src/Actions/kde_menu.py
___________________________________________________________________
Name: svn:keywords
   + Id





reply via email to

[Prev in Thread] Current Thread [Next in Thread]