beremiz

5b294dcaae18
fix issue, then it wasn't possible to view FBD programs

the reason for that is possible wx-3.0-gtk2 bug that happens if
ALWAYS_SHOW_SB is set.

Traceback (most recent call last):
File "Beremiz.py", line 1045, in OnProjectTreeItemActivated
IDEFrame.OnProjectTreeItemActivated(self, event)
File "IDEFrame.py", line 1667, in OnProjectTreeItemActivated
self.EditProjectElement(item_infos["type"], item_infos["tagname"])
File "IDEFrame.py", line 1752, in EditProjectElement
new_window = Viewer(self.TabsOpened, tagname, self, self.Controler)
File "editors/Viewer.py", line 611, in __init__
EditorPanel.__init__(self, parent, tagname, window, controler, debug)
File "editors/EditorPanel.py", line 68, in __init__
self._init_ctrls(parent)
File "editors/EditorPanel.py", line 52, in _init_ctrls
self._init_Editor(self)
File "editors/Viewer.py", line 603, in _init_Editor
style=wx.HSCROLL | wx.VSCROLL | wx.ALWAYS_SHOW_SB)
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_windows.py", line 296, in __init__
_windows_.ScrolledWindow_swiginit(self,_windows_.new_ScrolledWindow(*args, **kwargs))
PyAssertionError: C++ assertion "scrolled" failed at ../src/gtk/scrolwin.cpp(205) in DoShowScrollbars(): window must be created
import wx
from controls import ProjectPropertiesPanel, VariablePanel
from EditorPanel import EditorPanel
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()
self.ProjectProperties.RefreshView()
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()