| 1427 | |
| 1428 | class PFNotebookPagePreview(wx.Frame): |
| 1429 | def __init__(self, parent, pos, bitmap, title): |
| 1430 | super().__init__(parent, id=wx.ID_ANY, title=wx.EmptyString, pos=pos, |
| 1431 | size=wx.DefaultSize, style=wx.NO_BORDER | |
| 1432 | wx.FRAME_NO_TASKBAR | |
| 1433 | wx.STAY_ON_TOP) |
| 1434 | self.SetBackgroundStyle(wx.BG_STYLE_PAINT) |
| 1435 | self.title = title |
| 1436 | self.bitmap = bitmap |
| 1437 | self.SetSize((bitmap.GetWidth(), bitmap.GetHeight())) |
| 1438 | self.Bind(wx.EVT_PAINT, self.OnWindowPaint) |
| 1439 | self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnWindowEraseBk) |
| 1440 | self.Bind(wx.EVT_TIMER, self.OnTimer) |
| 1441 | |
| 1442 | self.timer = wx.Timer(self, wx.ID_ANY) |
| 1443 | self.timerSleep = None |
| 1444 | self.timerSleepId = wx.NewId() |
| 1445 | self.direction = 1 |
| 1446 | self.padding = 15 |
| 1447 | self.transp = 0 |
| 1448 | |
| 1449 | hfont = wx.Font(fonts.NORMAL, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False) |
| 1450 | self.SetFont(hfont) |
| 1451 | |
| 1452 | tx, ty = self.GetTextExtent(self.title) |
| 1453 | tx += self.padding * 2 |
| 1454 | |
| 1455 | if bitmap.GetWidth() < tx: |
| 1456 | width = tx |
| 1457 | else: |
| 1458 | width = bitmap.GetWidth() |
| 1459 | |
| 1460 | self.SetSize((width, bitmap.GetHeight() + 16)) |
| 1461 | |
| 1462 | self.SetTransparent(0) |
| 1463 | self.Refresh() |
| 1464 | |
| 1465 | def OnTimer(self, event): |
| 1466 | self.transp += 20 * self.direction |