Skip to content

Commit

Permalink
Merge branch 'master' into gh-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
swt2c committed Aug 28, 2024
2 parents 0a95e5e + f7d1d81 commit 0305314
Show file tree
Hide file tree
Showing 62 changed files with 22,210 additions and 13,142 deletions.
9 changes: 7 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import datetime
import shlex
import textwrap
import warnings

try:
import pathlib
Expand Down Expand Up @@ -1306,7 +1307,7 @@ def cmd_sip(options, args):
requires = ["sip >=6.6.2, <7"]
build-backend = "sipbuild.api"
[tool.sip.metadata]
[project]
name = "{base}"
[tool.sip.bindings.{base}]
Expand Down Expand Up @@ -1420,7 +1421,11 @@ def injectClassInfo(className, srcTxt):
tf_name = glob.glob(tmpdir + '/*.tar*')[0]
tf_dir = os.path.splitext(os.path.splitext(tf_name)[0])[0]
with tarfile.open(tf_name) as tf:
tf.extractall(tmpdir)
try:
tf.extractall(tmpdir, filter='data')
except TypeError:
warnings.warn('Falling back to less safe tarfile.extractall')
tf.extractall(tmpdir)
shutil.move(tf_dir, cfg.SIPINC)

# Copy sip's sip.h for distribution with wxPython's header
Expand Down
4 changes: 2 additions & 2 deletions buildtools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Configuration(object):
PKGDIR = 'wx'
# The name of the top-level package

SIP_ABI = '12.8'
SIP_ABI = '12.9'
SIP_TRACE = False

# ---------------------------------------------------------------
Expand Down Expand Up @@ -1081,7 +1081,7 @@ def updateLicenseFiles(cfg):
# Combine the relevant files into a single LICENSE.txt file
text = ''
for filename in ['preamble.txt', 'licence.txt', 'lgpl.txt', 'sip-license.txt']:
with open(opj('license', filename), 'r') as f:
with open(opj('license', filename), 'r', encoding='utf-8') as f:
text += f.read() + '\n\n'
with open('LICENSE.txt', 'w') as f:
f.write(text)
Expand Down
14 changes: 7 additions & 7 deletions demo/FloatCanvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ def TestHitTest(self, event=None):

x += dx
color = "SEA GREEN"
Points = N.array(( (x, y), (x, y+2.*h/3), (x+w, y+h), (x+w, y+h/2.), (x + 2.*w/3, y+h/2.), (x + 2.*w/3,y) ), N.float_)
Points = N.array(( (x, y), (x, y+2.*h/3), (x+w, y+h), (x+w, y+h/2.), (x + 2.*w/3, y+h/2.), (x + 2.*w/3,y) ), N.float64)
R = Canvas.AddPolygon(Points, LineWidth = 2, FillColor = color)
R.Name = color + " Polygon"
R.Bind(FloatCanvas.EVT_FC_RIGHT_DOWN, self.RectGotHitRight)
Expand All @@ -729,7 +729,7 @@ def TestHitTest(self, event=None):

x += dx
color = "Red"
Points = N.array(( (x, y), (x, y+2.*h/3), (x+w, y+h), (x+w, y+h/2.), (x + 2.*w/3, y+h/2.), (x + 2.*w/3,y) ), N.float_)
Points = N.array(( (x, y), (x, y+2.*h/3), (x+w, y+h), (x+w, y+h/2.), (x + 2.*w/3, y+h/2.), (x + 2.*w/3,y) ), N.float64)
R = Canvas.AddPointSet(Points, Diameter = 4, Color = color)
R.Name = "PointSet"
R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.PointSetGotHit)
Expand Down Expand Up @@ -1139,7 +1139,7 @@ def TestScaledTextBox(self, event= None):
Family = wx.FONTFAMILY_ROMAN,
Alignment = "right"
)
Point = N.array((100, -20), N.float_)
Point = N.array((100, -20), N.float64)
Box = Canvas.AddScaledTextBox("Here is even more auto wrapped text. This time the line spacing is set to 0.8. \n\nThe Padding is set to 0.",
Point,
Size = 3,
Expand All @@ -1153,7 +1153,7 @@ def TestScaledTextBox(self, event= None):
)
Canvas.AddPoint(Point, "Red", 2)

