Пример #1
0
 def on_invanalyzer_check_toggled (check):
     widgets["inv_analyzers_vbox"].set_sensitive(check.get_active())
     from pychess.Main import gameDic
     if gameDic:
         if check.get_active():
             for gmwidg in gameDic.keys():
                 gmwidg.gamemodel.restart_analyzer(SPY)
         else:
             for gmwidg in gameDic.keys():
                 gmwidg.gamemodel.remove_analyzer(SPY)
Пример #2
0
 def on_analyzer_check_toggled(check):
     widgets["analyzers_vbox"].set_sensitive(check.get_active())
     from pychess.Main import gameDic
     if gameDic:
         if check.get_active():
             for gmwidg in gameDic.keys():
                 gmwidg.gamemodel.restart_analyzer(HINT)
                 if not widgets["hint_mode"].get_active():
                     gmwidg.gamemodel.pause_analyzer(HINT)
         else:
             for gmwidg in gameDic.keys():
                 gmwidg.gamemodel.remove_analyzer(HINT)
Пример #3
0
 def on_invanalyzer_check_toggled(check):
     widgets["inv_analyzers_vbox"].set_sensitive(check.get_active())
     from pychess.Main import gameDic
     if gameDic:
         if check.get_active():
             for gmwidg in gameDic.keys():
                 gmwidg.gamemodel.restart_analyzer(SPY)
                 if not widgets["spy_mode"].get_active():
                     gmwidg.gamemodel.pause_analyzer(SPY)
         else:
             for gmwidg in gameDic.keys():
                 gmwidg.gamemodel.remove_analyzer(SPY)
Пример #4
0
def anal_combo_set_value(combobox, value, show_arrow_check, ana_check,
                         analyzer_type):
    engine = discoverer.getEngineByMd5(value)
    if engine is None:
        combobox.set_active(0)
        # This return saves us from the None-engine being used
        # in later code  -Jonas Thiem
        return
    else:
        try:
            index = list(discoverer.getAnalyzers()).index(engine)
        except ValueError:
            index = 0
        combobox.set_active(index)

    from pychess.Main import gameDic
    from pychess.widgets.gamewidget import widgets
    for gmwidg in gameDic.keys():
        spectators = gmwidg.gamemodel.spectators
        md5 = engine.get('md5')

        if analyzer_type in spectators and \
                spectators[analyzer_type].md5 != md5:
            gmwidg.gamemodel.remove_analyzer(analyzer_type)
            gmwidg.gamemodel.start_analyzer(analyzer_type)
            if not widgets[show_arrow_check].get_active():
                gmwidg.gamemodel.pause_analyzer(analyzer_type)
Пример #5
0
def anal_combo_set_value(combobox, value, show_arrow_check, ana_check,
                         analyzer_type):
    engine = discoverer.getEngineByMd5(value)
    if engine is None:
        combobox.set_active(0)
        # This return saves us from the None-engine being used
        # in later code  -Jonas Thiem
        return
    else:
        try:
            index = list(discoverer.getAnalyzers()).index(engine)
        except ValueError:
            index = 0
        combobox.set_active(index)

    from pychess.Main import gameDic
    from pychess.widgets.gamewidget import widgets
    for gmwidg in gameDic.keys():
        spectators = gmwidg.gamemodel.spectators
        md5 = engine.get('md5')

        if analyzer_type in spectators and \
                spectators[analyzer_type].md5 != md5:
            gmwidg.gamemodel.remove_analyzer(analyzer_type)
            gmwidg.gamemodel.start_analyzer(analyzer_type)
            if not widgets[show_arrow_check].get_active():
                gmwidg.gamemodel.pause_analyzer(analyzer_type)