• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python gamewidget.getWidgets函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: on_gmwidg_closed

 def on_gmwidg_closed(gmwidg):
     log.debug("GladeHandlers.on_gmwidg_closed")
     del gameDic[gmwidg]
     if not gameDic:
         for widget in MENU_ITEMS:
             gamewidget.getWidgets()[widget].set_property('sensitive',
                                                          False)
开发者ID:TPNguyen,项目名称:pychess,代码行数:7,代码来源:Main.py


示例2: on_gmwidg_created

 def on_gmwidg_created (handler, gmwidg, gamemodel):
     gameDic[gmwidg] = gamemodel
     
     # Bring playing window to the front
     gamewidget.getWidgets()["window1"].present()
     
     # Make sure we can remove gamewidgets from gameDic later
     gmwidg.connect("closed", GladeHandlers.__dict__["on_gmwidg_closed"])
开发者ID:jskurka,项目名称:PyChess-Learning-Module,代码行数:8,代码来源:Main.py


示例3: on_gmwidg_created

    def on_gmwidg_created(self, gamehandler, gmwidg):
        log.debug("GladeHandlers.on_gmwidg_created: starting")
        # Bring playing window to the front
        gamewidget.getWidgets()["main_window"].present()

        self.loaded_cids[gmwidg.gamemodel] = gmwidg.gamemodel.connect("game_loaded", self.update_recent)
        self.saved_cids[gmwidg.gamemodel] = gmwidg.gamemodel.connect("game_saved", self.update_recent)
        self.terminated_cids[gmwidg.gamemodel] = gmwidg.gamemodel.connect("game_terminated", self.on_terminated)

        log.debug("GladeHandlers.on_gmwidg_created: returning")
开发者ID:leogregianin,项目名称:pychess,代码行数:10,代码来源:Main.py


示例4: test1

    def test1(self):
        """ Open several dialogs """

        enginesDialog.run(gamewidget.getWidgets())

        newGameDialog.SetupPositionExtension.run(FEN_START)

        dd = DiscovererDialog(discoverer)
        self.dd_task = asyncio.async(dd.start())

        preferencesDialog.run(gamewidget.getWidgets())
开发者ID:teacoffee2017,项目名称:pychess,代码行数:11,代码来源:dialogs.py


示例5: on_gmwidg_created

    def on_gmwidg_created (handler, gmwidg, gamemodel):
        log.debug("GladeHandlers.on_gmwidg_created: starting")
        gameDic[gmwidg] = gamemodel
        
        # Bring playing window to the front
        gamewidget.getWidgets()["window1"].present()

        gamemodel.connect("game_loaded", GladeHandlers.__dict__["on_recent_game_activated"])
        gamemodel.connect("game_saved", GladeHandlers.__dict__["on_recent_game_activated"])
        
        # Make sure we can remove gamewidgets from gameDic later
        gmwidg.connect("closed", GladeHandlers.__dict__["on_gmwidg_closed"])
        log.debug("GladeHandlers.on_gmwidg_created: returning")
开发者ID:prvn16,项目名称:pychess,代码行数:13,代码来源:Main.py


示例6: test0

    def test0(self):
        """ Open engines dialogs """

        # engines dialog
        enginesDialog.run(gamewidget.getWidgets())
        engines = [item[1] for item in enginesDialog.engine_dialog.allstore]
        self.assertTrue("PyChess.py" in engines)
开发者ID:leogregianin,项目名称:pychess,代码行数:7,代码来源:dialogs.py


示例7: get_open_dialog

def get_open_dialog():
    mainwindow = gamewidget.getWidgets()["main_window"]
    opendialog = Gtk.FileChooserDialog(
        _("Open chess file"), mainwindow, Gtk.FileChooserAction.OPEN,
        (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN,
         Gtk.ResponseType.OK))
    opendialog.set_show_hidden(True)
    opendialog.set_select_multiple(True)

    # All chess files filter
    all_filter = Gtk.FileFilter()
    all_filter.set_name(_("All Chess Files"))
    opendialog.add_filter(all_filter)
    opendialog.set_filter(all_filter)

    # Specific filters and save formats
    for ending, saver in enddir.items():
        label = saver.__label__
        endstr = "(%s)" % ending
        f = Gtk.FileFilter()
        f.set_name(label + " " + endstr)
        if hasattr(saver, "load"):
            f.add_pattern("*." + ending)
            all_filter.add_pattern("*." + ending)
            opendialog.add_filter(f)

    return opendialog
