# HG changeset patch # User Edouard Tisserant # Date 1681417893 -7200 # Node ID 223a9158417254433d72f65ab8c386373e1e5c21 # Parent 36934591f6eb26c1c5135b8b377e43cf8503ea4a IDE: more fixes for wxPython 4.0.7 and pyhon 3.10 diff -r 36934591f6eb -r 223a91584172 controls/CustomStyledTextCtrl.py --- a/controls/CustomStyledTextCtrl.py Wed Apr 12 23:02:41 2023 +0200 +++ b/controls/CustomStyledTextCtrl.py Thu Apr 13 22:31:33 2023 +0200 @@ -114,3 +114,10 @@ def AppendText(self, text): self.GotoPos(self.GetLength()) self.AddText(text) + + if wx.VERSION < (4, 1, 0): + def StartStyling(self, pos, mask=0xff): + wx.stc.StyledTextCtrl.StartStyling(self, pos, mask) + else: + def StartStyling(self, pos, *ignored): + wx.stc.StyledTextCtrl.StartStyling(self, pos) diff -r 36934591f6eb -r 223a91584172 editors/CodeFileEditor.py --- a/editors/CodeFileEditor.py Wed Apr 12 23:02:41 2023 +0200 +++ b/editors/CodeFileEditor.py Thu Apr 13 22:31:33 2023 +0200 @@ -287,7 +287,13 @@ doc_end_pos = self.GetLength() for section in self.Controler.SECTIONS_NAMES: section_comments = self.SectionsComments[section] - start_pos, end_pos = self.FindText(0, doc_end_pos, section_comments["comment"]) + txttofind = section_comments["comment"] + results = self.FindText(0, doc_end_pos, txttofind) + if wx.VERSION < (4, 1, 0): + start_pos = results + end_pos = start_pos+len(txttofind) + else: + start_pos, end_pos = results self.StartStyling(start_pos) self.SetStyling(end_pos - start_pos, STC_CODE_SECTION) self.SetLineState(self.LineFromPosition(start_pos), 1) @@ -594,7 +600,7 @@ highlight_end_pos = self.GetLineEndPosition(end[0] - 1) + end[1] + 2 self.StartStyling(highlight_start_pos) self.SetStyling(highlight_end_pos - highlight_start_pos, highlight_type) - self.StartStyling(highlight_end_pos) + self.StartStyling(highlight_end_pos, 0x00) self.SetStyling(len(self.GetText()) - highlight_end_pos, stc.STC_STYLE_DEFAULT) diff -r 36934591f6eb -r 223a91584172 editors/ConfTreeNodeEditor.py --- a/editors/ConfTreeNodeEditor.py Wed Apr 12 23:02:41 2023 +0200 +++ b/editors/ConfTreeNodeEditor.py Thu Apr 13 22:31:33 2023 +0200 @@ -181,7 +181,7 @@ self.ConfNodeName = wx.TextCtrl(self.Editor, size=wx.Size(150, 25)) self.ConfNodeName.SetFont( - wx.Font(faces["size"] * 0.75, wx.DEFAULT, wx.NORMAL, + wx.Font(round(faces["size"] * 0.75), wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName=faces["helv"])) self.ConfNodeName.Bind( wx.EVT_TEXT, diff -r 36934591f6eb -r 223a91584172 editors/TextViewer.py --- a/editors/TextViewer.py Wed Apr 12 23:02:41 2023 +0200 +++ b/editors/TextViewer.py Thu Apr 13 22:31:33 2023 +0200 @@ -191,12 +191,8 @@ def Colourise(self, start, end): self.Editor.Colourise(start, end) - if wx.VERSION < (4, 1, 0): - def StartStyling(self, pos, mask=0xff): - self.Editor.StartStyling(pos, mask) - else: - def StartStyling(self, pos, *ignored): - self.Editor.StartStyling(pos) + def StartStyling(self, *a, **k): + self.Editor.StartStyling(*a, **k) INDIC0 = 0 INDIC1 = 1 @@ -981,6 +977,6 @@ if highlight_start_pos < end_pos and highlight_end_pos > start_pos: self.StartStyling(highlight_start_pos) self.SetStyling(highlight_end_pos - highlight_start_pos, highlight_type) - self.StartStyling(highlight_start_pos, 0x00) + self.StartStyling(highlight_end_pos, 0x00) until_end = max(0, len(self.Editor.GetText()) - highlight_end_pos) self.SetStyling(until_end, wx.stc.STC_STYLE_DEFAULT)