def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen
        actions = OrderedDict()
        actions[trans_TC(u"Configure")] = self._configure
        actions[
            trans_TC(u"Display the parameters")
        ] = lambda _: self._le2mserv.gestionnaire_graphique.display_information2(
            utiltools.get_module_info(pms), trans_TC(u"Parameters")
        )
        actions[trans_TC(u"Start")] = lambda _: self._demarrer()
        actions[trans_TC(u"Form groups for the dictator game")] = self._prepare_dictator
        actions[trans_TC(u"Display the question after the dictator game")] = lambda _: self._run_questionapresdictator()
        actions[trans_TC(u"Display payoffs")] = self._display_payoffs

        self._le2mserv.gestionnaire_graphique.add_topartmenu(u"Team Communication", actions)

        # ajout d'onglets ------------------------------------------------------
        self._onglet_looks = Wlist()
        self._onglet_essais = Wlist()
        self._onglet_messages = Wlist()
        self._le2mserv.gestionnaire_graphique.screen.ui.onglets.addTab(self._onglet_looks, trans_TC(u"Looks of grids"))
        self._le2mserv.gestionnaire_graphique.screen.ui.onglets.addTab(self._onglet_essais, trans_TC(u"Tries"))
        self._le2mserv.gestionnaire_graphique.screen.ui.onglets.addTab(self._onglet_messages, trans_TC(u"Messages"))

        # final question
        self._le2mserv.gestionnaire_graphique.screen.action_finalquest.triggered.disconnect()
        self._le2mserv.gestionnaire_graphique.screen.action_finalquest.triggered.connect(
            lambda _: self._display_questfinal()
        )

        self._currentsequence = -1
Beispiel #2
0
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen)
        actions = OrderedDict()
        actions[le2mtrans(u"Configure")] = self._configure
        actions[le2mtrans(u"Display parameters")] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), le2mtrans(u"Parameters"))
        actions[texts_OL.trans_OL(u"Set roles")] = self._set_roles
        actions[le2mtrans(u"Start")] = lambda _: self._demarrer()
        actions[texts_OL.trans_OL(u"Display additional questions")] = \
            lambda _: self._display_additionalquestion()
        actions[le2mtrans(u"Display payoffs")] = \
            lambda _: self._le2mserv.gestionnaire_experience.\
            display_payoffs_onserver("oathAndLies")
        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Oath and Lies", actions)

        # final questionnaire
        self._le2mserv.gestionnaire_graphique.screen.action_finalquest. \
            triggered.disconnect()
        self._le2mserv.gestionnaire_graphique.screen.action_finalquest. \
            triggered.connect(lambda _: self._display_questfinal())
Beispiel #3
0
    def init_part(self, partname, partclassname, remoteclassname, partparameters):
        """
        init the part:
        - each player loads the part and instanciate the object
        - we add the part to the list of parts
        - we store the parameters of the part in the session table
        :param partname: name of the part
        :param partclassname: class name of the part
        :param remoteclassname: class name of the remote part
        :param partparameters: parameters of the part
        :return:
        """
        self._le2msrv.gestionnaire_graphique.infoserv(None)
        self._le2msrv.gestionnaire_graphique.infoserv(partname.upper(), fg="white", bg="blue")
        self._le2msrv.gestionnaire_graphique.infoclt(None)
        self._le2msrv.gestionnaire_graphique.infoclt(partname.upper(), fg="white", bg="blue")

        # the players instantiate the part and get the corresponding remote
        players = self._le2msrv.gestionnaire_joueurs.get_players()
        self._le2msrv.gestionnaire_graphique.set_waitmode(players)
        yield (self.run_func(players, "add_part", self._le2msrv, partname, partclassname, remoteclassname))

        self._parts.append(partname)
        self.stop_repetitions = False

        # we store the parameters in the database (in table session)
        paramcontent = utiltools.get_module_info(partparameters)
        sesscontent = self._le2msrv.gestionnaire_base.get_session().parametres or u""
        sesscontent += u"{}PART {}\n{}".format(u"\n\n" if sesscontent else u"", partname, paramcontent)
        logger.debug(sesscontent)
        self._le2msrv.gestionnaire_base.get_session().parametres = sesscontent
        self._le2msrv.gestionnaire_base.enregistrer()

        self._le2msrv.gestionnaire_graphique.infoserv(le2mtrans(u"Start time: {st}").format(st=strftime("%H:%M:%S")))
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv
        
        # self._traitements_lances = []
        self._current_sequence = 0

        actions = OrderedDict()
        actions[u"Changer le paramètre 'ordre'"] = self._changer_ordre
        actions[le2mtrans(u"Display parameters")] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), le2mtrans(u"Parameters"))
        actions[u"Démarrer - baseline"] = lambda _: self._demarrer(
            pms.BASELINE)
        actions[u"Démarrer - prélèvement"] = lambda _: self._demarrer(
            pms.PRELEVEMENT)
        actions[u"Démarrer - désapprobation"] = lambda _: self._demarrer(
            pms.DESAPPROBATION)
        actions[u"Démarrer - désapprobation avec prélèvement"] = lambda _: \
            self._demarrer(pms.DESAPPROBATION_PRELEVEMENT)
        actions[u"Afficher les gains"] = lambda _: self._le2mserv. \
            gestionnaire_experience.display_payoffs_onserver(
            "bienPublicKate")
        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Bien Public Kate", actions)
