use docclass for opening pdf on win32 or linux
authorgreg
Mon, 03 Mar 2008 17:44:04 +0100
changeset 122 7676dba61281
parent 121 ccb1812f8323
child 123 b8512cf4dee9
use docclass for opening pdf on win32 or linux
Beremiz.py
plugger.py
--- a/Beremiz.py	Fri Feb 29 19:13:47 2008 +0100
+++ b/Beremiz.py	Mon Mar 03 17:44:04 2008 +0100
@@ -62,13 +62,15 @@
 
 import wx.lib.buttons, wx.lib.statbmp , wx.html
 import types, time, re, platform, time, traceback, commands
+import docclass.docpdf
 
 from plugger import PluginsRoot
+
 base_folder = os.path.split(sys.path[0])[0]
 CanFestivalPath = os.path.join(base_folder, "CanFestival-3")
 sys.path.append(os.path.join(CanFestivalPath, "objdictgen"))
 from objdictedit import *
-from doc_index.DS301_index import *
+
 
 SCROLLBAR_UNIT = 10
 WINDOW_COLOUR = wx.Colour(240,240,240)
@@ -1203,9 +1205,12 @@
         event.Skip()
     
     def OnBeremizMenu(self, event):
+        docclass.docpdf.open_pdf(os.path.join(CWD, "doc","manual_beremiz.pdf"))
         event.Skip()
     
     def OnAboutMenu(self, event):
+        about_html = objdictedit(self)
+        about_html.OpenHtmlFrame("About CAN Festival", os.path.join(CWD, "doc","about.html"), wx.Size(550, 500))
         event.Skip()
     
     def OnAddButton(self, event):
--- a/plugger.py	Fri Feb 29 19:13:47 2008 +0100
+++ b/plugger.py	Mon Mar 03 17:44:04 2008 +0100
@@ -13,6 +13,7 @@
 base_folder = os.path.split(sys.path[0])[0]
 sys.path.append(os.path.join(base_folder, "plcopeneditor"))
 
+import docclass.docpdf
 from xmlclass import GenerateClassesFromXSDstring
 from wxPopen import ProcessLogger
 
@@ -517,7 +518,15 @@
     def LoadXMLParams(self, logger, PlugName = None):
         methode_name = os.path.join(self.PlugPath(PlugName), "methods.py")
         if os.path.isfile(methode_name):
-            logger.write("Info: %s plugin as some special methods in methods.py\n" % (PlugName or "Root"))
+            logger.write_error("Welcome to the Beremiz Demo\n\n")            
+            logger.write("This demo provides a PLC working with the CANopen plugin\n")
+            logger.write("""Some external programs are also provided:\n
+            - a CAN TCP server to simulate the CANopen network
+            - a virtual slave node to simulate input block
+            - a virtual slave node to simulate output block
+            """)
+            logger.write("\nInfo: For this demo, %s plugin has some special methods to run external programs.\nThese methods are defined in methods.py\n" % (PlugName or "Root"))
+            docclass.docpdf.open_pdf(os.path.join(base_folder,"beremiz","doc","manual_beremiz.pdf"),pagenum=20)
             execfile(methode_name)
 
         # Get the base xml tree