--- a/PLCControler.py Mon Aug 14 22:23:17 2017 +0300
+++ b/PLCControler.py Mon Aug 14 22:30:41 2017 +0300
@@ -1794,7 +1794,7 @@
# the size of these types is implementation dependend
if typename in ["TIME", "DATE", "DT", "TOD"]:
return False
-
+
datatype = self.GetDataType(typename, debug)
if datatype is not None:
return self.IsLocatableDataType(datatype)
--- a/c_ext/c_ext.py Mon Aug 14 22:23:17 2017 +0300
+++ b/c_ext/c_ext.py Mon Aug 14 22:30:41 2017 +0300
@@ -47,13 +47,13 @@
"retrieveFunction",
"publishFunction"]
EditorType = CFileEditor
-
+
def GetIconName(self):
return "Cfile"
def CodeFileName(self):
return os.path.join(self.CTNPath(), "cfile.xml")
-
+
def CTNGenerate_C(self, buildpath, locations):
"""
Generate C code
@@ -70,17 +70,17 @@
current_location = self.GetCurrentLocation()
# define a unique name for the generated C file
location_str = "_".join(map(str, current_location))
-
+
text = "/* Code generated by Beremiz c_ext confnode */\n\n"
text += "#include <stdio.h>\n\n"
-
+
# Adding includes
text += "/* User includes */\n"
text += self.CodeFile.includes.getanyText().strip()
text += "\n"
-
+
text += '#include "iec_types_all.h"\n\n'
-
+
# Adding variables
config = self.GetCTRoot().GetProjectConfigNames()[0]
text += "/* User variables reference */\n"
@@ -93,36 +93,35 @@
text += "extern %(type)s %(global)s;\n" % var_infos
text += "#define %(name)s %(global)s.value\n" % var_infos
text += "\n"
-
+
# Adding user global variables and routines
text += "/* User internal user variables and routines */\n"
text += self.CodeFile.globals.getanyText().strip()
text += "\n"
-
+
# Adding Beremiz confnode functions
text += "/* Beremiz confnode functions */\n"
text += "int __init_%s(int argc,char **argv)\n{\n" % location_str
text += self.CodeFile.initFunction.getanyText().strip()
text += " return 0;\n}\n\n"
-
+
text += "void __cleanup_%s(void)\n{\n" % location_str
text += self.CodeFile.cleanUpFunction.getanyText().strip()
text += "\n}\n\n"
-
+
text += "void __retrieve_%s(void)\n{\n" % location_str
text += self.CodeFile.retrieveFunction.getanyText().strip()
text += "\n}\n\n"
-
+
text += "void __publish_%s(void)\n{\n" % location_str
text += self.CodeFile.publishFunction.getanyText().strip()
text += "\n}\n\n"
-
+
Gen_Cfile_path = os.path.join(buildpath, "CFile_%s.c" % location_str)
cfile = open(Gen_Cfile_path,'w')
cfile.write(text)
cfile.close()
-
+
matiec_CFLAGS = '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath())
-
+
return [(Gen_Cfile_path, str(self.CExtension.getCFLAGS() + matiec_CFLAGS))],str(self.CExtension.getLDFLAGS()),True
-
--- a/controls/CustomEditableListBox.py Mon Aug 14 22:23:17 2017 +0300
+++ b/controls/CustomEditableListBox.py Mon Aug 14 22:30:41 2017 +0300
@@ -26,15 +26,15 @@
import wx.gizmos
class CustomEditableListBox(wx.gizmos.EditableListBox):
-
+
def __init__(self, *args, **kwargs):
wx.gizmos.EditableListBox.__init__(self, *args, **kwargs)
-
+
listbox = self.GetListCtrl()
listbox.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
listbox.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnLabelBeginEdit)
listbox.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnLabelEndEdit)
-
+
for button, tooltip, call_function in [
(self.GetEditButton(), _("Edit item"), "_OnEditButton"),
(self.GetNewButton(), _("New item"), "_OnNewButton"),
@@ -43,13 +43,13 @@
(self.GetDownButton(), _("Move down"), "_OnDownButton")]:
button.SetToolTipString(tooltip)
button.Bind(wx.EVT_BUTTON, self.GetButtonPressedFunction(call_function))
-
+
self.Editing = False
-
+
def EnsureCurrentItemVisible(self):
listctrl = self.GetListCtrl()
listctrl.EnsureVisible(listctrl.GetFocusedItem())
-
+
def OnLabelBeginEdit(self, event):
self.Editing = True
func = getattr(self, "_OnLabelBeginEdit", None)
@@ -57,7 +57,7 @@
func(event)
else:
event.Skip()
-
+
def OnLabelEndEdit(self, event):
self.Editing = False
func = getattr(self, "_OnLabelEndEdit", None)
@@ -65,7 +65,7 @@
func(event)
else:
event.Skip()
-
+
def GetButtonPressedFunction(self, call_function):
def OnButtonPressed(event):
if wx.Platform != '__WXMSW__' or not self.Editing:
@@ -77,7 +77,7 @@
wx.CallAfter(self.EnsureCurrentItemVisible)
event.Skip()
return OnButtonPressed
-
+
def OnKeyDown(self, event):
button = None
keycode = event.GetKeyCode()
--- a/controls/CustomGrid.py Mon Aug 14 22:23:17 2017 +0300
+++ b/controls/CustomGrid.py Mon Aug 14 22:30:41 2017 +0300
@@ -26,45 +26,45 @@
import wx.grid
class CustomGrid(wx.grid.Grid):
-
+
def __init__(self, *args, **kwargs):
wx.grid.Grid.__init__(self, *args, **kwargs)
-
+
self.Editable = True
-
+
self.AddButton = None
self.DeleteButton = None
self.UpButton = None
self.DownButton = None
-
+
self.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Sans'))
self.SetLabelFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Sans'))
self.SetSelectionBackground(wx.WHITE)
self.SetSelectionForeground(wx.BLACK)
self.DisableDragRowSize()
-
+
self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnSelectCell)
self.Bind(wx.grid.EVT_GRID_EDITOR_HIDDEN, self.OnEditorHidden)
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
-
+
def SetFocus(self):
if self:
wx.grid.Grid.SetFocus(self)
-
+
def SetDefaultValue(self, default_value):
self.DefaultValue = default_value
-
+
def SetEditable(self, editable=True):
self.Editable = editable
self.RefreshButtons()
-
+
def SetButtons(self, buttons):
for name in ["Add", "Delete", "Up", "Down"]:
button = buttons.get(name, None)
setattr(self, "%sButton" % name, button)
if button is not None:
button.Bind(wx.EVT_BUTTON, getattr(self, "On%sButton" % name))
-
+
def RefreshButtons(self):
if self:
rows = self.Table.GetNumberRows()
@@ -77,7 +77,7 @@
self.UpButton.Enable(self.Editable and row > 0)
if self.DownButton is not None:
self.DownButton.Enable(self.Editable and 0 <= row < rows - 1)
-
+
def CloseEditControl(self):
row, col = self.GetGridCursorRow(), self.GetGridCursorCol()
if row != -1 and col != -1:
@@ -119,27 +119,27 @@
self.Table.ResetView(self)
if new_row != row:
self.SetSelectedCell(new_row, col)
-
+
def SetSelectedCell(self, row, col):
self.SetGridCursor(row, col)
self.MakeCellVisible(row, col)
self.RefreshButtons()
-
+
def OnAddButton(self, event):
self.AddRow()
self.SetFocus()
event.Skip()
-
+
def OnDeleteButton(self, event):
self.DeleteRow()
self.SetFocus()
event.Skip()
-
+
def OnUpButton(self, event):
self.MoveRow(self.GetGridCursorRow(), -1)
self.SetFocus()
event.Skip()
-
+
def OnDownButton(self, event):
self.MoveRow(self.GetGridCursorRow(), 1)
self.SetFocus()
--- a/controls/CustomStyledTextCtrl.py Mon Aug 14 22:23:17 2017 +0300
+++ b/controls/CustomStyledTextCtrl.py Mon Aug 14 22:30:41 2017 +0300
@@ -82,12 +82,12 @@
return None
class CustomStyledTextCtrl(wx.stc.StyledTextCtrl):
-
+
def __init__(self, *args, **kwargs):
wx.stc.StyledTextCtrl.__init__(self, *args, **kwargs)
-
+
self.Bind(wx.EVT_MOTION, self.OnMotion)
-
+
def OnMotion(self, event):
if wx.Platform == '__WXMSW__':
if not event.Dragging():
--- a/controls/CustomTable.py Mon Aug 14 22:23:17 2017 +0300
+++ b/controls/CustomTable.py Mon Aug 14 22:30:41 2017 +0300
@@ -31,7 +31,7 @@
ROW_HEIGHT = 28
class CustomTable(wx.grid.PyGridTableBase):
-
+
"""
A custom wx.grid.Grid Table using user supplied data
"""
@@ -47,10 +47,10 @@
# see if the table has changed size
self._rows = self.GetNumberRows()
self._cols = self.GetNumberCols()
-
+
def GetNumberCols(self):
return len(self.colnames)
-
+
def GetNumberRows(self):
return len(self.data)
@@ -66,11 +66,11 @@
def GetValue(self, row, col):
if row < self.GetNumberRows():
return self.data[row].get(self.GetColLabelValue(col, False), "")
-
+
def SetValue(self, row, col, value):
if col < len(self.colnames):
self.data[row][self.GetColLabelValue(col, False)] = value
-
+
def GetValueByName(self, row, colname):
if row < self.GetNumberRows():
return self.data[row].get(colname)
@@ -125,33 +125,33 @@
row_highlights = self.Highlights.get(row, {})
for col in range(self.GetNumberCols()):
colname = self.GetColLabelValue(col, False)
-
+
grid.SetReadOnly(row, col, True)
grid.SetCellEditor(row, col, None)
grid.SetCellRenderer(row, col, None)
-
+
highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
grid.SetCellBackgroundColour(row, col, highlight_colours[0])
grid.SetCellTextColour(row, col, highlight_colours[1])
self.ResizeRow(grid, row)
-
+
def ResizeRow(self, grid, row):
if grid.GetRowSize(row) < ROW_HEIGHT:
grid.SetRowMinimalHeight(row, ROW_HEIGHT)
grid.AutoSizeRow(row, False)
-
+
def SetData(self, data):
self.data = data
-
+
def GetData(self):
return self.data
-
+
def GetCurrentIndex(self):
return self.CurrentIndex
-
+
def SetCurrentIndex(self, index):
self.CurrentIndex = index
-
+
def AppendRow(self, row_content):
self.data.append(row_content)
--- a/controls/LogViewer.py Mon Aug 14 22:23:17 2017 +0300
+++ b/controls/LogViewer.py Mon Aug 14 22:30:41 2017 +0300
@@ -403,7 +403,7 @@
def ResetLogCounters(self):
self.previous_log_count = [None]*LogLevelsCount
-
+
def SetLogCounters(self, log_count):
new_messages = []
for level, count, prev in zip(xrange(LogLevelsCount), log_count, self.previous_log_count):
@@ -559,7 +559,7 @@
empty=False
break
return empty
-
+
def IsMessagePanelTop(self, message_idx=None):
if message_idx is None:
message_idx = self.CurrentMessage
--- a/controls/TextCtrlAutoComplete.py Mon Aug 14 22:23:17 2017 +0300
+++ b/controls/TextCtrlAutoComplete.py Mon Aug 14 22:30:41 2017 +0300
@@ -35,28 +35,28 @@
LISTBOX_INTERVAL_HEIGHT = 6
class PopupWithListbox(wx.PopupWindow):
-
+
def __init__(self, parent, choices=[]):
wx.PopupWindow.__init__(self, parent, wx.BORDER_SIMPLE)
-
+
self.ListBox = wx.ListBox(self, -1, style=wx.LB_HSCROLL|wx.LB_SINGLE|wx.LB_SORT)
-
+
self.SetChoices(choices)
-
+
self.ListBox.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.ListBox.Bind(wx.EVT_MOTION, self.OnMotion)
-
+
def SetChoices(self, choices):
max_text_width = 0
max_text_height = 0
-
+
self.ListBox.Clear()
for choice in choices:
self.ListBox.Append(choice)
w, h = self.ListBox.GetTextExtent(choice)
max_text_width = max(max_text_width, w)
max_text_height = max(max_text_height, h)
-
+
itemcount = min(len(choices), MAX_ITEM_SHOWN)
width = self.Parent.GetSize()[0]
height = max_text_height * itemcount + \
@@ -69,7 +69,7 @@
size.width -= 2
self.ListBox.SetSize(size)
self.SetClientSize(size)
-
+
def MoveSelection(self, direction):
selected = self.ListBox.GetSelection()
if selected == wx.NOT_FOUND:
@@ -82,10 +82,10 @@
if selected == self.ListBox.GetCount():
selected = wx.NOT_FOUND
self.ListBox.SetSelection(selected)
-
+
def GetSelection(self):
return self.ListBox.GetStringSelection()
-
+
def OnLeftDown(self, event):
selected = self.ListBox.HitTest(wx.Point(event.GetX(), event.GetY()))
parent_size = self.Parent.GetSize()
@@ -99,12 +99,12 @@
else:
wx.CallAfter(self.Parent.DismissListBox)
event.Skip()
-
+
def OnMotion(self, event):
self.ListBox.SetSelection(
self.ListBox.HitTest(wx.Point(event.GetX(), event.GetY())))
event.Skip()
-
+
class TextCtrlAutoComplete(wx.TextCtrl):
def __init__ (self, parent, choices=None, dropDownClick=True,
@@ -118,17 +118,17 @@
therest['style'] = wx.TE_PROCESS_ENTER | therest.get('style', 0)
wx.TextCtrl.__init__(self, parent, **therest)
-
+
# Some variables
self._dropDownClick = dropDownClick
self._lastinsertionpoint = None
self._hasfocus = False
-
+
self._screenheight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
self.element_path = element_path
-
+
self.listbox = None
-
+
self.SetChoices(choices)
#gp = self
@@ -201,14 +201,14 @@
self.DismissListBox()
self._hasfocus = False
event.Skip()
-
+
def SetChoices(self, choices):
self._choices = choices
self.RefreshListBoxChoices()
-
+
def GetChoices(self):
return self._choices
-
+
def SetValueFromSelected(self, selected):
"""
Sets the wx.TextCtrl value from the selected wx.ListCtrl item.
@@ -217,7 +217,7 @@
if selected != "":
self.SetValue(selected)
self.DismissListBox()
-
+
def RefreshListBoxChoices(self):
if self.listbox is not None:
text = self.GetValue()
@@ -227,7 +227,7 @@
def PopupListBox(self):
if self.listbox is None:
self.listbox = PopupWithListbox(self)
-
+
# Show the popup right below or above the button
# depending on available screen space...
pos = self.ClientToScreen((0, 0))
@@ -236,9 +236,9 @@
pos.x -= 2
pos.y -= 2
self.listbox.Position(pos, (0, sz[1]))
-
+
self.RefreshListBoxChoices()
-
+
self.listbox.Show()
def DismissListBox(self):
--- a/docutil/dochtml.py Mon Aug 14 22:23:17 2017 +0300
+++ b/docutil/dochtml.py Mon Aug 14 22:30:41 2017 +0300
@@ -46,7 +46,7 @@
wx.PyEvent.__init__(self)
self.SetEventType(EVT_HTML_URL_CLICK)
self.linkinfo = (linkinfo.GetHref(), linkinfo.GetTarget())
-
+
class UrlClickHtmlWindow(wx.html.HtmlWindow):
""" HTML window that generates and OnLinkClicked event.
@@ -54,7 +54,7 @@
"""
def OnLinkClicked(self, linkinfo):
wx.PostEvent(self, HtmlWindowUrlClick(linkinfo))
-
+
def Bind(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
if event == HtmlWindowUrlClick:
self.Connect(-1, -1, EVT_HTML_URL_CLICK, handler)
@@ -68,7 +68,7 @@
style=wx.DEFAULT_FRAME_STYLE, title='')
self.SetIcon(prnt.icon)
self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
-
+
self.HtmlContent = UrlClickHtmlWindow(id=ID_HTMLFRAMEHTMLCONTENT,
name='HtmlContent', parent=self, pos=wx.Point(0, 0),
size=wx.Size(-1, -1), style=wx.html.HW_SCROLLBAR_AUTO|wx.html.HW_NO_SELECTION)
@@ -77,17 +77,17 @@
def __init__(self, parent, opened):
self._init_ctrls(parent)
self.HtmlFrameOpened = opened
-
+
def SetHtmlCode(self, htmlcode):
self.HtmlContent.SetPage(htmlcode)
-
+
def SetHtmlPage(self, htmlpage):
self.HtmlContent.LoadPage(htmlpage)
-
+
def OnCloseFrame(self, event):
self.HtmlFrameOpened.remove(self.GetTitle())
event.Skip()
-
+
def OnLinkClick(self, event):
url = event.linkinfo[0]
try:
--- a/docutil/docpdf.py Mon Aug 14 22:23:17 2017 +0300
+++ b/docutil/docpdf.py Mon Aug 14 22:30:41 2017 +0300
@@ -27,7 +27,7 @@
readerexepath = None
-
+
def get_acroversion():
" Return version of Adobe Acrobat executable or None"
import _winreg
@@ -65,7 +65,7 @@
except:
wx.MessageBox("Acrobat Reader is not found or installed !")
return None
-
+
readerexepath = os.path.join(readerpath, "AcroRd32.exe")
if(os.path.isfile(readerexepath)):
open_win_pdf(readerexepath, pdffile, pagenum)
--- a/docutil/docsvg.py Mon Aug 14 22:23:17 2017 +0300
+++ b/docutil/docsvg.py Mon Aug 14 22:30:41 2017 +0300
@@ -45,7 +45,7 @@
""" Open Inkscape on Linux platform """
if os.path.isfile("/usr/bin/inkscape"):
os.system("%s %s &" % (svgexepath , svgfile))
-
+
def open_svg(svgfile):
""" Generic function to open SVG file """
if wx.Platform == '__WXMSW__' :
@@ -61,4 +61,3 @@
else:
wx.MessageBox("Inkscape is not found or installed !")
return None
-
--- a/editors/DataTypeEditor.py Mon Aug 14 22:23:17 2017 +0300
+++ b/editors/DataTypeEditor.py Mon Aug 14 22:30:41 2017 +0300
@@ -74,7 +74,7 @@
return row + 1
colname = self.GetColLabelValue(col, False)
value = self.data[row].get(colname, "")
-
+
if colname == "Type" and isinstance(value, TupleType):
if value[0] == "array":
return "ARRAY [%s] OF %s" % (",".join(map(lambda x : "..".join(x), value[2])), value[1])
@@ -574,7 +574,7 @@
dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR)
dialog.ShowModal()
dialog.Destroy()
-
+
def OnStructureElementsGridCellChange(self, event):
row, col = event.GetRow(), event.GetCol()
colname = self.StructureElementsTable.GetColLabelValue(col, False)
@@ -812,4 +812,3 @@
listctrl.SetItemBackgroundColour(infos[1], highlight_type[0])
listctrl.SetItemTextColour(infos[1], highlight_type[1])
listctrl.Select(listctrl.FocusedItem, False)
-
--- a/editors/EditorPanel.py Mon Aug 14 22:23:17 2017 +0300
+++ b/editors/EditorPanel.py Mon Aug 14 22:30:41 2017 +0300
@@ -27,66 +27,66 @@
from controls import VariablePanel
class EditorPanel(wx.SplitterWindow):
-
+
VARIABLE_PANEL_TYPE = None
-
+
def _init_Editor(self, prnt):
self.Editor = None
-
+
def _init_MenuItems(self):
self.MenuItems = []
-
+
def _init_ctrls(self, parent):
wx.SplitterWindow.__init__(self, parent,
style=wx.SUNKEN_BORDER|wx.SP_3D)
self.SetMinimumPaneSize(1)
-
+
self._init_MenuItems()
-
+
if self.VARIABLE_PANEL_TYPE is not None:
self.VariableEditor = VariablePanel(self, self, self.Controler, self.VARIABLE_PANEL_TYPE, self.Debug)
self.VariableEditor.SetTagName(self.TagName)
else:
self.VariableEditor = None
-
+
self._init_Editor(self)
-
+
if self.Editor is not None and self.VariableEditor is not None:
self.SplitHorizontally(self.VariableEditor, self.Editor, 200)
elif self.VariableEditor is not None:
self.Initialize(self.VariableEditor)
elif self.Editor is not None:
self.Initialize(self.Editor)
-
+
def __init__(self, parent, tagname, window, controler, debug=False):
self.ParentWindow = window
self.Controler = controler
self.TagName = tagname
self.Icon = None
self.Debug = debug
-
+
self._init_ctrls(parent)
-
+
def SetTagName(self, tagname):
self.TagName = tagname
if self.VARIABLE_PANEL_TYPE is not None:
self.VariableEditor.SetTagName(tagname)
-
+
def GetTagName(self):
return self.TagName
-
+
def Select(self):
self.ParentWindow.EditProjectElement(None, self.GetTagName(), True)
-
+
def GetTitle(self):
return ".".join(self.TagName.split("::")[1:])
-
+
def GetIcon(self):
return self.Icon
-
+
def SetIcon(self, icon):
self.Icon = icon
-
+
def IsViewing(self, tagname):
return self.GetTagName() == tagname
@@ -98,54 +98,54 @@
def ResetBuffer(self):
pass
-
+
def IsModified(self):
return False
-
+
def CheckSaveBeforeClosing(self):
return True
-
+
def Save(self):
pass
-
+
def SaveAs(self):
pass
-
+
def GetBufferState(self):
if self.Controler is not None:
return self.Controler.GetBufferState()
return False, False
-
+
def Undo(self):
if self.Controler is not None:
self.Controler.LoadPrevious()
self.RefreshView()
-
+
def Redo(self):
if self.Controler is not None:
self.Controler.LoadNext()
self.RefreshView()
-
+
def Find(self, direction, search_params):
pass
-
+
def HasNoModel(self):
return False
-
+
def RefreshView(self, variablepanel=True):
if variablepanel:
self.RefreshVariablePanel()
-
+
def RefreshVariablePanel(self):
if self.VariableEditor is not None:
self.VariableEditor.RefreshView()
-
+
def GetConfNodeMenuItems(self):
return self.MenuItems
-
+
def RefreshConfNodeMenu(self, confnode_menu):
pass
-
+
def _Refresh(self, *args):
self.ParentWindow._Refresh(*args)
@@ -159,7 +159,7 @@
def RemoveHighlight(self, infos, start, end, highlight_type):
if self.VariableEditor is not None and infos[0] in ["var_local", "var_input", "var_output", "var_inout"]:
self.VariableEditor.RemoveVariableHighlight(infos[1:], highlight_type)
-
+
def ClearHighlights(self, highlight_type=None):
if self.VariableEditor is not None:
self.VariableEditor.ClearHighlights(highlight_type)
--- a/editors/IECCodeViewer.py Mon Aug 14 22:23:17 2017 +0300
+++ b/editors/IECCodeViewer.py Mon Aug 14 22:30:41 2017 +0300
@@ -26,15 +26,15 @@
from plcopen.plcopen import TestTextElement
class IECCodeViewer(TextViewer):
-
+
def __del__(self):
TextViewer.__del__(self)
if getattr(self, "_OnClose"):
self._OnClose(self)
-
+
def Paste(self):
if self.Controler is not None:
TextViewer.Paste(self)
-
+
def Search(self, criteria):
return [((self.TagName, "body", 0),) + result for result in TestTextElement(self.Editor.GetText(), criteria)]
--- a/editors/ProjectNodeEditor.py Mon Aug 14 22:23:17 2017 +0300
+++ b/editors/ProjectNodeEditor.py Mon Aug 14 22:30:41 2017 +0300
@@ -29,53 +29,53 @@
from ConfTreeNodeEditor import ConfTreeNodeEditor
class ProjectNodeEditor(ConfTreeNodeEditor):
-
+
SHOW_BASE_PARAMS = False
ENABLE_REQUIRED = True
CONFNODEEDITOR_TABS = [
(_("Config variables"), "_create_VariablePanel"),
(_("Project properties"), "_create_ProjectPropertiesPanel")]
-
+
def _create_VariablePanel(self, prnt):
self.VariableEditorPanel = VariablePanel(prnt, self, self.Controler, "config", self.Debug)
self.VariableEditorPanel.SetTagName(self.TagName)
-
+
return self.VariableEditorPanel
-
+
def _create_ProjectPropertiesPanel(self, prnt):
self.ProjectProperties = ProjectPropertiesPanel(prnt, self.Controler, self.ParentWindow, self.ENABLE_REQUIRED)
-
+
return self.ProjectProperties
-
+
def __init__(self, parent, controler, window):
configuration = controler.GetProjectMainConfigurationName()
if configuration is not None:
tagname = controler.ComputeConfigurationName(configuration)
else:
tagname = ""
-
+
ConfTreeNodeEditor.__init__(self, parent, controler, window, tagname)
-
+
buttons_sizer = self.GenerateMethodButtonSizer()
self.MainSizer.InsertSizer(0, buttons_sizer, 0, border=5, flag=wx.ALL)
self.MainSizer.Layout()
-
+
self.VariableEditor = self.VariableEditorPanel
def GetTagName(self):
return self.Controler.CTNName()
-
+
def SetTagName(self, tagname):
self.TagName = tagname
if self.VariableEditor is not None:
self.VariableEditor.SetTagName(tagname)
-
+
def GetTitle(self):
fullname = _(self.Controler.CTNName())
if self.Controler.CTNTestModified():
return "~%s~" % fullname
return fullname
-
+
def RefreshView(self, variablepanel=True):
ConfTreeNodeEditor.RefreshView(self)
self.VariableEditorPanel.RefreshView()
@@ -83,12 +83,11 @@
def GetBufferState(self):
return self.Controler.GetBufferState()
-
+
def Undo(self):
self.Controler.LoadPrevious()
self.ParentWindow.CloseTabsWithoutModel()
-
+
def Redo(self):
self.Controler.LoadNext()
self.ParentWindow.CloseTabsWithoutModel()
-
--- a/targets/Xenomai/__init__.py Mon Aug 14 22:23:17 2017 +0300
+++ b/targets/Xenomai/__init__.py Mon Aug 14 22:30:41 2017 +0300
@@ -39,7 +39,7 @@
self.CTRInstance.logger.write_error(_("Unable to get Xenomai's %s \n") % flagsname)
return [result.strip()]
return []
-
+
def getBuilderLDFLAGS(self):
xeno_ldflags = self.getXenoConfig("ldflags")
return toolchain_gcc.getBuilderLDFLAGS(self) + xeno_ldflags + ["-shared"]
@@ -47,4 +47,3 @@
def getBuilderCFLAGS(self):
xeno_cflags = self.getXenoConfig("cflags")
return toolchain_gcc.getBuilderCFLAGS(self) + xeno_cflags + ["-fPIC"]
-
--- a/targets/toolchain_gcc.py Mon Aug 14 22:23:17 2017 +0300
+++ b/targets/toolchain_gcc.py Mon Aug 14 22:30:41 2017 +0300
@@ -41,7 +41,7 @@
self.CTRInstance = CTRInstance
self.buildpath = None
self.SetBuildPath(self.CTRInstance._getBuildPath())
-
+
def getBuilderCFLAGS(self):
"""
Returns list of builder specific CFLAGS
@@ -60,19 +60,19 @@
Returns compiler
"""
return self.CTRInstance.GetTarget().getcontent().getCompiler()
-
+
def getLinker(self):
"""
Returns linker
"""
return self.CTRInstance.GetTarget().getcontent().getLinker()
-
+
def GetBinaryCode(self):
try:
return open(self.exe_path, "rb").read()
except Exception, e:
return None
-
+
def _GetMD5FileName(self):
return os.path.join(self.buildpath, "lastbuildPLC.md5")
@@ -82,7 +82,7 @@
os.remove(self._GetMD5FileName())
except Exception, e:
pass
-
+
def GetBinaryCodeMD5(self):
if self.md5key is not None:
return self.md5key
@@ -91,7 +91,7 @@
return open(self._GetMD5FileName(), "r").read()
except Exception, e:
return None
-
+
def SetBuildPath(self, buildpath):
if self.buildpath != buildpath:
self.buildpath = buildpath
@@ -99,7 +99,7 @@
self.exe_path = os.path.join(self.buildpath, self.exe)
self.md5key = None
self.srcmd5 = {}
-
+
def append_cfile_deps(self, src, deps):
for l in src.splitlines():
res = includes_re.match(l)
@@ -107,7 +107,7 @@
depfn = res.groups()[0]
if os.path.exists(os.path.join(self.buildpath, depfn)):
deps.append(depfn)
-
+
def concat_deps(self, bn):
# read source
src = open(os.path.join(self.buildpath, bn),"r").read()
@@ -117,7 +117,7 @@
# recurse through deps
# TODO detect cicular deps.
return reduce(operator.concat, map(self.concat_deps, deps), src)
-
+
def check_and_update_hash_and_deps(self, bn):
# Get latest computed hash and deps
oldhash, deps = self.srcmd5.get(bn,(None,[]))
@@ -137,7 +137,7 @@
# recurse through deps
# TODO detect cicular deps.
return reduce(operator.and_, map(self.check_and_update_hash_and_deps, deps), match)
-
+
def calc_source_md5(self):
wholesrcdata = ""
for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS:
@@ -146,10 +146,10 @@
CFileName = os.path.basename(CFile)
wholesrcdata += self.concat_deps(CFileName)
return hashlib.md5(wholesrcdata).hexdigest()
-
+
def calc_md5(self):
return hashlib.md5(self.GetBinaryCode()).hexdigest()
-
+
def build(self):
# Retrieve compiler and linker
self.compiler = self.getCompiler()
@@ -167,7 +167,7 @@
self.CTRInstance.logger.write(".".join(map(str,Location))+" :\n")
else:
self.CTRInstance.logger.write(_("PLC :\n"))
-
+
for CFile, CFLAGS in CFilesAndCFLAGS:
if CFile.endswith(".c"):
bn = os.path.basename(CFile)
@@ -175,14 +175,14 @@
objectfilename = os.path.splitext(CFile)[0]+".o"
match = self.check_and_update_hash_and_deps(bn)
-
+
if match:
self.CTRInstance.logger.write(" [pass] "+bn+" -> "+obn+"\n")
else:
relink = True
self.CTRInstance.logger.write(" [CC] "+bn+" -> "+obn+"\n")
-
+
status, result, err_result = ProcessLogger(
self.CTRInstance.logger,
"\"%s\" -c \"%s\" -o \"%s\" %s %s"%
@@ -204,14 +204,14 @@
self.CTRInstance.logger.write(_("Linking :\n"))
if relink:
objstring = []
-
+
# Generate list .o files
listobjstring = '"' + '" "'.join(objs) + '"'
-
+
ALLldflags = ' '.join(self.getBuilderLDFLAGS())
-
+
self.CTRInstance.logger.write(" [CC] " + ' '.join(obns)+" -> " + self.exe + "\n")
-
+
status, result, err_result = ProcessLogger(
self.CTRInstance.logger,
"\"%s\" %s -o \"%s\" %s"%
@@ -220,13 +220,13 @@
self.exe_path,
ALLldflags)
).spin()
-
+
if status :
return False
-
+
else:
self.CTRInstance.logger.write(" [pass] " + ' '.join(obns)+" -> " + self.exe + "\n")
-
+
# Calculate md5 key and get data for the new created PLC
self.md5key = self.calc_md5()
@@ -234,6 +234,5 @@
f = open(self._GetMD5FileName(), "w")
f.write(self.md5key)
f.close()
-
+
return True
-
--- a/util/BitmapLibrary.py Mon Aug 14 22:23:17 2017 +0300
+++ b/util/BitmapLibrary.py Mon Aug 14 22:30:41 2017 +0300
@@ -47,24 +47,24 @@
if os.path.isfile(bmp_path):
return wx.Bitmap(bmp_path)
return None
-
+
def GetBitmap(bmp_name1, bmp_name2=None, size=None):
bmp = BitmapLibrary.get((bmp_name1, bmp_name2, size))
if bmp is not None:
return bmp
-
+
if bmp_name2 is None:
bmp = SearchBitmap(bmp_name1)
else:
# Bitmap with two icon
bmp1 = SearchBitmap(bmp_name1)
bmp2 = SearchBitmap(bmp_name2)
-
+
if bmp1 is not None and bmp2 is not None:
# Calculate bitmap size
width = bmp1.GetWidth() + bmp2.GetWidth() - 1
height = max(bmp1.GetHeight(), bmp2.GetHeight())
-
+
# Create bitmap with both icons
bmp = wx.EmptyBitmap(width, height)
dc = wx.MemoryDC()
@@ -73,13 +73,13 @@
dc.DrawBitmap(bmp1, 0, 0)
dc.DrawBitmap(bmp2, bmp1.GetWidth() - 1, 0)
dc.Destroy()
-
+
elif bmp1 is not None:
bmp = bmp1
elif bmp2 is not None:
bmp = bmp2
-
+
if bmp is not None:
BitmapLibrary[(bmp_name1, bmp_name2, size)] = bmp
-
+
return bmp
--- a/util/MiniTextControler.py Mon Aug 14 22:23:17 2017 +0300
+++ b/util/MiniTextControler.py Mon Aug 14 22:30:41 2017 +0300
@@ -29,22 +29,22 @@
import os
class MiniTextControler:
-
+
def __init__(self, filepath, controller):
self.FilePath = filepath
self.BaseController = controller
-
+
def __del__(self):
self.BaseController = None
-
+
def CTNFullName(self):
return ""
-
+
def SetEditedElementText(self, tagname, text):
file = open(self.FilePath, "w")
file.write(text)
file.close()
-
+
def GetEditedElementText(self, tagname, debug = False):
if os.path.isfile(self.FilePath):
file = open(self.FilePath, "r")
@@ -52,25 +52,25 @@
file.close()
return text
return ""
-
+
def GetEditedElementInterfaceVars(self, tagname, tree=False, debug = False):
return []
-
+
def GetEditedElementType(self, tagname, debug = False):
return "program"
-
+
def GetBlockType(self, type, inputs = None, debug = False):
return self.BaseController.GetBlockType(type, inputs, debug)
-
+
def GetBlockTypes(self, tagname = "", debug = False):
return self.BaseController.GetBlockTypes(tagname, debug)
-
+
def GetDataTypes(self, tagname = "", basetypes = True, only_locatables = False, debug = False):
return self.BaseController.GetDataTypes(tagname, basetypes, only_locatables, debug)
-
+
def GetEnumeratedDataValues(self, debug = False):
return self.BaseController.GetEnumeratedDataValues(debug)
-
+
def StartBuffering(self):
pass
@@ -79,4 +79,3 @@
def BufferProject(self):
pass
-
--- a/util/misc.py Mon Aug 14 22:23:17 2017 +0300
+++ b/util/misc.py Mon Aug 14 22:30:41 2017 +0300
@@ -62,6 +62,5 @@
AddCatalog(os.path.join(CWD, "locale"))
import gettext
import __builtin__
-
+
__builtin__.__dict__['_'] = wx.GetTranslation
-
--- a/version.py Mon Aug 14 22:23:17 2017 +0300
+++ b/version.py Mon Aug 14 22:30:41 2017 +0300
@@ -52,7 +52,7 @@
rev = None
except:
pass
-
+
# if this is not mercurial repository
# try to read revision from file
if rev is None:
@@ -69,17 +69,17 @@
info.Name = "Beremiz"
info.Version = app_version
-
+
info.Copyright = "(C) 2016 Andrey Skvortsov\n"
info.Copyright += "(C) 2008-2015 Eduard Tisserant\n"
info.Copyright += "(C) 2008-2015 Laurent Bessard"
info.WebSite = ("http://beremiz.org", "beremiz.org")
-
+
info.Description = _("Open Source framework for automation, "
"implemented IEC 61131 IDE with constantly growing set of extensions "
"and flexible PLC runtime.")
-
+
info.Developers = ("Andrey Skvortsov <andrej.skvortzov@gmail.com>",
"Sergey Surkov <surkov.sv@summatechnology.ru>",
"Edouard Tisserant <edouard.tisserant@gmail.com>",
@@ -124,6 +124,3 @@
rev = GetAppRevision()
if rev is not None:
app_version = app_version + "-" + rev.rstrip()
-
-
-