当前位置: 首页>>代码示例>>Python>>正文


Python BitmapLoader.getStaticBitmap方法代码示例

本文整理汇总了Python中gui.bitmap_loader.BitmapLoader.getStaticBitmap方法的典型用法代码示例。如果您正苦于以下问题:Python BitmapLoader.getStaticBitmap方法的具体用法?Python BitmapLoader.getStaticBitmap怎么用?Python BitmapLoader.getStaticBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gui.bitmap_loader.BitmapLoader的用法示例。


在下文中一共展示了BitmapLoader.getStaticBitmap方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: populatePanel

# 需要导入模块: from gui.bitmap_loader import BitmapLoader [as 别名]
# 或者: from gui.bitmap_loader.BitmapLoader import getStaticBitmap [as 别名]
    def populatePanel(self, contentPanel, headerPanel):
        contentSizer = contentPanel.GetSizer()

        self.panel = contentPanel
        self.headerPanel = headerPanel
        sizerTankStats = wx.FlexGridSizer(3, 5, 0, 0)
        for i in range(4):
            sizerTankStats.AddGrowableCol(i + 1)

        contentSizer.Add(sizerTankStats, 0, wx.EXPAND, 0)

        # Add an empty label first for correct alignment.
        sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""), 0)
        toolTipText = {
            "shieldPassive": "Passive shield recharge",
            "shieldActive": "Active shield boost",
            "armorActive": "Armor repair amount",
            "hullActive": "Hull repair amount"}
        for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"):
            bitmap = BitmapLoader.getStaticBitmap("%s_big" % tankType, contentPanel, "gui")
            tooltip = wx.ToolTip(toolTipText[tankType])
            bitmap.SetToolTip(tooltip)
            sizerTankStats.Add(bitmap, 0, wx.ALIGN_CENTER)

        toolTipText = {
            "reinforced": "Reinforced",
            "sustained": "Sustained"}
        for stability in ("reinforced", "sustained"):
            bitmap = BitmapLoader.getStaticBitmap("regen%s_big" % stability.capitalize(), contentPanel, "gui")
            tooltip = wx.ToolTip(toolTipText[stability])
            bitmap.SetToolTip(tooltip)
            sizerTankStats.Add(bitmap, 0, wx.ALIGN_CENTER)
            for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"):
                if stability == "reinforced" and tankType == "shieldPassive":
                    sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""))
                    continue

                tankTypeCap = tankType[0].capitalize() + tankType[1:]
                lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0.0", style=wx.ALIGN_RIGHT)
                setattr(self, "labelTank%s%s" % (stability.capitalize(), tankTypeCap), lbl)
                box = wx.BoxSizer(wx.HORIZONTAL)
                box.Add(lbl, 0, wx.EXPAND)

                unitlbl = wx.StaticText(contentPanel, wx.ID_ANY, " EHP/s")
                setattr(self, "unitLabelTank%s%s" % (stability.capitalize(), tankTypeCap), unitlbl)
                box.Add(unitlbl, 0, wx.EXPAND)

                sizerTankStats.Add(box, 0, wx.ALIGN_CENTRE)

        contentPanel.Layout()
开发者ID:blitzmann,项目名称:Pyfa,代码行数:52,代码来源:rechargeViewFull.py

示例2: populatePanel

