133 def PluginPath(self): |
133 def PluginPath(self): |
134 return os.path.join(self.PlugParent.PluginPath(), self.PlugType) |
134 return os.path.join(self.PlugParent.PluginPath(), self.PlugType) |
135 |
135 |
136 def PlugPath(self,PlugName=None): |
136 def PlugPath(self,PlugName=None): |
137 if not PlugName: |
137 if not PlugName: |
138 PlugName = self.BaseParams.getName() |
138 PlugName = self.PlugName() |
139 return os.path.join(self.PlugParent.PlugPath(), |
139 return os.path.join(self.PlugParent.PlugPath(), |
140 PlugName + NameTypeSeparator + self.PlugType) |
140 PlugName + NameTypeSeparator + self.PlugType) |
|
141 |
|
142 def PlugName(self): |
|
143 return self.BaseParams.getName() |
|
144 |
|
145 def PlugEnabled(self): |
|
146 return self.BaseParams.getEnabled() |
141 |
147 |
142 def PlugFullName(self): |
148 def PlugFullName(self): |
143 parent = self.PlugParent.PlugFullName() |
149 parent = self.PlugParent.PlugFullName() |
144 if parent != "": |
150 if parent != "": |
145 return parent + "." + self.BaseParams.getName() |
151 return parent + "." + self.PlugName() |
146 return self.BaseParams.getName() |
152 return self.BaseParams.getName() |
147 |
153 |
148 def GetIconPath(self, name): |
154 def GetIconPath(self, name): |
149 return opjimg(name) |
155 return opjimg(name) |
150 |
156 |
496 if self.EditorType is not None and self._View is None: |
502 if self.EditorType is not None and self._View is None: |
497 app_frame = self.GetPlugRoot().AppFrame |
503 app_frame = self.GetPlugRoot().AppFrame |
498 |
504 |
499 self._View = self.EditorType(app_frame.TabsOpened, self, app_frame) |
505 self._View = self.EditorType(app_frame.TabsOpened, self, app_frame) |
500 |
506 |
501 app_frame.EditProjectElement(self._View, self.GetFilename()) |
507 app_frame.EditProjectElement(self._View, self.PlugName()) |
502 |
508 |
503 def OnCloseEditor(self): |
509 def OnCloseEditor(self, view): |
504 self._View = None |
510 if self._View == view: |
|
511 self._View = None |
505 |
512 |
506 def OnPlugClose(self): |
513 def OnPlugClose(self): |
507 if self._View is not None: |
514 if self._View is not None: |
508 app_frame = self.GetPlugRoot().AppFrame |
515 app_frame = self.GetPlugRoot().AppFrame |
509 if app_frame is not None: |
516 if app_frame is not None: |
1838 self._connector.StartPLC() |
1845 self._connector.StartPLC() |
1839 self.logger.write(_("Starting PLC\n")) |
1846 self.logger.write(_("Starting PLC\n")) |
1840 self._connect_debug() |
1847 self._connect_debug() |
1841 else: |
1848 else: |
1842 self.logger.write_error(_("Couldn't start PLC !\n")) |
1849 self.logger.write_error(_("Couldn't start PLC !\n")) |
1843 self.UpdateMethodsFromPLCStatus() |
1850 wx.CallAfter(self.UpdateMethodsFromPLCStatus) |
1844 |
1851 |
1845 |
1852 |
1846 # def _Do_Test_Debug(self): |
1853 # def _Do_Test_Debug(self): |
1847 # # debug code |
1854 # # debug code |
1848 # self.temporary_non_weak_callable_refs = [] |
1855 # self.temporary_non_weak_callable_refs = [] |
1867 if self._connector is not None and not self._connector.StopPLC(): |
1874 if self._connector is not None and not self._connector.StopPLC(): |
1868 self.logger.write_error(_("Couldn't stop PLC !\n")) |
1875 self.logger.write_error(_("Couldn't stop PLC !\n")) |
1869 |
1876 |
1870 self.KillDebugThread() |
1877 self.KillDebugThread() |
1871 |
1878 |
1872 self.UpdateMethodsFromPLCStatus() |
1879 wx.CallAfter(self.UpdateMethodsFromPLCStatus) |
1873 |
1880 |
1874 def _Connect(self): |
1881 def _Connect(self): |
1875 # don't accept re-connetion is already connected |
1882 # don't accept re-connetion is already connected |
1876 if self._connector is not None: |
1883 if self._connector is not None: |
1877 self.logger.write_error(_("Already connected. Please disconnect\n")) |
1884 self.logger.write_error(_("Already connected. Please disconnect\n")) |
1961 |
1968 |
1962 |
1969 |
1963 def _Disconnect(self): |
1970 def _Disconnect(self): |
1964 self._connector = None |
1971 self._connector = None |
1965 self.StatusTimer.Stop() |
1972 self.StatusTimer.Stop() |
1966 self.UpdateMethodsFromPLCStatus() |
1973 wx.CallAfter(self.UpdateMethodsFromPLCStatus) |
1967 |
1974 |
1968 def _Transfer(self): |
1975 def _Transfer(self): |
1969 # Get the last build PLC's |
1976 # Get the last build PLC's |
1970 MD5 = self.GetLastBuildMD5() |
1977 MD5 = self.GetLastBuildMD5() |
1971 |
1978 |
2001 else: |
2008 else: |
2002 self.logger.write_error(_("Transfer failed\n")) |
2009 self.logger.write_error(_("Transfer failed\n")) |
2003 else: |
2010 else: |
2004 self.logger.write_error(_("No PLC to transfer (did build succeed ?)\n")) |
2011 self.logger.write_error(_("No PLC to transfer (did build succeed ?)\n")) |
2005 |
2012 |
2006 self.UpdateMethodsFromPLCStatus() |
2013 wx.CallAfter(self.UpdateMethodsFromPLCStatus) |
2007 |
2014 |
2008 PluginMethods = [ |
2015 PluginMethods = [ |
2009 {"bitmap" : opjimg("Build"), |
2016 {"bitmap" : opjimg("Build"), |
2010 "name" : _("Build"), |
2017 "name" : _("Build"), |
2011 "tooltip" : _("Build project into build folder"), |
2018 "tooltip" : _("Build project into build folder"), |