• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python character.Character类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中service.character.Character的典型用法代码示例。如果您正苦于以下问题:Python Character类的具体用法?Python Character怎么用?Python Character使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: SaveCharacterAs

    def SaveCharacterAs(parent, charID):
        sChar = Character.getInstance()
        name = sChar.getCharName(charID)

        dlg = TextEntryValidatedDialog(parent, CharacterTextValidor,
                                       "Enter a name for your new Character:",
                                       "Save Character As...")
        dlg.SetValue("{} Copy".format(name))
        dlg.txtctrl.SetInsertionPointEnd()
        dlg.CenterOnParent()

        if dlg.ShowModal() == wx.ID_OK:
            sChar = Character.getInstance()
            return sChar.saveCharacterAs(charID, dlg.txtctrl.GetValue().strip())
开发者ID:Sectoid,项目名称:Pyfa,代码行数:14,代码来源:characterEditor.py


示例2: fitChanged

    def fitChanged(self, event):
        """
        When fit is changed, or new fit is selected
        """
        self.charChoice.Enable(event.fitID is not None)
        choice = self.charChoice
        sFit = Fit.getInstance()
        currCharID = choice.GetClientData(choice.GetCurrentSelection())
        fit = sFit.getFit(event.fitID)
        newCharID = fit.character.ID if fit is not None else None

        if event.fitID is None:
            self.skillReqsStaticBitmap.SetBitmap(self.cleanSkills)
            self.skillReqsStaticBitmap.SetToolTip("No active fit")
        else:
            sCharacter = Character.getInstance()
            self.reqs = sCharacter.checkRequirements(fit)

            sCharacter.skillReqsDict = {'charname': fit.character.name, 'skills': []}
            if len(self.reqs) == 0:
                self.needsSkills = False
                tip = "All skill prerequisites have been met"
                self.skillReqsStaticBitmap.SetBitmap(self.greenSkills)
            else:
                self.needsSkills = True
                tip = "Skills required:\n"
                condensed = sFit.serviceFittingOptions["compactSkills"]
                if condensed:
                    dict_ = self._buildSkillsTooltipCondensed(self.reqs, skillsMap={})
                    for key in sorted(dict_):
                        tip += "%s: %d\n" % (key, dict_[key][0])
                else:
                    tip += self._buildSkillsTooltip(self.reqs)
                self.skillReqsStaticBitmap.SetBitmap(self.redSkills)
            self.skillReqsStaticBitmap.SetToolTip(tip.strip())

        if newCharID is None:
            sChar = Character.getInstance()
            self.selectChar(sChar.all5ID())

        elif currCharID != newCharID:
            self.selectChar(newCharID)
            if not fit.calculated:
                self.charChanged(None)

        self.toggleRefreshButton()

        event.Skip()
开发者ID:Sectoid,项目名称:Pyfa,代码行数:48,代码来源:characterSelection.py


示例3: refreshCharacterList

    def refreshCharacterList(self, event=None):
        choice = self.charChoice
        sChar = Character.getInstance()
        activeChar = self.getActiveCharacter()

        choice.Clear()
        charList = sorted(sChar.getCharacterList(), key=lambda c: (not c.ro, c.name))
        picked = False

        for char in charList:
            currId = choice.Append(char.name, char.ID)
            if char.ID == activeChar:
                choice.SetSelection(currId)
                self.charChanged(None)
                picked = True

        if not picked:
            charID = sChar.all5ID()
            self.selectChar(charID)
            fitID = self.mainFrame.getActiveFit()
            sFit = Fit.getInstance()
            sFit.changeChar(fitID, charID)

        choice.Append(u"\u2015 Open Character Editor \u2015", -1)
        self.charCache = self.charChoice.GetCurrentSelection()

        if event is not None:
            event.Skip()
开发者ID:PaulKPetersonCO,项目名称:Pyfa,代码行数:28,代码来源:characterSelection.py


