Bug on CanOpen help popup corrected
authorlbessard
Thu, 05 Apr 2007 09:03:18 +0200
changeset 147 de96ec63a793
parent 146 71d531bf5b68
child 148 ad3de8730172
Bug on CanOpen help popup corrected
objdictgen/doc_index/DS301_index.py
objdictgen/objdictedit.py
--- a/objdictgen/doc_index/DS301_index.py	Wed Apr 04 13:11:49 2007 +0200
+++ b/objdictgen/doc_index/DS301_index.py	Thu Apr 05 09:03:18 2007 +0200
@@ -5,15 +5,15 @@
 
 DS301_PDF_INDEX = {0x1000: 86, 0x1001: 87, 0x1002: 87, 0x1003: 88, 0x1005: 89, 0x1006: 90, 0x1007: 90, 0x1008: 91, 0x1009: 91, 0x100A: 91, 0x100C: 92, 0x100D: 92, 0x1010: 92, 0x1011: 94, 0x1012: 97, 0x1013: 98, 0x1014: 98, 0x1015: 99, 0x1016: 100, 0x1017: 101, 0x1018: 101, 0x1020: 117, 0x1200: 103, 0x1201: 103, 0x1280: 105, 0x1400: 106, 0x1600: 109, 0x1800: 111, 0x1A00: 112}
 
-def OpenPDFDocIndex(index):
-    if not os.path.isfile("../doc/301_v04000201.pdf"):
+def OpenPDFDocIndex(index, cwd):
+    if not os.path.isfile(os.path.join(cwd, "../doc/301_v04000201.pdf")):
         return """No documentation file available.
 Please read can festival documentation to know how to obtain one."""
     try:
         if index in DS301_PDF_INDEX:
-            os.system("xpdf -remote DS301 ../doc/301_v04000201.pdf "+str(DS301_PDF_INDEX[index])+" &")
+            os.system("xpdf -remote DS301 %s %d &"%(os.path.join(cwd, "../doc/301_v04000201.pdf"), DS301_PDF_INDEX[index]))
         else:
-            os.system("xpdf -remote DS301 ../doc/301_v04000201.pdf &")
+            os.system("xpdf -remote DS301 %s &"%os.path.join(cwd, "../doc/301_v04000201.pdf"))
         return True
     except:
         return """Check if xpdf is correctly installed on your computer"""
--- a/objdictgen/objdictedit.py	Wed Apr 04 13:11:49 2007 +0200
+++ b/objdictgen/objdictedit.py	Thu Apr 05 09:03:18 2007 +0200
@@ -125,6 +125,7 @@
         sys.exit()
 
 filesOpen = args
+WorkingDirectory = sys.path[0]
 
 ColSizes = [75, 250, 150, 125, 100, 60, 250]
 ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_RIGHT, wxALIGN_CENTER, wxALIGN_CENTER, wxALIGN_LEFT]
@@ -1058,13 +1059,13 @@
             if result:
                 find_index = True
                 index, subIndex = result
-                result = OpenPDFDocIndex(index)
+                result = OpenPDFDocIndex(index, WorkingDirectory)
                 if type(result) == StringType:
                     message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
                     message.ShowModal()
                     message.Destroy()
         if not find_index:
-            result = OpenPDFDocIndex(None)
+            result = OpenPDFDocIndex(None, WorkingDirectory)
             if type(result) == StringType:
                 message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
                 message.ShowModal()