# HG changeset patch
# User laurent
# Date 1340040881 -7200
# Node ID daa6941fe21a1325e09699f4c261a16200ed995b
# Parent c81397b665b686134df355e9864e9663d21ee2c7
Fix bug with Show Master functionality
Adding Export Slave functionality
diff -r c81397b665b6 -r daa6941fe21a canfestival/SlaveEditor.py
--- a/canfestival/SlaveEditor.py Mon Jun 18 02:35:21 2012 +0200
+++ b/canfestival/SlaveEditor.py Mon Jun 18 19:34:41 2012 +0200
@@ -69,4 +69,10 @@
self.ParentWindow.RefreshFileMenu()
self.ParentWindow.RefreshEditMenu()
self.ParentWindow.RefreshPageTitles()
-
+
+class MasterViewer(SlaveEditor):
+ SHOW_PARAMS = False
+
+ def __init__(self, parent, controler, window):
+ SlaveEditor.__init__(self, parent, controler, window, False)
+
diff -r c81397b665b6 -r daa6941fe21a canfestival/canfestival.py
--- a/canfestival/canfestival.py Mon Jun 18 02:35:21 2012 +0200
+++ b/canfestival/canfestival.py Mon Jun 18 19:34:41 2012 +0200
@@ -13,7 +13,7 @@
from commondialogs import CreateNodeDialog
import wx
-from SlaveEditor import SlaveEditor
+from SlaveEditor import SlaveEditor, MasterViewer
from NetworkEditor import NetworkEditor
from gnosis.xml.pickle import *
@@ -113,14 +113,22 @@
if self._View is not None:
self._View.SetBusId(self.GetCurrentLocation())
return self._View
-
+
+ def _ExportSlave(self):
+ dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a file"), os.getcwd(), "", _("EDS files (*.eds)|*.eds|All files|*.*"), wx.SAVE|wx.OVERWRITE_PROMPT)
+ if dialog.ShowModal() == wx.ID_OK:
+ result = eds_utils.GenerateEDSFile(dialog.GetPath(), self.GetCurrentNodeCopy())
+ if result:
+ self.GetCTRoot().logger.write_error(_("Error: Export slave failed\n"))
+ dialog.Destroy()
+
ConfNodeMethods = [
- {"bitmap" : "NetworkEdit",
- "name" : "Edit slave",
- "tooltip" : "Edit CanOpen slave with ObjdictEdit",
- "method" : "_OpenView"},
+ {"bitmap" : "ExportSlave",
+ "name" : _("Export slave"),
+ "tooltip" : _("Export CanOpen slave to EDS file"),
+ "method" : "_ExportSlave"},
]
-
+
def CTNTestModified(self):
return self.ChangesToSave or self.OneFileHasChanged()
@@ -188,16 +196,22 @@
self.Parent = parent
self.Fullname = fullname
-
+
+ def GetIconPath(self):
+ return None
+
def OnCloseEditor(self, view):
self.Parent.OnCloseEditor(view)
def CTNFullName(self):
return self.Fullname
+ def CTNTestModified(self):
+ return False
+
def GetBufferState(self):
return self.GetCurrentBufferState()
-
+
ConfNodeMethods = []
class _NodeListCTN(NodeList):
@@ -258,7 +272,7 @@
app_frame = self.GetCTRoot().AppFrame
manager = MiniNodeManager(self, masterpath, self.CTNFullName() + ".generated_master")
- self._GeneratedMasterView = SlaveEditor(app_frame.TabsOpened, manager, app_frame, False)
+ self._GeneratedMasterView = MasterViewer(app_frame.TabsOpened, manager, app_frame)
app_frame.EditProjectElement(self._GeneratedMasterView, name)
@@ -270,10 +284,6 @@
return self._View
ConfNodeMethods = [
- {"bitmap" : "NetworkEdit",
- "name" : _("Edit network"),
- "tooltip" : _("Edit CanOpen Network with NetworkEdit"),
- "method" : "_OpenView"},
{"bitmap" : "ShowMaster",
"name" : _("Show Master"),
"tooltip" : _("Show Master generated by config_utils"),
diff -r c81397b665b6 -r daa6941fe21a images/ExportSlave.png
Binary file images/ExportSlave.png has changed
diff -r c81397b665b6 -r daa6941fe21a images/icons.svg
--- a/images/icons.svg Mon Jun 18 02:35:21 2012 +0200
+++ b/images/icons.svg Mon Jun 18 19:34:41 2012 +0200
@@ -43,9 +43,9 @@
pagecolor="#ffffff"
id="base"
showgrid="false"
- inkscape:zoom="1.8101934"
- inkscape:cx="497.7697"
- inkscape:cy="737.93251"
+ inkscape:zoom="2.5600001"
+ inkscape:cx="643.14253"
+ inkscape:cy="778.71873"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:current-layer="svg2"
@@ -80394,7 +80394,7 @@
xlink:href="#linearGradient1513"
id="linearGradient16534"
gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.07859244,0,0,0.07859244,-648.89236,292.44662)"
+ gradientTransform="matrix(0.54799142,0,0,0.54799142,-31.948506,-0.05487363)"
x1="131.52188"
y1="198.01724"
x2="131.52188"
@@ -85577,6 +85577,331 @@
y1="8.059"
x2="36.358002"
y2="5.4565001" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
%% Build Clean editPLC HMIEditor ImportFile ImportDEF ImportSVG NetworkEdit ShowMaster Run ShowIECcode Stop Unknown %%
+ sodipodi:role="line">%% Build Clean editPLC HMIEditor ImportFile ImportDEF ImportSVG NetworkEdit ShowMaster ExportSlave Run ShowIECcode Stop Unknown %%
@@ -86242,7 +86567,7 @@
+ transform="translate(1830.9892,-430.1329)">
ST
@@ -86584,8 +86909,7 @@
inkscape:connector-curvature="0" />
@@ -89166,7 +89490,7 @@
+ transform="translate(1635.0897,-400.03854)">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Slave
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+