mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 04:20:07 +01:00
Merge branch 'master' into release-prep
This commit is contained in:
@@ -319,6 +319,7 @@ class SampleMultiButtonEditor(wxpg.PGTextCtrlEditor):
|
||||
property,
|
||||
pos,
|
||||
buttons.GetPrimarySize())
|
||||
wnd = wnd.m_primary
|
||||
|
||||
# Finally, move buttons-subwindow to correct position and make sure
|
||||
# returned wxPGWindowList contains our custom button list.
|
||||
@@ -331,7 +332,7 @@ class SampleMultiButtonEditor(wxpg.PGTextCtrlEditor):
|
||||
# PGMultiButton instance.
|
||||
self.buttons = buttons
|
||||
|
||||
return (wnd, buttons)
|
||||
return wxpg.PGWindowList(wnd, buttons)
|
||||
|
||||
def OnEvent(self, propGrid, prop, ctrl, event):
|
||||
if event.GetEventType() == wx.wxEVT_COMMAND_BUTTON_CLICKED:
|
||||
@@ -429,7 +430,7 @@ class TrivialPropertyEditor(wxpg.PGEditor):
|
||||
btn = wx.Button(propgrid.GetPanel(), wxpg.PG_SUBID2, '...',
|
||||
(x+w, y),
|
||||
(bw, h), wx.WANTS_CHARS)
|
||||
return (tc, btn)
|
||||
return wxpg.PGWindowList(tc, btn)
|
||||
except:
|
||||
import traceback
|
||||
print(traceback.print_exc())
|
||||
@@ -503,8 +504,7 @@ class LargeImagePickerCtrl(wx.Panel):
|
||||
Control created and used by LargeImageEditor.
|
||||
"""
|
||||
def __init__(self):
|
||||
pre = wx.PrePanel()
|
||||
self.PostCreate(pre)
|
||||
wx.Panel.__init__(self)
|
||||
|
||||
def Create(self, parent, id_, pos, size, style = 0):
|
||||
wx.Panel.Create(self, parent, id_, pos, size,
|
||||
@@ -586,18 +586,10 @@ class LargeImageEditor(wxpg.PGEditor):
|
||||
lipc.Hide()
|
||||
lipc.Create(propgrid.GetPanel(), wxpg.PG_SUBID1, (x,y), (w,h))
|
||||
lipc.SetProperty(property)
|
||||
# Hmmm.. how to have two-stage creation without subclassing?
|
||||
#btn = wx.PreButton()
|
||||
#pre = wx.PreWindow()
|
||||
#self.PostCreate(pre)
|
||||
#if sys.platform == 'win32':
|
||||
# btn.Hide()
|
||||
#btn.Create(propgrid, wxpg.PG_SUBID2, '...', (x2-bw,pos[1]),
|
||||
# (bw,h), wx.WANTS_CHARS)
|
||||
btn = wx.Button(propgrid.GetPanel(), wxpg.PG_SUBID2, '...',
|
||||
(x+w, y),
|
||||
(bw, h), wx.WANTS_CHARS)
|
||||
return (lipc, btn)
|
||||
return wxpg.PGWindowList(lipc, btn)
|
||||
except:
|
||||
import traceback
|
||||
print(traceback.print_exc())
|
||||
|
||||
@@ -66,6 +66,9 @@ def run():
|
||||
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
module.addInitializerCode("""\
|
||||
wxPGInitResourceModule();
|
||||
""")
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
|
||||
@@ -44,8 +44,9 @@ def run():
|
||||
tools.fixWindowClass(c)
|
||||
module.addGlobalStr('wxPropertyGridNameStr', c)
|
||||
|
||||
for m in c.find('RegisterEditorClass').all():
|
||||
m.find('editor').transfer = True
|
||||
for name in ['RegisterEditorClass', 'DoRegisterEditorClass']:
|
||||
for m in c.find(name).all():
|
||||
m.find('editor').transfer = True
|
||||
|
||||
|
||||
# TODO: provide a way to use a Python callable as a sort function
|
||||
@@ -100,6 +101,13 @@ def run():
|
||||
EVT_PG_COL_END_DRAG = wx.PyEventBinder( wxEVT_PG_COL_END_DRAG, 1 )
|
||||
""")
|
||||
|
||||
module.addItem(etgtools.WigCode("""\
|
||||
enum {
|
||||
wxPG_SUBID1,
|
||||
wxPG_SUBID2,
|
||||
wxPG_SUBID_TEMP1,
|
||||
};
|
||||
"""))
|
||||
|
||||
# Switch all wxVariant types to wxPGVariant, so the propgrid-specific
|
||||
# version of the MappedType will be used for converting to/from Python
|
||||
|
||||
@@ -40,10 +40,42 @@ def run():
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxPGEditor')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
# Change the method to return the value instead of passing it
|
||||
# through a parameter for modification.
|
||||
m = c.find('GetValueFromControl')
|
||||
m.find('variant').out = True
|
||||
|
||||
# Change the virtual method handler code to follow the same pattern as the
|
||||
# tweaked public API, namely that the value is the return value instead of
|
||||
# an out parameter.
|
||||
m.cppSignature = 'bool (wxVariant& variant, wxPGProperty* property, wxWindow* ctrl)'
|
||||
m.virtualCatcherCode = """\
|
||||
PyObject *sipResObj = sipCallMethod(0, sipMethod, "DDD",
|
||||
property, sipType_wxPGProperty, NULL,
|
||||
ctrl, sipType_wxWindow, NULL);
|
||||
if (sipResObj == Py_None) {
|
||||
sipRes = false;
|
||||
} else {
|
||||
sipParseResult(&sipIsErr, sipMethod, sipResObj, "bH5", &sipRes, sipType_wxPGVariant, &variant);
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
c = module.find('wxPGMultiButton')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
c.addPyMethod('AddButton', '(self, label, id=-2)',
|
||||
doc='A simple wrapper around the PGMultiButton.Add method, for backwards compatibility.',
|
||||
body="self.Add(label, id)")
|
||||
|
||||
c.addPyMethod('AddBitmapButton', '(self, bitmap, id=-2)',
|
||||
doc='A simple wrapper around the PGMultiButton.Add method, for backwards compatibility.',
|
||||
body="self.Add(bitmap, id)")
|
||||
|
||||
# Switch all wxVariant types to wxPGVariant, so the propgrid-specific
|
||||
# version of the MappedType will be used for converting to/from Python
|
||||
|
||||
@@ -698,7 +698,7 @@ HISTORY:
|
||||
1.1 - Initial version
|
||||
"""
|
||||
|
||||
class CheckListCtrlMixin:
|
||||
class CheckListCtrlMixin(object):
|
||||
"""
|
||||
This is a mixin for ListCtrl which add a checkbox in the first
|
||||
column of each row. It is inspired by limodou's CheckList.py(which
|
||||
@@ -738,8 +738,16 @@ class CheckListCtrlMixin:
|
||||
|
||||
self.Bind(wx.EVT_LEFT_DOWN, self.__OnLeftDown_)
|
||||
|
||||
# override the default methods of ListCtrl/ListView
|
||||
self.InsertStringItem = self.__InsertStringItem_
|
||||
# Monkey-patch in a new InsertItem so we can also set the image ID for the item
|
||||
self._origInsertItem = self.InsertItem
|
||||
self.InsertItem = self.__InsertItem_
|
||||
|
||||
|
||||
def __InsertItem_(self, *args, **kw):
|
||||
index = self._origInsertItem(*args, **kw)
|
||||
self.SetItemImage(index, self.uncheck_image)
|
||||
return index
|
||||
|
||||
|
||||
def __CreateBitmap(self, flag=0, size=(16, 16)):
|
||||
"""Create a bitmap of the platforms native checkbox. The flag
|
||||
@@ -748,15 +756,13 @@ class CheckListCtrlMixin:
|
||||
"""
|
||||
bmp = wx.Bitmap(*size)
|
||||
dc = wx.MemoryDC(bmp)
|
||||
dc.SetBackground(wx.WHITE_BRUSH)
|
||||
dc.Clear()
|
||||
wx.RendererNative.Get().DrawCheckBox(self, dc,
|
||||
(0, 0, size[0], size[1]), flag)
|
||||
dc.SelectObject(wx.NullBitmap)
|
||||
return bmp
|
||||
|
||||
def __InsertStringItem_(self, index, label):
|
||||
index = self.InsertItem(index, label, 0)
|
||||
return index
|
||||
|
||||
def __OnLeftDown_(self, evt):
|
||||
(index, flags) = self.HitTest(evt.GetPosition())
|
||||
|
||||
Reference in New Issue
Block a user