本文整理汇总了Python中service.market.Market类的典型用法代码示例。如果您正苦于以下问题:Python Market类的具体用法?Python Market怎么用?Python Market使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Market类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: spawnMenu
def spawnMenu(self, event):
item = event.GetItem()
self.skillTreeListCtrl.Select(item)
thing = self.skillTreeListCtrl.GetFirstChild(item).IsOk()
if thing:
return
id = self.skillTreeListCtrl.GetItemData(item)[1]
eveItem = Market.getInstance().getItem(id)
srcContext = "skillItem"
itemContext = "Skill"
context = (srcContext, itemContext)
menu = ContextMenu.getMenu(eveItem, [eveItem], context)
char = self.charEditor.entityEditor.getActiveEntity()
if char.name not in ("All 0", "All 5"):
menu.AppendSeparator()
menu.Append(self.idUnlearned, "Unlearn")
for level in range(6):
menu.Append(self.idLevels[level], "Level %d" % level)
# Doesn't make sense to have these menu items here, as they do not revert skill changes
# done in an editor - because these changes are persisted anyway
# menu.AppendSeparator()
# menu.Append(self.revertID, "Revert")
# menu.Append(self.saveID, "Save")
menu.Bind(wx.EVT_MENU, self.changeLevel)
self.PopupMenu(menu)
开发者ID:pyfa-org,项目名称:Pyfa,代码行数:28,代码来源:characterEditor.py
示例2: importCrest
def importCrest(str_):
fit = json.loads(str_)
sMkt = Market.getInstance()
f = Fit()
f.name = fit['name']
try:
try:
f.ship = Ship(sMkt.getItem(fit['ship']['id']))
except ValueError:
f.ship = Citadel(sMkt.getItem(fit['ship']['id']))
except:
return None
items = fit['items']
items.sort(key=lambda k: k['flag'])
moduleList = []
for module in items:
try:
item = sMkt.getItem(module['type']['id'], eager="group.category")
if module['flag'] == INV_FLAG_DRONEBAY:
d = Drone(item)
d.amount = module['quantity']
f.drones.append(d)
elif module['flag'] == INV_FLAG_CARGOBAY:
c = Cargo(item)
c.amount = module['quantity']
f.cargo.append(c)
elif module['flag'] == INV_FLAG_FIGHTER:
fighter = Fighter(item)
f.fighters.append(fighter)
else:
try:
m = Module(item)
# When item can't be added to any slot (unknown item or just charge), ignore it
except ValueError:
continue
# Add subsystems before modules to make sure T3 cruisers have subsystems installed
if item.category.name == "Subsystem":
if m.fits(f):
f.modules.append(m)
else:
if m.isValidState(State.ACTIVE):
m.state = State.ACTIVE
moduleList.append(m)
except:
continue
# Recalc to get slot numbers correct for T3 cruisers
svcFit.getInstance().recalc(f)
for module in moduleList:
if module.fits(f):
f.modules.append(module)
return f
开发者ID:Ebag333,项目名称:Pyfa,代码行数:60,代码来源:port.py
示例3: droneKey
def droneKey(self, drone):
sMkt = Market.getInstance()
groupName = sMkt.getMarketGroupByItem(drone.item).name
return (self.DRONE_ORDER.index(groupName),
drone.item.name)
开发者ID:burnsypet,项目名称:Pyfa,代码行数:7,代码来源:droneView.py
示例4: display
def display(self, srcContext, mainItem):
validContexts = ("marketItemMisc", "fittingModule",
"fittingCharge", "droneItem",
"implantItem", "boosterItem",
"projectedModule", "projectedDrone",
"projectedCharge", "cargoItem",
"implantItemChar", "fighterItem",
"projectedFighter")
if srcContext not in validContexts or mainItem is None:
return False
if mainItem is None or getattr(mainItem, "isEmpty", False):
return False
sMkt = Market.getInstance()
item = getattr(mainItem, "item", mainItem)
isMutated = getattr(mainItem, "isMutated", False)
mktGrp = sMkt.getMarketGroupByItem(item)
if mktGrp is None and isMutated:
mktGrp = sMkt.getMarketGroupByItem(mainItem.baseItem)
# 1663 is Special Edition Festival Assets, we don't have root group for it
if mktGrp is None or mktGrp.ID == 1663:
return False
doit = not mainItem.isEmpty if srcContext == "fittingModule" else True
return doit
开发者ID:pyfa-org,项目名称:Pyfa,代码行数:28,代码来源:itemMarketJump.py
示例5: getSubMenu
def getSubMenu(self, context, selection, rootMenu, i, pitem):
msw = True if "wxMSW" in wx.PlatformInfo else False
sMkt = Market.getInstance()
effdata = sMkt.getSystemWideEffects()
self.idmap = {}
sub = wx.Menu()
for swType in sorted(effdata):
subItem = wx.MenuItem(sub, wx.ID_ANY, swType)
grandSub = wx.Menu()
subItem.SetSubMenu(grandSub)
sub.AppendItem(subItem)
for swData in sorted(effdata[swType], key=lambda tpl: tpl[2]):
wxid = ContextMenu.nextID()
swObj, swName, swClass = swData
self.idmap[wxid] = (swObj, swName)
grandSubItem = wx.MenuItem(grandSub, wxid, swClass)
if msw:
rootMenu.Bind(wx.EVT_MENU, self.handleSelection, grandSubItem)
else:
grandSub.Bind(wx.EVT_MENU, self.handleSelection, grandSubItem)
grandSub.AppendItem(grandSubItem)
return sub
开发者ID:PaulKPetersonCO,项目名称:Pyfa,代码行数:25,代码来源:whProjector.py
示例6: display
def display(self, srcContext, mainItem, selection):
if not self.settings.get('metaSwap'):
return False
if self.mainFrame.getActiveFit() is None or srcContext not in (
'fittingModule',
'droneItem',
'fighterItem',
'boosterItem',
'implantItem',
'cargoItem',
'projectedModule',
'projectedDrone',
'projectedFighter'
):
return False
if mainItem is None or getattr(mainItem, 'isEmpty', False):
return False
self.mainVariations = Market.getInstance().getVariationsByItems((mainItem.item,))
# No variations from current module
if len(self.mainVariations) < 2:
return False
self.mainItem = mainItem
self.selection = selection
return True
开发者ID:pyfa-org,项目名称:Pyfa,代码行数:28,代码来源:itemVariationChange.py
示例7: spawnMenu
def spawnMenu(self):
sel = self.GetFirstSelected()
menu = None
sFit = Fit.getInstance()
fit = sFit.getFit(self.mainFrame.getActiveFit())
if not fit:
return
if sel != -1:
implant = fit.appliedImplants[sel]
sMkt = Market.getInstance()
sourceContext = "implantItem" if fit.implantSource == ImplantLocation.FIT else "implantItemChar"
itemContext = sMkt.getCategoryByItem(implant.item).name
menu = ContextMenu.getMenu((implant,), (sourceContext, itemContext))
elif sel == -1 and fit.implantSource == ImplantLocation.FIT:
fitID = self.mainFrame.getActiveFit()
if fitID is None:
return
context = (("implantView",),)
menu = ContextMenu.getMenu([], *context)
if menu is not None:
self.PopupMenu(menu)
开发者ID:burnsypet,项目名称:Pyfa,代码行数:26,代码来源:implantView.py
示例8: display
def display(self, srcContext, selection):
if not self.settings.get('metaSwap'):
return False
if self.mainFrame.getActiveFit() is None or srcContext not in (
"fittingModule",
"droneItem",
"fighterItem",
"boosterItem",
"implantItem",
"cargoItem",
):
return False
# Check if list of variations is same for all of selection
# If not - don't show the menu
mkt = Market.getInstance()
self.variations = None
for i in selection:
variations = mkt.getVariationsByItems([i.item])
if self.variations is None:
self.variations = variations
else:
if variations != self.variations:
return False
self.selection = selection
if len(self.variations) == 1:
return False # no variations from current module
return True
开发者ID:Sectoid,项目名称:Pyfa,代码行数:32,代码来源:metaSwap.py
示例9: refreshPanel
def refreshPanel(self, fit):
if fit is not None:
self.fit = fit
# Compose a list of all the data we need & request it
typeIDs = []
typeIDs.append(fit.ship.item.ID)
for mod in fit.modules:
if not mod.isEmpty:
typeIDs.append(mod.itemID)
for drone in fit.drones:
typeIDs.append(drone.itemID)
for fighter in fit.fighters:
if fighter.amountActive > 0:
typeIDs.append(fighter.itemID)
for cargo in fit.cargo:
typeIDs.append(cargo.itemID)
sMkt = Market.getInstance()
sMkt.getPrices(typeIDs, self.processPrices)
self.labelEMStatus.SetLabel("Updating prices...")
else:
self.labelEMStatus.SetLabel("")
self.labelPriceShip.SetLabel("0.0 ISK")
self.labelPriceFittings.SetLabel("0.0 ISK")
self.labelPriceTotal.SetLabel("0.0 ISK")
self._cachedFittings = self._cachedShip = self._cachedTotal = 0
self.panel.Layout()
开发者ID:Ebag333,项目名称:Pyfa,代码行数:31,代码来源:priceViewFull.py
示例10: getAbyssalWeather
def getAbyssalWeather(self):
sMkt = Market.getInstance()
environments = {x.ID: x for x in sMkt.getGroup("Abyssal Environment").items}
items = chain(sMkt.getGroup("MassiveEnvironments").items, sMkt.getGroup("Non-Interactable Object").items)
grouped = {}
flat = set()
for beacon in items:
if not beacon.isType('projected'):
continue
type = self.__class__.abyssal_mapping.get(beacon.name[0:-2], None)
type = environments.get(type, None)
if type is None:
continue
if type.name not in grouped:
grouped[type.name] = set()
display_name = "{} {}".format(type.name, beacon.name[-1:])
grouped[type.name].add((beacon, display_name, display_name))
# PVP weather
flat.add((sMkt.getItem(49766), 'PvP Weather', 'PvP Weather'))
return grouped, flat
开发者ID:pyfa-org,项目名称:Pyfa,代码行数:28,代码来源:envEffectAdd.py
示例11: run
def run(self):
# wait 1 second just in case a lot of modifications get made
time.sleep(1)
if self.stopRunning:
return
sMkt = Market.getInstance()
sFit = Fit.getInstance()
settings = HTMLExportSettings.getInstance()
minimal = settings.getMinimalEnabled()
dnaUrl = "https://o.smium.org/loadout/dna/"
if minimal:
HTML = self.generateMinimalHTML(sMkt, sFit, dnaUrl)
else:
HTML = self.generateFullHTML(sMkt, sFit, dnaUrl)
try:
FILE = open(settings.getPath(), "w", encoding='utf-8')
FILE.write(HTML)
FILE.close()
except IOError as ex:
print(("Failed to write to " + settings.getPath()))
pass
except Exception as ex:
pass
if self.callback:
wx.CallAfter(self.callback, -1)
开发者ID:bsmr-eve,项目名称:Pyfa,代码行数:30,代码来源:exportHtml.py
示例12: display
def display(self, srcContext, selection):
if not self.settings.get('marketJump'):
return False
validContexts = ("marketItemMisc", "fittingModule",
"fittingCharge", "droneItem",
"implantItem", "boosterItem",
"projectedModule", "projectedDrone",
"projectedCharge", "cargoItem",
"implantItemChar", "fighterItem",
"projectedDrone")
if srcContext not in validContexts or selection is None or len(selection) < 1:
return False
sMkt = Market.getInstance()
item = getattr(selection[0], "item", selection[0])
isMutated = getattr(selection[0], "isMutated", False)
mktGrp = sMkt.getMarketGroupByItem(item)
if mktGrp is None and isMutated:
mktGrp = sMkt.getMarketGroupByItem(selection[0].baseItem)
# 1663 is Special Edition Festival Assets, we don't have root group for it
if mktGrp is None or mktGrp.ID == 1663:
return False
doit = not selection[0].isEmpty if srcContext == "fittingModule" else True
return doit
开发者ID:blitzmann,项目名称:Pyfa,代码行数:28,代码来源:marketJump.py
示例13: expandLookup
def expandLookup(self, event):
tree = self.availableImplantsTree
sMkt = Market.getInstance()
parent = event.Item
child, _ = tree.GetFirstChild(parent)
text = tree.GetItemText(child)
if text == "dummy" or text == "itemdummy":
tree.Delete(child)
# if the dummy item is a market group, replace with actual market groups
if text == "dummy":
# Add 'real stoof!' instead
currentMktGrp = sMkt.getMarketGroup(tree.GetPyData(parent), eager="children")
for childMktGrp in sMkt.getMarketGroupChildren(currentMktGrp):
iconId = self.addMarketViewImage(sMkt.getIconByMarketGroup(childMktGrp))
childId = tree.AppendItem(parent, childMktGrp.name, iconId, data=wx.TreeItemData(childMktGrp.ID))
if sMkt.marketGroupHasTypesCheck(childMktGrp) is False:
tree.AppendItem(childId, "dummy")
else:
tree.AppendItem(childId, "itemdummy")
# replace dummy with actual items
if text == "itemdummy":
currentMktGrp = sMkt.getMarketGroup(tree.GetPyData(parent))
items = sMkt.getItemsByMarketGroup(currentMktGrp)
for item in items:
iconId = self.addMarketViewImage(item.icon.iconFile)
tree.AppendItem(parent, item.name, iconId, data=wx.TreeItemData(item))
tree.SortChildren(parent)
开发者ID:copyliu,项目名称:Pyfa,代码行数:31,代码来源:implantEditor.py
示例14: display
def display(self, srcContext, selection):
if not self.settings.get('moduleAmmoPicker'):
return False
if self.mainFrame.getActiveFit() is None or srcContext not in ("fittingModule", "projectedModule"):
return False
modules = selection if srcContext == "fittingModule" else (selection[0],)
validCharges = None
checkedTypes = set()
for mod in modules:
# loop through modules and gather list of valid charges
if mod.item.ID in checkedTypes:
continue
checkedTypes.add(mod.item.ID)
currCharges = mod.getValidCharges()
if len(currCharges) > 0:
if validCharges is not None and validCharges != currCharges:
return False
validCharges = currCharges
self.module = mod
if validCharges is None:
return False
self.modules = modules
self.charges = list([charge for charge in validCharges if Market.getInstance().getPublicityByItem(charge)])
return len(self.charges) > 0
开发者ID:bsmr-eve,项目名称:Pyfa,代码行数:31,代码来源:moduleAmmoPicker.py
示例15: getText
def getText(self, stuff):
if isinstance(stuff, Drone):
return "%dx %s" % (stuff.amount, stuff.item.name)
elif isinstance(stuff, Fighter):
return "%d/%d %s" % \
(stuff.amountActive, stuff.getModifiedItemAttr("fighterSquadronMaxSize"), stuff.item.name)
elif isinstance(stuff, Cargo):
return "%dx %s" % (stuff.amount, stuff.item.name)
elif isinstance(stuff, Fit):
if self.projectedView:
# we need a little more information for the projected view
fitID = self.mainFrame.getActiveFit()
info = stuff.getProjectionInfo(fitID)
if info:
return "%dx %s (%s)" % (stuff.getProjectionInfo(fitID).amount, stuff.name, stuff.ship.item.name)
pyfalog.warning("Projected View trying to display things that aren't there. stuff: {}, info: {}", repr(stuff),
info)
return "<unknown>"
else:
return "%s (%s)" % (stuff.name, stuff.ship.item.name)
elif isinstance(stuff, Rack):
if FitSvc.getInstance().serviceFittingOptions["rackLabels"]:
if stuff.slot == FittingSlot.MODE:
return '─ Tactical Mode ─'
else:
return '─ {} {} Slot{}─'.format(stuff.num, FittingSlot(stuff.slot).name.capitalize(), '' if stuff.num == 1 else 's')
else:
return ""
elif isinstance(stuff, Module):
if self.projectedView:
# check for projected abyssal name
name_check = stuff.item.name[0:-2]
type = WhProjector.abyssal_mapping.get(name_check, None)
if type:
sMkt = Market.getInstance()
type = sMkt.getItem(type)
return "{} {}".format(type.name, stuff.item.name[-1:])
if stuff.isEmpty:
return "%s Slot" % FittingSlot(stuff.slot).name.capitalize()
else:
return stuff.item.name
elif isinstance(stuff, Implant):
return stuff.item.name
else:
item = getattr(stuff, "item", stuff)
if FitSvc.getInstance().serviceFittingOptions["showMarketShortcuts"]:
marketShortcut = getattr(item, "marketShortcut", None)
if marketShortcut:
# use unicode subscript to display shortcut value
shortcut = chr(marketShortcut + 8320) + " "
del item.marketShortcut
return shortcut + item.name
return item.name
开发者ID:blitzmann,项目名称:Pyfa,代码行数:59,代码来源:baseName.py
示例16: groupHasFits
def groupHasFits(self, id):
sMkt = Market.getInstance()
grp = sMkt.getGroup(id, eager=("items", "group"))
items = sMkt.getItemsByGroup(grp)
for item in items:
if self.countFitsWithShip(item.ID) > 0:
return True
return False
开发者ID:MRACHINI,项目名称:Pyfa,代码行数:8,代码来源:fit.py
示例17: stage3
def stage3(self, event):
self.navpanel.ToggleRecentShips(False, False)
self.lpane.ShowLoading(False)
# If back is False, do not append to history. This could be us calling
# the stage from previous history, creating / copying fit, etc.
# We also have to use conditional for search stage since it's last data
# is kept elsewhere
if getattr(event, "back", False):
if self._activeStage == 4 and self.navpanel.lastSearch != "":
self.browseHist.append((4, self.navpanel.lastSearch))
else:
self.browseHist.append((self._activeStage, self.lastdata))
shipID = event.shipID
self.lastdata = shipID
self._lastStage = self._activeStage
self._activeStage = 3
sFit = Fit.getInstance()
sMkt = Market.getInstance()
ship = sMkt.getItem(shipID)
categoryID = ship.group.ID
self.lpane.Freeze()
self.lpane.RemoveAllChildren()
fitList = sFit.getFitsWithShip(shipID)
if len(fitList) == 0:
stage, data = self.browseHist.pop()
self.lpane.Thaw()
self.navpanel.gotoStage(stage, data)
return
self.categoryFitCache[categoryID] = True
self.navpanel.ShowNewFitButton(True)
self.navpanel.ShowSwitchEmptyGroupsButton(False)
if self.showRacesFilterInStage2Only:
self.raceselect.Show(False)
self.Layout()
fitList.sort(key=self.nameKey)
shipName = ship.name
self._stage3ShipName = shipName
self._stage3Data = shipID
shipTrait = ship.traits.traitText if (ship.traits is not None) else "" # empty string if no traits
for ID, name, booster, timestamp, notes, graphicID in fitList:
self.lpane.AddWidget(FitItem(self.lpane, ID, (shipName, shipTrait, name, booster, timestamp, notes), shipID, graphicID=graphicID))
self.lpane.RefreshList()
self.lpane.Thaw()
self.raceselect.RebuildRaces(self.RACE_ORDER)
开发者ID:blitzmann,项目名称:Pyfa,代码行数:58,代码来源:shipBrowser.py
示例18: getEffectBeacons
def getEffectBeacons(self, incursions=False):
"""
Get dictionary with wormhole system-wide effects
"""
sMkt = Market.getInstance()
# todo: rework this
# Container for system-wide effects
grouped = {}
# Expressions for matching when detecting effects we're looking for
if incursions:
validgroups = ("Incursion ship attributes effects",
"Invasion Effects")
else:
validgroups = ("Black Hole Effect Beacon",
"Cataclysmic Variable Effect Beacon",
"Magnetar Effect Beacon",
"Pulsar Effect Beacon",
"Red Giant Beacon",
"Wolf Rayet Effect Beacon")
# Stuff we don't want to see in names
garbages = ("Effects?", "Beacon", "ship attributes effects")
# Get group with all the system-wide beacons
grp = sMkt.getGroup("Effect Beacon")
# Cycle through them
for beacon in sMkt.getItemsByGroup(grp):
# Check if it belongs to any valid group
for group in validgroups:
# Check beginning of the name only
if re.match(group, beacon.name):
# Get full beacon name
beaconname = beacon.name
for garbage in garbages:
beaconname = re.sub(garbage, "", beaconname)
beaconname = re.sub(" {2,}", " ", beaconname).strip()
# Get short name
shortname = re.sub(group, "", beacon.name)
for garbage in garbages:
shortname = re.sub(garbage, "", shortname)
shortname = re.sub(" {2,}", " ", shortname).strip()
# Get group name
groupname = group
for garbage in garbages:
groupname = re.sub(garbage, "", groupname)
groupname = re.sub(" {2,}", " ", groupname).strip()
# Add stuff to dictionary
if groupname not in grouped:
grouped[groupname] = set()
grouped[groupname].add((beacon, beaconname, shortname))
# Break loop on 1st result
break
return grouped, ()
开发者ID:pyfa-org,项目名称:Pyfa,代码行数:57,代码来源:envEffectAdd.py
示例19: fighterKey
def fighterKey(self, fighter):
groupName = Market.getInstance().getGroupByItem(fighter.item).name
orderPos = self.FIGHTER_ORDER.index(groupName)
# Sort support fighters by name, ignore their abilities
if groupName == 'Support Fighter':
abilityEffectIDs = ()
# Group up fighters from various roles
else:
abilityEffectIDs = sorted(a.effectID for a in fighter.abilities)
return orderPos, abilityEffectIDs, fighter.item.name
开发者ID:pyfa-org,项目名称:Pyfa,代码行数:10,代码来源:fighterView.py
示例20: spawnMenu
def spawnMenu(self, event):
sel = self.GetFirstSelected()
if sel != -1:
fighter = self.fighters[sel]
sMkt = Market.getInstance()
sourceContext = "fighterItem"
itemContext = sMkt.getCategoryByItem(fighter.item).name
menu = ContextMenu.getMenu((fighter,), (sourceContext, itemContext))
self.PopupMenu(menu)
开发者ID:blitzmann,项目名称:Pyfa,代码行数:10,代码来源:fighterView.py
注:本文中的service.market.Market类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论