# 需要导入模块: from gui.bitmap_loader import BitmapLoader [as 别名]
# 或者: from gui.bitmap_loader.BitmapLoader import getStaticBitmap [as 别名]
    def populatePanel(self, contentPanel, headerPanel):
        contentSizer = contentPanel.GetSizer()
        self.panel = contentPanel
        self.headerPanel = headerPanel

        headerContentSizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer = headerPanel.GetSizer()
        hsizer.Add(headerContentSizer, 0, 0, 0)
        self.labelEMStatus = wx.StaticText(headerPanel, wx.ID_ANY, "")
        headerContentSizer.Add(self.labelEMStatus)
        headerPanel.GetParent().AddToggleItem(self.labelEMStatus)

        gridPrice = wx.GridSizer(1, 3, 0, 0)
        contentSizer.Add(gridPrice, 0, wx.EXPAND | wx.ALL, 0)
        for _type in ("ship", "fittings", "total"):
            image = "%sPrice_big" % _type if _type != "ship" else "ship_big"
            box = wx.BoxSizer(wx.HORIZONTAL)
            gridPrice.Add(box, 0, wx.ALIGN_TOP)

            box.Add(BitmapLoader.getStaticBitmap(image, contentPanel, "gui"), 0, wx.ALIGN_CENTER)

            vbox = wx.BoxSizer(wx.VERTICAL)
            box.Add(vbox, 1, wx.EXPAND)

            vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, _type.capitalize()), 0, wx.ALIGN_LEFT)

            hbox = wx.BoxSizer(wx.HORIZONTAL)
            vbox.Add(hbox)

            lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0.00 ISK")
            setattr(self, "labelPrice%s" % _type.capitalize(), lbl)
            hbox.Add(lbl, 0, wx.ALIGN_LEFT)
开发者ID:bsmr-eve,项目名称:Pyfa,代码行数:34,代码来源:priceViewMinimal.py

示例3: populatePanel

# 需要导入模块: from gui.bitmap_loader import BitmapLoader [as 别名]
# 或者: from gui.bitmap_loader.BitmapLoader import getStaticBitmap [as 别名]
    def populatePanel(self, contentPanel, headerPanel):
        contentSizer = contentPanel.GetSizer()
        parent = self.panel = contentPanel
        self.headerPanel = headerPanel

        sizerOutgoing = wx.GridSizer(1, 4, 0, 0)

        contentSizer.Add(sizerOutgoing, 0, wx.EXPAND, 0)

        for labelName, labelDesc, valueFormat, image, tooltip, val, preSpoolVal, fullSpoolVal, prec, lowest, highest in stats:
            baseBox = wx.BoxSizer(wx.VERTICAL)

            baseBox.Add(BitmapLoader.getStaticBitmap("%s_big" % image, parent, "gui"), 0, wx.ALIGN_CENTER)

            lbl = wx.StaticText(parent, wx.ID_ANY, valueFormat.format(0, ""))
            lbl.SetToolTip(wx.ToolTip(tooltip))
            setattr(self, labelName, lbl)

            baseBox.Add(lbl, 0, wx.ALIGN_CENTER)
            self._cachedValues.append(0)

            sizerOutgoing.Add(baseBox, 1, wx.ALIGN_LEFT)
开发者ID:blitzmann,项目名称:Pyfa,代码行数:24,代码来源:outgoingViewFull.py

示例4: populatePanel

# 需要导入模块: from gui.bitmap_loader import BitmapLoader [as 别名]
# 或者: from gui.bitmap_loader.BitmapLoader import getStaticBitmap [as 别名]
    def populatePanel(self, contentPanel, headerPanel):
        contentSizer = contentPanel.GetSizer()
        parent = self.panel = contentPanel
        self.headerPanel = headerPanel

        sizerOutgoing = wx.GridSizer(1, 4, 0, 0)

        contentSizer.Add(sizerOutgoing, 0, wx.EXPAND, 0)

        counter = 0

        rr_list = [
            ("RemoteCapacitor", "Capacitor:", "capacitorInfo", "Capacitor GJ/s per second transferred remotely."),
            ("RemoteShield", "Shield:", "shieldActive", "Shield hitpoints per second repaired remotely."),
            ("RemoteArmor", "Armor:", "armorActive", "Armor hitpoints per second repaired remotely."),
            ("RemoteHull", "Hull:", "hullActive", "Hull hitpoints per second repaired remotely."),
        ]

        for outgoingType, label, image, tooltip in rr_list:
            baseBox = wx.BoxSizer(wx.VERTICAL)

            baseBox.Add(BitmapLoader.getStaticBitmap("%s_big" % image, parent, "gui"), 0, wx.ALIGN_CENTER)

            if "Capacitor" in outgoingType:
                lbl = wx.StaticText(parent, wx.ID_ANY, "0 GJ/s")
            else:
                lbl = wx.StaticText(parent, wx.ID_ANY, "0 HP/s")

            lbl.SetToolTip(wx.ToolTip(tooltip))

            setattr(self, "label%s" % outgoingType, lbl)

            baseBox.Add(lbl, 0, wx.ALIGN_CENTER)
            self._cachedValues.append(0)
            counter += 1

            sizerOutgoing.Add(baseBox, 1, wx.ALIGN_LEFT)
开发者ID:Sectoid,项目名称:Pyfa,代码行数:39,代码来源:outgoingViewFull.py

示例5: __init__

# 需要导入模块: from gui.bitmap_loader import BitmapLoader [as 别名]
# 或者: from gui.bitmap_loader.BitmapLoader import getStaticBitmap [as 别名]
    def __init__(self, parent, stuff, item):
        wx.Panel.__init__(self, parent)
        self.stuff = stuff
        self.item = item
        self.timer = None
        self.activeFit = gui.mainFrame.MainFrame.getInstance().getActiveFit()
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        self.goodColor = wx.Colour(96, 191, 0)
        self.badColor = wx.Colour(255, 64, 0)

        self.event_mapping = {}

        for m in sorted(stuff.mutators.values(), key=lambda x: x.attribute.displayName):
            baseValueFormated = m.attribute.unit.TranslateValue(m.baseValue)[0]
            valueFormated = m.attribute.unit.TranslateValue(m.value)[0]
            slider = AttributeSlider(self, baseValueFormated, m.minMod, m.maxMod, not m.highIsGood)
            slider.SetValue(valueFormated, False)
            slider.Bind(EVT_VALUE_CHANGED, self.changeMutatedValue)
            self.event_mapping[slider] = m
            headingSizer = wx.BoxSizer(wx.HORIZONTAL)

            # create array for the two ranges
            min_t = [round(m.minValue, 3), m.minMod, None]
            max_t = [round(m.maxValue, 3), m.maxMod, None]

            # Then we need to determine if it's better than original, which will be the color
            min_t[2] = min_t[1] < 1 if not m.highIsGood else 1 < min_t[1]
            max_t[2] = max_t[1] < 1 if not m.highIsGood else 1 < max_t[1]

            # Lastly, we need to determine which range value is "worse" (left side) or "better" (right side)
            if (m.highIsGood and min_t[1] > max_t[1]) or (not m.highIsGood and min_t[1] < max_t[1]):
                better_range = min_t
            else:
                better_range = max_t

            if (m.highIsGood and max_t[1] < min_t[1]) or (not m.highIsGood and max_t[1] > min_t[1]):
                worse_range = max_t
            else:
                worse_range = min_t
            #
            # print("{}: \nHigh is good: {}".format(m.attribute.displayName, m.attribute.highIsGood))
            # print("Value {}".format(m.baseValue))
            #
            # print(min_t)
            # print(max_t)
            # print(better_range)
            # print(worse_range)

            font = parent.GetFont()
            font.SetWeight(wx.BOLD)

            headingSizer.Add(BitmapLoader.getStaticBitmap(m.attribute.iconID, self, "icons"), 0, wx.RIGHT, 10)

            displayName = wx.StaticText(self, wx.ID_ANY, m.attribute.displayName)
            displayName.SetFont(font)

            headingSizer.Add(displayName, 3, wx.ALL | wx.EXPAND, 0)


            range_low = wx.StaticText(self, wx.ID_ANY, ItemParams.FormatValue(*m.attribute.unit.TranslateValue(worse_range[0])))
            range_low.SetForegroundColour(self.goodColor if worse_range[2] else self.badColor)

            range_high = wx.StaticText(self, wx.ID_ANY, ItemParams.FormatValue(*m.attribute.unit.TranslateValue(better_range[0])))
            range_high.SetForegroundColour(self.goodColor if better_range[2] else self.badColor)

            headingSizer.Add(range_low, 0, wx.ALL | wx.EXPAND, 0)
            headingSizer.Add(wx.StaticText(self, wx.ID_ANY, " ─ "), 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 5)
            headingSizer.Add(range_high, 0, wx.RIGHT | wx.EXPAND, 10)

            mainSizer.Add(headingSizer, 0, wx.ALL | wx.EXPAND, 5)

            mainSizer.Add(slider, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 10)
            mainSizer.Add(wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.ALL | wx.EXPAND, 5)

        mainSizer.AddStretchSpacer()

        self.m_staticline = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
        mainSizer.Add(self.m_staticline, 0, wx.EXPAND)

        bSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.refreshBtn = wx.Button(self, wx.ID_ANY, "Reset defaults", wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer.Add(self.refreshBtn, 0, wx.ALIGN_CENTER_VERTICAL)
        self.refreshBtn.Bind(wx.EVT_BUTTON, self.resetMutatedValues)

        self.randomBtn = wx.Button(self, wx.ID_ANY, "Random stats", wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer.Add(self.randomBtn, 0, wx.ALIGN_CENTER_VERTICAL)
        self.randomBtn.Bind(wx.EVT_BUTTON, self.randomMutatedValues)

        mainSizer.Add(bSizer, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 0)

        self.SetSizer(mainSizer)
        self.Layout()
开发者ID:Sectoid,项目名称:Pyfa,代码行数:96,代码来源:itemMutator.py

示例6: populatePanel

# 需要导入模块: from gui.bitmap_loader import BitmapLoader [as 别名]
# 或者: from gui.bitmap_loader.BitmapLoader import getStaticBitmap [as 别名]
    def populatePanel(self, contentPanel, headerPanel):

        contentSizer = contentPanel.GetSizer()
        root = wx.BoxSizer(wx.VERTICAL)
        contentSizer.Add(root, 0, wx.EXPAND, 0)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        root.Add(sizer, 0, wx.EXPAND)
        root.Add(wx.StaticLine(contentPanel, wx.ID_ANY, style=wx.HORIZONTAL), 0, wx.EXPAND)

        sizerResources = wx.BoxSizer(wx.HORIZONTAL)
        root.Add(sizerResources, 1, wx.EXPAND, 0)

        parent = self.panel = contentPanel
        self.headerPanel = headerPanel
        panel = "full"

        base = sizerResources
        sizer.AddStretchSpacer()
        # Turrets & launcher hardslots display
        tooltipText = {"turret": "Turret hardpoints", "launcher": "Launcher hardpoints", "drones": "Drones active",
                       "fighter": "Fighter squadrons active", "calibration": "Calibration"}
        for type_ in ("turret", "launcher", "drones", "fighter", "calibration"):
            box = wx.BoxSizer(wx.HORIZONTAL)

            bitmap = BitmapLoader.getStaticBitmap("%s_big" % type_, parent, "gui")
            tooltip = wx.ToolTip(tooltipText[type_])
            bitmap.SetToolTip(tooltip)

            box.Add(bitmap, 0, wx.ALIGN_CENTER)

            sizer.Add(box, 0, wx.ALIGN_CENTER)

            suffix = {'turret': 'Hardpoints', 'launcher': 'Hardpoints', 'drones': 'Active', 'fighter': 'Tubes',
                      'calibration': 'Points'}
            lbl = wx.StaticText(parent, wx.ID_ANY, "0")
            setattr(self, "label%sUsed%s%s" % (panel.capitalize(), type_.capitalize(), suffix[type_].capitalize()), lbl)
            box.Add(lbl, 0, wx.ALIGN_CENTER | wx.LEFT, 5)

            box.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_CENTER)

            lbl = wx.StaticText(parent, wx.ID_ANY, "0")
            setattr(self, "label%sTotal%s%s" % (panel.capitalize(), type_.capitalize(), suffix[type_].capitalize()),
                    lbl)
            box.Add(lbl, 0, wx.ALIGN_CENTER)
            setattr(self, "boxSizer{}".format(type_.capitalize()), box)

            # Hack - We add a spacer after each thing, but we are always hiding something. The spacer is stil there.
            # This way, we only have one space after the drones/fighters
            if type_ != "drones":
                sizer.AddStretchSpacer()

        gauge_font = wx.Font(fonts.NORMAL, wx.SWISS, wx.NORMAL, wx.NORMAL, False)

        # PG, Cpu & drone stuff
        tooltipText = {"cpu": "CPU", "pg": "PowerGrid", "droneBay": "Drone bay", "fighterBay": "Fighter bay",
                       "droneBandwidth": "Drone bandwidth", "cargoBay": "Cargo bay"}
        for i, group in enumerate((("cpu", "pg"), ("cargoBay", "droneBay", "fighterBay", "droneBandwidth"))):
            main = wx.BoxSizer(wx.VERTICAL)
            base.Add(main, 1, wx.ALIGN_CENTER)

            for type_ in group:
                capitalizedType = type_[0].capitalize() + type_[1:]
                bitmap = BitmapLoader.getStaticBitmap(type_ + "_big", parent, "gui")
                tooltip = wx.ToolTip(tooltipText[type_])
                bitmap.SetToolTip(tooltip)

                stats = wx.BoxSizer(wx.VERTICAL)
                absolute = wx.BoxSizer(wx.HORIZONTAL)
                stats.Add(absolute, 0, wx.EXPAND)

                b = wx.BoxSizer(wx.HORIZONTAL)
                main.Add(b, 1, wx.ALIGN_CENTER)

                b.Add(bitmap, 0, wx.ALIGN_BOTTOM)

                b.Add(stats, 1, wx.EXPAND)

                lbl = wx.StaticText(parent, wx.ID_ANY, "0")
                setattr(self, "label%sUsed%s" % (panel.capitalize(), capitalizedType), lbl)
                absolute.Add(lbl, 0, wx.ALIGN_LEFT | wx.LEFT, 3)

                absolute.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_LEFT)

                lbl = wx.StaticText(parent, wx.ID_ANY, "0")
                setattr(self, "label%sTotal%s" % (panel.capitalize(), capitalizedType), lbl)
                absolute.Add(lbl, 0, wx.ALIGN_LEFT)

                units = {"cpu": " tf", "pg": " MW", "droneBandwidth": " mbit/s", "droneBay": " m\u00B3",
                         "fighterBay": " m\u00B3", "cargoBay": " m\u00B3"}
                lbl = wx.StaticText(parent, wx.ID_ANY, "%s" % units[type_])
                absolute.Add(lbl, 0, wx.ALIGN_LEFT)

                # Gauges modif. - Darriele

                gauge = PyGauge(parent, gauge_font, 1)
                gauge.SetValueRange(0, 0)
                gauge.SetMinSize((self.getTextExtentW("1.999M/1.99M MW"), 23))
                gauge.SetFractionDigits(2)

