MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / __init__

Method __init__

gui/builtinItemStatsViews/itemDescription.py:11–45  ·  view source on GitHub ↗
(self, parent, stuff, item)

Source from the content-addressed store, hash-verified

9
10class ItemDescription(wx.Panel):
11 def __init__(self, parent, stuff, item):
12 wx.Panel.__init__(self, parent)
13 mainSizer = wx.BoxSizer(wx.VERTICAL)
14 self.SetSizer(mainSizer)
15
16 bgcolor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
17 fgcolor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
18
19 self.description = wx.html.HtmlWindow(self)
20 if not item.description:
21 return
22
23 desc = item.description.replace("\n", "<br>")
24 # Strip font tags
25 desc = re.sub("<( *)font( *)color( *)=(.*?)>(?P<inside>.*?)<( *)/( *)font( *)>", r"\g<inside>", desc)
26 # Strip URLs
27 desc = re.sub("<( *)a(.*?)>(?P<inside>.*?)<( *)/( *)a( *)>", r"\g<inside>", desc)
28 desc = "<body bgcolor='{}' text='{}'>{}</body>".format(
29 bgcolor.GetAsString(wx.C2S_HTML_SYNTAX),
30 fgcolor.GetAsString(wx.C2S_HTML_SYNTAX),
31 desc
32 )
33
34 self.description.SetPage(desc)
35
36 mainSizer.Add(self.description, 1, wx.ALL | wx.EXPAND, 0)
37 self.Layout()
38
39 self.description.Bind(wx.EVT_CONTEXT_MENU, self.onPopupMenu)
40 self.description.Bind(wx.EVT_KEY_UP, self.onKeyUp)
41
42 self.popupMenu = wx.Menu()
43 copyItem = wx.MenuItem(self.popupMenu, 1, _t('Copy'))
44 self.popupMenu.Append(copyItem)
45 self.popupMenu.Bind(wx.EVT_MENU, self.menuClickHandler, copyItem)
46
47 def onPopupMenu(self, event):
48 self.PopupMenu(self.popupMenu)

Callers

nothing calls this directly

Calls 3

replaceMethod · 0.80
SetPageMethod · 0.80
_tFunction · 0.50

Tested by

no test coverage detected