Exemplo n.º 1
0
    def update(self):

        # update liststore
        self.liststore.clear()
        self.liststore.append(("0.", _("Start Pos"), " "))
        mvstr = engine.getmovelist()

        if mvstr != "":
            mlst = mvstr.split(",")
            moveno = 1
            for m in mlst:

                (capture, ispromoted, move) = m.split(";")

                if move.find("*") == -1:
                    m1 = move[0:3]
                    m2 = move[3:]
                    move = m1 + capture + m2
                    if ispromoted == "+":
                        move = "+" + move
                comment = self.comments.get_comment(moveno)
                if comment != "":
                    cind = "..."
                else:
                    cind = " "
                e = str(moveno) + ".", move, cind
                self.liststore.append(e)
                moveno += 1

        GObject.idle_add(self.scroll_to_end)
Exemplo n.º 2
0
    def update(self):

        # update liststore
        self.liststore.clear()
        if gv.show_moves == True:
            gv.gui.movestore.clear()
         #clear() calls clicked !
        self.liststore.append(("0.", _("Start Pos"), " "))
        mvstr = ""  #initialize to avoid problem with new game after loaded file
        mvstr = engine.getmovelist()
        #
        
        moveno = 1
        if mvstr != "":
            mlst = mvstr.split(",")
            moveno = 1
            for m in mlst:

                (capture, ispromoted, move) = m.split(";")

                if move.find("*") == -1:
                    m1 = move[0:3]
                    m2 = move[3:]
                    move = m1 + capture + m2
                    if ispromoted == "+":
                        move = "+" + move
                comment = self.comments.get_comment(moveno)
                if gv.show_moves == True:
                    gv.gui.comment_view.get_buffer().set_text("-")
                                    
                if comment != "":
                    cind = "..."
                else:
                    cind = " "
                e = str(moveno) + ".", move, cind
                e1 = str(moveno) + "." + " " + move +" " + cind #+"\n"
                le = []
                # to move_view model
                le.append(e1)
                # to move_list model
                self.liststore.append(e)
                if gv.show_moves == True:                    
                                      
                    gv.gui.move_view.get_model().append(le)
                                     
                     
                moveno += 1
        comment = self.comments.get_comment(moveno)
        
        if gv.show_moves == True:
            #if gv.gui.comment_view.get_buffer() in not None:
                gv.gui.comment_view.get_buffer().set_text(comment)
        GObject.idle_add(self.scroll_to_end)
Exemplo n.º 3
0
    def update(self):

        # update liststore
        self.liststore.clear()
        if gv.show_moves == True:
            gv.gui.movestore.clear()
        #clear() calls clicked !
        self.liststore.append(("0.", _("Start Pos"), " "))
        mvstr = ""  #initialize to avoid problem with new game after loaded file
        mvstr = engine.getmovelist()
        #

        moveno = 1
        if mvstr != "":
            mlst = mvstr.split(",")
            moveno = 1
            for m in mlst:

                (capture, ispromoted, move) = m.split(";")

                if move.find("*") == -1:
                    m1 = move[0:3]
                    m2 = move[3:]
                    move = m1 + capture + m2
                    if ispromoted == "+":
                        move = "+" + move
                comment = self.comments.get_comment(moveno)
                if gv.show_moves == True:
                    gv.gui.comment_view.get_buffer().set_text("-")

                if comment != "":
                    cind = "..."
                else:
                    cind = " "
                e = str(moveno) + ".", move, cind
                e1 = str(moveno) + "." + " " + move + " " + cind  #+"\n"
                le = []
                # to move_view model
                le.append(e1)
                # to move_list model
                self.liststore.append(e)
                if gv.show_moves == True:

                    gv.gui.move_view.get_model().append(le)

                moveno += 1
        comment = self.comments.get_comment(moveno)

        if gv.show_moves == True:
            #if gv.gui.comment_view.get_buffer() in not None:
            gv.gui.comment_view.get_buffer().set_text(comment)
        GObject.idle_add(self.scroll_to_end)