#.........这里部分代码省略.........
开发者ID:Sectoid,项目名称:Pyfa,代码行数:103,代码来源:resourcesViewFull.py

示例7: populatePanel

# 需要导入模块: from gui.bitmap_loader import BitmapLoader [as 别名]
# 或者: from gui.bitmap_loader.BitmapLoader import getStaticBitmap [as 别名]
    def populatePanel(self, contentPanel, headerPanel):
        contentSizer = contentPanel.GetSizer()
        parent = self.panel = contentPanel
        self.headerPanel = headerPanel

        panel = "full"

        sizerMiningYield = wx.FlexGridSizer(1, 4, 0, 0)
        sizerMiningYield.AddGrowableCol(1)

        contentSizer.Add(sizerMiningYield, 0, wx.EXPAND, 0)

        counter = 0

        for miningType, image in (("miner", "mining"), ("drone", "drones")):
            baseBox = wx.BoxSizer(wx.HORIZONTAL)
            sizerMiningYield.Add(baseBox, 1, wx.ALIGN_LEFT if counter == 0 else wx.ALIGN_CENTER_HORIZONTAL)

            baseBox.Add(BitmapLoader.getStaticBitmap("%s_big" % image, parent, "gui"), 0, wx.ALIGN_CENTER)

            box = wx.BoxSizer(wx.VERTICAL)
            baseBox.Add(box, 0, wx.ALIGN_CENTER)

            box.Add(wx.StaticText(parent, wx.ID_ANY, miningType.capitalize()), 0, wx.ALIGN_LEFT)

            hbox = wx.BoxSizer(wx.HORIZONTAL)
            box.Add(hbox, 1, wx.ALIGN_CENTER)

            lbl = wx.StaticText(parent, wx.ID_ANY, "0.0 m\u00B3/s")
            setattr(self, "label%sminingyield%s" % (panel.capitalize(), miningType.capitalize()), lbl)

            hbox.Add(lbl, 0, wx.ALIGN_CENTER)
            self._cachedValues.append(0)
            counter += 1
        targetSizer = sizerMiningYield

        baseBox = wx.BoxSizer(wx.HORIZONTAL)
        targetSizer.Add(baseBox, 0, wx.ALIGN_LEFT)

        baseBox.Add(BitmapLoader.getStaticBitmap("cargoBay_big", parent, "gui"), 0, wx.ALIGN_CENTER)

        box = wx.BoxSizer(wx.VERTICAL)
        baseBox.Add(box, 0, wx.EXPAND)

        box.Add(wx.StaticText(parent, wx.ID_ANY, "Total"), 0, wx.ALIGN_LEFT)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        box.Add(hbox, 1, wx.EXPAND)

        lbl = wx.StaticText(parent, wx.ID_ANY, "0.0 m\u00B3/s")
        setattr(self, "label%sminingyieldTotal" % panel.capitalize(), lbl)
        hbox.Add(lbl, 0, wx.ALIGN_LEFT)

        self._cachedValues.append(0)

        image = BitmapLoader.getBitmap("turret_small", "gui")
        firepower = wx.BitmapButton(contentPanel, -1, image)
        firepower.SetToolTip(wx.ToolTip("Click to toggle to Firepower View"))
        firepower.Bind(wx.EVT_BUTTON, self.switchToFirepowerView)
        sizerMiningYield.Add(firepower, 0, wx.ALIGN_LEFT)

        self._cachedValues.append(0)
