objdictgen/objdictedit.py
changeset 158 b505f7116a1c
parent 149 fe50ada8020b
child 171 db7a030babb2
equal deleted inserted replaced
157:8b45ff4202c3 158:b505f7116a1c
     1 #Boa:Frame:objdictedit
       
     2 #!/usr/bin/env python
     1 #!/usr/bin/env python
     3 # -*- coding: utf-8 -*-
     2 # -*- coding: utf-8 -*-
     4 
     3 
     5 #This file is part of CanFestival, a library implementing CanOpen Stack. 
     4 #This file is part of CanFestival, a library implementing CanOpen Stack. 
     6 #
     5 #
   123     if o in ("-h", "--help"):
   122     if o in ("-h", "--help"):
   124         usage()
   123         usage()
   125         sys.exit()
   124         sys.exit()
   126 
   125 
   127 filesOpen = args
   126 filesOpen = args
   128 WorkingDirectory = sys.path[0]
   127 ScriptDirectory = sys.path[0]
   129 
   128 
   130 ColSizes = [75, 250, 150, 125, 100, 60, 250]
   129 ColSizes = [75, 250, 150, 125, 100, 60, 250]
   131 ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_RIGHT, wxALIGN_CENTER, wxALIGN_CENTER, wxALIGN_LEFT]
   130 ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_RIGHT, wxALIGN_CENTER, wxALIGN_CENTER, wxALIGN_LEFT]
   132 AccessList = "Read Only,Write Only,Read/Write"
   131 AccessList = "Read Only,Write Only,Read/Write"
   133 RAccessList = "Read Only,Read/Write"
   132 RAccessList = "Read Only,Read/Write"
  1057             window = self.FileOpened.GetPage(selected)
  1056             window = self.FileOpened.GetPage(selected)
  1058             result = window.GetSelection()
  1057             result = window.GetSelection()
  1059             if result:
  1058             if result:
  1060                 find_index = True
  1059                 find_index = True
  1061                 index, subIndex = result
  1060                 index, subIndex = result
  1062                 result = OpenPDFDocIndex(index, WorkingDirectory)
  1061                 result = OpenPDFDocIndex(index, ScriptDirectory)
  1063                 if type(result) == StringType:
  1062                 if type(result) == StringType:
  1064                     message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
  1063                     message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
  1065                     message.ShowModal()
  1064                     message.ShowModal()
  1066                     message.Destroy()
  1065                     message.Destroy()
  1067         if not find_index:
  1066         if not find_index:
  1068             result = OpenPDFDocIndex(None, WorkingDirectory)
  1067             result = OpenPDFDocIndex(None, ScriptDirectory)
  1069             if type(result) == StringType:
  1068             if type(result) == StringType:
  1070                 message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
  1069                 message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
  1071                 message.ShowModal()
  1070                 message.ShowModal()
  1072                 message.Destroy()
  1071                 message.Destroy()
  1073         event.Skip()
  1072         event.Skip()
  1074         
  1073         
  1075     def OnHelpCANFestivalMenu(self, event):
  1074     def OnHelpCANFestivalMenu(self, event):
  1076         #self.OpenHtmlFrame("CAN Festival Reference", os.path.join(WorkingDirectory, "../doc/canfestival.html"), wx.Size(1000, 600))
  1075         #self.OpenHtmlFrame("CAN Festival Reference", os.path.join(ScriptDirectory, "doc/canfestival.html"), wx.Size(1000, 600))
  1077         os.system("xpdf -remote CANFESTIVAL %s %d &"%(os.path.join(WorkingDirectory, "../doc/manual/en/manual.pdf"),16))
  1076         os.system("xpdf -remote CANFESTIVAL %s %d &"%(os.path.join(ScriptDirectory, "doc/manual_en.pdf"),16))
  1078         event.Skip()
  1077         event.Skip()
  1079 
  1078 
  1080     def OnAboutMenu(self, event):
  1079     def OnAboutMenu(self, event):
  1081         self.OpenHtmlFrame("About CAN Festival", os.path.join(WorkingDirectory, "../doc/about.html"), wx.Size(500, 450))
  1080         self.OpenHtmlFrame("About CAN Festival", os.path.join(ScriptDirectory, "doc/about.html"), wx.Size(500, 450))
  1082         event.Skip()
  1081         event.Skip()
  1083 
  1082 
  1084     def OpenHtmlFrame(self, title, file, size):
  1083     def OpenHtmlFrame(self, title, file, size):
  1085         if title not in self.HtmlFrameOpened:
  1084         if title not in self.HtmlFrameOpened:
  1086             self.HtmlFrameOpened.append(title)
  1085             self.HtmlFrameOpened.append(title)
  2194         self.Type.Append("master")
  2193         self.Type.Append("master")
  2195         self.Type.Append("slave")
  2194         self.Type.Append("slave")
  2196         self.Type.SetStringSelection("slave")
  2195         self.Type.SetStringSelection("slave")
  2197         self.ListProfile = {"None" : ""}
  2196         self.ListProfile = {"None" : ""}
  2198         self.Profile.Append("None")
  2197         self.Profile.Append("None")
  2199         self.Directory = os.path.join(os.getcwd(), "config")
  2198         self.Directory = os.path.join(ScriptDirectory, "config")
  2200         listfiles = os.listdir(self.Directory)
  2199         listfiles = os.listdir(self.Directory)
  2201         listfiles.sort()
  2200         listfiles.sort()
  2202         for item in listfiles:
  2201         for item in listfiles:
  2203             name, extend = os.path.splitext(item)
  2202             name, extend = os.path.splitext(item)
  2204             if os.path.isfile(os.path.join(self.Directory, item)) and extend == ".prf" and name != "DS-302":
  2203             if os.path.isfile(os.path.join(self.Directory, item)) and extend == ".prf" and name != "DS-302":