def __init__(self, defered, automatique, parent, periode, historique): super(GuiDecision, self).__init__(parent) # variables self._defered = defered self._automatique = automatique self._historique = GuiHistorique(self, historique) layout = QtGui.QVBoxLayout(self) wperiod = WPeriod(period=periode, ecran_historique=self._historique, parent=self) layout.addWidget(wperiod) wexplanation = WExplication(text=textes_PGG.get_text_explanation(), parent=self, size=(450, 80)) layout.addWidget(wexplanation) self._wdecision = WSpinbox(label=textes_PGG.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_PGG(u"Decision")) 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, periode, historique): super(GuiDecision, self).__init__(parent) # variables self._defered = defered self._automatique = automatique self._historique = GuiHistorique(self, historique) layout = QtGui.QVBoxLayout(self) wperiod = WPeriod(period=periode, ecran_historique=self._historique, parent=self) layout.addWidget(wperiod) wexplanation = WExplication(text=texts_DP.get_text_explanation(), parent=self, size=(450, 80)) layout.addWidget(wexplanation) options = tuple([v for k, v in sorted(pms.OPTIONS.viewitems())]) self._wdecision = WRadio(texts=options, label=trans_DP(u"Choose an option"), parent=self, automatique=self._automatique) layout.addWidget(self._wdecision) buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok) buttons.accepted.connect(self._accept) layout.addWidget(buttons) self.setWindowTitle(le2mtrans(u"Decision")) 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, periode, historique): super(GuiDecision, self).__init__(parent) self._defered = defered self._automatique = automatique self._historique = GuiHistorique(self, historique) layout = QtGui.QVBoxLayout(self) self._widperiod = WPeriod( period=periode, ecran_historique=self._historique, parent=self) layout.addWidget(self._widperiod) self._widexplication = WExplication( text=texts_CPR.DECISION_explication, parent=self) layout.addWidget(self._widexplication) self._widdecision = WSpinbox( label=texts_CPR.DECISION_label, minimum=pms.DECISION_MIN, maximum=pms.DECISION_MAX, interval=pms.DECISION_STEP, automatique=self._automatique, parent=self) layout.addWidget(self._widdecision) buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok) buttons.accepted.connect(self._accept) layout.addWidget(buttons) if self._automatique: self._timer_automatique = QtCore.QTimer() self._timer_automatique.timeout.connect( buttons.button(QtGui.QDialogButtonBox.Ok).click) self._timer_automatique.start(7000) # title and size self.setWindowTitle(texts_CPR.DECISION_titre) self.adjustSize() self.setFixedSize(self.size())
def __init__(self, defered, automatique, parent, period, historique, remote): super(GuiDecision, self).__init__(parent) # variables self._defered = defered self._automatique = automatique self._historique = GuiHistorique(self, historique) self._remote = remote self._offer_items = {} layout = QtGui.QVBoxLayout(self) wperiod = WPeriod(period=period, ecran_historique=self._historique) layout.addWidget(wperiod) wexplanation = WExplication(text=texts_MC.get_text_explanation( self._remote.role, self._remote.value_or_cost), size=(450, 50), parent=self) layout.addWidget(wexplanation) self._compte_rebours = WCompterebours(parent=self, temps=pms.TEMPS, actionfin=self._accept) layout.addWidget(self._compte_rebours) gridlayout = QtGui.QGridLayout() layout.addLayout(gridlayout) CURRENT_LINE = 0 gridlayout.addWidget(QtGui.QLabel(u"Offres de ventes"), CURRENT_LINE, 0) gridlayout.addWidget(QtGui.QLabel(u"Offres d'achats"), CURRENT_LINE, 1) gridlayout.addWidget(QtGui.QLabel(u"Transactions"), CURRENT_LINE, 2) CURRENT_LINE += 1 self._model_ventes = QtGui.QStandardItemModel() self._listview_ventes = QtGui.QListView() self._listview_ventes.setModel(self._model_ventes) self._listview_ventes.setMaximumSize(300, 600) gridlayout.addWidget(self._listview_ventes, CURRENT_LINE, 0) self._model_achats = QtGui.QStandardItemModel() self._listview_achats = QtGui.QListView() self._listview_achats.setModel(self._model_achats) self._listview_achats.setMaximumSize(300, 600) gridlayout.addWidget(self._listview_achats, CURRENT_LINE, 1) self._listwidget_transactions = QtGui.QListWidget() self._listwidget_transactions.setMaximumSize(300, 600) gridlayout.addWidget(self._listwidget_transactions, CURRENT_LINE, 2) CURRENT_LINE += 1 if self._remote.role == pms.VENDEUR: self._layout_offer = QtGui.QHBoxLayout() self._layout_offer.addWidget(QtGui.QLabel(u"Offre de vente")) self._spin_offer = QtGui.QDoubleSpinBox() self._spin_offer.setDecimals(pms.DECIMALES) self._spin_offer.setMinimum(0) self._spin_offer.setMaximum(pms.DECISION_MAX) self._spin_offer.setButtonSymbols(QtGui.QSpinBox.NoButtons) self._spin_offer.setMaximumWidth(50) self._layout_offer.addWidget(self._spin_offer) self._button_send_offer = QtGui.QPushButton(u"Envoyer") self._button_send_offer.setMaximumWidth(100) self._button_send_offer.clicked.connect( lambda _: self._send_offer()) self._layout_offer.addWidget(self._button_send_offer) self._layout_offer.addSpacerItem( QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)) gridlayout.addLayout(self._layout_offer, CURRENT_LINE, 0) else: self._layout_offer = QtGui.QHBoxLayout() self._layout_offer.addWidget(QtGui.QLabel(u"Offre d'achat")) self._spin_offer = QtGui.QDoubleSpinBox() self._spin_offer.setDecimals(pms.DECIMALES) self._spin_offer.setMinimum(0) self._spin_offer.setMaximum(pms.DECISION_MAX) self._spin_offer.setButtonSymbols(QtGui.QSpinBox.NoButtons) self._spin_offer.setMaximumWidth(50) self._layout_offer.addWidget(self._spin_offer) self._button_send_offer = QtGui.QPushButton(u"Envoyer") self._button_send_offer.setMaximumWidth(100) self._button_send_offer.clicked.connect( lambda _: self._send_offer()) self._layout_offer.addWidget(self._button_send_offer) self._layout_offer.addSpacerItem( QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)) gridlayout.addLayout(self._layout_offer, CURRENT_LINE, 1) self.setWindowTitle(trans_MC(u"Marché")) self.adjustSize() self.setFixedSize(self.size()) if self._automatique: self._timer_automatique = QtCore.QTimer() self._timer_automatique.setSingleShot(False) self._timer_automatique.timeout.connect(self._play_auto) self._timer_automatique.start(5000)
def __init__(self, defered, automatique, parent, period, historique, remote): super(GuiDecision, self).__init__(parent) # variables self._defered = defered self._automatique = automatique self._remote = remote layout = QtGui.QVBoxLayout(self) self._historique = GuiHistorique(self, historique, size=SIZE_HISTO) wperiod = WPeriod( period=period, ecran_historique=self._historique) layout.addWidget(wperiod) wexplanation = WExplication( text=texts_MRI.get_text_explanation( self._remote.balance_if_triangle, self._remote.balance_if_star), size=(SIZE_HISTO[0], 70), parent=self) layout.addWidget(wexplanation) # Compte à rebours ===================================================== self._compte_rebours = WCompterebours( parent=self, temps=pms.MARKET_TIME, actionfin=self._accept) self._compte_rebours.setStyleSheet("color: blue;") layout.addWidget(self._compte_rebours) # zone information actualisée ========================================== self._information = InformationZone() layout.addWidget(self._information) # market =============================================================== market_layout = QtGui.QGridLayout() layout.addLayout(market_layout) # triangle triangle_label = QtGui.QLabel(trans_MRI(u"Triangle")) triangle_label.setStyleSheet("color: red;") market_layout.addWidget(triangle_label, 0, 0, 1, 2) self._triangle_purchase_zone = OfferZone(pms.BUY, zone_size=(350, 250)) market_layout.addWidget(self._triangle_purchase_zone, 1, 0) self._triangle_sell_zone = OfferZone(pms.SELL, zone_size=(350, 250)) market_layout.addWidget(self._triangle_sell_zone, 1, 1) self._triangle_transactions = TransactionZone(zone_size=(350, 250)) market_layout.addWidget(self._triangle_transactions, 2, 0, 1, 2) # star star_label = QtGui.QLabel(trans_MRI(u"Star")) star_label.setStyleSheet("color: red;") market_layout.addWidget(star_label, 0, 3, 1, 2) self._star_purchase_zone = OfferZone(pms.BUY, zone_size=(350, 250)) market_layout.addWidget(self._star_purchase_zone, 1, 3) self._star_sell_zone = OfferZone(pms.SELL, zone_size=(350, 250)) market_layout.addWidget(self._star_sell_zone, 1, 4) self._star_transactions = TransactionZone(zone_size=(350, 250)) market_layout.addWidget(self._star_transactions, 2, 3, 1, 2) separator = QtGui.QFrame() separator.setFrameShape(QtGui.QFrame.VLine) market_layout.addWidget(separator, 0, 2, market_layout.rowCount(), 1) # finalisation ========================================================= layout.addSpacing(50) self._make_connections() self.setWindowTitle(trans_MRI(u"Market")) # self.adjustSize() # self.setFixedSize(self.size()) if self._automatique: self._timer_automatique = QtCore.QTimer() self._timer_automatique.timeout.connect(self._play_auto) self._timer_automatique.start(randint(2000, 7000))
def __init__(self, defered, automatique, parent, periode, historique): super(GuiDecision, self).__init__(parent) # variables self._defered = defered self._automatique = automatique self._historique = GuiHistorique(self, historique, size=(1100, 500)) layout = QtGui.QVBoxLayout(self) wperiod = WPeriod(period=periode, ecran_historique=self._historique, parent=self) layout.addWidget(wperiod) wexplanation = WExplication( text=textes_PGLG.get_text_explanation(), parent=self, size=(450, 80)) layout.addWidget(wexplanation) gridlayout = QtGui.QGridLayout() layout.addLayout(gridlayout) CURRENT_LINE = 0 gridlayout.addWidget(QtGui.QLabel(u"Saisissez le nombre de jetons que " u"vous placez sur votre compte individuel"), CURRENT_LINE, 0) self._spin_indiv = QtGui.QSpinBox() self._spin_indiv.setMinimum(0) self._spin_indiv.setMaximum(pms.DOTATION) self._spin_indiv.setSingleStep(1) self._spin_indiv.setButtonSymbols(QtGui.QSpinBox.NoButtons) self._spin_indiv.setMaximumWidth(80) gridlayout.addWidget(self._spin_indiv, CURRENT_LINE, 1) CURRENT_LINE += 1 gridlayout.addWidget(QtGui.QLabel(u"Saisissez le nombre de jetons que " u"vous placez sur le compte local"), CURRENT_LINE, 0) self._spin_local = QtGui.QSpinBox() self._spin_local.setMinimum(0) self._spin_local.setMaximum(pms.DOTATION) self._spin_local.setSingleStep(1) self._spin_local.setButtonSymbols(QtGui.QSpinBox.NoButtons) self._spin_local.setMaximumWidth(80) gridlayout.addWidget(self._spin_local, CURRENT_LINE, 1) CURRENT_LINE += 1 gridlayout.addWidget(QtGui.QLabel(u"Saisissez le nombre de jetons que " u"vous placez sur le compte global"), CURRENT_LINE, 0) self._spin_global = QtGui.QSpinBox() self._spin_global.setMinimum(0) self._spin_global.setMaximum(pms.DOTATION) self._spin_global.setSingleStep(1) self._spin_global.setButtonSymbols(QtGui.QSpinBox.NoButtons) self._spin_global.setMaximumWidth(80) gridlayout.addWidget(self._spin_global, CURRENT_LINE, 1) buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok) buttons.accepted.connect(self._accept) layout.addWidget(buttons) self.setWindowTitle(trans_PGLG(u"Decision")) self.adjustSize() self.setFixedSize(self.size()) if self._automatique: indiv, loc, glob = 0, 0, 0 while indiv + loc + glob != pms.DOTATION: indiv = randint(0, pms.DOTATION) loc = randint(0, pms.DOTATION) glob = randint(0, pms.DOTATION) self._spin_indiv.setValue(indiv) self._spin_local.setValue(loc) self._spin_global.setValue(glob) self._timer_automatique = QtCore.QTimer() self._timer_automatique.timeout.connect( buttons.button(QtGui.QDialogButtonBox.Ok).click) self._timer_automatique.start(7000)