示例4: fetchSkills

 def fetchSkills(self, event):
     charName = self.charChoice.GetString(self.charChoice.GetSelection())
     if charName:
         sChar = Character.getInstance()
         activeChar = self.charEditor.entityEditor.getActiveEntity()
         sChar.apiFetch(activeChar.ID, charName, self.__fetchCallback)
         self.stStatus.SetLabel("Getting skills for {}".format(charName))
开发者ID:copyliu,项目名称:Pyfa,代码行数:7,代码来源:characterEditor.py


示例5: charChanged

    def charChanged(self, event):
        sChar = Character.getInstance()
        activeChar = self.charEditor.entityEditor.getActiveEntity()

        ID, key, char, chars = sChar.getApiDetails(activeChar.ID)
        self.inputID.SetValue(str(ID))
        self.inputKey.SetValue(key)

        self.charChoice.Clear()

        if chars:
            for charName in chars:
                self.charChoice.Append(charName)
            self.charChoice.SetStringSelection(char)
            self.charChoice.Enable(True)
            self.btnFetchSkills.Enable(True)
        else:
            self.charChoice.Append("No characters...", 0)
            self.charChoice.SetSelection(0)
            self.charChoice.Enable(False)
            self.btnFetchSkills.Enable(False)

        if activeChar.name in ("All 0", "All 5"):
            self.Enable(False)
            self.stDisabledTip.Show()
            self.Layout()
        else:
            self.Enable()
            self.stDisabledTip.Hide()
            self.Layout()

        if event is not None:
            event.Skip()
开发者ID:copyliu,项目名称:Pyfa,代码行数:33,代码来源:characterEditor.py


示例6: populateSkillTree

    def populateSkillTree(self, event=None):
        sChar = Character.getInstance()
        char = self.charEditor.entityEditor.getActiveEntity()
        dirtyGroups = set([skill.item.group.ID for skill in char.dirtySkills])

        if char.name in ("All 0", "All 5"):
            self.clonesChoice.Disable()
            self.btnSecStatus.Disable()
        else:
            self.clonesChoice.Enable()
            self.btnSecStatus.Enable()

        groups = sChar.getSkillGroups()
        imageId = self.skillBookImageId
        root = self.root
        tree = self.skillTreeListCtrl
        tree.DeleteChildren(root)

        for id, name in groups:
            childId = tree.AppendItem(root, name, imageId)
            tree.SetPyData(childId, ('group', id))
            tree.AppendItem(childId, "dummy")
            if id in dirtyGroups:
                tree.SetItemTextColour(childId, wx.BLUE)

        tree.SortChildren(root)

        if event:
            event.Skip()
开发者ID:copyliu,项目名称:Pyfa,代码行数:29,代码来源:characterEditor.py


示例7: _buildSkillsTooltipCondensed

    def _buildSkillsTooltipCondensed(self, reqs, currItem="", tabulationLevel=0, skillsMap=None):
        if skillsMap is None:
            skillsMap = {}

        sCharacter = Character.getInstance()

        if tabulationLevel == 0:
            for item, subReqs in reqs.iteritems():
                skillsMap = self._buildSkillsTooltipCondensed(subReqs, item.name, 1, skillsMap)
            sorted(skillsMap, key=skillsMap.get)
        else:
            for name, info in reqs.iteritems():
                level, ID, more = info
                sCharacter.skillReqsDict['skills'].append({
                    'item': currItem,
                    'skillID': ID,
                    'skill': name,
                    'level': level,
                    'indent': tabulationLevel,
                })

                if name not in skillsMap:
                    skillsMap[name] = level
                elif skillsMap[name] < level:
                    skillsMap[name] = level

                skillsMap = self._buildSkillsTooltipCondensed(more, currItem, tabulationLevel + 1, skillsMap)

        return skillsMap
开发者ID:PaulKPetersonCO,项目名称:Pyfa,代码行数:29,代码来源:characterSelection.py


