From: Laszlo T. <ave...@us...> - 2006-12-27 21:19:28
|
Update of /cvsroot/gemrb/gemrb/gemrb/GUIScripts/tob In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14957/tob Modified Files: GUIINV.py Log Message: yellow highlight for valid slots when dragging an item over them Index: GUIINV.py =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/GUIScripts/tob/GUIINV.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** GUIINV.py 27 Dec 2006 19:55:41 -0000 1.60 --- GUIINV.py 27 Dec 2006 21:19:20 -0000 1.61 *************** *** 41,44 **** --- 41,45 ---- OldPortraitWindow = None OldOptionsWindow = None + OverSlot = None def OpenInventoryWindow (): *************** *** 142,149 **** if SlotType["ID"]: Button = GemRB.GetControl (Window, SlotType["ID"]) GemRB.SetVarAssoc (Window, Button, "ItemButton", slot+1) #keeping 2 in the original place, because it is how #the gui resource has it, but setting the other cycles ! GemRB.SetButtonSprites (Window, Button, "STONSLOT",0,0,2,1,3) GemRB.SetButtonFont (Window, Button, "NUMBER") GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_ALIGN_RIGHT | IE_GUI_BUTTON_ALIGN_TOP | IE_GUI_BUTTON_PICTURE, OP_OR) --- 143,152 ---- if SlotType["ID"]: Button = GemRB.GetControl (Window, SlotType["ID"]) + GemRB.SetEvent (Window, Button, IE_GUI_MOUSE_ENTER_BUTTON, "MouseEnterSlot") + GemRB.SetEvent (Window, Button, IE_GUI_MOUSE_LEAVE_BUTTON, "MouseLeaveSlot") GemRB.SetVarAssoc (Window, Button, "ItemButton", slot+1) #keeping 2 in the original place, because it is how #the gui resource has it, but setting the other cycles ! GemRB.SetButtonSprites (Window, Button, "STONSLOT",0,0,2,4,3) GemRB.SetButtonFont (Window, Button, "NUMBER") GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_ALIGN_RIGHT | IE_GUI_BUTTON_ALIGN_TOP | IE_GUI_BUTTON_PICTURE, OP_OR) *************** *** 427,437 **** GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_SHIFT_PRESS, "") ! if (SlotType["Type"]&SLOT_INVENTORY) or not GemRB.CanUseItemType(itemtype, SlotType["Type"]): ! GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) else: ! GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) ! if slot_item and (GemRB.GetEquippedQuickSlot (pc)==slot+1 or GemRB.GetEquippedAmmunition (pc)==slot+1): ! GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_THIRD) return --- 430,446 ---- GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_SHIFT_PRESS, "") ! if OverSlot == slot+1: ! if GemRB.CanUseItemType(itemtype, SlotType["Type"]): ! GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SELECTED) ! else: ! GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) else: ! if (SlotType["Type"]&SLOT_INVENTORY) or not GemRB.CanUseItemType(itemtype, SlotType["Type"]): ! GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) ! else: ! GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) ! if slot_item and (GemRB.GetEquippedQuickSlot (pc)==slot+1 or GemRB.GetEquippedAmmunition (pc)==slot+1): ! GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_THIRD) return *************** *** 440,444 **** pc = GemRB.GameGetSelectedPCSingle () ! slot = GemRB.GetVar ("GroundItemButton") + GemRB.GetVar("TopIndex") if not GemRB.IsDraggingItem (): slot_item = GemRB.GetContainerItem (pc, slot) --- 449,453 ---- pc = GemRB.GameGetSelectedPCSingle () ! slot = GemRB.GetVar ("GroundItemButton") + GemRB.GetVar ("TopIndex") if not GemRB.IsDraggingItem (): slot_item = GemRB.GetContainerItem (pc, slot) *************** *** 619,623 **** GemRB.SetText (Window, Text, text) ! GemRB.ShowModal(ItemInfoWindow, MODAL_SHADOW_GRAY) return --- 628,632 ---- GemRB.SetText (Window, Text, text) ! GemRB.ShowModal (ItemInfoWindow, MODAL_SHADOW_GRAY) return *************** *** 647,651 **** pc = GemRB.GameGetSelectedPCSingle () ! slot = GemRB.GetVar("TopIndex")+GemRB.GetVar("GroundItemButton") slot_item = GemRB.GetContainerItem (pc, slot) --- 656,660 ---- pc = GemRB.GameGetSelectedPCSingle () ! slot = GemRB.GetVar ("TopIndex")+GemRB.GetVar ("GroundItemButton") slot_item = GemRB.GetContainerItem (pc, slot) *************** *** 658,661 **** --- 667,689 ---- return + def MouseEnterSlot (): + global OverSlot + + pc = GemRB.GameGetSelectedPCSingle () + OverSlot = GemRB.GetVar ("ItemButton") + if GemRB.IsDraggingItem(): + UpdateSlot (pc, OverSlot-1) + return + + def MouseLeaveSlot (): + global OverSlot + + pc = GemRB.GameGetSelectedPCSingle () + slot = GemRB.GetVar ("ItemButton") + if slot == OverSlot or not GemRB.IsDraggingItem (): + OverSlot = None + UpdateSlot (pc, slot-1) + return + ################################################### #End of file GUIINV.py |