Beispiel #5
0
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen)
        actions = OrderedDict()
        actions[le2mtrans(u"Configure")] = self._configure
        actions[le2mtrans(u"Display parameters")] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), le2mtrans(u"Parameters"))
        actions[le2mtrans(u"Start")] = lambda _: self._demarrer()
        # actions[trans_PGGS(u"Display expectations")] = \
        #     lambda _: self._display_expectations()
        actions[le2mtrans(u"Display payoffs")] = self._display_payoffs

        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Public Good Game Solidarity", actions)

        # final question
        self._le2mserv.gestionnaire_graphique.screen.action_finalquest.\
            triggered.disconnect()
        self._le2mserv.gestionnaire_graphique.screen.action_finalquest.\
            triggered.connect(lambda _: self._display_questfinal())

        self._currentsequence = 0
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen)
        actions = OrderedDict()
        actions[le2mtrans(u"Configure")] = self._configure
        actions[le2mtrans(u"Display parameters")] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), le2mtrans(u"Parameters"))
        actions[texts_OL.trans_OL(u"Set roles")] = self._set_roles
        actions[le2mtrans(u"Start")] = lambda _: self._demarrer()
        actions[texts_OL.trans_OL(u"Display additional questions")] = \
            lambda _: self._display_additionalquestion()
        actions[le2mtrans(u"Display payoffs")] = \
            lambda _: self._le2mserv.gestionnaire_experience.\
            display_payoffs_onserver("oathAndLies")
        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Oath and Lies", actions)

        # final questionnaire
        self._le2mserv.gestionnaire_graphique.screen.action_finalquest. \
            triggered.disconnect()
        self._le2mserv.gestionnaire_graphique.screen.action_finalquest. \
            triggered.connect(lambda _: self._display_questfinal())
Beispiel #7
0
 def __init__(self, le2mserv):
     self._le2mserv = le2mserv
     actions = OrderedDict()
     actions[le2mtrans(u"Settings")] = self._configure
     actions[le2mtrans(u"Display settings")] = \
         lambda _: self._le2mserv.gestionnaire_graphique. \
         display_information2(
             utiltools.get_module_info(pms), u"Paramètres")
     actions[le2mtrans(u"Start")] = lambda _: self._demarrer()
     actions[le2mtrans(u"Display payoffs")] = \
         lambda _: self._le2mserv.gestionnaire_experience.\
         display_payoffs_onserver("Dictator")
     actions[le2mtrans(u"Show graph")] = self._show_fig
     self._le2mserv.gestionnaire_graphique.add_topartmenu(
         u"Dictator", actions)
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv
        self._current_sequence = 0

        # creation of the menu (will be placed in the "part" menu on the
        # server screen)
        actions = OrderedDict()
        actions[le2mtrans(u"Configure")] = self._configure
        actions[le2mtrans(u"Display parameters")] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), le2mtrans(u"Parameters"))
        actions[le2mtrans(u"Start")] = lambda _: self._demarrer()
        actions[u"Afficher les gains sur les postes"] = \
            lambda _: self._display_payoffs()
        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Marché - Concurrence", actions)
Beispiel #9
0
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen)
        actions = OrderedDict()
        actions[le2mtrans(u"Configure")] = self._configure
        actions[le2mtrans(u"Display parameters")] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), le2mtrans(u"Parameters"))
        actions[le2mtrans(u"Start")] = lambda _: self._demarrer()
        actions[le2mtrans(u"Display payoffs")] = \
            lambda _: self._le2mserv.gestionnaire_experience.\
            display_payoffs_onserver("EXPERIENCE_NOM")
        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"EXPERIENCE_MENU", actions)
Beispiel #10
0
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen)
        actions = OrderedDict()
        actions[u"Configurer"] = self._configure
        actions[u"Afficher les paramètres"] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), u"Paramètres")
        actions[u"Démarrer"] = lambda _: self._demarrer()
        actions[u"Afficher les gains"] = \
            lambda _: self._le2mserv.gestionnaire_experience.\
            display_payoffs_onserver("HoltLaury")
        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Holt et Laury", actions)
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen
        actions = OrderedDict()
        actions[le2mtrans(u"Configure")] = self._configure
        actions[le2mtrans(u"Display parameters")] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), u"Paramètres")
        actions[le2mtrans(u"Start")] = lambda _: self._demarrer()
        actions[le2mtrans(u"Display payoffs")] = \
            lambda _: self._le2mserv.gestionnaire_experience.\
            display_payoffs_onserver("prisonnersDilemma")
        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Prisonner's dillemma", actions)
Beispiel #12
0
 def __init__(self, le2mserv):
     self.le2mserv = le2mserv
     self.current_sequence = 0
     self.current_period = 0
     self.all = []
     self.groups = []
     self.the_n = 0  # n=second in continus time and n=period in discrete time
     # menu ---------------------------------------------------------------------------------------------------------
     actions = OrderedDict()
     actions[le2mtrans(u"Configure")] = self.configure
     actions[le2mtrans(
         u"Display parameters"
     )] = lambda _: self.le2mserv.gestionnaire_graphique.display_information2(
         utiltools.get_module_info(pms), le2mtrans(u"Parameters"))
     actions[le2mtrans(u"Start")] = lambda _: self.demarrer()
     actions[le2mtrans(
         u"Display payoffs")] = lambda _: self.display_payoffs()
     self.le2mserv.gestionnaire_graphique.add_topartmenu(u"Jeu", actions)
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen
        actions = OrderedDict()
        actions[trans_PGLG(u"Configure")] = self._configure
        actions[trans_PGLG(u"Display parameters")] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), u"Paramètres")
        actions[trans_PGLG(u"Start")] = lambda _: self._demarrer()
        actions[trans_PGLG(u"Display payoffs")] = \
            lambda _: self._le2mserv.gestionnaire_experience.\
            display_payoffs_onserver("PublicGoodLocalGlobal")
        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Public Good - Local Global", actions)

        self._fig = None
Beispiel #14
0
    def init_part(self, partname, partclassname, remoteclassname,
                  partparameters):
        """
        init the part:
        - each player loads the part and instanciate the object
        - we add the part to the list of parts
        - we store the parameters of the part in the session table
        :param partname: name of the part
        :param partclassname: class name of the part
        :param remoteclassname: class name of the remote part
        :param partparameters: parameters of the part
        :return:
        """
        self._le2msrv.gestionnaire_graphique.infoserv(None)
        self._le2msrv.gestionnaire_graphique.infoserv(partname.upper(),
                                                      fg="white",
                                                      bg="blue")
        self._le2msrv.gestionnaire_graphique.infoclt(None)
        self._le2msrv.gestionnaire_graphique.infoclt(partname.upper(),
                                                     fg="white",
                                                     bg="blue")

        # the players instantiate the part and get the corresponding remote
        players = self._le2msrv.gestionnaire_joueurs.get_players()
        self._le2msrv.gestionnaire_graphique.set_waitmode(players)
        yield (self.run_func(players, "add_part", self._le2msrv, partname,
                             partclassname, remoteclassname))

        self._parts.append(partname)
        self.stop_repetitions = False

        # we store the parameters in the database (in table session)
        paramcontent = utiltools.get_module_info(partparameters)
        sesscontent = \
            self._le2msrv.gestionnaire_base.get_session().parametres or u""
        sesscontent += u"{}PART {}\n{}".format(u"\n\n" if sesscontent else u"",
                                               partname, paramcontent)
        logger.debug(sesscontent)
        self._le2msrv.gestionnaire_base.get_session().parametres = sesscontent
        self._le2msrv.gestionnaire_base.enregistrer()

        self._le2msrv.gestionnaire_graphique.infoserv(
            le2mtrans(u"Start time: {st}").format(st=strftime("%H:%M:%S")))
Beispiel #15
0
    def __init__(self, le2mserv):
        self.le2mserv = le2mserv
        self.current_sequence = 0
        self.current_period = 0
        self.all = []

        # creation of the menu (will be placed in the "part" menu on the
        # server screen)
        actions = OrderedDict()
        actions[le2mtrans(u"Configure")] = self.configure
        actions[le2mtrans(u"Display parameters")] = \
            lambda _: self.le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), le2mtrans(u"Parameters"))
        actions[le2mtrans(u"Start")] = lambda _: self.demarrer()
        actions[le2mtrans(u"Display payoffs")] = \
            lambda _: self.display_payoffs()
        self.le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Contrôle Optimal", actions)
Beispiel #16
0
    def __init__(self, le2mserv):
        QObject.__init__(self)
        self.le2mserv = le2mserv
        self.current_sequence = 0
        self.current_period = 0
        self.all = []
        self.groups = []

        # __ MENU __
        actions = OrderedDict()
        actions[le2mtrans("Configure")] = self._configure
        actions[le2mtrans("Parameters")] = \
            lambda _: self.le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), le2mtrans(u"Parameters"))
        actions[le2mtrans("Start")] = lambda _: self.demarrer()
        actions[le2mtrans("Display payoffs")] = \
            lambda _: self.display_payoffs()
        self.le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Dynamic CPR", actions)
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen
        actions = OrderedDict()
        actions[trans_CPR(u"Configure")] = self._configure
        actions[trans_CPR(u"Display parameters")] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), u"Paramètres")
        actions[trans_CPR(u"Start")] = lambda _: self._demarrer()
        actions[trans_CPR(u"Display payoffs")] = \
            lambda _: self._le2mserv.gestionnaire_experience.\
            display_payoffs_onserver("CommonPoolResource")
        actions[trans_CPR(u"Show graph")] = self._show_fig
        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Common Pool Resource", actions)

        self._fig = None
Beispiel #18
0
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen)
        actions = OrderedDict()
        actions[u"Configurer"] = self._configure
        actions[u"Afficher les paramètres"] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
                display_information2(
                utiltools.get_module_info(pms), u"Paramètres")
        actions[u"Démarrer"] = lambda _: self._demarrer()
        actions[u"Afficher les gains"] = \
            lambda _: self._le2mserv.gestionnaire_experience. \
                display_payoffs_onserver("pestuse")
        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Pesticide use", actions)
        # Variable numerotant les partie pestuse qui servira au tirage au sort du gains
        self.indice_part_pestuse = 0
        # On tire au sort qu elle partie pestuse servira au gain et quelle periode
        self.tirage_part_pestuse_gain = random.randint(1, 4)
        self.tirage_periode_pestuse_gain = random.randint(1, pms.NOMBRE_PERIODES)
        self._le2mserv.gestionnaire_graphique.infoserv([None, u"Pestuse : tirage au sort de la période {} pour la partie {}".format(self.tirage_periode_pestuse_gain, self.tirage_part_pestuse_gain)])
    def __init__(self, le2mserv):
        self._le2mserv = le2mserv

        # creation of the menu (will be placed in the "part" menu on the
        # server screen)
        actions = OrderedDict()
        actions[le2mtrans(u"Configure")] = self._configure
        actions[le2mtrans(u"Display parameters")] = \
            lambda _: self._le2mserv.gestionnaire_graphique. \
            display_information2(
                utiltools.get_module_info(pms), le2mtrans(u"Parameters"))
        actions[le2mtrans(u"Start")] = lambda _: self._demarrer()
        actions[le2mtrans(u"Display payoffs")] = self._display_payoffs

        self._le2mserv.gestionnaire_graphique.add_topartmenu(
            u"Public Good Game Solidarity", actions)

        # final question
        self._le2mserv.gestionnaire_graphique.screen.action_finalquest.\
            triggered.disconnect()
        self._le2mserv.gestionnaire_graphique.screen.action_finalquest.\
            triggered.connect(lambda _: self._display_questfinal())

        self._currentsequence = 0
Beispiel #20
0
 def remote_configure(self, params):
     logger.info(u"{} configure".format(self._le2mclt.uid))
     for k, v in params.iteritems():
         setattr(pms, k, v)
     logger.debug(u"Params")
     logger.debug(get_module_info(pms))
 def remote_configure(self, params):
     logger.info(u"{} configure".format(self._le2mclt.uid))
     for k, v in params.iteritems():
         setattr(pms, k, v)
     logger.debug(u"Params")
     logger.debug(get_module_info(pms))