开发者ID:Sectoid,项目名称:Pyfa,代码行数:64,代码来源:miningyieldViewFull.py

示例8: populatePanel

# 需要导入模块: from gui.bitmap_loader import BitmapLoader [as 别名]
# 或者: from gui.bitmap_loader.BitmapLoader import getStaticBitmap [as 别名]
    def populatePanel(self, contentPanel, headerPanel):
        contentSizer = contentPanel.GetSizer()
        parent = self.panel = contentPanel

        self.headerPanel = headerPanel
        hsizer = self.headerPanel.GetSizer()
        self.stEff = wx.StaticText(self.headerPanel, wx.ID_ANY, "( Effective )")
        hsizer.Add(self.stEff)
        self.headerPanel.GetParent().AddToggleItem(self.stEff)

        panel = "full"

        sizerFirepower = wx.FlexGridSizer(1, 4, 0, 0)
        sizerFirepower.AddGrowableCol(1)

        contentSizer.Add(sizerFirepower, 0, wx.EXPAND, 0)

        counter = 0

        for damageType, image in (("weapon", "turret"), ("drone", "droneDPS")):
            baseBox = wx.BoxSizer(wx.HORIZONTAL)
            sizerFirepower.Add(baseBox, 1, wx.ALIGN_LEFT if counter == 0 else wx.ALIGN_CENTER_HORIZONTAL)

            baseBox.Add(BitmapLoader.getStaticBitmap("%s_big" % image, parent, "gui"), 0, wx.ALIGN_CENTER)

            box = wx.BoxSizer(wx.VERTICAL)
            baseBox.Add(box, 0, wx.ALIGN_CENTER)

            box.Add(wx.StaticText(parent, wx.ID_ANY, damageType.capitalize()), 0, wx.ALIGN_LEFT)

            hbox = wx.BoxSizer(wx.HORIZONTAL)
            box.Add(hbox, 1, wx.ALIGN_CENTER)

            lbl = wx.StaticText(parent, wx.ID_ANY, "0.0 DPS")
            setattr(self, "label%sDps%s" % (panel.capitalize(), damageType.capitalize()), lbl)

            hbox.Add(lbl, 0, wx.ALIGN_CENTER)
            self._cachedValues.append(0)
            counter += 1
        targetSizer = sizerFirepower

        baseBox = wx.BoxSizer(wx.HORIZONTAL)
        targetSizer.Add(baseBox, 0, wx.ALIGN_RIGHT)

        baseBox.Add(BitmapLoader.getStaticBitmap("volley_big", parent, "gui"), 0, wx.ALIGN_CENTER)

        gridS = wx.GridSizer(2, 2, 0, 0)

        baseBox.Add(gridS, 0)

        lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
        setattr(self, "label%sVolleyTotal" % panel.capitalize(), lbl)
        gridS.Add(wx.StaticText(parent, wx.ID_ANY, " Volley: "), 0, wx.ALL | wx.ALIGN_RIGHT)
        gridS.Add(lbl, 0, wx.ALIGN_LEFT)

        self._cachedValues.append(0)

        lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
        setattr(self, "label%sDpsTotal" % panel.capitalize(), lbl)
        gridS.Add(wx.StaticText(parent, wx.ID_ANY, " DPS: "), 0, wx.ALL | wx.ALIGN_RIGHT)

        self._cachedValues.append(0)

        gridS.Add(lbl, 0, wx.ALIGN_LEFT)

        image = BitmapLoader.getBitmap("mining_small", "gui")
        self.miningyield = wx.BitmapButton(contentPanel, -1, image)
        self.miningyield.SetToolTip(wx.ToolTip("Click to toggle to Mining Yield "))
        self.miningyield.Bind(wx.EVT_BUTTON, self.switchToMiningYieldView)
        sizerFirepower.Add(self.miningyield, 0, wx.ALIGN_LEFT)

        self._cachedValues.append(0)
