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

Method __init__

gui/patternEditor.py:97–204  ·  view source on GitHub ↗
(self, parent)

Source from the content-addressed store, hash-verified

95 DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
96
97 def __init__(self, parent):
98 super().__init__(
99 parent, id=wx.ID_ANY, title=_t("Damage Pattern Editor"), resizeable=True,
100 # Dropdown list widget is scaled to its longest content line on GTK, adapt to that
101 size=wx.Size(500, 240) if "wxGTK" in wx.PlatformInfo else wx.Size(400, 240))
102
103 self.block = False
104 self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
105
106 mainSizer = wx.BoxSizer(wx.VERTICAL)
107
108 self.entityEditor = DmgPatternEntityEditor(self)
109 mainSizer.Add(self.entityEditor, 0, wx.ALL | wx.EXPAND, 2)
110
111 self.sl = wx.StaticLine(self)
112 mainSizer.Add(self.sl, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
113
114 contentSizer = wx.BoxSizer(wx.VERTICAL)
115 self.embitmap = BitmapLoader.getBitmap("em_big", "gui")
116 self.thermbitmap = BitmapLoader.getBitmap("thermal_big", "gui")
117 self.kinbitmap = BitmapLoader.getBitmap("kinetic_big", "gui")
118 self.expbitmap = BitmapLoader.getBitmap("explosive_big", "gui")
119
120 dmgeditSizer = wx.FlexGridSizer(2, 6, 0, 2)
121 dmgeditSizer.AddGrowableCol(0)
122 dmgeditSizer.AddGrowableCol(5)
123 dmgeditSizer.SetFlexibleDirection(wx.BOTH)
124 dmgeditSizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
125
126 width = -1
127 defSize = wx.Size(width, -1)
128
129 for i, type_ in enumerate(self.DAMAGE_TYPES):
130 bmp = wx.StaticBitmap(self, wx.ID_ANY, BitmapLoader.getBitmap("%s_big" % type_, "gui"))
131 if i % 2:
132 style = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT
133 border = 20
134 else:
135 style = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT
136 border = 5
137
138 # set text edit
139 editBox = FloatBox(parent=self, id=wx.ID_ANY, value=0, pos=wx.DefaultPosition, size=defSize)
140 percLabel = wx.StaticText(self, wx.ID_ANY, "0%")
141 setattr(self, "%sEdit" % type_, editBox)
142 setattr(self, "%sPerc" % type_, percLabel)
143
144 dmgeditSizer.Add(bmp, 0, style, border)
145 dmgeditSizer.Add(editBox, 0, wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL, 5)
146 dmgeditSizer.Add(percLabel, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
147
148 editBox.Bind(wx.EVT_TEXT, self.OnFieldChanged)
149
150 contentSizer.Add(dmgeditSizer, 1, wx.EXPAND | wx.ALL, 5)
151 self.slfooter = wx.StaticLine(self)
152 contentSizer.Add(self.slfooter, 0, wx.EXPAND | wx.TOP, 5)
153
154 footerSizer = wx.BoxSizer(wx.HORIZONTAL)

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 9

patternChangedMethod · 0.95
FloatBoxClass · 0.90
GetBitmapMethod · 0.80
checkEntitiesExistMethod · 0.80
SetSizeMethod · 0.80
_tFunction · 0.50
getBitmapMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected