当前位置: 首页>>代码示例>>Python>>正文


Python gamewidget.cur_gmwidg函数代码示例

本文整理汇总了Python中pychess.widgets.gamewidget.cur_gmwidg函数的典型用法代码示例。如果您正苦于以下问题:Python cur_gmwidg函数的具体用法?Python cur_gmwidg怎么用?Python cur_gmwidg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cur_gmwidg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_rotate_board1_activate

 def on_rotate_board1_activate(self, widget):
     board_control = newGameDialog.SetupPositionExtension.board_control
     if board_control is not None and board_control.view.is_visible():
         view = newGameDialog.SetupPositionExtension.board_control.view
     elif gamewidget.cur_gmwidg() is not None:
         view = gamewidget.cur_gmwidg().board.view
     else:
         return
     if view.rotation:
         view.rotation = 0
     else:
         view.rotation = math.pi
开发者ID:TPNguyen,项目名称:pychess,代码行数:12,代码来源:Main.py

示例2: on_set_up_position_activate

 def on_set_up_position_activate(self, widget):
     gmwidg = gamewidget.cur_gmwidg()
     if gmwidg is not None:
         if len(gmwidg.gamemodel.boards) == 1:
             ply = 0
         else:
             ply = gmwidg.board.view.shown
         fen = gmwidg.gamemodel.boards[ply].asFen()
     else:
         fen = None
     newGameDialog.SetupPositionExtension.run(fen)
开发者ID:Stephen-Gose-Game-Studio,项目名称:pychess,代码行数:11,代码来源:Main.py

示例3: on_quit1_activate

    def on_quit1_activate(self, widget, *args):
        if isinstance(widget, Gdk.Event):
            if len(gameDic) == 1 and conf.get("hideTabs", False):
                gmwidg = gamewidget.cur_gmwidg()
                response = ionest.closeGame(gmwidg, gameDic[gmwidg])
                return True

        if ionest.closeAllGames(gameDic.items()) in (Gtk.ResponseType.OK, Gtk.ResponseType.YES):
            Gtk.main_quit()
        else:
            return True
开发者ID:jholland6843,项目名称:pychess,代码行数:11,代码来源:Main.py

示例4: on_set_up_position_activate

 def on_set_up_position_activate(self, widget):
     rotate_menu = gamewidget.getWidgets()["rotate_board1"]
     rotate_menu.set_sensitive(True)
     gmwidg = gamewidget.cur_gmwidg()
     if gmwidg is not None:
         if len(gmwidg.gamemodel.boards) == 1:
             ply = 0
         else:
             ply = gmwidg.board.view.shown
         fen = gmwidg.gamemodel.boards[ply].asFen()
     else:
         fen = None
     newGameDialog.SetupPositionExtension.run(fen)
开发者ID:TPNguyen,项目名称:pychess,代码行数:13,代码来源:Main.py

示例5: on_quit1_activate

 def on_quit1_activate(self, widget, *args):
     if isinstance(widget, Gdk.Event):
         if len(game_handler.gamewidgets) == 1 and conf.get("hideTabs", False):
             gmwidg = gamewidget.cur_gmwidg()
             game_handler.closeGame(gmwidg, gmwidg.gamemodel)
             return True
         elif len(game_handler.gamewidgets) >= 1 and conf.get("closeAll", False):
             game_handler.closeAllGames(game_handler.gamewidgets)
             return True
     if game_handler.closeAllGames(game_handler.gamewidgets) in (
             Gtk.ResponseType.OK, Gtk.ResponseType.YES):
         Gtk.main_quit()
     else:
         return True
开发者ID:ME7ROPOLIS,项目名称:pychess,代码行数:14,代码来源:Main.py

示例6: emit_action

 def emit_action (self, action, param):
     # If there are two or more tabs open, we have to ensure us that it is
     # us who are in the active tab, and not the others
     if self.gmwidg != cur_gmwidg():
         return
     # If there are two human players, we have to ensure us that it was us
     # who did the action, and not the others
     if self.gamemodel.players[1-self.color].__type__ == LOCAL:
         if action == HURRY_ACTION:
             if self.gamemodel.boards[-1].color == self.color:
                 return
         else:
             if self.gamemodel.boards[-1].color != self.color:
                 return
     self.emit("offer", Offer(action, param=param))
开发者ID:jskurka,项目名称:PyChess-Learning-Module,代码行数:15,代码来源:Human.py

示例7: on_window_key_press

    def on_window_key_press (window, event):
        log.debug('on_window_key_press: %s %s' % (window.get_title(), event))
        # Tabbing related shortcuts
        if not gamewidget.getheadbook():
            pagecount = 0
        else: pagecount = gamewidget.getheadbook().get_n_pages()
        if pagecount > 1:
            if event.get_state() & Gdk.ModifierType.CONTROL_MASK:
                page_num = gamewidget.getheadbook().get_current_page()
                # Move selected
                if event.get_state() & Gdk.ModifierType.SHIFT_MASK:
                    child = gamewidget.getheadbook().get_nth_page(page_num)
                    if event.keyval == Gdk.KEY_Page_Up:
                        gamewidget.getheadbook().reorder_child(child, (page_num-1)%pagecount)
                        return True
                    elif event.keyval == Gdk.KEY_Page_Down:
                        gamewidget.getheadbook().reorder_child(child, (page_num+1)%pagecount)
                        return True
                # Change selected
                else:
                    if event.keyval == Gdk.KEY_Page_Up:
                        gamewidget.getheadbook().set_current_page((page_num-1)%pagecount)
                        return True
                    elif event.keyval == Gdk.KEY_Page_Down:
                        gamewidget.getheadbook().set_current_page((page_num+1)%pagecount)
                        return True

        gmwidg = gamewidget.cur_gmwidg()
        if gmwidg is not None:
            for panel in gmwidg.panels:
                focused = panel.get_focus_child()
                # Do nothing in chat panel
                if focused is not None and isinstance(focused, BorderBox):
                    return False

            # Navigate on boardview with arrow keys
            if event.keyval in leftkeys:
                if event.get_state() & Gdk.ModifierType.CONTROL_MASK:
                    gmwidg.board.view.backToMainLine()
                    return True
                else:
                    gmwidg.board.view.showPrev()
                    return True
            elif event.keyval in rightkeys:
                gmwidg.board.view.showNext()
                return True
            elif event.keyval in upkeys:
                gmwidg.board.view.showPrev(step=2)
                return True
            elif event.keyval in downkeys:
                gmwidg.board.view.showNext(step=2)
                return True
            elif event.keyval in homekeys:
                gmwidg.board.view.showFirst()
                return True
            elif event.keyval in endkeys:
                gmwidg.board.view.showLast()
                return True

            if (not event.get_state() & Gdk.ModifierType.CONTROL_MASK) and \
                    (not event.get_state() & Gdk.ModifierType.MOD1_MASK) and \
                    (event.keyval != Gdk.KEY_Escape) and \
                    (event.keyval not in functionkeys):
                # Enter moves with keyboard
                board_control = gmwidg.board
                keyname = Gdk.keyval_name(event.keyval)
                board_control.key_pressed(keyname)
                gmwidg.status(board_control.keybuffer)
                return True

            return False
开发者ID:prvn16,项目名称:pychess,代码行数:71,代码来源:Main.py

示例8: on_copy_pgn_activate

 def on_copy_pgn_activate(self, widget):
     gamewidget.cur_gmwidg().copy_pgn()
开发者ID:prvn16,项目名称:pychess,代码行数:2,代码来源:Main.py

示例9: on_rotate_board1_activate

 def on_rotate_board1_activate(self, widget):
     gmwidg = gamewidget.cur_gmwidg()
     if gmwidg.board.view.rotation:
         gmwidg.board.view.rotation = 0
     else:
         gmwidg.board.view.rotation = math.pi
开发者ID:prvn16,项目名称:pychess,代码行数:6,代码来源:Main.py

示例10: on_close1_activate

 def on_close1_activate(self, widget):
     gmwidg = gamewidget.cur_gmwidg()
     response = ionest.closeGame(gmwidg, gameDic[gmwidg])
开发者ID:prvn16,项目名称:pychess,代码行数:3,代码来源:Main.py

示例11: on_export_position_activate

 def on_export_position_activate(self, widget):
     gmwidg = gamewidget.cur_gmwidg()
     position = gmwidg.board.view.shown
     ionest.saveGameAs (gameDic[gmwidg], position)
开发者ID:prvn16,项目名称:pychess,代码行数:4,代码来源:Main.py

示例12: on_save_game_as1_activate

 def on_save_game_as1_activate(self, widget):
     ionest.saveGameAs (gameDic[gamewidget.cur_gmwidg()])
开发者ID:prvn16,项目名称:pychess,代码行数:2,代码来源:Main.py

示例13: on_share_game_activate

 def on_share_game_activate(self, widget):
     chesspastebin.paste(gameDic[gamewidget.cur_gmwidg()])
开发者ID:ZeepXanflorp,项目名称:pychess,代码行数:2,代码来源:Main.py

示例14: on_save_game_as1_activate

 def on_save_game_as1_activate(self, widget):
     gmwidg = gamewidget.cur_gmwidg()
     position = gmwidg.board.view.shown
     game_handler.saveGameAs(gmwidg.gamemodel, position)
开发者ID:ME7ROPOLIS,项目名称:pychess,代码行数:4,代码来源:Main.py

示例15: on_save_game_as1_activate

 def on_save_game_as1_activate(self, widget):
     gmwidg = gamewidget.cur_gmwidg()
     position = gmwidg.board.view.shown
     ionest.saveGameAs(gameDic[gamewidget.cur_gmwidg()], position)
开发者ID:TPNguyen,项目名称:pychess,代码行数:4,代码来源:Main.py


注:本文中的pychess.widgets.gamewidget.cur_gmwidg函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。