示例8: fitChanged

    def fitChanged(self, event):
        enable = event.fitID is not None
        self.Enable(wx.ID_SAVEAS, enable)
        self.Enable(wx.ID_COPY, enable)
        self.Enable(self.exportSkillsNeededId, enable)

        sChar = Character.getInstance()
        charID = self.mainFrame.charSelection.getActiveCharacter()
        char = sChar.getCharacter(charID)

        # enable/disable character saving stuff
        self.Enable(self.saveCharId, not char.ro and char.isDirty)
        self.Enable(self.saveCharAsId, char.isDirty)
        self.Enable(self.revertCharId, char.isDirty)

        self.Enable(self.toggleIgnoreRestrictionID, enable)

        if event.fitID:
            sFit = Fit.getInstance()
            fit = sFit.getFit(event.fitID)

            if fit.ignoreRestrictions:
                self.ignoreRestrictionItem.SetItemLabel("Enable Fitting Restrictions")
            else:
                self.ignoreRestrictionItem.SetItemLabel("Disable Fitting Restrictions")

        event.Skip()
开发者ID:Sectoid,项目名称:Pyfa,代码行数:27,代码来源:mainMenuBar.py


示例9: change

    def change(self, event):
        sChar = Character.getInstance()
        sChar.saveCharacterAs(self.charID, self.input.GetLineText(0))
        wx.PostEvent(self.parent, GE.CharListUpdated())

        event.Skip()
        self.Close()
开发者ID:PaulKPetersonCO,项目名称:Pyfa,代码行数:7,代码来源:characterEditor.py


示例10: populateSkillTree

    def populateSkillTree(self, event=None):
        sChar = Character.getInstance()
        char = self.charEditor.entityEditor.getActiveEntity()
        dirtyGroups = set([skill.item.group.ID for skill in char.dirtySkills])

        if char.name in ("All 0", "All 5"):
            self.clonesChoice.Disable()
            self.btnSecStatus.Disable()
        else:
            self.clonesChoice.Enable()
            self.btnSecStatus.Enable()

        groups = sChar.getSkillGroups()
        root = self.root
        tree = self.skillTreeListCtrl
        tree.DeleteAllItems()

        for id, name in groups:
            imageId = self.skillBookImageId
            if id in dirtyGroups:
                imageId = self.skillBookDirtyImageId

            childId = tree.AppendItem(root, name, imageId, data=('group', id))
            tree.AppendItem(childId, "dummy")

        if event:
            event.Skip()
开发者ID:Sectoid,项目名称:Pyfa,代码行数:27,代码来源:characterEditor.py


示例11: exportSkillsNeeded

    def exportSkillsNeeded(self, event):
        """ Exports skills needed for active fit and active character """
        sCharacter = Character.getInstance()
        saveDialog = wx.FileDialog(
            self,
            "Export Skills Needed As...",
            wildcard=("EVEMon skills training file (*.emp)|*.emp|"
                      "EVEMon skills training XML file (*.xml)|*.xml|"
                      "Text skills training file (*.txt)|*.txt"),
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
        )

        if saveDialog.ShowModal() == wx.ID_OK:
            saveFmtInt = saveDialog.GetFilterIndex()

            if saveFmtInt == 0:  # Per ordering of wildcards above
                saveFmt = "emp"
            elif saveFmtInt == 1:
                saveFmt = "xml"
            else:
                saveFmt = "txt"

            filePath = saveDialog.GetPath()
            if '.' not in os.path.basename(filePath):
                filePath += ".{0}".format(saveFmt)

            self.waitDialog = wx.BusyInfo("Exporting skills needed...")
            sCharacter.backupSkills(filePath, saveFmt, self.getActiveFit(), self.closeWaitDialog)

        saveDialog.Destroy()
开发者ID:petosorus,项目名称:Pyfa,代码行数:30,代码来源:mainFrame.py


示例12: changeLevel

    def changeLevel(self, event):
        level = self.levelIds.get(event.Id)

        sChar = Character.getInstance()
        char = self.charEditor.entityEditor.getActiveEntity()
        selection = self.skillTreeListCtrl.GetSelection()
        skillID = self.skillTreeListCtrl.GetPyData(selection)

        if level is not None:
            self.skillTreeListCtrl.SetItemText(selection, "Level %d" % level if isinstance(level, int) else level, 1)
            sChar.changeLevel(char.ID, skillID, level, persist=True)
        elif event.Id == self.revertID:
            sChar.revertLevel(char.ID, skillID)
        elif event.Id == self.saveID:
            sChar.saveSkill(char.ID, skillID)

        self.skillTreeListCtrl.SetItemTextColour(selection, None)

        dirtySkills = sChar.getDirtySkills(char.ID)
        dirtyGroups = set([skill.item.group.ID for skill in dirtySkills])

        parentID = self.skillTreeListCtrl.GetItemParent(selection)
        groupID = self.skillTreeListCtrl.GetPyData(parentID)

        if groupID not in dirtyGroups:
            self.skillTreeListCtrl.SetItemTextColour(parentID, None)

        event.Skip()
开发者ID:Ebag333,项目名称:Pyfa,代码行数:28,代码来源:characterEditor.py


示例13: toggleRefreshButton

 def toggleRefreshButton(self):
     charID = self.getActiveCharacter()
     sChar = Character.getInstance()
     char = sChar.getCharacter(charID)
     if sChar.getCharName(charID) not in ("All 0", "All 5") and sChar.getSsoCharacter(char.ID) is not None:
         self.btnRefresh.Enable(True)
     else:
         self.btnRefresh.Enable(False)
开发者ID:Sectoid,项目名称:Pyfa,代码行数:8,代码来源:characterSelection.py


示例14: __init__

    def __init__(self):
        self.pattern = DamagePattern.getInstance().getDamagePattern("Uniform")
        self.character = Character.getInstance().all5()
        self.dirtyFitIDs = set()

        serviceFittingDefaultOptions = {"useGlobalCharacter": False, "useGlobalDamagePattern": False, "defaultCharacter": self.character.ID, "useGlobalForceReload": False}

        self.serviceFittingOptions = SettingsProvider.getInstance().getSettings("pyfaServiceFittingOptions", serviceFittingDefaultOptions)
开发者ID:MRACHINI,项目名称:Pyfa,代码行数:8,代码来源:fit.py


示例15: DoRename

    def DoRename(self, entity, name):
        sChar = Character.getInstance()

        if entity.alphaCloneID:
            trimmed_name = re.sub('[ \(\u03B1\)]+$', '', name)
            sChar.rename(entity, trimmed_name)
        else:
            sChar.rename(entity, name)
开发者ID:blitzmann,项目名称:Pyfa,代码行数:8,代码来源:characterEditor.py


示例16: changeLevel

    def changeLevel(self, event):
        level = self.levelIds.get(event.Id)

        sChar = Character.getInstance()
        char = self.charEditor.entityEditor.getActiveEntity()
        selection = self.skillTreeListCtrl.GetSelection()
        dataType, skillID = self.skillTreeListCtrl.GetItemData(selection)

        if level is not None:
            sChar.changeLevel(char.ID, skillID, level, persist=True)
        elif event.Id == self.revertID:
            sChar.revertLevel(char.ID, skillID)
        elif event.Id == self.saveID:
            sChar.saveSkill(char.ID, skillID)

        # After saving the skill, we need to update not just the selected skill, but all open skills due to strict skill
        # level setting. We don't want to refresh tree, as that will lose all expanded categories and users location
        # within the tree. Thus, we loop through the tree and refresh the info.
        # @todo: when collapsing branch, remove the data. This will make this loop more performant

        child = self.skillTreeListCtrl.GetFirstChild(self.root)

        def _setTreeSkillLevel(treeItem, skillID):
            lvl, dirty = sChar.getSkillLevel(char.ID, skillID)
            self.skillTreeListCtrl.SetItemText(treeItem,
                                               1,
                                               "Level {}".format(int(lvl)) if not isinstance(lvl, str) else lvl)

            if not dirty:
                self.skillTreeListCtrl.SetItemImage(treeItem, self.skillBookImageId)

        while child.IsOk():
            # child = Skill category
            dataType, id = self.skillTreeListCtrl.GetItemData(child)

            if dataType == 'skill':
                _setTreeSkillLevel(child, id)
            else:
                grand = self.skillTreeListCtrl.GetFirstChild(child)
                while grand.IsOk():
                    if self.skillTreeListCtrl.GetItemText(grand) != "dummy":
                        _, skillID = self.skillTreeListCtrl.GetItemData(grand)
                        _setTreeSkillLevel(grand, skillID)
                    grand = self.skillTreeListCtrl.GetNextSibling(grand)

            child = self.skillTreeListCtrl.GetNextSibling(child)

        dirtySkills = sChar.getDirtySkills(char.ID)
        dirtyGroups = set([skill.item.group.ID for skill in dirtySkills])

        parentID = self.skillTreeListCtrl.GetItemParent(selection)
        parent = self.skillTreeListCtrl.GetItemData(parentID)

        if parent:
            if parent[1] in dirtyGroups:
                self.skillTreeListCtrl.SetItemImage(parentID, self.skillBookImageId)

        event.Skip()
开发者ID:Sectoid,项目名称:Pyfa,代码行数:58,代码来源:characterEditor.py


示例17: ssoCharChanged

    def ssoCharChanged(self, event):
        sChar = Character.getInstance()
        activeChar = self.charEditor.entityEditor.getActiveEntity()
        ssoChar = self.getActiveCharacter()
        sChar.setSsoCharacter(activeChar.ID, ssoChar)

        self.fetchButton.Enable(ssoChar is not None)

        event.Skip()
开发者ID:Sectoid,项目名称:Pyfa,代码行数:9,代码来源:characterEditor.py


示例18: changeChar

    def changeChar(self, fitID, charID):
        if fitID is None or charID is None:
            if charID is not None:
                self.character = Character.getInstance().all5()

            return

        fit = eos.db.getFit(fitID)
        fit.character = self.character = eos.db.getCharacter(charID)
        self.recalc(fit)
开发者ID:MRACHINI,项目名称:Pyfa,代码行数:10,代码来源:fit.py


示例19: fetchSkills

 def fetchSkills(self, event):
     charName = self.charChoice.GetString(self.charChoice.GetSelection())
     if charName:
         try:
             sChar = Character.getInstance()
             activeChar = self.charEditor.entityEditor.getActiveEntity()
             sChar.apiFetch(activeChar.ID, charName)
             self.stStatus.SetLabel("Successfully fetched %s\'s skills from EVE API." % charName)
         except Exception, e:
             self.stStatus.SetLabel("Unable to retrieve %s\'s skills. Error message:\n%s" % (charName, e))
开发者ID:Ebag333,项目名称:Pyfa,代码行数:10,代码来源:characterEditor.py


示例20: refreshApi

 def refreshApi(self, event):
     sChar = Character.getInstance()
     ID, key, charName, chars = sChar.getApiDetails(self.getActiveCharacter())
     if charName:
         try:
             sChar.apiFetch(self.getActiveCharacter(), charName)
         except:
             # can we do a popup, notifying user of API error?
             pass
     self.refreshCharacterList()
开发者ID:Ebag333,项目名称:Pyfa,代码行数:10,代码来源:characterSelection.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python damagePattern.DamagePattern类代码示例发布时间:2022-05-27
下一篇:
Python cache.get_cached_driver函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap