Ejemplo n.º 1
0
 def on_actionCalculator_triggered(self):
     from xulpymoney.ui.wdgCalculator import wdgCalculator
     d = MyNonModalQDialog(self)
     d.setSettings(self.mem.settings, "frmMain", "wdgCalculator", 850, 850)
     d.setWindowTitle(self.tr("Investment calculator"))
     w = wdgCalculator(self.mem, self)
     w.setProduct(
         self.mem.data.products.find_by_id(
             int(self.mem.settings.value("wdgCalculator/product", "0"))))
     d.setWidgets(w)
     d.show()
Ejemplo n.º 2
0
 def on_actionMiddle_triggered(self):
     d = MyNonModalQDialog(self)
     d.setSettings(self.mem.settings, "wdgIndexRange", "mqdCalculator")
     d.setWindowTitle(self.tr("Investment calculator"))
     w = wdgCalculator(self.mem)
     w.setProduct(
         self.mem.data.products.find_by_id(
             int(self.mem.settings.value("wdgCalculator/product", "0"))))
     w.spnProductPriceVariation.setValue(
         self.range.currentPriceMiddleVariation().value_100())
     d.setWidgets(w)
     d.show()
Ejemplo n.º 3
0
 def on_actionCalculate_triggered(self):
     d = QDialog(self)
     d.setFixedSize(850, 850)
     d.setWindowTitle(self.tr("Investment last operation calculator"))
     w = wdgCalculator(self.mem)
     w.setInvestment(self.mqtwInvestments.selected)
     price = self.mqtwInvestments.selected.op_actual.last().price * (
         1 + self.spin.value() / Decimal(100))  #Is + because -·-
     w.txtFinalPrice.setText(price)
     lay = QVBoxLayout(d)
     lay.addWidget(w)
     d.show()
Ejemplo n.º 4
0
 def on_actionExecute_triggered(self):        
     if self.mqtwOpportunities.selected.executed==None:#Only adds an order if it's not executed
         d=QDialog(self)        
         d.setModal(True)
         d.setFixedSize(850, 850)
         d.setWindowTitle(self.tr("Investment calculator"))
         w=wdgCalculator(self.mem, self)
         w.setProduct(self.mqtwOpportunities.selected.product)
         w.txtFinalPrice.setText(self.mqtwOpportunities.selected.entry)
         lay = QVBoxLayout(d)
         lay.addWidget(w)
         d.exec_()
         reply = QMessageBox.question(None, self.tr('Opportunity execution'), self.tr("If you have make and order, you must execute\nDo you want to execute this oportunity?"),  QMessageBox.Yes, QMessageBox.No)          
         if reply==QMessageBox.Yes:
             self.mqtwOpportunities.selected.executed=self.mem.localzone.now()#Set execution
             self.mqtwOpportunities.selected.save()
             self.mem.con.commit()
     else:
         self.mqtwOpportunities.selected.executed=None#Remove execution
         self.mqtwOpportunities.selected.save()
         self.mem.con.commit()
     self.on_cmbMode_currentIndexChanged(self.cmbMode.currentIndex())