def remote_newperiod(self, period): """ Set the current period and delete the history :param period: the current period :return: """ logger.info(u"{} Period {}".format(self._le2mclt.uid, period)) self.currentperiod = period if self.currentperiod == 1: del self.histo[:] self.histo_vars = texts_EXPERIENCE_NOM_COURT.get_histo_vars() self.histo.append(texts_EXPERIENCE_NOM_COURT.get_histo_head())
def remote_newperiod(self, period): """ Set the current period and delete the history :param period: the current period :return: """ logger.info(u"{} Period {}".format(self._le2mclt.uid, period)) self.currentperiod = period if self.currentperiod <= 1: del self.histo[:] self.histo_vars = texts_EXPERIENCE_NOM_COURT.get_histo_vars() self.histo.append(texts_EXPERIENCE_NOM_COURT.get_histo_head())
def __init__(self, defered, automatique, parent, period, historique): super(GuiDecision, self).__init__(parent) # variables self._defered = defered self._automatique = automatique self._historique = GuiHistorique(self, historique) layout = QtGui.QVBoxLayout(self) # should be removed if one-shot game wperiod = WPeriod(period=period, ecran_historique=self._historique) layout.addWidget(wperiod) wexplanation = WExplication( text=texts_EXPERIENCE_NOM_COURT.get_text_explanation(), size=(450, 80), parent=self) layout.addWidget(wexplanation) self._wdecision = WSpinbox( label=texts_EXPERIENCE_NOM_COURT.get_text_label_decision(), minimum=pms.DECISION_MIN, maximum=pms.DECISION_MAX, interval=pms.DECISION_STEP, automatique=self._automatique, parent=self) layout.addWidget(self._wdecision) buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok) buttons.accepted.connect(self._accept) layout.addWidget(buttons) self.setWindowTitle(trans_EXPERIENCE_NOM_COURT(u"Décision")) self.adjustSize() self.setFixedSize(self.size()) if self._automatique: self._timer_automatique = QtCore.QTimer() self._timer_automatique.timeout.connect( buttons.button(QtGui.QDialogButtonBox.Ok).click) self._timer_automatique.start(7000)
def __init__(self, defered, automatique, parent, period, historique): super(GuiDecision, self).__init__(parent) # variables self._defered = defered self._automatique = automatique self._historique = GuiHistorique(self, historique) layout = QtGui.QVBoxLayout(self) # should be removed if one-shot game wperiod = WPeriod( period=period, ecran_historique=self._historique) layout.addWidget(wperiod) wexplanation = WExplication( text=texts_EXPERIENCE_NOM_COURT.get_text_explanation(), size=(450, 80), parent=self) layout.addWidget(wexplanation) self._wdecision = WSpinbox( label=texts_EXPERIENCE_NOM_COURT.get_text_label_decision(), minimum=pms.DECISION_MIN, maximum=pms.DECISION_MAX, interval=pms.DECISION_STEP, automatique=self._automatique, parent=self) layout.addWidget(self._wdecision) buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok) buttons.accepted.connect(self._accept) layout.addWidget(buttons) self.setWindowTitle(trans_EXPERIENCE_NOM_COURT(u"Décision")) self.adjustSize() self.setFixedSize(self.size()) if self._automatique: self._timer_automatique = QtCore.QTimer() self._timer_automatique.timeout.connect( buttons.button(QtGui.QDialogButtonBox.Ok).click) self._timer_automatique.start(7000)
def remote_display_summary(self, period_content): """ Display the summary screen :param period_content: dictionary with the content of the current period :return: deferred """ logger.info(u"{} Summary".format(self._le2mclt.uid)) self.histo.append([period_content.get(k) for k in self._histo_vars]) if self._le2mclt.simulation: return 1 else: defered = defer.Deferred() ecran_recap = GuiRecapitulatif( defered, self._le2mclt.automatique, self._le2mclt.screen, self.currentperiod, self.histo, texts_EXPERIENCE_NOM_COURT.get_text_summary(period_content)) ecran_recap.show() return defered
def remote_display_summary(self, period_content): """ Display the summary screen :param period_content: dictionary with the content of the current period :return: deferred """ logger.info(u"{} Summary".format(self._le2mclt.uid)) self.histo.append([period_content.get(k) for k in self.histo_vars]) if self._le2mclt.simulation: return 1 else: defered = defer.Deferred() ecran_recap = GuiRecapitulatif( defered, self._le2mclt.automatique, self._le2mclt.screen, self.currentperiod, self.histo, texts_EXPERIENCE_NOM_COURT.get_text_summary(period_content)) ecran_recap.show() return defered
def __init__(self, le2mclt): IRemote.__init__(self, le2mclt) self._histo_vars = [ "EXPERIENCE_NOM_COURT_period", "EXPERIENCE_NOM_COURT_decision", "EXPERIENCE_NOM_COURT_periodpayoff", "EXPERIENCE_NOM_COURT_cumulativepayoff"] self._histo.append(texts_EXPERIENCE_NOM_COURT.get_histo_head())