Point = N.array((0, -40), N.float_)
Point = N.array((0, -40), N.float64)
# Point = N.array((0, 0), N.float_)
for Position in ["tl", "bl", "tr", "br"]:
# for Position in ["br"]:
Expand All @@ -1172,7 +1172,7 @@ def TestScaledTextBox(self, event= None):
)
Canvas.AddPoint(Point, "Red", 4)

Point = N.array((-20, 60), N.float_)
Point = N.array((-20, 60), N.float64)
Box = Canvas.AddScaledTextBox("Here is some\ncentered\ntext",
Point,
Size = 4,
Expand All @@ -1188,7 +1188,7 @@ def TestScaledTextBox(self, event= None):
LineSpacing = 0.8
)

Point = N.array((-20, 20), N.float_)
Point = N.array((-20, 20), N.float64)
Box = Canvas.AddScaledTextBox("Here is some\nright aligned\ntext",
Point,
Size = 4,
Expand All @@ -1203,7 +1203,7 @@ def TestScaledTextBox(self, event= None):
LineSpacing = 0.8
)

Point = N.array((100, -60), N.float_)
Point = N.array((100, -60), N.float64)
Box = Canvas.AddScaledTextBox("Here is some auto wrapped text. This time it is centered, rather than right aligned.\n\nThe Padding is set to 2.",
Point,
Size = 3,
Expand Down
3 changes: 1 addition & 2 deletions demo/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import shutil
from threading import Thread

from distutils.version import LooseVersion

import wx
import wx.adv
Expand Down Expand Up @@ -2661,7 +2660,7 @@ class MyApp(wx.App, wx.lib.mixins.inspection.InspectionMixin):
def OnInit(self):

# Check runtime version
if LooseVersion(version.VERSION_STRING) != LooseVersion(wx.VERSION_STRING):
if version.VERSION_STRING != wx.VERSION_STRING:
wx.MessageBox(caption="Warning",
message="You're using version %s of wxPython, but this copy of the demo was written for version %s.\n"
"There may be some version incompatibilities..."
Expand Down
2 changes: 1 addition & 1 deletion demo/agw/ShortcutEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def ShowDialog(self, dlg):
def OnMenuShortcuts(self, event):

itemId = event.GetId()
menu = event.GetEventObject().GetMenuBar()
menu = event.GetEventObject()
menuItem = menu.FindItemById(itemId)

label = menuItem.GetItemLabel()
Expand Down
1 change: 1 addition & 0 deletions docs/sphinx/itemToModuleMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@
"DataViewBitmapRenderer":"wx.dataview.",
"DataViewCellMode":"wx.dataview.",
"DataViewCellRenderState":"wx.dataview.",
"DataViewCheckIconText":"wx.dataview.",
"DataViewCheckIconTextRenderer":"wx.dataview.",
"DataViewChoiceRenderer":"wx.dataview.",
"DataViewColumn":"wx.dataview.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@

# Normal usage
wait = wx.BusyCursor()

for i in xrange(10000):
for i in range(10000):
DoACalculation()

del wait

# It can be used as a context manager too
with wx.BusyCursor():
for i in range(10000):
DoACalculation()
9 changes: 9 additions & 0 deletions etg/_glcanvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ def run():
sipRes = wxGLCanvas::IsDisplaySupported(attribPtr);
""")

c.find('CreateSurface').setCppCode("""\
#if wxUSE_GLCANVAS_EGL
return self->CreateSurface();
#else
wxPyRaiseNotImplemented();
return false;
#endif
""")

#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
Expand Down
2 changes: 2 additions & 0 deletions etg/dataview.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'wxDataViewItem',
'wxDataViewItemAttr',
'wxDataViewIconText',
'wxDataViewCheckIconText',
'wxDataViewModelNotifier',

'wxDataViewModel',
Expand Down Expand Up @@ -308,6 +309,7 @@ def _fixupTypeParam(klass):
# them in all these classes
for name in [ 'wxDataViewTextRenderer',
'wxDataViewIconTextRenderer',
'wxDataViewCheckIconTextRenderer',
'wxDataViewProgressRenderer',
'wxDataViewSpinRenderer',
'wxDataViewToggleRenderer',
Expand Down
2 changes: 1 addition & 1 deletion etg/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def run():
module.insertItemAfter(td, etgtools.TypedefDef(type='wchar_t', name='wxChar'))
module.insertItemAfter(td, etgtools.TypedefDef(type='wxInt64', name='time_t'))
module.insertItemAfter(td, etgtools.TypedefDef(type='long long', name='wxFileOffset'))
module.insertItemAfter(td, etgtools.TypedefDef(type='SIP_SSIZE_T', name='ssize_t'))
module.insertItemAfter(td, etgtools.TypedefDef(type='Py_ssize_t', name='ssize_t'))
module.insertItemAfter(td, etgtools.TypedefDef(type='unsigned char', name='byte', pyInt=True))
module.insertItemAfter(td, etgtools.TypedefDef(type='unsigned long', name='ulong'))

Expand Down
2 changes: 1 addition & 1 deletion etg/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def wrapper(self, obj):

#---------------------------------------------
c = module.find('wxGraphicsGradientStops')
c.addCppMethod('SIP_SSIZE_T', '__len__', '()', body="return (SIP_SSIZE_T)self->GetCount();")
c.addCppMethod('Py_ssize_t', '__len__', '()', body="return (Py_ssize_t)self->GetCount();")
c.addCppMethod('wxGraphicsGradientStop*', '__getitem__', '(ulong n)',
pyArgsString='(n)',
body="return new wxGraphicsGradientStop(self->Item(n));",
Expand Down
1 change: 1 addition & 0 deletions etg/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ def setParamsPyInt(name):
if p.type == 'unsigned char':
p.pyInt = True

setParamsPyInt('Clear')
setParamsPyInt('Replace')
setParamsPyInt('ConvertAlphaToMask')
setParamsPyInt('ConvertToMono')
Expand Down
48 changes: 21 additions & 27 deletions etg/textctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,35 +114,29 @@ def parseAndTweakModule():


# OSX methods for controlling native features
c.addCppMethod('void', 'OSXEnableAutomaticQuoteSubstitution', '(bool enable)',
doc="Mac-only method for turning on/off automatic quote substitutions.",
body="""\
#ifdef __WXMAC__
self->OSXEnableAutomaticQuoteSubstitution(enable);
#else
wxPyRaiseNotImplemented();
#endif
""")
c.find('OSXEnableAutomaticQuoteSubstitution').setCppCode("""\
#ifdef __WXMAC__
self->OSXEnableAutomaticQuoteSubstitution(enable);
#else
wxPyRaiseNotImplemented();
#endif
""")

c.addCppMethod('void', 'OSXEnableAutomaticDashSubstitution', '(bool enable)',
doc="Mac-only method for turning on/off automatic dash substitutions.",
body="""\
#ifdef __WXMAC__
self->OSXEnableAutomaticDashSubstitution(enable);
#else
wxPyRaiseNotImplemented();
#endif
""")
c.find('OSXEnableAutomaticDashSubstitution').setCppCode("""\
#ifdef __WXMAC__
self->OSXEnableAutomaticDashSubstitution(enable);
#else
wxPyRaiseNotImplemented();
#endif
""")

c.addCppMethod('void', 'OSXDisableAllSmartSubstitutions', '()',
doc="Mac-only method to disable all automatic text substitutions.",
body="""\
#ifdef __WXMAC__
self->OSXDisableAllSmartSubstitutions();
#else
wxPyRaiseNotImplemented();
#endif
""")
c.find('OSXDisableAllSmartSubstitutions').setCppCode("""\
#ifdef __WXMAC__
self->OSXDisableAllSmartSubstitutions();
#else
wxPyRaiseNotImplemented();
#endif
""")

# TODO: add support for wxTextProofOptions (only supported on MSW/GTK3)
# so will need stubs on other platforms.
Expand Down
17 changes: 17 additions & 0 deletions etg/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,23 @@ def run():
return NULL;
#endif
""")
c.find('GetOrCreateAccessible').setCppCode("""\
#if wxUSE_ACCESSIBILITY
return self->GetOrCreateAccessible();
#else
wxPyRaiseNotImplemented();
return NULL;
#endif
""")
c.find('CreateAccessible').factory = True
c.find('CreateAccessible').setCppCode("""\
#if wxUSE_ACCESSIBILITY
return self->CreateAccessible();
#else
wxPyRaiseNotImplemented();
return NULL;
#endif
""")
c.find('SetAccessible.accessible').transfer = True
c.find('SetAccessible').setCppCode("""\
#if wxUSE_ACCESSIBILITY
Expand Down
11 changes: 11 additions & 0 deletions etgtools/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def extract(self, element):
# class. Should be overridden in derived classes to get what each one
# needs in addition to the base.
self.name = element.find(self.nameTag).text
if self.name is None:
self.name = ''
if '::' in self.name:
loc = self.name.rfind('::')
self.name = self.name[loc+2:]
Expand Down Expand Up @@ -1574,12 +1576,21 @@ def addElement(self, element):
extractingMsg(kind, element)
for node in element.findall('sectiondef/memberdef'):
self.addElement(node)
for node in element.findall('sectiondef/member'):
node = self.resolveRefid(node)
self.addElement(node)

else:
raise ExtractorError('Unknown module item kind: %s' % kind)

return item

def resolveRefid(self, node):
from etgtools import XMLSRC
refid = node.get('refid')
fname = os.path.join(XMLSRC, refid.rsplit('_', 1)[0]) + '.xml'
root = et.parse(fname).getroot()
return root.find(".//memberdef[@id='{}']".format(refid))


def addCppFunction(self, type, name, argsString, body, doc=None, **kw):
Expand Down
6 changes: 3 additions & 3 deletions etgtools/tweaker_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ class {ListClass}
{TypeDef}
%End
public:
SIP_SSIZE_T __len__();
Py_ssize_t __len__();
%MethodCode
sipRes = sipCpp->size();
%End
Expand Down Expand Up @@ -1129,7 +1129,7 @@ def wxArrayWrapperTemplate(ArrayClass, ItemClass, module, itemIsPtr=False, getIt
class {ArrayClass}
{{
public:
SIP_SSIZE_T __len__();
Py_ssize_t __len__();
%MethodCode
sipRes = sipCpp->GetCount();
%End
Expand Down Expand Up @@ -1183,7 +1183,7 @@ def wxArrayPtrWrapperTemplate(ArrayClass, ItemClass, module):
class {ArrayClass}
{{
public:
SIP_SSIZE_T __len__();
Py_ssize_t __len__();
%MethodCode
sipRes = sipCpp->GetCount();
%End
Expand Down
2 changes: 1 addition & 1 deletion ext/wxWidgets
Submodule wxWidgets updated 570 files
2 changes: 2 additions & 0 deletions packaging/HOWTO-Release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ HOWTO Release wxPython Phoenix
for f in wxPython-4*; do gpg --detach-sign -a $f; done
for f in $(find linux -name "*.whl"); do echo $f; gpg --detach-sign -a $f; done

NOTE: It looks like PyPI does not support gpg signatures any longer, so this step can be skipped/

12. Upload to PyPI with::

cd ~/release-builds
Expand Down
4 changes: 2 additions & 2 deletions requirements/devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
appdirs
setuptools < 74 ; sys.platform == 'win32'
setuptools ; sys.platform != 'win32'
sip == 6.7.9
sip == 6.8.5

wheel
twine
requests
requests[security]
cython==0.29.34
cython==3.0.10
pytest
pytest-xdist
pytest-forked
Expand Down
2 changes: 1 addition & 1 deletion requirements/install.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Runtime dependencies needed when using wxPython Phoenix
numpy < 1.17 ; python_version <= '2.7'
numpy ; python_version >= '3.0' and python_version < '3.12'
pillow
# pillow < 3.0
six
Loading

0 comments on commit 0305314

Please sign in to comment.