本文整理汇总了Python中service.market.Market类的典型用法代码示例。如果您正苦于以下问题:Python Market类的具体用法?Python Market怎么用?Python Market使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Market类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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
示例3: droneKey
def droneKey(self, drone):
sMkt = Market.getInstance()
groupName = sMkt.getMarketGroupByItem(drone.item).name
return (self.DRONE_ORDER.index(groupName),
drone.item.name)
示例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
示例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
示例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
示例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)
示例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
示例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()
示例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
示例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)
示例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
示例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)
示例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
示例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