File: wx.MemoryFSHandler.1.py

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (35 lines) | stat: -rw-r--r-- 1,357 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

        def OnAbout(self, event):

            bcur = wx.BeginBusyCursor()

            wx.FileSystem.AddHandler(wx.MemoryFSHandler)
            wx.MemoryFSHandler.AddFile("logo.pcx", wx.Bitmap("logo.pcx", wx.BITMAP_TYPE_PCX))
            wx.MemoryFSHandler.AddFile("about.htm",
                                       "<html><body>About: "
                                       "<img src=\"memory:logo.pcx\"></body></html>")

            dlg = wx.Dialog(self, -1, _("About"))

            topsizer = wx.BoxSizer(wx.VERTICAL)

            html = wx.html.HtmlWindow(dlg, size=wx.Size(380, 160), style=wx.HW_SCROLLBAR_NEVER)
            html.SetBorders(0)
            html.LoadPage("memory:about.htm")
            html.SetSize(html.GetInternalRepresentation().GetWidth(),
                         html.GetInternalRepresentation().GetHeight())

            topsizer.Add(html, 1, wx.ALL, 10)
            topsizer.Add(wx.StaticLine(dlg, -1), 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
            topsizer.Add(wx.Button(dlg, wx.ID_OK, "Ok"),
                         0, wx.ALL | wx.ALIGN_RIGHT, 15)

            dlg.SetAutoLayout(True)
            dlg.SetSizer(topsizer)
            topsizer.Fit(dlg)
            dlg.Centre()
            dlg.ShowModal()

            wx.MemoryFSHandler.RemoveFile("logo.pcx")
            wx.MemoryFSHandler.RemoveFile("about.htm")