Exemple #1
0
    def __init__(self, parent=None):
        super(ContractIniter, self).__init__(parent)
        self.ui = Ui_ContractIniter()
        self.ui.setupUi(self)

        scrollArea = QtGui.QScrollArea()
        scrollArea.setWidgetResizable(True)
        self.contractEditor = ContractEditor(scrollArea)
        self.contractEditor.initEditor()

        self.ui.tab_main.addTab(self.contractEditor, "Nouveau contrat")
        self.ui.tab_main.widget(1).setSizePolicy(
            QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred)
        self.setWindowTitle("Créateur de contrat")

        self.oil_market = Market()
        self.cDB = ContractsDatabase()

        self.usine_selected = None
        self.m_completer = QtGui.QCompleter(
            self.oil_market.marchandises_list['fr'])
        self.m_completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
        self.m_completer.setCompletionMode(
            QtGui.QCompleter.UnfilteredPopupCompletion)
        self.ui.produit.setCompleter(self.m_completer)

        self.ui.tab_main.setCurrentIndex(0)

        self.contractEditor.s_contract_validated.connect(self.close)
        self.contractEditor.s_close_widget.connect(self.close)
        self.connectionsManager(disconnect=False)

        self.ui.rb_fournisseur.setChecked(True)
    def __init__(self, parent=None):
        super(ContractEditor, self).__init__(parent)
        self.ui = Ui_ContractEditor()
        self.ui.setupUi(self)
        self.setCreatorMode() # precis if we modify an existant contract or not
        
        self.cDB = ContractsDatabase()
        self.oil_market = Market()
#        self.comm = self.cDB.communicator
#        self.comm.s_cDB_updated.connect(self.updateCtrList)
#        self.new_contract = Contract()
        self.new_contract = None
        
        self.w_dlv = QtGui.QWidget()
        layout = QtGui.QVBoxLayout()
        label_detail = QtGui.QLabel("Détails :")
        self.t_dlv = QtGui.QTextEdit()
        self.w_dlv_date = CalendarDeliveries()
        layout.addWidget(self.w_dlv_date)
        layout.addWidget(label_detail)
        layout.addWidget(self.t_dlv)
        self.w_dlv.setLayout(layout)
        scrollArea = QtGui.QScrollArea()
        scrollArea.setWidgetResizable(True)
        scrollArea.setWidget(self.w_dlv)
        scrollArea.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)

        self.ui.formLayout.setWidget(11, QtGui.QFormLayout.FieldRole, scrollArea)

#        layout = QtGui.QVBoxLayout()
#        layout.addWidget(self.w_dlv_date)
#        self.ui.date_livraison.setLayout(layout)
#        
#        self.ui.date_livraison.updateGeometry()
#        self.ui.date_livraison.resize(self.w_dlv_date.minimumSize())
#        self.ui.date_livraison.adjustSize()
#        self.w_dlv_date.updateGeometry()
#        self.w_dlv_date.adjustSize()
#        self.ui.date_livraison.adjustSize()
        
        self.ui.n_contrat.setEnabled(True)
        self.ui.cb_adr_depart.view().setAlternatingRowColors(True)
        self.ui.cb_adr_livraison.view().setAlternatingRowColors(True)
        self.ui.cb_logement.view().setAlternatingRowColors(True)
        self.ui.cb_marchandise.view().setAlternatingRowColors(True)
        self.ui.cb_nom_acheteur.view().setAlternatingRowColors(True)
        self.ui.cb_nom_vendeur.view().setAlternatingRowColors(True)
        self.ui.cb_usine.view().setAlternatingRowColors(True)
#        self.ui.cb_usine.setMinimumHeight(100)
        
        self.ui.qte_total.setValidator(QtGui.QDoubleValidator(0.0, 999999.0, 10, self))
        self.ui.prix.setValidator(QtGui.QDoubleValidator(0.0, 999999.0, 10, self))
        self.initMonnaie()
        self.initMarchandiseList()
        self.initPaiementList()
        self.initLogementList()
        self.connectionsManager()
        self.repaint()