开发者ID:bboutkov,项目名称:pychess,代码行数:27,代码来源:__init__.py


示例8: get_save_dialog

def get_save_dialog(export=False):
    mainwindow = gamewidget.getWidgets()["main_window"]
    savedialog = Gtk.FileChooserDialog(
        "", mainwindow, Gtk.FileChooserAction.SAVE,
        (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE,
         Gtk.ResponseType.ACCEPT))
    savedialog.set_current_folder(os.path.expanduser("~"))

    # Add widgets to the savedialog
    savecombo = Gtk.ComboBox()
    savecombo.set_name("savecombo")

    crt = Gtk.CellRendererText()
    savecombo.pack_start(crt, True)
    savecombo.add_attribute(crt, 'text', 0)

    crt = Gtk.CellRendererText()
    savecombo.pack_start(crt, False)
    savecombo.add_attribute(crt, 'text', 1)

    if export:
        savecombo.set_model(exportformats)
    else:
        savecombo.set_model(saveformats)

    savecombo.set_active(1)  # pgn
    savedialog.set_extra_widget(savecombo)

    return savedialog, savecombo
开发者ID:bboutkov,项目名称:pychess,代码行数:29,代码来源:__init__.py


示例9: do_activate

    def do_activate(self):
        # asyncio.async(self.print_tasks())
        self.add_window(self.window)
        self.window.show_all()
        gamewidget.getWidgets()["player_rating1"].hide()
        gamewidget.getWidgets()["leave_fullscreen1"].hide()

        # Externals download dialog
        if not conf.get("dont_show_externals_at_startup", False):
            externals_dialog.show()

        # Tip of the day dialog
        if conf.get("show_tip_at_startup", False):
            tipOfTheDay.TipOfTheDay.show()

        dd = DiscovererDialog(discoverer)
        self.dd_task = asyncio.async(dd.start())
开发者ID:bboutkov,项目名称:pychess,代码行数:17,代码来源:Main.py


示例10: __init__

 def __init__(self):
     GObject.GObject.__init__(self)
     Perspective.__init__(self, "database", _("Database"))
     self.widgets = gamewidget.getWidgets()
     self.chessfile = None
     self.chessfiles = []
     self.gamelists = []
     self.filter_panels = []
     self.notebooks = {}
     self.connect("chessfile_opened0", self.on_chessfile_opened0)
开发者ID:bboutkov,项目名称:pychess,代码行数:10,代码来源:__init__.py


示例11: on_set_up_position_activate

 def on_set_up_position_activate(self, widget):
     rotate_menu = gamewidget.getWidgets()["rotate_board1"]
     rotate_menu.set_sensitive(True)
     persp = perspective_manager.get_perspective("games")
     gmwidg = persp.cur_gmwidg()
     if gmwidg is not None:
         ply = gmwidg.board.view.shown
         variation = gmwidg.board.view.shown_variation_idx
         fen = gmwidg.gamemodel.getBoardAtPly(ply, variation).asFen()
     else:
         fen = None
     newGameDialog.SetupPositionExtension.run(fen)
开发者ID:teacoffee2017,项目名称:pychess,代码行数:12,代码来源:Main.py