开发者ID:Sectoid,项目名称:Pyfa,代码行数:74,代码来源:firepowerViewFull.py

示例9: __init__

# 需要导入模块: from gui.bitmap_loader import BitmapLoader [as 别名]
# 或者: from gui.bitmap_loader.BitmapLoader import getStaticBitmap [as 别名]
    def __init__(self, parent, stuff, item):
        wx.Panel.__init__(self, parent)
        self.stuff = stuff
        self.item = item
        self.timer = None
        self.activeFit = gui.mainFrame.MainFrame.getInstance().getActiveFit()

        font = parent.GetFont()
        font.SetWeight(wx.BOLD)

        mainSizer = wx.BoxSizer(wx.VERTICAL)

        sourceItemsSizer = wx.BoxSizer(wx.HORIZONTAL)
        sourceItemsSizer.Add(BitmapLoader.getStaticBitmap(stuff.item.iconID, self, "icons"), 0, wx.LEFT, 5)
        sourceItemsSizer.Add(BitmapLoader.getStaticBitmap(stuff.mutaplasmid.item.iconID, self, "icons"), 0, wx.LEFT, 0)
        sourceItemShort = "{} {}".format(stuff.mutaplasmid.item.name.split(" ")[0], stuff.baseItem.name)
        sourceItemText = wx.StaticText(self, wx.ID_ANY, sourceItemShort)
        sourceItemText.SetFont(font)
        sourceItemsSizer.Add(sourceItemText, 0, wx.LEFT, 10)
        mainSizer.Add(sourceItemsSizer, 0, wx.TOP | wx.EXPAND, 10)

        mainSizer.Add(wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.ALL | wx.EXPAND, 5)

        self.goodColor = wx.Colour(96, 191, 0)
        self.badColor = wx.Colour(255, 64, 0)

        self.event_mapping = {}
        higOverrides = {
            ('Stasis Web', 'speedFactor'): False,
        }

        for m in sorted(stuff.mutators.values(), key=lambda x: x.attribute.displayName):
            highIsGood = higOverrides.get((stuff.item.group.name, m.attribute.name), m.highIsGood)
            # Format: [raw value, modifier applied to base raw value, display value]
            range1 = (m.minValue, m.attribute.unit.SimplifyValue(m.minValue))
            range2 = (m.maxValue, m.attribute.unit.SimplifyValue(m.maxValue))

            # minValue/maxValue do not always correspond to min/max, because these are
            # just base value multiplied by minMod/maxMod, and in case base is negative
            # minValue is actually bigger than maxValue
            if range1[0] <= range2[0]:
                minRange = range1
                maxRange = range2
            else:
                minRange = range2
                maxRange = range1

            if (highIsGood and minRange[0] >= maxRange[0]) or (not highIsGood and minRange[0] <= maxRange[0]):
                betterRange = minRange
                worseRange = maxRange
            else:
                betterRange = maxRange
                worseRange = minRange

            if minRange[1] >= maxRange[1]:
                displayMaxRange = minRange
                displayMinRange = maxRange
            else:
                displayMaxRange = maxRange
                displayMinRange = minRange

            # If base value is outside of mutation range, make sure that center of slider
            # corresponds to the value which is closest available to actual base value. It's
            # how EVE handles it
            if minRange[0] <= m.baseValue <= maxRange[0]:
                sliderBaseValue = m.baseValue
            else:
                sliderBaseValue = max(minRange[0], min(maxRange[0], m.baseValue))

            headingSizer = wx.BoxSizer(wx.HORIZONTAL)

            headingSizer.Add(BitmapLoader.getStaticBitmap(m.attribute.iconID, self, "icons"), 0, wx.RIGHT, 10)

            displayName = wx.StaticText(self, wx.ID_ANY, m.attribute.displayName)
            displayName.SetFont(font)

            headingSizer.Add(displayName, 3, wx.ALL | wx.EXPAND, 0)

            worseVal = ItemParams.FormatValue(*m.attribute.unit.PreformatValue(worseRange[0]), rounding='dec')
            worseText = wx.StaticText(self, wx.ID_ANY, worseVal)
            worseText.SetForegroundColour(self.badColor)

            betterVal = ItemParams.FormatValue(*m.attribute.unit.PreformatValue(betterRange[0]), rounding='dec')
            betterText = wx.StaticText(self, wx.ID_ANY, betterVal)
            betterText.SetForegroundColour(self.goodColor)

            headingSizer.Add(worseText, 0, wx.ALL | wx.EXPAND, 0)
            headingSizer.Add(wx.StaticText(self, wx.ID_ANY, " ─ "), 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 5)
            headingSizer.Add(betterText, 0, wx.RIGHT | wx.EXPAND, 10)

            mainSizer.Add(headingSizer, 0, wx.ALL | wx.EXPAND, 5)

            slider = AttributeSlider(parent=self,
                                     baseValue=m.attribute.unit.SimplifyValue(sliderBaseValue),
                                     minValue=displayMinRange[1],
                                     maxValue=displayMaxRange[1],
                                     inverse=displayMaxRange is worseRange)
            slider.SetValue(m.attribute.unit.SimplifyValue(m.value), False)
            slider.Bind(EVT_VALUE_CHANGED, self.changeMutatedValue)
            self.event_mapping[slider] = m
#.........这里部分代码省略.........
开发者ID:blitzmann,项目名称:Pyfa,代码行数:103,代码来源:itemMutator.py


注:本文中的gui.bitmap_loader.BitmapLoader.getStaticBitmap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。