コード例 #1
0
ファイル: gui_navigation.py プロジェクト: TG-Techie/TG-US
    def move(self, dirx, diry):

        #if self.move_mode == (0,1):
        #diry = (dirx or diry)

        #starting locations
        nextx = self.selected[0] + get_direction(dirx)
        nexty = self.selected[1] + get_direction(diry)

        chgx = 0
        chgy = 0

        #check if on my movement method superior needs to movw pages
        if not (0 <= nextx < self.cols):
            chgy += get_direction(nextx)
        if not (0 <= nexty < self.rows):
            chgx += get_direction(nexty)

        #print(chgx,chgy)
        nextx = nextx + chgx
        nexty = nexty + chgy

        #if chgx*self.move_mode[0] or chgy*self.move_mode[1]:
        #print(not(0 <= nextx < self.cols) and not(0 <= nexty < self.rows))
        #print(not(0 <= nextx < self.cols) and not(0 <= nexty < self.rows) and (chgx + chgy))
        #print(chgx + chgy)
        #print('---')
        #self.superior.move(1)
        if (blank_nidos_superior != self.superior):
            if not (0 <= nextx < self.cols) and not (
                    0 <= nexty < self.rows) and (chgx + chgy):
                try:
                    #print('moving superior')
                    #print((self.superior._gui_id))
                    self.superior.move(chgx + chgy)
                    #(self.superior.move(chgx*self.move_mode[0] + chgy*self.move_mode[1]))

                    #self.superior.move(get_direction(sup_dir) * bool(abs(sup_dir) == (self.selected[0] + self.selected[1] )))
                    #self.superior.move(chgx,chgy)
                except:
                    pass

            #for i in (1,):
            else:  #blank_nidos_superior != self.superior:
                self.switch((nextx) % self.cols, (nexty) % self.rows)

        del nextx, nexty, chgx, chgy
コード例 #2
0
    def move(self, direction):
        next_pos = self._cur_pos + get_direction(direction)

        if self.move_loop:
            next_pos = next_pos % len(self.contents)
        else:
            next_pos = max(0, min(next_pos, len(self.contents) - 1))
        #print('win side move',next_pos)
        self.switch(next_pos)
コード例 #3
0
ファイル: gui_navigation.py プロジェクト: TG-Techie/TG-US
    def move(self, direction):
        #print('superior recieved move command')
        next_pos = self._cur_pos + get_direction(direction)

        if self.move_loop:
            next_pos = next_pos % len(self.index)
        else:
            next_pos = max(0, min(next_pos, len(self.index) - 1))
        #print('win side move',next_pos)
        self.switch(next_pos)
コード例 #4
0
    def move(self, dirx, diry):

        #if self.move_mode == (0,1):
        #diry = (dirx or diry)

        #starting locations
        nextx = self.selected[0] + get_direction(dirx)
        nexty = self.selected[1] + get_direction(diry)

        chgx = 0
        chgy = 0

        #check if on my movement method superior needs to movw pages
        if not (0 <= nextx < self.cols):
            chgy += get_direction(nextx)
        if not (0 <= nexty < self.rows):
            chgx += get_direction(nexty)

        print(chgx, chgy)
        nextx = nextx + chgx
        nexty = nexty + chgy

        #if chgx*self.move_mode[0] or chgy*self.move_mode[1]:
        print(not (0 <= nextx < self.cols) and not (0 <= nexty < self.rows))
        if not (0 <= nextx < self.cols) and not (0 <= nexty < self.rows):
            try:
                (self.superior.move(chgx * self.move_mode[0] +
                                    chgy * self.move_mode[1]))

                #self.superior.move(get_direction(sup_dir) * bool(abs(sup_dir) == (self.selected[0] + self.selected[1] )))
                #self.superior.move(chgx,chgy)
            except:
                pass

        self.switch((nextx) % self.cols, (nexty) % self.rows)

        del nextx, nexty, chgx, chgy