示例12: attachGameWidget

    def attachGameWidget(self, gmwidg):
        log.debug("attachGameWidget: %s" % gmwidg)
        if self.first_run:
            self.init_layout()
            self.first_run = False
        perspective_manager.activate_perspective("games")

        gmwidg.panels = [panel.Sidepanel().load(gmwidg) for panel in self.sidePanels]
        self.key2gmwidg[gmwidg.notebookKey] = gmwidg
        headbook = self.getheadbook()

        headbook.append_page(gmwidg.notebookKey, gmwidg.tabcontent)
        gmwidg.notebookKey.show_all()

        if hasattr(headbook, "set_tab_reorderable"):
            headbook.set_tab_reorderable(gmwidg.notebookKey, True)

        def callback(notebook, gpointer, page_num, gmwidg):
            if notebook.get_nth_page(page_num) == gmwidg.notebookKey:
                gmwidg.infront()
                if gmwidg.gamemodel.players and gmwidg.gamemodel.isObservationGame():
                    gmwidg.light_on_off(False)
                    text = gmwidg.game_info_label.get_text()
                    gmwidg.game_info_label.set_markup(
                        '<span color="black" weight="bold">%s</span>' % text)

        self.key2cid[gmwidg.notebookKey] = headbook.connect_after("switch-page", callback, gmwidg)
        gmwidg.infront()

        align = gamewidget.createAlignment(0, 0, 0, 0)
        align.show()
        align.add(gmwidg.infobar)
        self.notebooks["messageArea"].append_page(align, None)
        self.notebooks["board"].append_page(gmwidg.boardvbox, None)
        gmwidg.boardvbox.show_all()
        for panel, instance in zip(self.sidePanels, gmwidg.panels):
            self.notebooks[panel_name(panel.__name__)].append_page(instance, None)
            instance.show_all()
        self.notebooks["buttons"].append_page(gmwidg.stat_hbox, None)
        gmwidg.stat_hbox.show_all()

        if headbook.get_n_pages() == 1:
            self.show_tabs(not conf.get("hideTabs"))
        else:
            # We should always show tabs if more than one exists
            self.show_tabs(True)

        headbook.set_current_page(-1)

        widgets = gamewidget.getWidgets()
        if headbook.get_n_pages() == 1 and not widgets["show_sidepanels"].get_active():
            self.zoomToBoard(True)
开发者ID:leogregianin,项目名称:pychess,代码行数:52,代码来源:__init__.py


示例13: 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


示例14: set_sensitives

    def set_sensitives(self, on):
        self.import_button.set_sensitive(on)
        self.widgets["import_chessfile"].set_sensitive(on)
        self.widgets["database_save_as"].set_sensitive(on)
        self.widgets["create_book"].set_sensitive(on)
        self.widgets["import_endgame_nl"].set_sensitive(on)
        self.widgets["import_twic"].set_sensitive(on)

        if on:
            gamewidget.getWidgets()["copy_pgn"].set_property('sensitive', on)
            gamewidget.getWidgets()["copy_fen"].set_property('sensitive', on)
        else:
            persp = perspective_manager.get_perspective("games")
            if persp.cur_gmwidg() is None:
                gamewidget.getWidgets()["copy_pgn"].set_property('sensitive', on)
                gamewidget.getWidgets()["copy_fen"].set_property('sensitive', on)
开发者ID:leogregianin,项目名称:pychess,代码行数:16,代码来源:__init__.py


示例15: __init__

 def __init__(self):
     GObject.GObject.__init__(self)
     Perspective.__init__(self, "database", _("Database"))
     self.widgets = gamewidget.getWidgets()
     self.first_run = True
     self.chessfile = None
     self.chessfiles = []
     self.importer = None
     self.gamelists = []
     self.filter_panels = []
     self.opening_tree_panels = []
     self.preview_panels = []
     self.notebooks = {}
     self.page_dict = {}
     self.connect("chessfile_opened0", self.on_chessfile_opened0)
     self.dockLocation = addUserConfigPrefix("pydock-database.xml")
开发者ID:teacoffee2017,项目名称:pychess,代码行数:16,代码来源:__init__.py


示例16: test4

    def test4(self):
        """ Open preferences dialog """

        widgets = gamewidget.getWidgets()
        preferencesDialog.run(widgets)

        notebook = widgets["preferences_notebook"]
        self.assertIsNotNone(preferencesDialog.general_tab)

        notebook.next_page()
        self.assertIsNotNone(preferencesDialog.hint_tab)

        notebook.next_page()
        self.assertIsNotNone(preferencesDialog.theme_tab)

        notebook.next_page()
        self.assertIsNotNone(preferencesDialog.sound_tab)

        notebook.next_page()
        self.assertIsNotNone(preferencesDialog.save_tab)