Exemple #3
0
def main():

    #    print isfile(getFromConfig("path", "stylesheet_file"))
    #    app.translate()

    ##########################################
    try:
        logging.basicConfig(level=logging.DEBUG)  #,
        #        format='%(asctime)-15s %(levelname)-8s %(message)s',
        #        datefmt='%Y-%m-%d %H:%M:%S',
        #        filename="Log.log",
        #        filemode='w')

        stdout_logger = logging.getLogger()
        stderr_logger = logging.getLogger()

        fh_debug = logging.FileHandler('Log.log')
        fh_debug.setLevel(logging.DEBUG)
        fh_debug.setFormatter(
            logging.Formatter('%(asctime)-15s %(levelname)-8s %(message)s'))
        stdout_logger.addHandler(fh_debug)

    #    sh = logging.StreamHandler(sys.stdout)
    #    sh.setLevel(logging.DEBUG)
    #    sh.setFormatter(logging.Formatter('%(asctime)-15s %(levelname)-8s %(message)s'))
    #    stdout_logger.addHandler(sh)


#        sys.stdout = StreamToLogger(stdout_logger, logging.DEBUG)
#        sys.stderr = StreamToLogger(stderr_logger, logging.ERROR)
    except:
        try:
            for handler in stdout_logger.handlers:
                handler.close()
                stdout_logger.removeFilter(handler)

            for handler in stderr_logger.handlers:
                handler.close()
                stderr_logger.removeFilter(handler)
        except:
            pass
    #########################################

    # INITIALIZATION ##
    Market()

    # EXECUTE
    setup = Ui_manager(version)
    setup.show()
    splash.finish(setup)

    sys.exit(app.exec_())
Exemple #4
0
    def __init__(self, version=0.0, parent=None):
        super(Ui_manager, self).__init__(parent)
        self.ui = Ui_Accueil()
        self.ui.setupUi(self)
        self.setWindowIcon(QtGui.QIcon('icone.png'))
        self.setWindowTitle('Gestionnaire de clientèle')
        self.ui.splitter.setHandleWidth(15)
        self.version = version

        l_ctr = QtGui.QHBoxLayout()
        scroll_ctr = QtGui.QScrollArea()
        self.ctr_manager = ContractsManager(self)
        self.w_ctr = self.ctr_manager.ui.ctr_centralwidget
        self.w_ctr.setAttribute(QtCore.Qt.WA_StyledBackground)
        self.w_ctr.setObjectName("w_ctr")
        #        self.w_ctr.adjustSize()
        scroll_ctr.setWidgetResizable(True)
        scroll_ctr.setWidget(self.w_ctr)
        #        scroll_ctr.adjustSize()
        l_ctr.addWidget(scroll_ctr)
        self.ui.f_contracts.setLayout(l_ctr)
        self.ui.f_contracts.setFrameShape(QtGui.QFrame.NoFrame)

        l_deliv = QtGui.QHBoxLayout()
        scroll_deliv = QtGui.QScrollArea()
        self.dlv_manager = DeliveryManager(self)
        self.w_dlv = self.dlv_manager.ui.dlv_centralwidget
        self.w_dlv.setAttribute(QtCore.Qt.WA_StyledBackground)
        self.w_dlv.setObjectName("w_dlv")
        scroll_deliv.setWidget(self.w_dlv)
        scroll_deliv.setWidgetResizable(True)
        l_deliv.addWidget(scroll_deliv)
        self.ui.f_deliveries.setLayout(l_deliv)
        self.updateStyle()

        self.ctr_manager.s_addDelivery.connect(self.dlv_manager.addDelivery)

        self.oil_market = Market()
        #        self.ctr_manager.FIAUpdated()
        #        self.ctr_manager.FIFUpdated()
        self.ui.actionConfig.triggered.connect(
            self.oil_market.updateConfigLanguages)
        self.ui.actionFIA.triggered.connect(self.updateFIA)
        self.ui.actionFIF.triggered.connect(self.oil_market.updateFIF)
        self.ui.menuA_propos.aboutToShow.connect(self.a_propos)

        self.showMaximized()
    def __init__(self, parent=None, ctr=None, delivery=None):
        super(deliveryEditor, self).__init__(parent)
        self.setWindowIcon(QtGui.QIcon('icone.png'))
        self.setWindowTitle('Éditeur de livraison')
        self.oil_market = Market()

        if ctr is None: return
        self.ctr = ctr
        self.mainWidget = ui_new_delivery(self)
        self.buttons = QtGui.QDialogButtonBox(
            QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok,
            QtCore.Qt.Horizontal, self)
        self.buttons.button(QtGui.QDialogButtonBox.Ok).setText("Valider")
        self.buttons.button(QtGui.QDialogButtonBox.Cancel).setText("Annuler")
        self.doNotClose = False

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.mainWidget)
        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addLayout(layout)
        mainLayout.addWidget(self.buttons)
        self.setLayout(mainLayout)

        self.mainWidget.ui.l_qte.setValidator(
            QtGui.QDoubleValidator(0.0, 999999.0, 10, self))
        self.buttons.accepted.connect(self.checkDelivery)
        self.buttons.rejected.connect(self.reject)
        self.mainWidget.ui.cb_ville.setEditable(True)
        self.mainWidget.ui.cb_date.currentIndexChanged.connect(
            self.dateSelected)
        self.mainWidget.ui.rb_franco.toggled.connect(self.delivTypeChanged)
        self.mainWidget.ui.rb_depart.toggled.connect(self.delivTypeChanged)

        self.initWidget()
        if delivery is not None:
            self.updateWidget(delivery)
