# HG changeset patch # User Laurent Bessard # Date 1365116214 -7200 # Node ID 6b7ba640f49ec48518956d6b8f39d4da0edd8eda # Parent e2f7d6c95db028bf53930c3ba1bb0a1fd1c2486c# Parent 2925d6e49893e879e085918e7d5c44d24611b877 Merged diff -r e2f7d6c95db0 -r 6b7ba640f49e Beremiz.py --- a/Beremiz.py Thu Apr 04 11:13:28 2013 +0900 +++ b/Beremiz.py Fri Apr 05 00:56:54 2013 +0200 @@ -254,7 +254,9 @@ if style is None : style=self.black_white if style != self.black_white: self.output.StartStyling(self.output.GetLength(), 0xff) + self.output.SetReadOnly(False) self.output.AddText(s) + self.output.SetReadOnly(True) if style != self.black_white: self.output.SetStyling(len(s), style) self.stack = [] @@ -400,6 +402,10 @@ self.LogConsole = wx.stc.StyledTextCtrl(id=ID_BEREMIZLOGCONSOLE, name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0), size=wx.Size(0, 0)) + self.LogConsole.Bind(wx.EVT_SET_FOCUS, self.OnLogConsoleFocusChanged) + self.LogConsole.Bind(wx.EVT_KILL_FOCUS, self.OnLogConsoleFocusChanged) + self.LogConsole.Bind(wx.stc.EVT_STC_UPDATEUI, self.OnLogConsoleUpdateUI) + self.LogConsole.SetReadOnly(True) self.LogConsole.SetWrapMode(wx.stc.STC_WRAP_CHAR) # Define Log Console styles @@ -560,6 +566,15 @@ wnd = self InspectionTool().Show(wnd, True) + def OnLogConsoleFocusChanged(self, event): + if self: + self.RefreshEditMenu() + event.Skip() + + def OnLogConsoleUpdateUI(self, event): + self.SetCopyBuffer(self.LogConsole.GetSelectedText(), True) + event.Skip() + def OnLogConsoleMarginClick(self, event): line_idx = self.LogConsole.LineFromPosition(event.GetPosition()) wx.CallAfter(self.SearchLineForError, self.LogConsole.GetLine(line_idx)) @@ -762,6 +777,9 @@ def RefreshEditMenu(self): IDEFrame.RefreshEditMenu(self) + if self.FindFocus() == self.LogConsole: + self.EditMenu.Enable(wx.ID_COPY, True) + self.Panes["MenuToolBar"].EnableTool(wx.ID_COPY, True) if self.CTR is not None: selected = self.TabsOpened.GetSelection() diff -r e2f7d6c95db0 -r 6b7ba640f49e IDEFrame.py --- a/IDEFrame.py Thu Apr 04 11:13:28 2013 +0900 +++ b/IDEFrame.py Fri Apr 05 00:56:54 2013 +0200 @@ -717,7 +717,7 @@ def SelectTab(self, tab): for notebook in [self.LeftNoteBook, self.BottomNoteBook, self.RightNoteBook]: idx = notebook.GetPageIndex(tab) - if idx != wx.NOT_FOUND: + if idx != wx.NOT_FOUND and idx != notebook.GetSelection(): notebook.SetSelection(idx) return @@ -879,8 +879,13 @@ event.Veto() - def GetCopyBuffer(self): + def GetCopyBuffer(self, primary_selection=False): data = None + if primary_selection: + if wx.Platform != '__WXMSW__': + wx.TheClipboard.UsePrimarySelection(primary_selection) + else: + return data if wx.TheClipboard.Open(): dataobj = wx.TextDataObject() if wx.TheClipboard.GetData(dataobj): @@ -888,7 +893,12 @@ wx.TheClipboard.Close() return data - def SetCopyBuffer(self, text): + def SetCopyBuffer(self, text, primary_selection=False): + if primary_selection: + if wx.Platform != '__WXMSW__': + wx.TheClipboard.UsePrimarySelection(primary_selection) + else: + return if wx.TheClipboard.Open(): data = wx.TextDataObject() data.SetText(text) diff -r e2f7d6c95db0 -r 6b7ba640f49e controls/VariablePanel.py --- a/controls/VariablePanel.py Thu Apr 04 11:13:28 2013 +0900 +++ b/controls/VariablePanel.py Fri Apr 05 00:56:54 2013 +0200 @@ -667,8 +667,7 @@ self.Controler.UpdateEditedElementUsedVariable(self.TagName, old_value, value) self.Controler.BufferProject() wx.CallAfter(self.ParentWindow.RefreshView, False) - self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE) - event.Skip() + self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE) else: self.SaveValues() if colname == "Class": diff -r e2f7d6c95db0 -r 6b7ba640f49e xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Thu Apr 04 11:13:28 2013 +0900 +++ b/xmlclass/xmlclass.py Fri Apr 05 00:56:54 2013 +0200 @@ -1669,6 +1669,8 @@ raise ValueError("Wrong path!") if attributes[parts[0]]["attr_type"]["basename"] == "boolean": setattr(self, parts[0], value) + elif attributes[parts[0]]["use"] == "optional" and value == "": + setattr(self, parts[0], None) else: setattr(self, parts[0], attributes[parts[0]]["attr_type"]["extract"](value, False)) elif elements.has_key(parts[0]): @@ -1677,6 +1679,8 @@ raise ValueError("Wrong path!") if elements[parts[0]]["elmt_type"]["basename"] == "boolean": setattr(self, parts[0], value) + elif attributes[parts[0]]["minOccurs"] == 0 and value == "": + setattr(self, parts[0], None) else: setattr(self, parts[0], elements[parts[0]]["elmt_type"]["extract"](value, False)) else: