mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-09 05:20:08 +01:00
More code snippets converted for the docs
This commit is contained in:
@@ -2446,6 +2446,8 @@
|
||||
"PGEditor_Choice":"wx.propgrid.",
|
||||
"PGEditor_ChoiceAndButton":"wx.propgrid.",
|
||||
"PGEditor_ComboBox":"wx.propgrid.",
|
||||
"PGEditor_DatePickerCtrl":"wx.propgrid.",
|
||||
"PGEditor_SpinCtrl":"wx.propgrid.",
|
||||
"PGEditor_TextCtrl":"wx.propgrid.",
|
||||
"PGEditor_TextCtrlAndButton":"wx.propgrid.",
|
||||
"PGFileDialogAdapter":"wx.propgrid.",
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
# Thanks to the magic of Python nothing extra needs to be done here.
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
def OnButtonClick(self, propGrid, value):
|
||||
dlgSize = wx.Size(... size of your dialog ...)
|
||||
dlgPos = propGrid.GetGoodEditorDialogPosition(self, dlgSize)
|
||||
|
||||
# Create dialog dlg at dlgPos. Use value as initial string
|
||||
# value.
|
||||
with MyCustomDialog(None, title, pos=dlgPos, size=dlgSize) as dlg:
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
value = dlg.GetStringValue()
|
||||
return (True, value)
|
||||
return (False, value)
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
self.SetFlag(wx.propgrid.PG_PROP_NO_ESCAPE)
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
class MyProperty(wx.propgrid.PGProperty):
|
||||
# All arguments of this ctor should have a default value -
|
||||
# use wx.propgrid.PG_LABEL for label and name
|
||||
def __init__(self,
|
||||
label = wx.propgrid.PG_LABEL,
|
||||
name = wx.propgrid.PG_LABEL,
|
||||
value = ""):
|
||||
wx.propgrid.PGProperty.__init__(label, name)
|
||||
self.value = value
|
||||
|
||||
def DoGetEditorClass(self):
|
||||
# Determines editor used by property.
|
||||
# You can replace 'TextCtrl' below with any of these
|
||||
# builtin-in property editor identifiers: Choice, ComboBox,
|
||||
# TextCtrlAndButton, ChoiceAndButton, CheckBox, SpinCtrl,
|
||||
# DatePickerCtrl.
|
||||
return wx.PGEditor_TextCtrl
|
||||
|
||||
def ValueToString(self, value, argFlags):
|
||||
# TODO: Convert given property value to a string and return it
|
||||
return ""
|
||||
|
||||
def StringToValue(self, text, argFlags):
|
||||
# TODO: Adapt string to property value and return it
|
||||
value = do_something(text)
|
||||
return (True, value)
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class MyProperty(wx.propgrid.PGProperty):
|
||||
def __init__(self, label, name, value):
|
||||
wx.propgrid.PGProperty.__init__(self, label, name)
|
||||
self.SetValue(value)
|
||||
|
||||
Reference in New Issue
Block a user