Changeset 156


Ignore:
Timestamp:
06/20/09 21:34:36 (10 years ago)
Author:
meggie_parpg
Message:

Believe that mouseMoved 'bug' is fixed by making mousePressed mouseReleased instead (see forums and chat logs for discussion).

Location:
trunk/PARPG/scripts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/PARPG/scripts/context_menu.py

    r152 r156  
    3636            p = pychan.widgets.Button(name=item[0], text=unicode(item[1])) 
    3737            self.vbox.addChild(p) 
    38             events_to_map[item[0]] = cbwa(*item[2:]) 
     38            events_to_map[item[0]+"/mousePressed"] = cbwa(*item[2:]) 
     39            events_to_map[item[0]+"/mouseReleased"] = self.vbox.hide 
    3940        self.vbox.mapEvents(events_to_map) 
    4041        self.vbox.show() 
  • trunk/PARPG/scripts/engine.py

    r153 r156  
    242242                if isinstance(i, NpcData): 
    243243                    # keep it simple for now, None to be replaced by callbacks 
    244                     actions.append(["Talk", "Talk", self.nullFunc, i]) 
     244                    actions.append(["Talk", "Talk", self.initTalk, i]) 
    245245                    actions.append(["Attack", "Attack", self.nullFunc, i])  
    246246                elif isinstance(i, DoorData): 
     
    262262        print userdata 
    263263     
    264     def initTalk(self, npc): 
     264    def initTalk(self, npcInfo): 
    265265        """ Starts the PC talking to an NPC. """ 
    266266        # TODO: work more on this when we get NPCData and HeroData straightened 
    267267        # out 
    268         npc.talk() 
     268        for npc in self.npcs: 
     269            if str(npcInfo.id) == npc.id: 
     270                npc.talk() 
     271                break 
    269272        self.PC.approachNPC(npc.getLocation()) 
    270273 
     
    274277           @param map_file: Name of map file to load 
    275278           @return: None""" 
    276         # try to clear the menu 
    277         self.view.clearMenu() 
    278279        # then we let FIFE load the rest of the map 
    279280        self.view.load(str(map_file)) 
  • trunk/PARPG/scripts/world.py

    r155 r156  
    275275            self.sounds.toggleMusic() 
    276276 
    277     def mousePressed(self, evt): 
    278         """If a mouse button is pressed down, fife calls this routine. 
     277    def mouseReleased(self, evt): 
     278        """If a mouse button is released, fife calls this routine. 
     279           We want to wait until the button is released, because otherwise 
     280           pychan captures the release if a menu is opened. 
    279281           @type evt: fife.event 
    280282           @param evt: The event that fife caught 
     
    305307            pos = (evt.getX(), evt.getY()) 
    306308            self.context_menu = ContextMenu(self.engine, data, pos) 
    307              
     309 
    308310    def onWalk(self, click): 
    309311        """Callback sample for the context menu. 
Note: See TracChangeset for help on using the changeset viewer.