开发者ID:leogregianin,项目名称:pychess,代码行数:20,代码来源:dialogs.py


示例17: delGameWidget

    def delGameWidget(self, gmwidg):
        """ Remove the widget from the GUI after the game has been terminated """
        log.debug("Games.delGameWidget: starting %s" % repr(gmwidg))
        gmwidg.closed = True
        gmwidg.emit("closed")

        called_from_preferences = False
        window_list = Gtk.Window.list_toplevels()
        widgets = gamewidget.getWidgets()
        for window in window_list:
            if window.is_active() and window == widgets["preferences"]:
                called_from_preferences = True
                break

        pageNum = gmwidg.getPageNumber()
        headbook = self.getheadbook()

        if gmwidg.notebookKey in self.key2gmwidg:
            del self.key2gmwidg[gmwidg.notebookKey]

        if gmwidg.notebookKey in self.key2cid:
            headbook.disconnect(self.key2cid[gmwidg.notebookKey])
            del self.key2cid[gmwidg.notebookKey]

        headbook.remove_page(pageNum)
        for notebook in self.notebooks.values():
            notebook.remove_page(pageNum)

        if headbook.get_n_pages() == 1 and conf.get("hideTabs"):
            self.show_tabs(False)

        if headbook.get_n_pages() == 0:
            if not called_from_preferences:
                # If the last (but not the designGW) gmwidg was closed
                # and we are FICS-ing, present the FICS lounge
                perspective_manager.disable_perspective("games")

        gmwidg._del()
开发者ID:leogregianin,项目名称:pychess,代码行数:38,代码来源:__init__.py


示例18: do_activate

    def do_activate(self):
        # create_task(self.print_tasks())
        self.add_window(self.window)
        self.window.show_all()
        gamewidget.getWidgets()["player_rating1"].hide()
        gamewidget.getWidgets()["leave_fullscreen1"].hide()

        # Externals download dialog
        if not conf.get("dont_show_externals_at_startup"):
            externals_dialog = ExternalsDialog()
            externals_dialog.show()

        # Tip of the day dialog
        if conf.get("show_tip_at_startup"):
            tip_of_the_day = TipOfTheDay()
            tip_of_the_day.show()

        preferencesDialog.run(gamewidget.getWidgets())

        def on_all_engine_discovered(discoverer):
            engine = discoverer.getEngineByName(discoverer.getEngineLearn())
            if engine is None:
                engine = discoverer.getEngineN(-1)
            default_engine = engine.get("md5")
            conf.set("ana_combobox", default_engine)
            conf.set("inv_ana_combobox", default_engine)

        # Try to set conf analyzer engine on very first start of pychess
        if conf.get("ana_combobox") == 0:
            discoverer.connect_after("all_engines_discovered", on_all_engine_discovered)

        dd = DiscovererDialog(discoverer)
        self.dd_task = create_task(dd.start())

        style_ctxt = gamewidget.getWidgets()["main_window"].get_style_context()
        LIGHT = hexcol(style_ctxt.lookup_color("p_light_color")[1])
        DARK = hexcol(style_ctxt.lookup_color("p_dark_color")[1])
        conf.set("lightcolour", LIGHT)
        conf.set("darkcolour", DARK)
开发者ID:leogregianin,项目名称:pychess,代码行数:39,代码来源:Main.py


示例19: on_leave_fullscreen1_activate

 def on_leave_fullscreen1_activate(self, widget):
     gamewidget.getWidgets()["window1"].unfullscreen()
     gamewidget.getWidgets()["leave_fullscreen1"].hide()
     gamewidget.getWidgets()["fullscreen1"].show()
开发者ID:prvn16,项目名称:pychess,代码行数:4,代码来源:Main.py


示例20: on_player_rating1_activate

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python filetools.add_extension函数代码示例发布时间:2022-05-25
下一篇:
Python gamewidget.cur_gmwidg函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap