mirror of https://github.com/chriskiehl/Gooey.git
Chris
3 years ago
3 changed files with 81 additions and 2 deletions
Unified View
Diff Options
@ -0,0 +1,40 @@ |
|||||
|
import rewx.components as c |
||||
|
import wx |
||||
|
import wx.html2 |
||||
|
from rewx import wsx, render |
||||
|
|
||||
|
|
||||
|
def _html_window(html): |
||||
|
return wsx( |
||||
|
[c.Block, {'orient': wx.VERTICAL, 'flag': wx.EXPAND}, |
||||
|
[c.HtmlWindow, {'style': wx.TE_READONLY, 'flag': wx.EXPAND | wx.ALL, |
||||
|
'proportion': 1, 'value': html}]] |
||||
|
) |
||||
|
|
||||
|
|
||||
|
class HtmlDialog(wx.Dialog): |
||||
|
""" |
||||
|
A MessageDialog where the central contents are an HTML window |
||||
|
customizable by the user. |
||||
|
""" |
||||
|
def __init__(self, *args, **kwargs): |
||||
|
caption = kwargs.pop('caption', '') |
||||
|
html = kwargs.pop('html', '') |
||||
|
super(HtmlDialog, self).__init__(None, *args, **kwargs) |
||||
|
|
||||
|
wx.InitAllImageHandlers() |
||||
|
|
||||
|
self.SetTitle(caption) |
||||
|
sizer = wx.BoxSizer(wx.VERTICAL) |
||||
|
sizer.Add(render(_html_window(html), self), 1, wx.EXPAND) |
||||
|
|
||||
|
# in addition to creating the sizer, this actually attached |
||||
|
# a few common handlers which makes it feel more dialog-y. Thus |
||||
|
# it being done here rather than in rewx |
||||
|
btnSizer = self.CreateStdDialogButtonSizer(wx.OK) |
||||
|
sizer.Add(btnSizer, 0, wx.ALL | wx.EXPAND, 9) |
||||
|
self.SetSizer(sizer) |
||||
|
self.Layout() |
||||
|
|
||||
|
|
||||
|
|
Write
Preview
Loading…
Cancel
Save