summaryrefslogtreecommitdiff
path: root/cad/src/experimental/demoapp_0.1/outtakes/pane-text-stuff.py
blob: e2669e484ba6b346743867a2883a10b2ae7d3324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40



outtakes:
    def set_tip(self, tip, obj):
        #print "set_tip:", tip, obj # works, except should be a better message when cmd is NOOP, and appearance/location
        self.tip.text = tip or ""
        self.tip_player = obj

    def unset_tip(self):
        self.set_tip("", None)

##    def on_mouse_motion_FROM_SOUNDSPACE(self, x, y, dx, dy): #### port me [already done?]
##        handle, offset = self.hit_test(x, y)
##        if handle:
##            self.tip.text = handle.tip # string constant describing what the handle adjusts
##            pos = self.player_transform(handle.player) # bks cmt: is this line needed?
##            self.tip_player = handle.player # the obj the handle is controlling
##        else:
##            self.tip.text = ''

        # tooltip [modified from soundspace.py; comments by bks, some are about the old context of the code]
        if self.tip_player: # the player that the tip should be near
            player_pos = self.player_transform(self.tip_player) # get transform for this player, for placing the tip
            # note: some other code has set tip.text... and has maintained tip_player ###k
            self.tip.x = player_pos[0]
            self.tip.y = player_pos[1] - 15
            self.tip.draw()

    def player_transform(self, obj): ### RENAME, get pos of obj for purpose of placing the tip
        try:
            return obj.pos
        except:
            print "tip needs pos from %r, nim" % (obj,)
            return None
        pass

        self.tip_player = None
            # the player object that the tip should be near; set in window on_mouse_motion [bks cmt]