本文整理汇总了Python中util.utili18n.le2mtrans函数的典型用法代码示例。如果您正苦于以下问题:Python le2mtrans函数的具体用法?Python le2mtrans怎么用?Python le2mtrans使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了le2mtrans函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: finalize_part
def finalize_part(self, partname, *args, **kwargs):
"""
Calcule le gain de la partie puis ajoute l'heure de fin et les
textes de fin
"""
if not self.has_part(partname):
raise ValueError(le2mtrans(u"Part {p} not in the list").format(p=partname))
# computation of part's payoffs
logger.info(le2mtrans(u"Computation of payoffs for part {p}").format(p=partname))
self._le2msrv.gestionnaire_graphique.infoclt(
[None, le2mtrans(u"Payoffs of part {p}").format(p=partname.upper())], fg="red"
)
players = self._le2msrv.gestionnaire_joueurs.get_players(partname)
yield (self.run_func(players, "compute_partpayoff", *args, **kwargs))
for p in players:
payoff = getattr(p, "{}_gain_euros".format(p.nom_court))
self._le2msrv.gestionnaire_graphique.infoclt(u"{}: {}".format(p.joueur, payoff))
self._le2msrv.gestionnaire_base.enregistrer()
# Finalization of part
self._le2msrv.gestionnaire_graphique.infoserv(le2mtrans(u"End time: {et}").format(et=strftime("%H:%M:%S")))
self._le2msrv.gestionnaire_graphique.infoclt(u"Ok {}".format(partname).upper(), fg="white", bg="blue")
self._le2msrv.gestionnaire_graphique.infoserv(u"Ok {}".format(partname).upper(), fg="white", bg="blue")
开发者ID:dimdub34,项目名称:le2m-v2.1,代码行数:26,代码来源:servgestexpe.py
示例2: _accept
def _accept(self):
try:
self._timer_automatique.stop()
except AttributeError:
pass
try:
reponses = {}
for k, v in self._reponses_widgets.viewitems():
reponses[k] = (v[0].get_checkedbutton(),
v[1].get_checkedbutton())
except ValueError:
QtGui.QMessageBox.warning(
self, le2mtrans(u"Warning"),
trans_RR(u"You must answer to all the questions"))
return
if not self._automatique:
confirmation = QtGui.QMessageBox.question(
self, le2mtrans(u"Confirmation"),
le2mtrans(u"Do you confirm your choices?"),
QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)
if confirmation != QtGui.QMessageBox.Yes:
return
logger.info(u"Send back {}".format(reponses))
self.accept()
self._defered.callback(reponses)
开发者ID:dimdub34,项目名称:relativesRelationships,代码行数:27,代码来源:relativesRelationshipsGui.py
示例3: display_payoffs_onserver
def display_payoffs_onserver(self, partname):
"""
Open a dialog box with the payoffs
"""
payoffs = []
try:
joueurs = sorted(self._le2msrv.gestionnaire_joueurs.get_players(partname), key=lambda x: x.joueur.hostname)
except TypeError: # no client connected
QtGui.QMessageBox.warning(
self._le2msrv.gestionnaire_graphique.screen, le2mtrans(u"warning"), le2mtrans(u"No client connected")
)
return
try:
if partname == "base":
for j in joueurs:
payoffs.append([j.joueur.hostname, "{:.2f}".format(j.paiementFinal)])
else:
for j in joueurs:
gain_partie = getattr(j, "{}_gain_euros".format(j.nom_court))
payoffs.append([j.joueur.hostname, "{:.2f}".format(gain_partie)])
except (AttributeError, KeyError) as e:
QtGui.QMessageBox.critical(
self._le2msrv.gestionnaire_graphique.screen,
le2mtrans(u"Error"),
le2mtrans(u"Error while getting payoffs for " u"part {}: {}").format(partname, e.message),
)
return
self._screenpayoffs = GuiPayoffs(self._le2msrv, partname, payoffs)
self._screenpayoffs.show()
开发者ID:dimdub34,项目名称:le2m-v2.1,代码行数:31,代码来源:servgestexpe.py
示例4: __init__
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())
开发者ID:dimdub34,项目名称:oathAndLies,代码行数:26,代码来源:oathAndLiesServ.py
示例5: _accept
def _accept(self):
if self._widheadtail.ui.pushButton_start.isEnabled():
QtGui.QMessageBox.warning(
self, le2mtrans(u"Warning"),
le2mtrans(u"You must play"))
return
self.accept()
开发者ID:dimdub34,项目名称:le2m-v2.1,代码行数:7,代码来源:servguidialogs.py
示例6: _headtail
def _headtail(self):
screen = DHeadtail(self)
if screen.exec_():
self._le2mserv.gestionnaire_graphique.infoserv(
le2mtrans(u"Head and tail: {}".format(
le2mtrans(u"Head") if screen.get_value() == FACE else
le2mtrans(u"Tail"))))
开发者ID:JMRousselle,项目名称:le2m-v2.1,代码行数:7,代码来源:servguiwindows.py
示例7: __init__
def __init__(self, le2mserv, partname, payoffs):
super(GuiPayoffs, self).__init__()
self._le2mserv = le2mserv
self._partname = partname
self._payoffs = payoffs
# creation gui
self.ui = servguipayoffs.Ui_Dialog()
self.ui.setupUi(self)
# table model for displaying payoffs
self._tableModel = TableModelPaiements(self._payoffs)
self.ui.tableView.setModel(self._tableModel)
self.ui.tableView.horizontalHeader().setResizeMode(
QtGui.QHeaderView.Stretch)
# slot
self.ui.pushButton_imprimer.clicked.connect(self._print)
self.ui.pushButton_enregistrer.clicked.connect(self._save)
self.ui.pushButton_afficher.clicked.connect(self._display_onremotes)
self.ui.pushButton_ajouter.clicked.connect(self._addto_finalpayoffs)
if self._partname == "base":
self.setWindowTitle(le2mtrans(u"Payoffs for the experiment"))
self.ui.pushButton_ajouter.setEnabled(False)
else:
self.setWindowTitle(le2mtrans(u"Payoffs of part {}").format(
self._partname))
self.setFixedSize(550, 608)
开发者ID:dimdub34,项目名称:le2m-v2.1,代码行数:29,代码来源:servguidialogs.py
示例8: _print
def _print(self):
"""
Print the table with the subjects' payoffs
"""
if not self._payoffs:
return
html = u"<table align='center' border=1>\n<tr>" \
u"<td align='center'><b>"
html += le2mtrans(u"Hostname")
html += u"</b></td>" \
u"<td align='center'><b>"
html += le2mtrans(u"Payoff")
html += u"</b></td></tr>\n"
for l in self._payoffs:
html += u"<tr><td align='center'>{}</>" \
u"<td align='center'>{}€</td>" \
u"</tr>\n".format(l[0], l[1])
html += u"</table>\n"
doc = QtGui.QTextDocument()
doc.setHtml(html)
printer = QtGui.QPrinter()
dialog = QtGui.QPrintDialog(printer)
dialog.setModal(True)
dialog.setWindowTitle(le2mtrans(u"Payoffs"))
if dialog.exec_():
doc.print_(printer)
开发者ID:dimdub34,项目名称:le2m-v2.1,代码行数:26,代码来源:servguidialogs.py
示例9: _stoprepetitions
def _stoprepetitions(self, yes_or_no):
if yes_or_no:
self.action_stoprepetitions.setText(
le2mtrans(u"The part will stop after this period"))
else:
self.action_stoprepetitions.setText(
le2mtrans(u"Stop the part after this period "))
开发者ID:JMRousselle,项目名称:le2m-v2.1,代码行数:7,代码来源:servguiwindows.py
示例10: _display_questfinal
def _display_questfinal(self):
if not self._le2mserv.gestionnaire_base.is_created():
QtGui.QMessageBox.warning(
self._le2mserv.gestionnaire_graphique.screen,
le2mtrans(u"Warning"),
le2mtrans(u"There is no database yet. You first need to " u"load at least one part."),
)
return
if not hasattr(self, "_tous"):
QtGui.QMessageBox.warning(
self._le2mserv.gestionnaire_graphique.screen,
le2mtrans(u"Warning"),
trans_TC(u"TeamCommunication has to be run before to " u"start this questionnaire"),
)
return
confirmation = QtGui.QMessageBox.question(
self._le2mserv.gestionnaire_graphique.screen,
le2mtrans(u"Confirmation"),
le2mtrans(u"Start the final questionnaire?"),
QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok,
)
if confirmation != QtGui.QMessageBox.Ok:
return
yield (
self._le2mserv.gestionnaire_experience.run_step(
trans_TC(u"Final questionnaire"), self._tous, "display_questfinal"
)
)
开发者ID:dimdub34,项目名称:TeamCommunication,代码行数:30,代码来源:TeamCommunicationServ.py
示例11: _load_questcomp
def _load_questcomp(self):
"""
Récupère le fichier xml de questionnaire de compréhension et le
traite
:return:
"""
xmlfile = str(
QtGui.QFileDialog.getOpenFileName(
self,
le2mtrans(u"Select the understanding questionnaire to load"),
"", le2mtrans(u"xml file (*.xml)")))
if not xmlfile:
return
else:
self._questcomp = questcomp.get_questions(xmlfile)
if not self._questcomp:
return
txt = u""
for q in self._questcomp:
txt += u"{}\n\n".format(q)
QtGui.QMessageBox.information(
self,
le2mtrans(u"Understanding questionnaire"), txt)
self.add_serverlist(
le2mtrans(u"Understanding questionnaire loaded "
u"({} questions)").format(len(self._questcomp)))
开发者ID:JMRousselle,项目名称:le2m-v2.1,代码行数:27,代码来源:servguiwindows.py
示例12: remove_wait_mode
def remove_wait_mode(self, list_players):
"""
Change the icon color to green, meaning that the remote has taken
his decision
:param list_players: either a list of players (or parts) or only one
element (player or part)
"""
if isinstance(list_players, list):
for p in list_players:
try:
index = self._players_wait_mode.index(p)
except ValueError as e:
logger.warning(
le2mtrans(u"Problem with remove_waitmode: "
u"{msg}").format(e.message)
)
else:
self.ui.listWidget_attente.item(index).setIcon(
self._icon_vert)
else:
try:
index = self._players_wait_mode.index(list_players)
except ValueError as e:
logger.warning(
le2mtrans(u"Problem with remove_waitmode: "
u"{msg}").format(e.message)
)
else:
self.ui.listWidget_attente.item(index).setIcon(self._icon_vert)
开发者ID:JMRousselle,项目名称:le2m-v2.1,代码行数:29,代码来源:servguiwindows.py
示例13: __init__
def __init__(self, defered, automatique, parent):
DQuestFinal.__init__(self, defered, automatique, parent)
politics = [v for k, v in sorted(texts_PGGS.POLITICS.viewitems())]
politics.insert(0, le2mtrans(u"Choose"))
politics.append(le2mtrans(u"Not in the list above"))
self._politics = WCombo(
parent=self, automatique=self._automatique,
label=texts_PGGS.trans_PGGS(
u"Politically, you feel yourself in line with"),
items=politics)
self._gridlayout.addWidget(self._politics, 6, 1)
self._risk = WRadio(parent=self, automatique=self._automatique,
label=texts_PGGS.get_text_risk(),
texts=map(str, range(11)))
self._gridlayout.addWidget(self._risk, 7, 0, 1, 3)
self._inequality = WRadio(parent=self, automatique=self._automatique,
label=texts_PGGS.get_text_inequality(),
texts=map(str, range(11)))
self._gridlayout.addWidget(self._inequality, 8, 0, 1, 3)
self.setMinimumSize(0, 0)
self.setMaximumSize(16777215, 16777215)
self.adjustSize()
self.setFixedSize(self.size())
开发者ID:leem34,项目名称:PublicGoodGameSolidarity,代码行数:28,代码来源:PublicGoodGameSolidarityGui.py
示例14: _accept
def _accept(self):
try:
self._timer_automatique.stop()
except AttributeError:
pass
inputs = self._get_inputs()
if type(inputs) is dict:
try:
inputs["politics"] = self._politics.get_currentindex()
inputs["risk"] = self._risk.get_checkedbutton()
inputs["inequality"] = self._inequality.get_checkedbutton()
except ValueError:
return QtGui.QMessageBox.warning(
self, le2mtrans(u"Warning"),
le2mtrans(u"You must answer to all the questions"))
if not self._automatique:
confirm = QtGui.QMessageBox.question(
self, le2mtrans(u"Confirmation"),
le2mtrans(u"Do you confirm your answers?"),
QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)
if confirm != QtGui.QMessageBox.Yes:
return
logger.info(u"Send back: {}".format(inputs))
self.accept()
self._defered.callback(inputs)
else:
return
开发者ID:leem34,项目名称:PublicGoodGameSolidarity,代码行数:33,代码来源:PublicGoodGameSolidarityGui.py
示例15: __init__
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)
开发者ID:dimdub34,项目名称:bienPublicKate,代码行数:25,代码来源:bienPublicKateServ.py
示例16: _accept
def _accept(self):
try:
self._timer_automatique.stop()
except AttributeError:
pass
inputs = self._get_inputs()
if type(inputs) is dict:
try:
inputs["naissance_ville"] = self._naissance_ville.get_text()
except ValueError:
return QtGui.QMessageBox.warning(
self, le2mtrans(u"Warning"),
le2mtrans(u"You must answer to all the questions"))
if not self._automatique:
if QtGui.QMessageBox.question(
self, le2mtrans(u"Confirmation"),
le2mtrans(u"Do you confirm your answers?"),
QtGui.QMessageBox.No | QtGui.QMessageBox.Yes) != \
QtGui.QMessageBox.Yes: return
logger.info(u"Send back: {}".format(inputs))
self.accept()
self._defered.callback(inputs)
else:
return
开发者ID:dimdub34,项目名称:voteMajorite,代码行数:28,代码来源:voteMajoriteGui.py
示例17: creer_base
def creer_base(self, dossier, nom_fichier, istest):
"""
Create the database.
The database is named data.sqlite and is located in the directory that
starts the software.
"""
fichier = "{}".format(os.path.join(dossier, nom_fichier))
logger.info("database path: {}".format(fichier))
engine = create_engine("sqlite:///{}".format(fichier), echo=False)
DB.configure(bind=engine)
self._db = DB()
Base.metadata.create_all(engine)
logger.info(le2mtrans("database created"))
# add the session to the database
self._session = Session(self._nom_session, self._heure_debut, istest)
self.ajouter(self._session)
logger.info(le2mtrans(u"Session {s} added to the database").format(
s=self._nom_session))
# add the connected players to the database
for j in self._playerstoadd:
logger.info(le2mtrans(u"Player {p} added to the "
u"session").format(p=j))
self.ajouter(j)
self._session.joueurs.append(j)
del self._playerstoadd[:]
self.enregistrer()
开发者ID:dimdub34,项目名称:le2m-v2.1,代码行数:29,代码来源:servgestbase.py
示例18: get_payoff_text
def get_payoff_text(pay_euros, pay_ecus=None):
if pay_ecus is not None:
txt = le2mtrans(u"You've earned {} which corresponds to {}.").format(
get_pluriel(pay_ecus, u"ecu"), get_pluriel(pay_euros, u"euro"))
else:
txt = le2mtrans(u"You've earned {}.".format(
get_pluriel(pay_euros, u"euro")))
return txt
开发者ID:JMRousselle,项目名称:le2m-v2.1,代码行数:8,代码来源:clttexts.py
示例19: set_genres
def set_genres(self, dict_genres):
for k, v in dict_genres.iteritems():
k.set_genre(v)
hommes = [j for j in self.get_players() if j.genre == HOMME]
femmes = [j for j in self.get_players() if j.genre == FEMME]
self._main_serveur.gestionnaire_graphique.infoserv(
[None, le2mtrans(u"Subjects' gender"),
le2mtrans(u"Men: {m}").format(m=hommes),
le2mtrans(u"Women: {w}").format(w=femmes)])
开发者ID:JMRousselle,项目名称:le2m-v2.1,代码行数:9,代码来源:servgestplayers.py
示例20: __init__
def __init__(self, le2mserv):
super(GuiServeur, self).__init__()
self._le2mserv = le2mserv
self._questcomp = None
self.ui = servguimain.Ui_EcranServeur()
self.ui.setupUi(self)
self._create_menus()
self.ui.label_le2m.setText(le2mtrans(u"LE2M\nExperimental Economics Software of Montpellier"))
# tabs
self.ui.onglets.setTabText(self.ui.onglets.indexOf(self.ui.tabInfos), le2mtrans(u"Informations"))
self.ui.onglets.setTabText(self.ui.onglets.indexOf(self.ui.tabClients), le2mtrans(u"Remotes"))
self.ui.onglets.setTabText(self.ui.onglets.indexOf(self.ui.tabExperience), le2mtrans(u"Experiment"))
# picture on the first tab ---------------------------------------------
try:
img_labo_pix = QtGui.QPixmap(params.getp("LABLOGO"))
self.ui.label_logo_laboratoire.setPixmap(img_labo_pix)
except IOError:
logger.warning(u"Error while loading LABLOGO picture")
self.ui.label_logo_laboratoire.setText(le2mtrans(u"Here the logo of the lab"))
try:
img_leem_pix = QtGui.QPixmap(params.getp("LABPICTURE"))
self.ui.label_image_centre.setPixmap(img_leem_pix)
except IOError:
logger.warning(u"Error while loading LABPICTURE picture")
self.ui.label_image_centre.setText(le2mtrans(u"Here the main picture"))
# icons for the waiting mode -------------------------------------------
self._icon_rouge = QtGui.QIcon(os.path.join(params.getp("IMGDIR"), "red.png"))
self._icon_vert = QtGui.QIcon(os.path.join(params.getp("IMGDIR"), "green.png"))
self.ui.label_attente.setText(le2mtrans(u"Decisions"))
self._players_wait_mode = list()
# server infos ---------------------------------------------------------
self.ui.label_infos_serveur.setText(
u"OS: {} {} | Python version: {} | Hostname: {} | IP: {}".format(
platform.uname()[0],
platform.uname()[2],
sys.version.split()[0],
self._le2mserv.hostname,
self._le2mserv.ip,
)
)
# table on the second tab with connected remotes -----------------------
# handle automatic and simulation modes as well as remotes' deconnection
self.ui.label_connectedremotes.setText(le2mtrans(u"Connected remotes: 0"))
self.tableJoueurs = TableModelJoueurs()
self.ui.tv_clients_connectes.setModel(self.tableJoueurs)
self.ui.tv_clients_connectes.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
self.ui.tv_clients_connectes.horizontalHeader().setClickable(True)
self.ui.tv_clients_connectes.horizontalHeader().sectionClicked[int].connect(self.tableJoueurs.inverse)
self.ui.onglets.setCurrentIndex(0)
self.setWindowTitle(le2mtrans(u"LE2M"))
开发者ID:dimdub34,项目名称:le2m-v2.1,代码行数:59,代码来源:servguiwindows.py
注:本文中的util.utili18n.le2mtrans函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论