forked from wxWidgets/Phoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
257 additions
and
38 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
docs/sphinx/rest_substitutions/snippets/python/AppConsole.SetCLocale.2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
std.locale.global(std.locale("")) |
9 changes: 9 additions & 0 deletions
9
docs/sphinx/rest_substitutions/snippets/python/AppConsole.StoreCurrentException.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
void MyFrame.SomeFunction() | ||
|
||
try | ||
MyDialog dlg(self) | ||
dlg.ShowModal() | ||
catch (const MyExpectedException& e) | ||
# Deal with the exceptions thrown from the dialog. | ||
|
38 changes: 38 additions & 0 deletions
38
docs/sphinx/rest_substitutions/snippets/python/AppConsole.StoreCurrentException.2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
class MyApp : public wx.App | ||
public: | ||
virtual bool StoreCurrentException() | ||
|
||
try | ||
throw | ||
catch (const std.runtime_exception& e) | ||
if (!self.runtimeError.empty()) | ||
# This is not supposed to happen, only one exception, | ||
# at most, should be stored. | ||
return false | ||
|
||
|
||
self.runtimeError = e.what() | ||
|
||
# Don't terminate, let our code handle self exception later. | ||
return true | ||
catch (...) | ||
# This could be extended to store information about any | ||
# other exceptions too, but if we don't store them, we | ||
# should return false to let the program die. | ||
|
||
|
||
return false | ||
|
||
|
||
virtual void RethrowStoredException() | ||
|
||
if (!self.runtimeError.empty()) | ||
std.runtime_exception e(self.runtimeError) | ||
self.runtimeError.clear() | ||
throw e | ||
|
||
|
||
|
||
private: | ||
std.string self.runtimeError |
2 changes: 2 additions & 0 deletions
2
docs/sphinx/rest_substitutions/snippets/python/Bitmap.NewFromPNGData.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
#include <wx./imagpng.h> |
10 changes: 10 additions & 0 deletions
10
docs/sphinx/rest_substitutions/snippets/python/BusyInfo.3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
wx.WindowDisabler disableAll | ||
wx.BusyInfo wait("Please wait, working...") | ||
|
||
for (int i = 0 i < 100000 i++) | ||
|
||
DoACalculation() | ||
|
||
if (!(i % 1000)) | ||
wx.TheApp.Yield() |
2 changes: 2 additions & 0 deletions
2
docs/sphinx/rest_substitutions/snippets/python/BusyInfo.__init__.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
wx.BusyInfo(wx.BusyInfoFlags().Parent(parent).Label(message)) |
11 changes: 11 additions & 0 deletions
11
docs/sphinx/rest_substitutions/snippets/python/BusyInfoFlags.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
wx.BusyInfo info | ||
( | ||
wx.BusyInfoFlags() | ||
.Parent(window) | ||
.Icon(icon) | ||
.Title("Some text") | ||
.Text("Some more text") | ||
.Foreground(wx.Colour(...)) | ||
.Background(wx.Colour(...)) | ||
) |
2 changes: 2 additions & 0 deletions
2
docs/sphinx/rest_substitutions/snippets/python/DateTime.SetTimeT.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
(time_t)-1 |
12 changes: 12 additions & 0 deletions
12
docs/sphinx/rest_substitutions/snippets/python/EvtHandler.TryAfter.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
class MyClass : public BaseClass # inheriting from wx.EvtHandler | ||
|
||
... | ||
protected: | ||
virtual bool TryAfter(wx.Event& event) | ||
|
||
if (BaseClass.TryAfter(event)) | ||
return true | ||
|
||
return MyPostProcess(event) | ||
|
12 changes: 12 additions & 0 deletions
12
docs/sphinx/rest_substitutions/snippets/python/EvtHandler.TryBefore.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
class MyClass : public BaseClass # inheriting from wx.EvtHandler | ||
|
||
... | ||
protected: | ||
virtual bool TryBefore(wx.Event& event) | ||
|
||
if (MyPreProcess(event)) | ||
return true | ||
|
||
return BaseClass.TryBefore(event) | ||
|
4 changes: 4 additions & 0 deletions
4
docs/sphinx/rest_substitutions/snippets/python/Image.SetLoadFlags.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
wx.Image image | ||
image.SetLoadFlags(image.GetLoadFlags() & ~wx.Image.Load_Verbose) | ||
image.LoadFile(...) |
2 changes: 2 additions & 0 deletions
2
docs/sphinx/rest_substitutions/snippets/python/SVGFileDC.SetBitmapHandler.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
mySVGFileDC.SetBitmapHandler(wx.SVGBitmapEmbedHandler()) |
2 changes: 2 additions & 0 deletions
2
docs/sphinx/rest_substitutions/snippets/python/Window.FromDIP.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
wx.Bitmap bmp(FromDIP(32, 32)) |
2 changes: 2 additions & 0 deletions
2
docs/sphinx/rest_substitutions/snippets/python/Window.FromDIP.2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
wx.Bitmap bmp(FromDIP(32, 32)) |
3 changes: 3 additions & 0 deletions
3
docs/sphinx/rest_substitutions/snippets/python/Window.ToDIP.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
wx.Point pt(ToDIP(GetPosition())) | ||
wx.Size size(ToDIP(GetSize())) |
3 changes: 3 additions & 0 deletions
3
docs/sphinx/rest_substitutions/snippets/python/Window.ToDIP.2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
wx.Point pt(ToDIP(GetPosition())) | ||
wx.Size size(ToDIP(GetSize())) |
17 changes: 17 additions & 0 deletions
17
docs/sphinx/rest_substitutions/snippets/python/glcanvas.GLAttribsBase.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
wx.GLContextAttrs cxtAttrs | ||
# Some values | ||
cxtAttrs.CoreProfile().OGLVersion(5, 0) # OGL 5.0, whenever available | ||
cxtAttrs.PlatformDefaults() | ||
# Values usually are platform-dependant named (even value assigned!) | ||
#if defined(__WXMSW__) | ||
cxtAttrs.AddAttribute(WGL_NEW_CTX_F) | ||
cxtAttrs.AddAttribBits(WGL_CONTEXT_PROFILE_MASK_ARB, WGL_NEW_BITS) | ||
#elif defined(__WXX11__) | ||
cxtAttrs.AddAttribute(GLX_NEW_CTX_F) | ||
cxtAttrs.AddAttribBits(GLX_CONTEXT_PROFILE_MASK_ARB, GLX_NEW_BITS) | ||
#else | ||
# Other platforms | ||
#endif | ||
cxtAttrs.EndList() # Don't forget self | ||
cxtAttrs.SetNeedsARB(true) # Context attributes are set by an ARB-function |
3 changes: 3 additions & 0 deletions
3
docs/sphinx/rest_substitutions/snippets/python/glcanvas.GLAttributes.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
wx.GLAttributes dispAttrs | ||
dispAttrs.PlatformDefaults().MinRGBA(8, 8, 8, 8).DoubleBuffer().Depth(32).EndList() |
3 changes: 3 additions & 0 deletions
3
docs/sphinx/rest_substitutions/snippets/python/glcanvas.GLContextAttrs.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
wx.GLContextAttrs cxtAttrs | ||
cxtAttrs.CoreProfile().OGLVersion(4, 5).Robust().ResetIsolation().EndList() |
13 changes: 13 additions & 0 deletions
13
docs/sphinx/rest_substitutions/snippets/python/html.HtmlParser.PushTagHandler.2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
TAG_HANDLER_BEGIN(MYITEM, "MYITEMS") | ||
TAG_HANDLER_PROC(tag) | ||
|
||
# ...something... | ||
|
||
self.Parser . PushTagHandler(self, "PARAM") | ||
ParseInner(tag) | ||
self.Parser . PopTagHandler() | ||
|
||
# ...something... | ||
|
||
TAG_HANDLER_END(MYITEM) |
4 changes: 4 additions & 0 deletions
4
docs/sphinx/rest_substitutions/snippets/python/html.HtmlWindow.AddFilter.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
text/html | ||
text/plain | ||
image/* |
12 changes: 12 additions & 0 deletions
12
docs/sphinx/rest_substitutions/snippets/python/html2.WebView.GetNativeBackend.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
#include <webkit/webkit.h> | ||
|
||
#ifdef __WXGTK__ | ||
WebKitWebView* | ||
wv = static_cast<WebKitWebView*>(self.window.GetNativeBackend()) | ||
|
||
WebKitWebSettings* settings = webkit_web_view_get_settings(wv) | ||
g_object_set(G_OBJECT(settings), | ||
"enable-frame-flattening", TRUE, | ||
NULL) | ||
#endif |
15 changes: 15 additions & 0 deletions
15
docs/sphinx/rest_substitutions/snippets/python/media.MediaCtrl.1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
#connect to the media event | ||
self.Connect(wx.MY_ID, wx.EVT_MEDIA_STOP, (wx.ObjectEventFunction) | ||
(wx.EventFunction)(wx.MediaEventFunction) &MyFrame.OnMediaStop) | ||
|
||
#... | ||
void MyFrame.OnMediaStop(const wx.MediaEvent& evt) | ||
|
||
if(bUserWantsToSeek) | ||
|
||
self.mediactrl.SetPosition( | ||
self.mediactrl.GetDuration() << 1 | ||
) | ||
evt.Veto() | ||
|
16 changes: 16 additions & 0 deletions
16
docs/sphinx/rest_substitutions/snippets/python/xml.XmlDocument.4.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
# Create a document and add the root node. | ||
wx.XmlDocument xmlDoc | ||
|
||
wx.XmlNode* root = wx.XmlNode(NULL, wx.XML_ELEMENT_NODE, "Root") | ||
xmlDoc.SetRoot(root) | ||
|
||
# Add some XML. | ||
wx.XmlNode* library = wx.XmlNode (root, wx.XML_ELEMENT_NODE, "Library") | ||
library.AddAttribute("type", "CrossPlatformList") | ||
wx.XmlNode* name = wx.XmlNode(library, wx.XML_ELEMENT_NODE, "Name") | ||
name.AddChild(wx.XmlNode(wx.XML_TEXT_NODE, "", "wx.Widgets")) | ||
|
||
# Write the output to a wx.String. | ||
wx.StringOutputStream stream | ||
xmlDoc.Save(stream) |
7 changes: 7 additions & 0 deletions
7
docs/sphinx/rest_substitutions/snippets/python/xml.XmlDocument.5.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Root> | ||
<Library type="CrossPlatformList"> | ||
<Name>wx.Widgets</Name> | ||
</Library> | ||
</Root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters