beremiz

Parents deb0fcab0c64
Children 3d79c31e4697
Fixed LogConsole: set read only, enabled copy selected text with CTRL+C and primary selection
  • +18 -0
    Beremiz.py
  • +13 -3
    IDEFrame.py
  • --- a/Beremiz.py Fri Mar 29 14:23:18 2013 +0900
    +++ b/Beremiz.py Fri Apr 05 00:05:40 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()
    --- a/IDEFrame.py Fri Mar 29 14:23:18 2013 +0900
    +++ b/IDEFrame.py Fri Apr 05 00:05:40 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)