本文整理汇总了Python中pychess.widgets.gamewidget.getWidgets函数的典型用法代码示例。如果您正苦于以下问题:Python getWidgets函数的具体用法?Python getWidgets怎么用?Python getWidgets使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getWidgets函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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"])
示例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")
示例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())
示例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")
示例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)
示例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
示例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
示例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())
示例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)
示例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)
示例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)
示例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)
示例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)
示例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")