Ejemplo n.º 1
0
 def on_actionSimulations_triggered(self):
     from xulpymoney.ui.wdgSimulations import wdgSimulations
     d = MyModalQDialog(self)
     d.setSettings(self.mem.settings, "wdgSimulations", "mqdSimulations")
     d.setWindowTitle(self.tr("Xulpymoney Simulations"))
     d.setWidgets(wdgSimulations(self.mem, d))
     d.exec_()
Ejemplo n.º 2
0
 def on_actionDisReinvestProduct_triggered(self):
     d = MyModalQDialog()
     d.setSettings(self.mem.settings, "frmInvestmentReport",
                   "frmDisReinvestProduct")
     d.setWindowTitle(self.tr("Divest / Reinvest simulation"))
     d.setWidgets(wdgDisReinvest(self.mem, self.investment, True, d))
     d.exec_()
Ejemplo n.º 3
0
 def on_actionOrderNew_triggered(self):
     d = MyModalQDialog(self)
     d.setWindowTitle(self.tr("Add new order"))
     d.setSettings(self.mem.settings, "wdgOrders", "frmOrderAdd", 600, 400)
     w = wdgOrdersAdd(self.mem, None, None, d)
     d.setWidgets(w)
     d.exec_()
     self.on_cmbMode_currentIndexChanged(self.cmbMode.currentIndex())
Ejemplo n.º 4
0
 def on_cmdOrder_released(self):
     d = MyModalQDialog(self)
     d.setWindowTitle(self.tr("Add new order"))
     d.setSettings(self.mem.settings, "wdgCalculator", "mqdOrdersAdd ")
     w = wdgOrdersAdd(self.mem, None, self.investments.selected, d)
     w.txtShares.setText(self.txtShares.decimal())
     w.txtPrice.setText(self.txtFinalPrice.decimal())
     d.setWidgets(w)
     d.exec_()
Ejemplo n.º 5
0
 def on_actionStrategyEdit_triggered(self):
     d = MyModalQDialog(self)
     d.setWindowTitle(self.tr("Edit a strategy"))
     d.setSettings(self.mem.settings, "wdgStrategyResults",
                   "wdgStrategyResultsAdd_dialog", 600, 400)
     w = wdgStrategyResultsAdd(self.mem, self.mqtwStrategies.selected, d)
     d.setWidgets(w)
     d.exec_()
     self.update()
Ejemplo n.º 6
0
 def on_actionStrategyNew_triggered(self):
     d = MyModalQDialog(self)
     d.setWindowTitle(self.tr("Add new strategy"))
     d.setSettings(self.mem.settings, "wdgStrategyResults",
                   "wdgStrategyResultsAdd_dialog", 600, 400)
     w = wdgStrategyResultsAdd(self.mem, None, d)
     d.setWidgets(w)
     d.exec_()
     self.update()
Ejemplo n.º 7
0
 def on_actionOrderEdit_triggered(self):
     d = MyModalQDialog(self)
     d.setWindowTitle(self.tr("Edit order"))
     d.setSettings(self.mem.settings, "wdgOrders", "frmOrderAdd", 600, 400)
     w = wdgOrdersAdd(self.mem, self.mqtwOrders.selected,
                      self.mqtwOrders.selected.investment, d)
     d.setWidgets(w)
     d.exec_()
     self.on_cmbMode_currentIndexChanged(self.cmbMode.currentIndex())
Ejemplo n.º 8
0
    def on_actionConceptReport_triggered(self):
        if self.tab.currentIndex()==0:
            concept=self.mqtwOperations.selected.concept
        else:
            concept=self.mqtwCreditCardOperations.selected[0].concept

        d=MyModalQDialog(self)     
        d.setSettings(self.mem.settings, "frmAccountsReport","qdialog_conceptreport")
        d.setWindowTitle(self.tr("Historical report of {}").format(concept.name))
        d.setWidgets(wdgConceptsHistorical(self.mem, concept, d))
        d.exec_()
Ejemplo n.º 9
0
 def on_actionMergeCodes_triggered(self):
     if len(self.mqtwInvestments.selected) == 2:
         #Only two checked in custom contest
         d = MyModalQDialog(self)
         d.setWindowTitle(self.tr("Merging codes"))
         d.setSettings(self.mem.settings, "wdgProducts", "frmMergeProducts")
         w = wdgProductsDataMove(self.mem, self.mqtwInvestments.selected[0],
                                 self.mqtwInvestments.selected[1])
         d.setWidgets(w)
         d.exec_()
         self.build_array_from_arrInt()
Ejemplo n.º 10
0
 def on_cmdOrder_released(self):
     d = MyModalQDialog(self)
     d.setSettings(self.mem.settings, "wdgDisReinvest", "mqdOrdersAdd")
     d.setWindowTitle(self.tr("Add new order"))
     w = wdgOrdersAdd(self.mem, None, self.investment, d)
     w.txtShares.setText(self.txtAcciones.decimal())
     if self.radDes.isChecked():  #DESINVERSION
         w.txtPrice.setText(-self.txtValorAccion.decimal())
     else:  #REINVERSION
         w.txtPrice.setText(self.txtValorAccion.decimal())
     d.setWidgets(w)
     d.exec_()
Ejemplo n.º 11
0
 def on_cmdDrawRanges_pressed(self):       
     from xulpymoney.ui.wdgProductHistoricalChart import wdgProductHistoricalChart
     d=MyModalQDialog(self)     
     d.setSettings(self.mem.settings, "wdgProductRange","MyModalQDialog")
     d.setWindowTitle(self.tr("Historical report of {}").format(self.product.name))
     wdgTSHistorical=wdgProductHistoricalChart(d)
     wdgTSHistorical.setProduct(self.product, None)
     wdgTSHistorical.setDrawRangeLines(self.prm.list_of_range_values())
     wdgTSHistorical.generate()
     wdgTSHistorical.display()
     d.setWidgets(wdgTSHistorical)
     d.exec_()
Ejemplo n.º 12
0
    def __init__(self, parent=None):
        MyModalQDialog.__init__(self, parent=None)
        self._fileToDelete = None
        self.wdg = wdgQuotesSaveResult(self)
        self.setWindowTitle(self.tr("Report after saving quotes"))

        self.chkDeleteFile = QCheckBox(self)
        self.chkDeleteFile.setChecked(True)
        self.bb = QDialogButtonBox(self)
        self.bb.setStandardButtons(QDialogButtonBox.Cancel
                                   | QDialogButtonBox.Ok)
        self.bb.setCenterButtons(True)
        self.bb.accepted.connect(self.on_bb_accepted)
        self.bb.rejected.connect(self.on_bb_rejected)
Ejemplo n.º 13
0
    def on_actionShowReinvest_triggered(self):
        if self.mqtwOrders.selected.price is None or self.mqtwOrders.selected.shares is None or self.mqtwOrders.selected.investment.shares(
        ) == 0:
            qmessagebox(self.tr("This order can't be simulated"))
            return

        d = MyModalQDialog()
        d.setWindowTitle(self.tr("Order reinvest simulation"))
        d.setSettings(self.mem.settings, "wdgOrders", "frmDisReinvest")
        w = wdgDisReinvest(self.mem, self.mqtwOrders.selected.investment,
                           False, d)
        w.txtValorAccion.setText(self.mqtwOrders.selected.price)
        w.txtSimulacion.setText(self.mqtwOrders.selected.price *
                                self.mqtwOrders.selected.shares)
        d.setWidgets(w)
        d.exec_()
Ejemplo n.º 14
0
    def on_actionShowReinvestSameProduct_triggered(self):
        investment = self.mem.data.investments_active(
        ).Investment_merging_current_operations_with_same_product(
            self.mqtwOrders.selected.investment.product)
        if self.mqtwOrders.selected.price == None or self.mqtwOrders.selected.shares == None or investment.shares(
        ) == 0:
            qmessagebox(self.tr("This order can't be simulated"))
            return

        d = MyModalQDialog()
        d.setWindowTitle(
            self.
            tr("Order reinvest simulation with all investments with the same product"
               ))
        d.setSettings(self.mem.settings, "wdgOrders", "frmDisReinvest")
        w = wdgDisReinvest(self.mem, investment, True, d)
        w.txtValorAccion.setText(self.mqtwOrders.selected.price)
        w.txtSimulacion.setText(self.mqtwOrders.selected.price *
                                self.mqtwOrders.selected.shares)
        d.setWidgets(w)
        d.exec_()
Ejemplo n.º 15
0
    def on_actionProductsWithPriceVariation_triggered(self):
        from xulpymoney.ui.wdgProducts import wdgProducts
        self.w.close()
        d = MyModalQDialog()
        d.setWindowTitle(self.tr("Price variation"))
        d.setSettings(self.mem.settings, "frmMain",
                      "mqdProductsWithPriceVariation")
        lblDays = QLabel("Days")
        txtDays = myQLineEdit(d)
        txtDays.setText(90)
        lblVariation = QLabel("Variation")
        txtVariation = myQLineEdit(d)
        txtVariation.setText(-10)
        d.setWidgets(lblDays, txtDays, lblVariation, txtVariation)
        d.exec_()

        sql = "select * from products where is_price_variation_in_time(id, {}, now()::timestamptz-interval '{} day')=true and obsolete=False order by name".format(
            txtVariation.text(), txtDays.text())
        print(sql)
        self.w = wdgProducts(self.mem, sql)
        self.layout.addWidget(self.w)
        self.w.show()
Ejemplo n.º 16
0
 def on_cmdGraph_released(self):
     d = MyModalQDialog(self)
     d.setWindowIcon(QIcon(":/xulpymoney/bank.png"))
     d.setSettings(self.mem.settings, "wdgBanks", "mqdGraph")
     d.setWindowTitle(self.tr("Banks graph"))
     view = VCPie(d)
     view.pie.setTitle(self.tr("Banks graph"))
     view.setSettings(self.mem.settings, "wdgBanks", "pie")
     for bank in self.mem.data.banks_active().arr:
         view.pie.appendData(bank.name, bank.balance())
     view.display()
     d.setWidgets(view)
     d.exec_()
Ejemplo n.º 17
0
    def on_cmdGraph_released(self):
        self.investment.product.needStatus(2)
        d = MyModalQDialog(self)
        d.setSettings(self.mem.settings, "wdgDisReinvest", "mqdGraphReinvest")
        d.setWindowTitle(self.tr("Reinvest graph"))
        d.showMaximized()

        wc = wdgProductHistoricalReinvestChart()
        wc.setProduct(self.investment.product, self.investment)
        wc.setReinvest(self.investment_simulated.op,
                       self.investment_simulated.op_actual)
        wc.generate()
        wc.display()

        d.setWidgets(wc)
        d.exec_()
Ejemplo n.º 18
0
 def exec_(self):
     if self.fileToDelete() == None:
         self.chkDeleteFile.hide()
     MyModalQDialog.exec_(self)
Ejemplo n.º 19
0
 def on_cmdGraph_released(self):
     self.product.needStatus(2)
     d = MyModalQDialog(self)
     d.showMaximized()
     d.setWindowTitle(self.tr("Purchase graph"))
     d.setSettings(self.mem.settings, "wdgCalculator", "mqdBuyGraph")
     wc = wdgProductHistoricalBuyChart()
     wc.setProduct(self.product, None)
     wc.setPrice(self.txtFinalPrice.decimal())
     wc.generate()
     wc.display()
     d.setWidgets(wc)
     d.exec_()