def __init__(self, data, trade=0, buy=0, sell=0, use=0, weapon=0, isDisabled=0, **kw): width = PiratesGuiGlobals.PurchaseListItemWidth height = PiratesGuiGlobals.PurchaseListItemHeight optiondefs = (('relief', None, None), ('state', DGG.NORMAL, None), ('frameSize', (0, width, 0, height), None), ('pressEffect', 0, None), ('command', self.sendEvents, None)) self.defineoptions(kw, optiondefs) InventoryListItem.__init__( self, data, trade=trade, buy=buy, sell=sell, use=use, weapon=weapon, isDisabled=isDisabled, width=PiratesGuiGlobals.PurchaseListItemWidth, height=PiratesGuiGlobals.PurchaseListItemHeight) self.initialiseoptions(PurchaseListItem) self.createGui() self.bind(DGG.ENTER, self.highlightStart) self.bind(DGG.EXIT, self.highlightStop) return
def __init__(self, data, trade = 0, buy = 0, sell = 0, use = 0, weapon = 0, isDisabled = 0, **kw): width = PiratesGuiGlobals.PurchaseListItemWidth height = PiratesGuiGlobals.PurchaseListItemHeight optiondefs = (('relief', None, None), ('state', DGG.NORMAL, None), ('frameSize', (0, width, 0, height), None), ('pressEffect', 0, None), ('command', self.sendEvents, None)) self.defineoptions(kw, optiondefs) InventoryListItem.__init__(self, data, trade = trade, buy = buy, sell = sell, use = use, weapon = weapon, isDisabled = isDisabled, width = PiratesGuiGlobals.PurchaseListItemWidth, height = PiratesGuiGlobals.PurchaseListItemHeight) self.initialiseoptions(PurchaseListItem) self.createGui() self.bind(DGG.ENTER, self.highlightStart) self.bind(DGG.EXIT, self.highlightStop)
def __init__(self, data, trade = 0, buy = 0, sell = 0, use = 0, weapon = 0, isDisabled = 0, **kw): if (trade and buy and sell and use or weapon) and not isDisabled: buttonRelief = DGG.RAISED buttonState = DGG.NORMAL else: buttonRelief = DGG.RIDGE buttonState = DGG.DISABLED self.loadGui() optiondefs = (('relief', None, None), ('state', buttonState, None), ('frameSize', (0, self.width, 0, self.height), None), ('image', InventoryItemGui.genericButton, None), ('image_scale', (0.54000000000000004, 1, 0.41999999999999998), None), ('image_pos', (0.26000000000000001, 0, 0.080000000000000002), None), ('pressEffect', 0, None), ('command', self.sendEvents, None)) self.defineoptions(kw, optiondefs) InventoryListItem.__init__(self, data, trade = trade, buy = buy, sell = sell, use = use, weapon = weapon, isDisabled = isDisabled, width = self.width, height = self.height) self.initialiseoptions(InventoryItemGui) self.createGui() self.draggable = abs(self.buy) + abs(self.sell) + abs(self.use) + abs(self.trade) - 1 if self.draggable > 0: self.bind(DGG.B1PRESS, self.dragStart) self.bind(DGG.B1RELEASE, self.dragStop) self.bind(DGG.B2PRESS, self.dragStart) self.bind(DGG.B2RELEASE, self.dragStop) self.bind(DGG.B3PRESS, self.dragStart) self.bind(DGG.B3RELEASE, self.dragStop) if self.weapon: self.bind(DGG.B1PRESS, self.equipWeapon) self.bind(DGG.B2PRESS, self.equipWeapon) self.bind(DGG.B3PRESS, self.equipWeapon) self.helpFrame = None self.cm = CardMaker('itemCard') self.cm.setFrame(-0.29999999999999999, 0.29999999999999999, -0.089999999999999997, 0.089999999999999997) self.buffer = None self.lens = PerspectiveLens() self.lens.setNear(0.5) self.lens.setAspectRatio(0.59999999999999998 / 0.17999999999999999) self.realItem = None self.itemCard = None self.portraitSceneGraph = NodePath('PortraitSceneGraph') detailGui = loader.loadModel('models/gui/gui_card_detail') self.bg = detailGui.find('**/color') self.bg.setScale(4) self.bg.setPos(0, 17, -6.2999999999999998) self.glow = detailGui.find('**/glow') self.glow.setScale(3) self.glow.setPos(0, 17, -6.2999999999999998) self.glow.setColor(1, 1, 1, 0.80000000000000004) self.setBin('gui-fixed', 1) self.accept('open_main_window', self.createBuffer) self.accept('aspectRatioChanged', self.createBuffer) self.accept('close_main_window', self.destroyBuffer) self.bind(DGG.ENTER, self.showDetails) self.bind(DGG.EXIT, self.hideDetails)
def destroy(self): taskMgr.remove('helpInfoTask') taskMgr.remove(self.taskName('dragTask')) self.destroyBuffer() if self.itemCard: self.itemCard.removeNode() if self.realItem: self.realItem.removeNode() if self.helpFrame: self.helpFrame.destroy() self.helpFrame = None del self.picture if self.weapon: taskMgr.remove(DGG.B1PRESS) taskMgr.remove(DGG.B2PRESS) taskMgr.remove(DGG.B3PRESS) InventoryListItem.destroy(self)
def destroy(self): del self.picture self.highlightStop() InventoryListItem.destroy(self)
def loadGui(self): if InventoryItemGui.guiLoaded: return None InventoryListItem.loadGui(self) InventoryItemGui.genericButton = (InventoryListItem.topGui.find('**/generic_button'), InventoryListItem.topGui.find('**/generic_button_down'), InventoryListItem.topGui.find('**/generic_button_over'), InventoryListItem.topGui.find('**/generic_button_disabled'))