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

Method __init__

gui/builtinViews/entityEditor.py:39–73  ·  view source on GitHub ↗
(self, parent, entityName, selected=None)

Source from the content-addressed store, hash-verified

37 """
38
39 def __init__(self, parent, entityName, selected=None):
40 wx.Panel.__init__(self, parent, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL)
41 self.entityName = entityName
42 self.validator = None
43 self.navSizer = wx.BoxSizer(wx.HORIZONTAL)
44
45 self.choices = []
46 self.choices.sort(key=lambda p: p.name)
47 self.entityChoices = wx.Choice(self, choices=[p.name for p in self.choices])
48 self.navSizer.Add(self.entityChoices, 1, wx.ALL, 5)
49
50 buttons = (("new", wx.ART_NEW, self.OnNew),
51 ("rename", BitmapLoader.getBitmap("rename", "gui"), self.OnRename),
52 ("copy", wx.ART_COPY, self.OnCopy),
53 ("delete", wx.ART_DELETE, self.OnDelete))
54
55 size = None
56 for name, art, func in buttons:
57 bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) if name != "rename" else art
58 btn = wx.BitmapButton(self, wx.ID_ANY, bitmap)
59 if size is None:
60 size = btn.GetSize()
61
62 btn.SetMinSize(size)
63 btn.SetMaxSize(size)
64
65 btn.SetToolTip("{} {}".format(name.capitalize(), self.entityName))
66 btn.Bind(wx.EVT_BUTTON, func)
67 setattr(self, "btn%s" % name.capitalize(), btn)
68 self.navSizer.Add(btn, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
69
70 self.SetSizer(self.navSizer)
71 self.Layout()
72
73 self.refreshEntityList(selected=selected)
74
75 def SetEditorValidator(self, validator=None):
76 """ Sets validator class (not an instance of the class) """

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 5

refreshEntityListMethod · 0.95
GetBitmapMethod · 0.80
sortMethod · 0.45
getBitmapMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected