mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-10 13:57:08 +01:00
Merge branch 'master' into refactor-thumbnailctrl
This commit is contained in:
@@ -79,6 +79,8 @@ New and improved in this release:
|
||||
was done to workaround a bug in wxMac, but it seems worthwhile enough to keep
|
||||
it around even after the bug was fixed.
|
||||
|
||||
* Added the missing context manager methods for wx.LogNull. (#1842)
|
||||
|
||||
* Refactored ScrolledThumbnail out of agw.ThumbnailCtrl so as to be usable
|
||||
outside of ThumbnailCtrl.
|
||||
|
||||
|
||||
@@ -20,15 +20,17 @@ class TestPanel(wx.Panel):
|
||||
self.Bind(wx.adv.EVT_DATE_CHANGED, self.OnDateChanged, dpc)
|
||||
sizer.Add(dpc, 0, wx.ALL, 50)
|
||||
|
||||
# In some cases the widget used above will be a native date
|
||||
# picker, so show the generic one too.
|
||||
# dpc = wx.adv.DatePickerCtrlGeneric(self, size=(120,-1),
|
||||
# style = wx.TAB_TRAVERSAL
|
||||
# | wx.adv.DP_DROPDOWN
|
||||
# | wx.adv.DP_SHOWCENTURY
|
||||
# | wx.adv.DP_ALLOWNONE )
|
||||
# self.Bind(wx.adv.EVT_DATE_CHANGED, self.OnDateChanged, dpc)
|
||||
# sizer.Add(dpc, 0, wx.LEFT, 50)
|
||||
st = wx.StaticText(self,
|
||||
label="In some cases the widget used above will be a native date picker, so show the generic one too.")
|
||||
sizer.Add(st, 0, wx.LEFT, 50)
|
||||
|
||||
dpc = wx.adv.DatePickerCtrlGeneric(self, size=(120,-1),
|
||||
style = wx.adv.DP_DROPDOWN
|
||||
| wx.adv.DP_SHOWCENTURY
|
||||
| wx.adv.DP_ALLOWNONE )
|
||||
self.Bind(wx.adv.EVT_DATE_CHANGED, self.OnDateChanged, dpc)
|
||||
sizer.Add((1,15))
|
||||
sizer.Add(dpc, 0, wx.LEFT, 50)
|
||||
|
||||
|
||||
def OnDateChanged(self, evt):
|
||||
|
||||
@@ -21,6 +21,8 @@ class SVGBitmapDisplay(wx.Panel):
|
||||
sbox = wx.StaticBoxSizer(wx.VERTICAL, self, label)
|
||||
sbox.Add(self.statbmp)
|
||||
self.SetSizer(sbox)
|
||||
if not self.IsDoubleBuffered():
|
||||
self.SetDoubleBuffered(True) # Reduce flicker on size event.
|
||||
|
||||
|
||||
def UpdateSVG(self, svg_filename):
|
||||
|
||||
@@ -33,7 +33,7 @@ class SVGRenderPanel(wx.Panel):
|
||||
|
||||
|
||||
def OnPaint(self, event):
|
||||
dc = wx.PaintDC(self)
|
||||
dc = wx.BufferedPaintDC(self)
|
||||
dc.Clear()
|
||||
|
||||
iw, ih = (self._img.width, self._img.height) if self._img else (100,100)
|
||||
|
||||
@@ -891,6 +891,7 @@
|
||||
"DataViewVirtualListModel":"wx.dataview.",
|
||||
"DateEvent":"wx.adv.",
|
||||
"DatePickerCtrl":"wx.adv.",
|
||||
"DatePickerCtrlGeneric":"wx.adv.",
|
||||
"DateProperty":"wx.propgrid.",
|
||||
"DateSpan":"wx.",
|
||||
"DateTime":"wx.",
|
||||
|
||||
@@ -42,8 +42,8 @@ def run():
|
||||
gdpc = tools.copyClassDef(dpc, 'wxDatePickerCtrlGeneric')
|
||||
assert isinstance(gdpc, etgtools.ClassDef)
|
||||
module.insertItemAfter(dpc, gdpc)
|
||||
# and give it a new Python name to match Classic
|
||||
gdpc.pyName = 'GenericDatePickerCtrl'
|
||||
# and give it an alias matching the class name in Classic
|
||||
module.addPyCode("GenericDatePickerCtrl = DatePickerCtrlGeneric")
|
||||
|
||||
# now back to our regular tweaking
|
||||
for c in [dpc, gdpc]:
|
||||
|
||||
@@ -116,11 +116,13 @@ def run():
|
||||
c.addPrivateCopyCtor()
|
||||
c.addPrivateAssignOp()
|
||||
|
||||
|
||||
|
||||
c = module.find('wxLogFormatter')
|
||||
c.find('FormatTime').ignore(False)
|
||||
|
||||
c = module.find('wxLogNull')
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
|
||||
@@ -215,18 +215,20 @@ def run():
|
||||
|
||||
c.find('GetPropertyValues').ignore()
|
||||
c.addPyMethod('GetPropertyValues',
|
||||
'(self, dict_=None, as_strings=False, inc_attributes=False)',
|
||||
'(self, dict_=None, as_strings=False, inc_attributes=False, flags=PG_ITERATE_PROPERTIES)',
|
||||
doc="""\
|
||||
Returns all property values in the grid.\n
|
||||
:param `dict_`: A to fill with the property values. If not given,
|
||||
then a new one is created. The dict_ can be an object as well,
|
||||
in which case it's __dict__ is used.
|
||||
Returns all property values in the grid.
|
||||
|
||||
:param `dict_`: A diftionary to fill with the property values.
|
||||
If not given, then a new one is created. The dict_ can be an
|
||||
object as well, in which case it's __dict__ is used.
|
||||
:param `as_strings`: if True, then string representations of values
|
||||
are fetched instead of native types. Useful for config and such.
|
||||
:param `inc_attributes`: if True, then property attributes are added
|
||||
in the form of "@<propname>@<attr>".
|
||||
in the form of ``"@<propname>@<attr>"``.
|
||||
:param `flags`: Flags to pass to the iterator. See :ref:`wx.propgrid.PG_ITERATOR_FLAGS`.
|
||||
:returns: A dictionary with values. It is always a dictionary,
|
||||
so if dict_ was and object with __dict__ attribute, then that
|
||||
so if dict_ was an object with __dict__ attribute, then that
|
||||
attribute is returned.
|
||||
""",
|
||||
body="""\
|
||||
@@ -237,7 +239,7 @@ def run():
|
||||
|
||||
getter = self.GetPropertyValue if not as_strings else self.GetPropertyValueAsString
|
||||
|
||||
it = self.GetVIterator(PG_ITERATE_PROPERTIES)
|
||||
it = self.GetVIterator(flags)
|
||||
while not it.AtEnd():
|
||||
p = it.GetProperty()
|
||||
name = p.GetName()
|
||||
@@ -314,7 +316,7 @@ def run():
|
||||
self.Refresh()
|
||||
""")
|
||||
|
||||
# TODO: should these be marked as deprecated?
|
||||
# TODO: should these be marked as deprecated? Probably...
|
||||
module.addPyCode("""\
|
||||
PropertyGridInterface.GetValues = PropertyGridInterface.GetPropertyValues
|
||||
PropertyGridInterface.SetValues = PropertyGridInterface.SetPropertyValues
|
||||
@@ -503,6 +505,14 @@ def run():
|
||||
c.addPyProperty('Items', '_Items')
|
||||
|
||||
|
||||
def postProcessReST(text):
|
||||
# fix some autodoc glitches
|
||||
text = text.replace(':ref:`PropertyGridIterator Flags <propertygriditerator flags>`',
|
||||
':ref:`wx.propgrid.PG_ITERATOR_FLAGS`')
|
||||
return text
|
||||
|
||||
c.setReSTPostProcessor(postProcessReST)
|
||||
|
||||
#----------------------------------------------------------
|
||||
|
||||
module.addItem(
|
||||
|
||||
@@ -684,6 +684,7 @@ class ClassDef(BaseDef):
|
||||
self.isInner = False # Is this a nested class?
|
||||
self.klass = None # if so, then this is the outer class
|
||||
self.preMethodCode = None
|
||||
self.postProcessReST = None
|
||||
|
||||
# Stuff that needs to be generated after the class instead of within
|
||||
# it. Some back-end generators need to put stuff inside the class, and
|
||||
@@ -1157,6 +1158,11 @@ private:
|
||||
self.addItem(item)
|
||||
return item
|
||||
|
||||
def setReSTPostProcessor(self, func):
|
||||
"""
|
||||
Set a function to be called after the class's docs have been generated.
|
||||
"""
|
||||
self.postProcessReST = func
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ from sphinxtools.utilities import pickleClassInfo, pickleFunctionInfo, isNumeric
|
||||
from sphinxtools.utilities import underscore2Capitals, countSpaces
|
||||
from sphinxtools.utilities import formatContributedSnippets
|
||||
from sphinxtools.utilities import PickleFile
|
||||
from sphinxtools.utilities import textfile_open
|
||||
|
||||
from sphinxtools.constants import VERSION, REMOVED_LINKS, SECTIONS
|
||||
from sphinxtools.constants import MAGIC_METHODS, MODULENAME_REPLACE
|
||||
@@ -3230,6 +3231,14 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
f = dispatch[item.__class__][0]
|
||||
f(item)
|
||||
|
||||
if klass.postProcessReST is not None:
|
||||
full_name = os.path.join(SPHINXROOT, filename)
|
||||
with textfile_open(full_name) as f:
|
||||
text = f.read()
|
||||
text = klass.postProcessReST(text)
|
||||
with textfile_open(full_name, 'wt') as f:
|
||||
f.write(text)
|
||||
|
||||
if klass.enum_list:
|
||||
stream = StringIO()
|
||||
stream.write("\n.. toctree::\n :maxdepth: 1\n :hidden:\n\n")
|
||||
|
||||
Submodule ext/wxWidgets updated: 15f1f7a9e5...f65caa3183
@@ -3,7 +3,7 @@
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 1-June-2012
|
||||
# Copyright: (c) 2012-2018 by Total Control Software
|
||||
# Copyright: (c) 2012-2020 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Author: Andrea Gavana
|
||||
#
|
||||
# Created: 30-Nov-2010
|
||||
# Copyright: (c) 2010-2018 by Total Control Software
|
||||
# Copyright: (c) 2010-2020 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Author: Andrea Gavana
|
||||
#
|
||||
# Created: 30-Nov-2010
|
||||
# Copyright: (c) 2010-2018 by Total Control Software
|
||||
# Copyright: (c) 2010-2020 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Author: Andrea Gavana
|
||||
#
|
||||
# Created: 30-Nov-2010
|
||||
# Copyright: (c) 2010-2018 by Total Control Software
|
||||
# Copyright: (c) 2010-2020 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Author: Andrea Gavana
|
||||
#
|
||||
# Created: 30-Nov-2010
|
||||
# Copyright: (c) 2010-2018 by Total Control Software
|
||||
# Copyright: (c) 2010-2020 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Author: Andrea Gavana
|
||||
#
|
||||
# Created: 30-Nov-2010
|
||||
# Copyright: (c) 2010-2018 by Total Control Software
|
||||
# Copyright: (c) 2010-2020 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -561,7 +561,7 @@ header = """\
|
||||
This file was generated by Phoenix's sphinx generator and associated
|
||||
tools, do not edit by hand.
|
||||
|
||||
Copyright: (c) 2011-2018 by Total Control Software
|
||||
Copyright: (c) 2011-2020 by Total Control Software
|
||||
License: wxWindows License
|
||||
|
||||
"""
|
||||
@@ -861,3 +861,17 @@ def isPython3():
|
||||
|
||||
return sys.version_info >= (3, )
|
||||
|
||||
|
||||
def textfile_open(filename, mode='rt'):
|
||||
"""
|
||||
Simple wrapper around open() that will use codecs.open on Python2 and
|
||||
on Python3 will add the encoding parameter to the normal open(). The
|
||||
mode parameter must include the 't' to put the stream into text mode.
|
||||
"""
|
||||
assert 't' in mode
|
||||
if sys.version_info < (3,):
|
||||
import codecs
|
||||
mode = mode.replace('t', '')
|
||||
return codecs.open(filename, mode, encoding='utf-8')
|
||||
else:
|
||||
return open(filename, mode, encoding='utf-8')
|
||||
|
||||
@@ -23,6 +23,12 @@ class log_Tests(wtc.WidgetTestCase):
|
||||
wx.LogMessage("This is a test")
|
||||
self.assertTrue(log.messageLogged)
|
||||
|
||||
|
||||
def test_lognull_is_context_mgr(self):
|
||||
with wx.LogNull():
|
||||
pass
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ class Throbber(wx.Panel):
|
||||
:param `event`: a :class:`PaintEvent` event to be processed.
|
||||
|
||||
"""
|
||||
self.Draw(wx.PaintDC(self))
|
||||
self.Draw(wx.BufferedPaintDC(self))
|
||||
event.Skip()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user