[Osgeo4w-commits] r1138 - trunk/apt

svn_osgeo4w at osgeo.org svn_osgeo4w at osgeo.org
Thu Feb 11 03:12:20 EST 2010


Author: maphew
Date: 2010-02-11 03:12:18 -0500 (Thu, 11 Feb 2010)
New Revision: 1138

Added:
   trunk/apt/winspecialfolders.py
Removed:
   trunk/apt/specialfolders.py
Modified:
   trunk/apt/apt.py
Log:
* partially addresses ticket#52, now we can reliably get the start menu and desktop locations. Next step is to record the links in installed manifest.

Modified: trunk/apt/apt.py
===================================================================
--- trunk/apt/apt.py	2010-02-11 07:12:29 UTC (rev 1137)
+++ trunk/apt/apt.py	2010-02-11 08:12:18 UTC (rev 1138)
@@ -24,6 +24,7 @@
 import gzip, tarfile
 import hashlib
 import subprocess
+import winspecialfolders as specialfolders
 
 OSGEO4W_ROOT = ''
 if 'OSGEO4W_ROOT' in os.environ.keys ():
@@ -34,10 +35,9 @@
    sys.stderr.write ('error: Please set OSGEO4W_ROOT\n')
    sys.exit (2)
 
-#FIXME: should this really be hardcoded?
-#FIXME:  this only works for English, (e.g. called Startmenu with umlaut in a german windows)
-# related: http://trac.osgeo.org/osgeo4w/ticket/21, http://code.google.com/p/maphew/issues/detail?id=13
-OSGEO4W_STARTMENU = os.environ['USERPROFILE'] + '\Start Menu\Programs\OSGeo4W'
+# Thank you Luke Pinner for answering how to get path of "Start > Programs"
+# http://stackoverflow.com/questions/2216173
+OSGEO4W_STARTMENU = specialfolders.get(specialfolders.ALLUSERSPROGRAMS)
 os.putenv('OSGEO4W_STARTMENU', OSGEO4W_STARTMENU)
 
 root = OSGEO4W_ROOT

Deleted: trunk/apt/specialfolders.py
===================================================================
--- trunk/apt/specialfolders.py	2010-02-11 07:12:29 UTC (rev 1137)
+++ trunk/apt/specialfolders.py	2010-02-11 08:12:18 UTC (rev 1138)
@@ -1,48 +0,0 @@
-''' Get windows special folders without pythonwin
-    Example:
-            import specialfolders
-            start_programs = specialfolders.get(specialfolders.PROGRAMS)
-
-Code is public domain, do with it what you will. 
-
-Luke Pinner - Environment.gov.au, 2010 February 10
-'''
-
-#Imports use _syntax to mask them from autocomplete IDE's
-import ctypes as _ctypes
-from ctypes.wintypes import HWND as _HWND, HANDLE as _HANDLE,DWORD as _DWORD,LPCWSTR as _LPCWSTR,MAX_PATH as _MAX_PATH, create_unicode_buffer as _cub
-_SHGetFolderPath = _ctypes.windll.shell32.SHGetFolderPathW
-
-#public special folder constants
-DESKTOP=                             0
-PROGRAMS=                            2
-MYDOCUMENTS=                         5
-FAVORITES=                           6
-STARTUP=                             7
-RECENT=                              8
-SENDTO=                              9
-STARTMENU=                          11
-MYMUSIC=                            13
-MYVIDEOS=                           14
-NETHOOD=                            19
-FONTS=                              20
-TEMPLATES=                          21
-ALLUSERSSTARTMENU=                  22
-ALLUSERSPROGRAMS=                   23
-ALLUSERSSTARTUP=                    24
-ALLUSERSDESKTOP=                    25
-APPLICATIONDATA=                    26
-PRINTHOOD=                          27
-LOCALSETTINGSAPPLICATIONDATA=       28
-ALLUSERSFAVORITES=                  31
-LOCALSETTINGSTEMPORARYINTERNETFILES=32
-COOKIES=                            33
-LOCALSETTINGSHISTORY=               34
-ALLUSERSAPPLICATIONDATA=            35
-
-def get(intFolder):
-    _SHGetFolderPath.argtypes = [_HWND, _ctypes.c_int, _HANDLE, _DWORD, _LPCWSTR]
-    auPathBuffer = _cub(_MAX_PATH)
-    exit_code=_SHGetFolderPath(0, intFolder, 0, 0, auPathBuffer)
-    return auPathBuffer.value
-

Copied: trunk/apt/winspecialfolders.py (from rev 1137, trunk/apt/specialfolders.py)
===================================================================
--- trunk/apt/winspecialfolders.py	                        (rev 0)
+++ trunk/apt/winspecialfolders.py	2010-02-11 08:12:18 UTC (rev 1138)
@@ -0,0 +1,48 @@
+''' Get windows special folders without pythonwin
+    Example:
+            import specialfolders
+            start_programs = specialfolders.get(specialfolders.PROGRAMS)
+
+Code is public domain, do with it what you will. 
+
+Luke Pinner - Environment.gov.au, 2010 February 10
+'''
+
+#Imports use _syntax to mask them from autocomplete IDE's
+import ctypes as _ctypes
+from ctypes.wintypes import HWND as _HWND, HANDLE as _HANDLE,DWORD as _DWORD,LPCWSTR as _LPCWSTR,MAX_PATH as _MAX_PATH, create_unicode_buffer as _cub
+_SHGetFolderPath = _ctypes.windll.shell32.SHGetFolderPathW
+
+#public special folder constants
+DESKTOP=                             0
+PROGRAMS=                            2
+MYDOCUMENTS=                         5
+FAVORITES=                           6
+STARTUP=                             7
+RECENT=                              8
+SENDTO=                              9
+STARTMENU=                          11
+MYMUSIC=                            13
+MYVIDEOS=                           14
+NETHOOD=                            19
+FONTS=                              20
+TEMPLATES=                          21
+ALLUSERSSTARTMENU=                  22
+ALLUSERSPROGRAMS=                   23
+ALLUSERSSTARTUP=                    24
+ALLUSERSDESKTOP=                    25
+APPLICATIONDATA=                    26
+PRINTHOOD=                          27
+LOCALSETTINGSAPPLICATIONDATA=       28
+ALLUSERSFAVORITES=                  31
+LOCALSETTINGSTEMPORARYINTERNETFILES=32
+COOKIES=                            33
+LOCALSETTINGSHISTORY=               34
+ALLUSERSAPPLICATIONDATA=            35
+
+def get(intFolder):
+    _SHGetFolderPath.argtypes = [_HWND, _ctypes.c_int, _HANDLE, _DWORD, _LPCWSTR]
+    auPathBuffer = _cub(_MAX_PATH)
+    exit_code=_SHGetFolderPath(0, intFolder, 0, 0, auPathBuffer)
+    return auPathBuffer.value
+



More information about the osgeo4w-commits mailing list