Exemplo n.º 4
0
    def get_game(self):

        gamestr = ""
        startpos = gv.gshogi.get_startpos()
        # properties
        dat = str(date.today())
        dat = dat.replace("-", "/")

        zstr = '[Date "' + dat + '"]\n'
        gamestr += zstr

        zstr = '[Sente: ' + gv.gshogi.get_player(BLACK).strip() + '"]\n'
        gamestr += zstr

        zstr = '[Gote: ' + gv.gshogi.get_player(WHITE).strip() + '"]\n'
        gamestr += zstr

        # sfen
        if startpos == "startpos":
            zstr = '[SFEN "lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP' \
                   '/1B5R1/LNSGKGSNL b - 1"]\n'
            gamestr += zstr
        else:
            zstr = '[SFEN "' + startpos + '"]\n'
            gamestr += zstr

        # add comment if present
        comment = self.comments.get_comment(0)
        if comment != "":
            gamestr = gamestr + "{\n" + comment + "\n}\n"

        # if the movelist is positioned part way through the game then
        # we must redo all moves so the full game will be saved
        redo_count = len(gv.gshogi.get_redolist())
        for i in range(0, redo_count):
            gv.gshogi.redo_move()

        # moves
        moveno = 1
        # ml = self.movelist
        mvstr = engine.getmovelist()

        # if we did any redo moves then undo them now to get things back
        # the way they were
        for i in range(0, redo_count):
            gv.gshogi.undo_move()

        if mvstr != "":
            mlst = mvstr.split(",")

            for m in mlst:

                (capture, ispromoted, move) = m.split(";")

                if move.find("*") == -1:
                    m1 = move[0:3]
                    m2 = move[3:]
                    move = m1 + capture + m2
                    if ispromoted == "+":
                        move = "+" + move
                zstr = str(moveno) + "." + move + "\n"
                gamestr += zstr
                # add comment for this move if present
                comment = self.comments.get_comment(moveno)
                if comment != "":
                    gamestr = gamestr + "{" + comment + "}\n"
                moveno += 1
        #if gv.show_moves:
        #   gv.gui.moves_clicked_(0)
        return (gamestr)
Exemplo n.º 5
0
    def get_game(self):

        gamestr = ""
        startpos = gv.gshogi.get_startpos()
        # properties
        dat = str(date.today())
        dat = dat.replace("-", "/")

        zstr = '[Date "' + dat + '"]\n'
        gamestr += zstr

        zstr =  '[Sente: ' + gv.gshogi.get_player(BLACK).strip() + '"]\n'   
        gamestr += zstr

        zstr =  '[Gote: ' + gv.gshogi.get_player(WHITE).strip() + '"]\n' 
        gamestr += zstr

        # sfen
        if startpos == "startpos":
            zstr = '[SFEN "lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP' \
                   '/1B5R1/LNSGKGSNL b - 1"]\n'
            gamestr += zstr
        else:
            zstr = '[SFEN "' + startpos + '"]\n'
            gamestr += zstr

        # add comment if present
        comment = self.comments.get_comment(0)
        if comment != "":
            gamestr = gamestr + "{\n" + comment + "\n}\n"

        # if the movelist is positioned part way through the game then
        # we must redo all moves so the full game will be saved
        redo_count = len(gv.gshogi.get_redolist())
        for i in range(0, redo_count):
            gv.gshogi.redo_move()

        # moves
        moveno = 1
        # ml = self.movelist
        mvstr = engine.getmovelist()

        # if we did any redo moves then undo them now to get things back
        # the way they were
        for i in range(0, redo_count):
            gv.gshogi.undo_move()

        if mvstr != "":
            mlst = mvstr.split(",")

            for m in mlst:

                (capture, ispromoted, move) = m.split(";")

                if move.find("*") == -1:
                    m1 = move[0:3]
                    m2 = move[3:]
                    move = m1 + capture + m2
                    if ispromoted == "+":
                        move = "+" + move
                zstr = str(moveno) + "." + move + "\n"
                gamestr += zstr
                # add comment for this move if present
                comment = self.comments.get_comment(moveno)
                if comment != "":
                    gamestr = gamestr + "{" + comment + "}\n"
                moveno += 1
        #if gv.show_moves:
         #   gv.gui.moves_clicked_(0)
        return (gamestr)