Skip to content

Commit 096b00e

Browse files
committed
Merge branch 'master' into release-prep
2 parents 0ff5ce6 + 93bca1d commit 096b00e

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

CHANGES.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,18 @@ Changes in this release include the following:
115115
* Allow extra CLI args to be passed to build.py by setting WXPYTHON_BUILD_ARGS
116116
in the environment.
117117

118+
* Added context manager methods to wx.DC that explicitly destroys the C++
119+
part of the DC upon exit. Using DCs as context managers is not required, but
120+
can be handy in the rare cases where something holds on to a DC for too
121+
long, perhaps unintentionally. (#680)
122+
123+
* Fixed crash due to too aggressive management of wxModules when we load
124+
subordinate extensions that have their own wxModules (wx.html, wx.adv, etc.)
125+
(#688)
126+
127+
* Fixed StyledTextCtrl.MarkerDefineRGBAImage and RegisterRGBAImage methods to
128+
be able to accept any Python buffer compatible object for the pixel data. (#716)
129+
118130

119131

120132

@@ -212,14 +224,6 @@ Changes in this release include the following:
212224
point values to integers, and a couple other possible incorrect
213225
conversions. (#536)
214226

215-
* Added context manager methods to wx.DC that explicitly destroys the C++
216-
part of the DC upon exit. Using DCs as context managers is not required, but
217-
can be handy in the rare cases where something holds on to a DC for too
218-
long, perhaps unintentionally. (#680)
219-
220-
* Fixed crash due to too aggressive management of wxModules when we load
221-
subordinate extensions that have their own wxModules (wx.html, wx.adv, etc.)
222-
(#688)
223227

224228

225229

etg/_stc.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def run():
6464
#-----------------------------------------------------------------
6565

6666
module.addHeaderCode('#include <wx/stc/stc.h>')
67+
module.addHeaderCode('#include "wxpybuffer.h"')
6768

6869

6970
c = module.find('wxStyledTextCtrl')
@@ -162,6 +163,29 @@ def run():
162163
c.find('ShowNativeCaret').ignore()
163164
c.find('HideNativeCaret').ignore()
164165

166+
# Change the *RGBAImage methods to accept any buffer object
167+
c.find('MarkerDefineRGBAImage').ignore()
168+
c.addCppMethod('void', 'MarkerDefineRGBAImage', '(int markerNumber, wxPyBuffer* pixels)',
169+
doc="""\
170+
Define a marker from RGBA data.\n
171+
It has the width and height from RGBAImageSetWidth/Height. You must
172+
ensure that the buffer is at least width*height*4 bytes long.
173+
""",
174+
body="""\
175+
self->MarkerDefineRGBAImage(markerNumber, (unsigned char*)pixels->m_ptr);
176+
""")
177+
178+
c.find('RegisterRGBAImage').ignore()
179+
c.addCppMethod('void', 'RegisterRGBAImage', '(int type, wxPyBuffer* pixels)',
180+
doc="""\
181+
Register an RGBA image for use in autocompletion lists.\n
182+
It has the width and height from RGBAImageSetWidth/Height. You must
183+
ensure that the buffer is at least width*height*4 bytes long.
184+
""",
185+
body="""\
186+
self->RegisterRGBAImage(type, (unsigned char*)pixels->m_ptr);
187+
""")
188+
165189

166190
# TODO: Add the UTF8 PyMethods from classic (see _stc_utf8_methods.py)
167191

wx/lib/pydocview.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3013,6 +3013,7 @@ def BuildWindowMenu(self, currentFrame):
30133013
currentFrame = wx.GetApp().GetTopWindow()
30143014

30153015
windowMenuIndex = currentFrame.GetMenuBar().FindMenu(_("&Window"))
3016+
assert windowMenuIndex != wx.NOT_FOUND, "Menu not found in MenuBar for {}".format(_("&Window"))
30163017
windowMenu = currentFrame.GetMenuBar().GetMenu(windowMenuIndex)
30173018

30183019
if self.GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI:

0 commit comments

Comments
 (0)