From a3e3ddb60f9f05abf6fc69f9acf51effc7ebf37c Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 14 Sep 2016 20:34:29 -0700 Subject: [PATCH] More code snippets converted for the docs --- docs/sphinx/itemToModuleMap.json | 2 ++ .../converted/wx.propgrid.PGProperty.1.py | 2 ++ .../converted/wx.propgrid.PGProperty.2.py | 12 +++++++++ .../converted/wx.propgrid.PGProperty.3.py | 2 ++ .../converted/wx.propgrid.PGProperty.4.py | 0 .../converted/wx.propgrid.PGProperty.5.py | 0 .../converted/wx.propgrid.PGProperty.6.py | 27 +++++++++++++++++++ .../converted/wx.propgrid.PGProperty.7.py | 0 .../wx.propgrid.PGProperty.__init__.1.py | 6 +++++ 9 files changed, 51 insertions(+) create mode 100644 docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.1.py create mode 100644 docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.2.py create mode 100644 docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.3.py create mode 100644 docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.4.py create mode 100644 docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.5.py create mode 100644 docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.6.py create mode 100644 docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.7.py create mode 100644 docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.__init__.1.py diff --git a/docs/sphinx/itemToModuleMap.json b/docs/sphinx/itemToModuleMap.json index 8f35c420..832b93e0 100644 --- a/docs/sphinx/itemToModuleMap.json +++ b/docs/sphinx/itemToModuleMap.json @@ -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.", diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.1.py new file mode 100644 index 00000000..6fab1f80 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.1.py @@ -0,0 +1,2 @@ + + # Thanks to the magic of Python nothing extra needs to be done here. diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.2.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.2.py new file mode 100644 index 00000000..c4e11dc6 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.2.py @@ -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) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.3.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.3.py new file mode 100644 index 00000000..1c79ca1f --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.3.py @@ -0,0 +1,2 @@ + + self.SetFlag(wx.propgrid.PG_PROP_NO_ESCAPE) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.4.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.4.py new file mode 100644 index 00000000..e69de29b diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.5.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.5.py new file mode 100644 index 00000000..e69de29b diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.6.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.6.py new file mode 100644 index 00000000..d45a72b7 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.6.py @@ -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) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.7.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.7.py new file mode 100644 index 00000000..e69de29b diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.__init__.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.__init__.1.py new file mode 100644 index 00000000..c1920926 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.propgrid.PGProperty.__init__.1.py @@ -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) +