Exemple #6
0
    def __init__(self, parent=None):
        super(PDFCreator, self).__init__(parent)
        self.ui = Ui_printer()
        self.ui.setupUi(self)
        self.setWindowTitle('Édition du document')
        self.oil_market = Market()

        self.lang_list = getFromConfig("langages", 'lang_list')
        for lang in self.lang_list:
            rb = langueRB(parent=self.ui.layout_langues,
                          text=lang['nom'],
                          data=lang)
            self.ui.layout_langues.addWidget(rb)

        for i in range(0, self.ui.layout_langues.count(), 1):
            w = self.ui.layout_langues.itemAt(i)
            if w is not None:
                w.widget().setChecked(True)
                break

        self.setAttribute(QtCore.Qt.WA_StyledBackground)
        self.ui.b_print.clicked.connect(self.createPDF)
        self.ui.b_close.clicked.connect(self.close)
        self.hide()
Exemple #7
0
import numpy as np
import matplotlib.pyplot as plt
from classes import Market, deadw

baseline_params = 15, 0.5, -2, 0.5, 3
m = Market(*baseline_params)

q_max = m.quantity() * 2
q_grid = np.linspace(0.0, q_max, 100)
pd = m.inverse_demand(q_grid)
ps = m.inverse_supply(q_grid)
psno = m.inverse_supply_no_tax(q_grid)

fig, ax = plt.subplots()
ax.plot(q_grid, pd, lw=2, alpha=0.6, label='demanda')
ax.plot(q_grid, ps, lw=2, alpha=0.6, label='oferta')
ax.plot(q_grid, psno, '--k', lw=2, alpha=0.6, label='Oferta sin impuestos')
ax.set_xlabel('Cantidad', fontsize=14)
ax.set_xlim(0, q_max)
ax.set_ylabel('Precio', fontsize=14)
ax.legend(loc='lower right', frameon=False, fontsize=14)
plt.show()

baseline_params = 15, 0.5, -2, 0.5, 3
m = Market(*baseline_params)
peso = deadw(m)
print(peso)
Exemple #8
0
    def __init__(self, parent=None):
        super(DeliveryManager, self).__init__(parent)
        self.ui = Ui_delivery_manager()
        self.ui.setupUi(self)

        self.cDB = ContractsDatabase()
        self.comm = self.cDB.communicator
        self.oil_market = Market()

        self.ui.t_deliver_list.deleteLater()
        self.t_deliver_list = MyTreeWidget(self)
        self.t_deliver_list.setAlternatingRowColors(True)
        #        self.ui.t_ctr_list.header().setDefaultAlignment(QtCore.Qt.AlignCenter)
        self.t_deliver_list.setIndentation(0)
        self.t_deliver_list.s_dropped_contract.connect(
            self.loadDeliveriesFromContract)
        self.t_deliver_list.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.t_deliver_list.customContextMenuRequested.connect(
            self.customContextMenu)
        self.t_deliver_list.header().setStretchLastSection(True)
        #        self.t_deliver_list.header().setResizeMode(QtGui.QHeaderView.Interactive)
        self.t_deliver_list.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
        self.ui.horizontalLayout.addWidget(self.t_deliver_list)
        self.ui.t_deliv_tot.setIndentation(0)

        self.ui.l_ref_client.installEventFilter(self)
        self.ui.l_ref_fourniss.installEventFilter(self)
        self.ui.l_ref_charg.installEventFilter(self)
        self.ui.l_ref_client.returnPressed.connect(self.researchDelivery)
        self.ui.l_ref_fourniss.returnPressed.connect(self.researchDelivery)
        self.ui.l_ref_charg.returnPressed.connect(self.researchDelivery)
        self.ui.b_rechercher.clicked.connect(self.researchDelivery)
        self.ui.b_rechercher.setEnabled(False)

        self.popMenu = QtGui.QMenu(self)
        self.actionSetConfirm_dlv = QtGui.QAction(
            "Confirmer/infirmer la livraison", self)
        self.actionSetConfirm_dlv.triggered.connect(
            self.setConfirmationLivraison)
        self.actionSetPaied = QtGui.QAction("Confirmer/infirmer le paiement",
                                            self)
        self.actionSetPaied.triggered.connect(self.setPaiment)
        self.actionModifyDeliv = QtGui.QAction("Modifier la livraison", self)
        self.actionModifyDeliv.triggered.connect(self.modifyDelivery)
        self.actionRemove = QtGui.QAction("Supprimer la livraison", self)
        self.actionRemove.triggered.connect(self.removeDelivery)
        self.actionImport = QtGui.QAction(
            "Importer des livraisons depuis Execution.xlsx", self)
        self.actionImport.triggered.connect(self.importDeliveries)

        self.popMenu.addAction(self.actionSetConfirm_dlv)
        self.popMenu.addAction(self.actionSetPaied)
        self.popMenu.addSeparator()
        self.popMenu.addAction(self.actionModifyDeliv)
        self.popMenu.addSeparator()
        self.popMenu.addAction(self.actionRemove)
        self.popMenu.addSeparator()
        self.popMenu.addAction(self.actionImport)

        self.popMenu2 = QtGui.QMenu(self)
        self.actionImport2 = QtGui.QAction("Importer depuis Execution.xlsx",
                                           self)
        self.actionImport2.triggered.connect(self.importDeliveries)
        self.popMenu2.addAction(self.actionImport)

        self.ui.cb_marchandise.view().setAlternatingRowColors(True)
        self.ui.cb_sort_client.view().setAlternatingRowColors(True)
        self.ui.cb_sort_fourniss_2.view().setAlternatingRowColors(True)

        self.ui.rb_date_appel.setChecked(True)
        self.initMarchandiseList()
        self.initOrdererClient()
        self.initOrdererFourniss()
        self.initOrdererDate()
        self.initDelivList()

        self.t_deliver_list.itemSelectionChanged.connect(self.itemSelected)
        self.ui.cb_year.currentIndexChanged.connect(self.updateDelivList)
        self.ui.rb_date_appel.toggled.connect(self.updateDelivList)

        self.ui.cb_month.currentIndexChanged.connect(self.updateDelivList)
        self.ui.cb_sort_client.currentIndexChanged.connect(
            self.updateDelivList)
        self.ui.cb_sort_fourniss_2.currentIndexChanged.connect(
            self.updateDelivList)
        self.ui.cb_marchandise.currentIndexChanged.connect(
            self.updateDelivList)
        self.ui.b_reinit_list.clicked.connect(self.reinitSorters)
        self.comm.s_cDB_updated.connect(self.updateSorters)
    def __init__(self, parent=None):
        super(ContractsManager, self).__init__(parent)
        self.ui = Ui_ContractsManager()
        self.ui.setupUi(self)

        #        self.widget = QtUiTools.QUiLoader().load("../interface_GC/accueil.ui")
        #        self.ui = self.widget()

        self.cDB = ContractsDatabase()
        self.comm = self.cDB.communicator
        self.oil_market = Market()

        self.ui.t_ctr_list.deleteLater()
        self.t_ctr_list = MyTreeWidget(self)
        self.t_ctr_list.setObjectName("t_ctr_list")
        self.ui.horizontalLayout.addWidget(self.t_ctr_list)
        self.t_ctr_list.itemSelectionChanged.connect(self.itemSelected)
        self.t_ctr_list.customContextMenuRequested.connect(
            self.customContextMenu)
        self.t_ctr_list.s_dropped_delivery.connect(
            self.loadContractFromDeliveries)
        self.ui.t_ctr_total.setIndentation(0)
        self.initOrdererMarchandise()

        self.ui.cb_marchandise.view().setAlternatingRowColors(True)
        self.ui.cb_sort_client_2.view().setAlternatingRowColors(True)
        self.ui.cb_sort_fourniss.view().setAlternatingRowColors(True)

        self.printer = PDFCreator(self)
        self.printer.setAttribute(QtCore.Qt.WA_StyledBackground)

        self.popMenu = QtGui.QMenu(self)
        self.actionPDF = QtGui.QAction("Voir le contrat PDF", self)
        self.actionPDF.triggered.connect(self.openPdfContract)
        self.actionAddNumberC = QtGui.QAction("Ajouter numero client", self)
        self.actionAddNumberC.triggered.connect(self.setClientNumber)
        self.actionAddNumberF = QtGui.QAction("Ajouter numero fournisseur",
                                              self)
        self.actionAddNumberF.triggered.connect(self.setFournissNumber)
        self.actionAddDelivery = QtGui.QAction("Nouvelle livraison", self)
        self.actionAddDelivery.triggered.connect(self.addDelivery)
        self.actionRemoveCtr = QtGui.QAction("Supprimer le contrat", self)
        self.actionRemoveCtr.triggered.connect(self.removeContract)
        self.actionModifyCtr = QtGui.QAction("Voir/modifier le contrat", self)
        self.actionModifyCtr.triggered.connect(self.modifyContract)
        self.actionAccessToClient = QtGui.QAction("Fiche client", self)
        self.actionAccessToClient.triggered.connect(self.openClientFile)
        self.actionAccessToFournis = QtGui.QAction("Fiche fournisseur", self)
        self.actionAccessToFournis.triggered.connect(self.openFournisFile)
        self.actionPrint = QtGui.QAction("Créer le contrat PDF", self)
        self.actionPrint.triggered.connect(self.printContract)
        self.actionNotes = QtGui.QAction("Notes du contrat", self)
        self.actionNotes.triggered.connect(self.showCtrNotes)

        self.popMenu.addAction(self.actionAddDelivery)
        self.popMenu.addSeparator()
        self.popMenu.addAction(self.actionPDF)
        self.popMenu.addAction(self.actionPrint)
        self.popMenu.addAction(self.actionModifyCtr)
        self.popMenu.addAction(self.actionNotes)
        self.popMenu.addSeparator()
        self.popMenu.addAction(self.actionAccessToClient)
        self.popMenu.addAction(self.actionAccessToFournis)
        self.popMenu.addSeparator()
        self.popMenu.addAction(self.actionAddNumberC)
        self.popMenu.addAction(self.actionAddNumberF)
        self.popMenu.addSeparator()
        self.popMenu.addAction(self.actionRemoveCtr)

        self.initCtrList()
        self.initOrdererClient()
        self.initOrdererFourniss()
        self.updateOrdererYear()

        self.ui.cb_marchandise.currentIndexChanged.connect(self.updateCtrList)
        self.ui.cb_sort_year.currentIndexChanged.connect(self.updateCtrList)
        self.ui.cb_sort_client_2.currentIndexChanged.connect(
            self.updateCtrList)
        self.ui.cb_sort_fourniss.currentIndexChanged.connect(
            self.updateCtrList)

        #        self.comm.s_cDB_updated.connect(self.updateCtrList)
        self.comm.s_cDB_updated.connect(self.updateOrdererYear)
        self.ui.b_reinit_list.clicked.connect(self.reinitSorters)

        self.ui.l_n_client.installEventFilter(self)
        self.ui.l_n_ctr.installEventFilter(self)
        self.ui.l_n_fourniss.installEventFilter(self)
        self.ui.l_n_ctr.returnPressed.connect(self.researchContract)
        self.ui.l_n_client.returnPressed.connect(self.researchContract)
        self.ui.l_n_fourniss.returnPressed.connect(self.researchContract)

        self.ui.b_rechercher.clicked.connect(self.researchContract)
        self.ui.b_rechercher.setEnabled(False)

        self.ui.b_new_contract.clicked.connect(self.newContract)
Exemple #10
0
from classes import Market

z = Market()
z.add_check('iPad')
z.add_check('iPhone')
z.add_check('apple')
z.my_cart()
z.delete_item('iPad')
z.my_cart()