def __init__(self, table_p, buy="", parent=0, *args, **kwargs): # super(BuyShowViewWidget, self).__init__(parent=parent, # *args, **kwargs) QDialog.__init__(self, parent, *args, **kwargs) self.parentWidget().setWindowTitle(Config.APP_NAME + u" CONSULTATION DES ACHAT") self.parent = parent self.buy = buy self.table_p = table_p self.title = "Arivage" vbox = QVBoxLayout() vbox.addWidget(FPageTitle(self.title)) self.table_show = ShowBuyTableWidget(parent=self) editbox = QGridLayout() self.btt_export = BttExportXLSX("") self.btt_export.clicked.connect(self.export_xls) self.button_dl = DeletedBtt(u"Annuler la facture") self.button_dl.released.connect(self.cancellation) editbox.addWidget(FLabel(u"<b>Achat N°: </b>%s" % self.buy.id), 0, 0) editbox.addWidget(FLabel(u"<b>Par : </b> %s " % self.buy.owner), 1, 0) editbox.addWidget( FLabel(u"<b>Date : </b>%s" % (show_date(self.buy.date))), 1, 3) editbox.addWidget(self.button_dl, 0, 4) editbox.addWidget(self.btt_export, 1, 4) vbox.addLayout(editbox) vbox.addWidget(self.table_show) self.setLayout(vbox)
def __init__(self, table_group, parent, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) vbox = QVBoxLayout() vbox.addWidget(FBoxTitle(u"Ajout d'un nouveau groupe")) self.parent = table_group self.name = LineEdit() formbox = QGridLayout() self.error_field = FLabel(u"") formbox.addWidget(self.error_field, 0, 1) formbox.addWidget(FLabel(u"Nom"), 1, 0) formbox.addWidget(self.name, 1, 1) butt = Button(u"Enregistrer") butt.clicked.connect(self.edit_prod) cancel_but = Button(u"Annuler") cancel_but.clicked.connect(self.cancel) formbox.addWidget(butt, 2, 1) formbox.addWidget(cancel_but, 2, 0) formbox.setColumnStretch(3, 3) formbox.setRowStretch(2, 2) vbox.addLayout(formbox) self.setLayout(vbox)
def __init__(self, parent=0, *args, **kwargs): super(DebtsViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.parentWidget().setWindowTitle(Config.NAME_ORGA + u"Gestion des dettes") hbox = QHBoxLayout(self) # self.balace_box = QGridLayout(self) # self.balace_box.addWidget(FLabel(u"Reste à payer :"), 0, 2) # self.balace_box.setRowStretch(1, 2) self.remaining_box = FLabel() self.remaining_box.setMaximumHeight(40) self.table_debt = DebtsTableWidget(parent=self) self.table_provid_clt = ProviderOrClientTableWidget(parent=self) self.search_field = LineEdit() self.search_field.textChanged.connect(self.search) self.search_field.setPlaceholderText(u"Nom ou numéro tel") self.search_field.setMaximumHeight(40) splitter = QSplitter(Qt.Horizontal) self.splitter_left = QSplitter(Qt.Vertical) self.splitter_left.addWidget(self.search_field) self.splitter_left.addWidget(self.table_provid_clt) splt_clt = QSplitter(Qt.Vertical) splt_clt.addWidget(self.remaining_box) splt_clt.addWidget(self.table_debt) splt_clt.resize(900, 1000) splitter.addWidget(self.splitter_left) splitter.addWidget(splt_clt) hbox.addWidget(splitter) self.setLayout(hbox)
def __init__(self, parent, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) vbox = QVBoxLayout() vbox.addWidget(FBoxTitle(u" Configuration ")) self.sttg = LocalSetting.get(LocalSetting.slug == 1) self.baudrate = LineEdit(self.sttg.baudrate) self.code_consultation = LineEdit(self.sttg.code_consultation) self.code_send = LineEdit(self.sttg.code_send) self.code_send.setEchoMode(LineEdit.Password) self.port = LineEdit(self.sttg.port) formbox = QGridLayout() formbox.addWidget(FLabel(u"Mon de passe"), 1, 0) formbox.addWidget(self.baudrate, 1, 1) formbox.addWidget(FLabel(u"Consultation"), 2, 0) formbox.addWidget(self.code_consultation, 2, 1) formbox.addWidget(FLabel(u"Code envoi"), 3, 0) formbox.addWidget(self.code_send, 3, 1) formbox.addWidget(FLabel(u"PORT"), 4, 0) formbox.addWidget(self.port, 4, 1) butt = Button(u"Enregistrer") butt.clicked.connect(self.edit_prod) cancel_but = Button(u"Annuler") cancel_but.clicked.connect(self.cancel) formbox.addWidget(butt, 5, 1) formbox.addWidget(cancel_but, 5, 0) formbox.setColumnStretch(3, 3) formbox.setRowStretch(2, 2) vbox.addLayout(formbox) self.setLayout(vbox)
def activationGroupBox(self): self.topLeftGroupBoxBtt = QGroupBox(self.tr("Nouvelle license")) self.setWindowTitle(u"License") self.parentWidget().setWindowTitle(u"Activation de la license") self.code_field = PyTextViewer( u"""Vous avez besoin du code ci desous pour l'activation:<hr> <b>{code}</b><hr> <h4>Contacts:</h4>{contact}""". format(code=SettingsAdmin().select().get().clean_mac, contact=Constants.TEL_AUT)) self.name_field = LineEdit() self.license_field = QTextEdit() self.pixmap = QPixmap("") self.image = FLabel(self) self.image.setPixmap(self.pixmap) butt = Button_save(u"Enregistrer") butt.clicked.connect(self.add_lience) editbox = QGridLayout() editbox.addWidget(FLabel(u"Nom: "), 0, 0) editbox.addWidget(self.name_field, 0, 1) editbox.addWidget(FLabel(u"License: "), 1, 0) editbox.addWidget(self.license_field, 1, 1) editbox.addWidget(self.code_field, 1, 2) editbox.addWidget(self.image, 5, 1) editbox.addWidget(butt, 6, 1) self.topLeftGroupBoxBtt.setLayout(editbox)
def office_group_box(self): self.organGroupBoxBtt = QGroupBox( self.tr("Configuration des localités")) self.office_box = QComboBox() self.office_box.currentIndexChanged.connect(self.change_select_office) self.office_list = get_offices() self.region_box = QComboBox() self.region_label = FLabel() self.cercle_label = FLabel() self.phone_field = IntLineEdit() self.phone_field.setInputMask('## ## ## ##') self.bp = LineEdit() self.adress_org = QTextEdit() self.email_org = LineEdit() for index, value in enumerate(self.office_list): self.office_box.addItem("{}".format(office_name(value)), value) formbox = QFormLayout() formbox.addRow(FormLabel(u"Nom service :"), self.office_box) formbox.addRow(FormLabel(u"Région"), self.region_label) formbox.addRow(FormLabel(u"Cercle"), self.cercle_label) formbox.addRow(FormLabel(u"Tel :"), self.phone_field) formbox.addRow(FormLabel(u"B.P :"), self.bp) formbox.addRow(FormLabel(u"E-mail :"), self.email_org) formbox.addRow(FormLabel(u"Adresse complete :"), self.adress_org) butt = Button_save(u"Enregistrer") butt.clicked.connect(self.save_edit) formbox.addRow("", butt) self.organGroupBoxBtt.setLayout(formbox)
class GroupViewWidget(QDialog, FWidget): def __init__(self, table_group, parent, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) vbox = QVBoxLayout() vbox.addWidget(FBoxTitle(u"Ajout d'un nouveau groupe")) self.parent = table_group self.name = LineEdit() formbox = QGridLayout() self.error_field = FLabel(u"") formbox.addWidget(self.error_field, 0, 1) formbox.addWidget(FLabel(u"Nom"), 1, 0) formbox.addWidget(self.name, 1, 1) butt = Button(u"Enregistrer") butt.clicked.connect(self.edit_prod) cancel_but = Button(u"Annuler") cancel_but.clicked.connect(self.cancel) formbox.addWidget(butt, 2, 1) formbox.addWidget(cancel_but, 2, 0) formbox.setColumnStretch(3, 3) formbox.setRowStretch(2, 2) vbox.addLayout(formbox) self.setLayout(vbox) def cancel(self): self.close() def isvalid(self): if unicode(self.name.text()) == "": return False def edit_prod(self): self.error_field.setStyleSheet("") name = unicode(self.name.text()) if name == "": self.error_field.setStyleSheet("font-size:20px; color: red") self.error_field.setText(u"Ce champ est obligatoire.") return False group = Group() try: group.name = name group.save() self.cancel() self.parent.table_group.refresh_() except sqlite3.IntegrityError: self.error_field.setStyleSheet("font-size:20px; color: red") self.error_field.setText(u"%s existe déjà" % name)
class DebtsViewWidget(FWidget): """ Shows the home page """ def __init__(self, parent=0, *args, **kwargs): super(DebtsViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.parentWidget().setWindowTitle(Config.NAME_ORGA + u"Gestion des dettes") hbox = QHBoxLayout(self) # self.balace_box = QGridLayout(self) # self.balace_box.addWidget(FLabel(u"Reste à payer :"), 0, 2) # self.balace_box.setRowStretch(1, 2) self.remaining_box = FLabel() self.remaining_box.setMaximumHeight(40) self.table_debt = DebtsTableWidget(parent=self) self.table_provid_clt = ProviderOrClientTableWidget(parent=self) self.search_field = LineEdit() self.search_field.textChanged.connect(self.search) self.search_field.setPlaceholderText(u"Nom ou numéro tel") self.search_field.setMaximumHeight(40) splitter = QSplitter(Qt.Horizontal) self.splitter_left = QSplitter(Qt.Vertical) self.splitter_left.addWidget(self.search_field) self.splitter_left.addWidget(self.table_provid_clt) splt_clt = QSplitter(Qt.Vertical) splt_clt.addWidget(self.remaining_box) splt_clt.addWidget(self.table_debt) splt_clt.resize(900, 1000) splitter.addWidget(self.splitter_left) splitter.addWidget(splt_clt) hbox.addWidget(splitter) self.setLayout(hbox) def search(self): self.table_provid_clt.refresh_(self.search_field.text()) def new_refund(self, provid_clt): from ui.refund_edit_add import RefundEditAddDialog self.parent.open_dialog(RefundEditAddDialog, modal=True, type_=Refund.RB, provid_clt=provid_clt, table_p=self.table_debt)
class InfoTableWidget(FWidget): def __init__(self, parent, *args, **kwargs): super(FWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.refresh() self.details = FLabel() self.edit_ow_but = Button(u"Mettre à jour") self.edit_ow_but.setIcon(QIcon.fromTheme('document-new', QIcon(u"{}edit_user.png".format(Config.img_cmedia)))) self.edit_ow_but.setEnabled(False) self.edit_ow_but.clicked.connect(self.edit_owner) self.formbox = QGridLayout() self.formbox.addWidget(self.details, 0, 0) self.formbox.addWidget(self.edit_ow_but, 0, 1) # self.formbox.ColumnStretch(4, 2) # self.formbox.RowStretch(6, 2) vbox = QVBoxLayout() vbox.addLayout(self.formbox) self.setLayout(vbox) def refresh_(self, owner): self.refresh() self.owner = owner if isinstance(self.owner, int): return self.details.setText( """<h2>Nom: {username}</h2> <h4><b>Active:</b> {isactive}</h4> <h4><b>Numéro tel:</b> {phone}</h4> <h4><b>Dernière login:</b> {last_login}</h4> <h4><b>Nombre de connexion:</b> {login_count}</h4> <h4><b>Groupe:</b> {group}</h4> """.format(group=self.owner.group, login_count=self.owner.login_count, last_login=self.owner.last_login.strftime(u"%c"), phone=self.owner.phone, isactive=self.owner.isactive, username=self.owner.username)) def edit_owner(self): self.parent.parent.open_dialog(NewOrEditUserViewWidget, owner=self.owner, modal=True, pp=self.parent.table_info)
def activationGroupBox(self): self.topLeftGroupBoxBtt = QGroupBox(self.tr("Nouvelle license")) self.setWindowTitle(u"License") self.parentWidget().setWindowTitle(u"Activation de la license") self.code_field = PyTextViewer(u"""Vous avez besoin du code ci desous pour l'activation:<hr> <b>{code}</b><hr> <h4>Contacts:</h4>{contact}""" .format(code=SettingsAdmin().select().get().clean_mac, contact=Constants.TEL_AUT)) self.name_field = LineEdit() self.license_field = QTextEdit() self.pixmap = QPixmap("") self.image = FLabel(self) self.image.setPixmap(self.pixmap) butt = Button_save(u"Enregistrer") butt.clicked.connect(self.add_lience) editbox = QGridLayout() editbox.addWidget(FLabel(u"Nom: "), 0, 0) editbox.addWidget(self.name_field, 0, 1) editbox.addWidget(FLabel(u"License: "), 1, 0) editbox.addWidget(self.license_field, 1, 1) editbox.addWidget(self.code_field, 1, 2) editbox.addWidget(self.image, 5, 1) editbox.addWidget(butt, 6, 1) self.topLeftGroupBoxBtt.setLayout(editbox)
def __init__(self, table_group, parent, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) self.parent = table_group group_id = self.parent.table_group.group.group_id self.group = Group.select().where(Group.id == group_id).get() vbox = QVBoxLayout() vbox.addWidget( FBoxTitle(u"<h3>Groupe: {}</h3>".format(self.group.name))) self.order_number = LineEdit() # form transfer self.amount = LineEdit() self.amount.setFont(QFont("Arial", 15)) self.amount.setValidator(QIntValidator()) self.amount.setToolTip(u"Taper le montant du transfert") # self.solde = FLabel(get_solde()) self.amount_error = ErrorLabel(u"") send_butt = Button(u"Envoyer") send_butt.clicked.connect(self.sender) cancel_but = Button(u"Annuler") cancel_but.clicked.connect(self.cancel) formbox = QGridLayout() formbox.addWidget(FLabel(u"Montant: "), 0, 0) formbox.addWidget(self.amount, 0, 1) formbox.addWidget(send_butt, 2, 1) formbox.addWidget(cancel_but, 2, 0) vbox.addLayout(formbox) self.setLayout(vbox)
def __init__(self, parent=0, *args, **kwargs): super(PeriodByViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.title = FPageTitle(_(u"Periodic report")) self.on_date = FormatDate(QDate(date.today().year, 1, 1)) self.end_date = FormatDate(QDate.currentDate()) self.Button = Button(u"OK") self.Button.clicked.connect(self.rapport_filter) self.current_period = FLabel( self.format_period(self.on_date.text(), self.end_date.text())) vbox = QVBoxLayout() # Grid gridbox = QGridLayout() gridbox.addWidget(FormLabel(u"Date debut"), 0, 0) gridbox.addWidget(self.on_date, 0, 1) gridbox.addWidget(FormLabel(u"Date fin"), 1, 0) gridbox.addWidget(self.end_date, 1, 1) gridbox.addWidget(self.Button, 1, 2) gridbox.setColumnStretch(3, 1) gridbox.addWidget(self.current_period, 1, 4) self.table = By_periodTableWidget(parent=self) vbox.addWidget(self.title) vbox.addLayout(gridbox) vbox.addWidget(self.table) self.setLayout(vbox)
def __init__(self, table_p, obj, parent, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) self.setWindowTitle(u"Confirmation de le suppression") self.title = FPageTitle(u"Voulez vous vraiment le supprimer?") self.obj = obj self.table_p = table_p self.parent = parent # self.title.setAlignment(Qt.AlignHCenter) title_hbox = QHBoxLayout() title_hbox.addWidget(self.title) report_hbox = QGridLayout() report_hbox.addWidget(FLabel(obj.display_name()), 0, 0) # delete and cancel hbox Button_hbox = QHBoxLayout() # Delete Button widget. delete_but = Button(u"Supprimer") Button_hbox.addWidget(delete_but) delete_but.clicked.connect(self.delete) # Cancel Button widget. cancel_but = Button(u"Annuler") Button_hbox.addWidget(cancel_but) cancel_but.clicked.connect(self.cancel) # Create the QVBoxLayout contenaire. vbox = QVBoxLayout() vbox.addLayout(title_hbox) vbox.addLayout(report_hbox) vbox.addLayout(Button_hbox) self.setLayout(vbox)
def createHomeGroupBox(self): self.homegbox = QGroupBox() self.table = OperationTableWidget(parent=self) table_box = QVBoxLayout() self.title_table = FPageTitle(u"Historique des transferts") table_box.addWidget(self.title_table) table_box.addWidget(self.table) # form transfer self.number = LineEdit() self.number.setInputMask("D9.99.99.99") self.number.setAlignment(Qt.AlignCenter) self.number.setFont(QFont("Arial", 17)) self.number.setToolTip(u"""Taper le nom ou le numéro de téléphone du beneficiare""") self.amount = LineEdit() self.amount.setFont(QFont("Arial", 15)) self.amount.setValidator(QIntValidator()) self.amount.setToolTip(u"Taper le montant du transfert") self.password_field = EnterTabbedLineEdit() self.password_field.setFont(QFont("Arial", 15)) self.password_field.setEchoMode(LineEdit.Password) self.password_field.setToolTip(u"Taper le code orange money") self.msg_field = FLabel("") butt = Button(u"Envoyer") butt.clicked.connect(self.get_or_creat_nbr) formbox = QGridLayout() formbox.addWidget(FLabel(u"Numéro"), 0, 0) formbox.addWidget(self.number, 1, 0) formbox.addWidget(FLabel(u"Montant"), 0, 1) formbox.addWidget(self.amount, 1, 1) formbox.addWidget(FLabel(u"code"), 0, 2) formbox.addWidget(self.password_field, 1, 2) formbox.addWidget(self.msg_field, 0, 5) formbox.addWidget(butt, 1, 4) formbox.setColumnStretch(5, 3) transfer_box = QVBoxLayout() # formbox.setSizeConstraint(QLayout.SetFixedSize) transfer_box.addWidget(self.title) transfer_box.addLayout(formbox) transfer_box.addLayout(table_box) # self.setLayout(transfer_box) self.homegbox.setLayout(transfer_box)
def __init__(self, table_p, invoice_num, parent=0, *args, **kwargs): # super(ShowInvoiceViewWidget, self).__init__( # parent=parent, *args, **kwargs) QDialog.__init__(self, parent, *args, **kwargs) self.invoice = Invoice.get(number=invoice_num) self.parentWidget().setWindowTitle( "{} {}".format(Config.APP_NAME, "CONSULTATION DE FACTURE")) self.parent = parent self.table_p = table_p vbox = QVBoxLayout() self.title = self.invoice.type_ self.table_show = ShowOrderTableWidget(parent=self) editbox = QGridLayout() xls_bicon = QIcon.fromTheme( 'document-del', QIcon(u"{}xls.png".format(Config.img_cmedia))) pdf_icon = QIcon.fromTheme( 'document-del', QIcon(u"{}pdf.png".format(Config.img_cmedia))) self.button_pdf = QPushButton(pdf_icon, u"") self.button_pdf.setFixedWidth(30) self.button_pdf.setFixedHeight(30) self.button_xls = QPushButton(xls_bicon, u"") self.button_xls.setFixedWidth(30) self.button_xls.setFixedHeight(30) self.button_pdf.released.connect(self.printer_pdf) self.button_xls.released.connect(self.export_xls) self.button_dl = DeletedBtt(u"Annuler la facture") self.button_dl.released.connect(self.cancellation) editbox.addWidget(FLabel(u"{typ} N°: {num}".format( num=self.invoice.number, typ=self.invoice.type_)), 0, 0) editbox.addWidget(FLabel(u"%s le %s" % ( self.invoice.location, show_date(self.invoice.date))), 1, 4) editbox.addWidget(FLabel(u"Doit: %s " % self.invoice.client), 1, 0) editbox.addWidget(self.button_pdf, 1, 5) editbox.addWidget(self.button_dl, 0, 4) editbox.addWidget(self.button_xls, 1, 6) vbox.addLayout(editbox) vbox.addWidget(self.table_show) self.setLayout(vbox)
def __init__(self, parent, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) vbox = QVBoxLayout() vbox.addWidget(FBoxTitle(u"<h3>Ajout de contact </h3>")) self.combo_grp = QComboBox() groups = Group() groups.name = "Aucun" self.list_grp = Group.all() self.list_grp.append(groups) self.list_grp.reverse() for index in self.list_grp: sentence = u"%(name)s" % {'name': index.name} self.combo_grp.addItem(sentence) self.full_name = LineEdit() self.msg_e_or_c = FLabel("") self.full_name.setFont(QFont("Arial", 16)) self.phone_number = IntLineEdit() self.phone_number.setInputMask("D9.99.99.99") self.phone_number.setAlignment(Qt.AlignCenter) self.phone_number.setFont(QFont("Arial", 16)) send_butt = Button(u"Enregistrer") send_butt.clicked.connect(self.save_form) cancel_but = Button(u"Fermer") cancel_but.clicked.connect(self.cancel) formbox = QGridLayout() formbox.addWidget(FLabel(u"Groupes:"), 0, 0) formbox.addWidget(self.combo_grp, 1, 0) formbox.addWidget(FLabel(u"Nom complèt: "), 0, 1) formbox.addWidget(self.full_name, 1, 1) formbox.addWidget(FLabel(u"Numéro: "), 0, 2) formbox.addWidget(self.phone_number, 1, 2) formbox.addWidget(send_butt, 2, 1) formbox.addWidget(cancel_but, 2, 0) formbox.addWidget(self.msg_e_or_c, 3, 0, 3, 2) vbox.addLayout(formbox) self.setLayout(vbox)
def __init__(self, parent, *args, **kwargs): super(FWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.refresh() self.info_box = FLabel(" ") self.image = FLabel(" ") self.image_btt = BttSmall("Zoom") self.image_btt.setFlat(True) self.image_btt.clicked.connect(self.show_image) hbox = QHBoxLayout() gridbox = QGridLayout() gridbox.addWidget(self.info_box, 0, 0) gridbox.addWidget(self.image, 1, 0) gridbox.addWidget(self.image_btt, 1, 1) hbox.addLayout(gridbox) self.setLayout(hbox)
def __init__(self, table_group, parent, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) self.parent = table_group group_id = self.parent.table_group.group.group_id self.group = Group.select().where(Group.id == group_id).get() vbox = QVBoxLayout() vbox.addWidget( FBoxTitle( u"<h2>Envoi pour les ({0}) contactes du groupe <b>{1}</b></h2>" .format(len(self.group.contacts), self.group.name))) # form transfer self.amount = LineEdit() self.amount.setFont(QFont("Arial", 15)) self.amount.setValidator(QIntValidator()) self.amount.setToolTip(u"Taper le montant du transfert") self.amount_error = ErrorLabel(u"") self.password_field = EnterTabbedLineEdit() self.password_field.setEchoMode(LineEdit.Password) self.password_field.setToolTip(u"Taper le code orange money") self.send_butt = Button(u"Envoyer") self.send_butt.clicked.connect(self.sender) cancel_but = Button(u"Annuler") cancel_but.clicked.connect(self.cancel) formbox = QGridLayout() formbox.addWidget(FLabel(u"Montant: "), 0, 0) formbox.addWidget(self.amount, 0, 1) formbox.addWidget(FLabel(u"Code: "), 1, 0) formbox.addWidget(self.password_field, 1, 1) formbox.addWidget(self.send_butt, 2, 1) formbox.addWidget(cancel_but, 2, 0) self.isvalid() vbox.addLayout(formbox) self.setLayout(vbox)
def __init__(self, parent, dmd=None, *args, **kwargs): super(ImmatriculationSCoopViewWidget, self).__init__( parent=parent, *args, **kwargs) self.parent = parent self.parentWidget().set_window_title("FORMULAIRE D’IMMATRICULATION") self.dmd = dmd self.scoop = self.dmd.scoop self.name_declarant_field = QLineEdit() self.name_declarant_field.setPlaceholderText("M. / Mme") self.name_declarant_field.setMaximumWidth(600) self.procuration_field = QLineEdit() self.procuration_field.setPlaceholderText( "Réf.de la Procuration le cas échéant") self.procuration_field.setMaximumWidth(600) self.quality_box = QComboBox() self.quality_box.setMaximumWidth(600) self.quality_box.currentIndexChanged.connect(self.change_select) self.qualities_list = get_qualities() for index, value in enumerate(self.qualities_list): self.quality_box.addItem( "{}".format(self.qualities_list.get(value).upper()), value) self.type_box = QComboBox() self.type_box.setMaximumWidth(600) self.type_lists = Immatriculation.TYPES for index, value in enumerate(self.type_lists): print(value) self.type_box.addItem("{}".format(value[1], index)) self.tel_declarant_field = IntLineEdit() self.tel_declarant_field.setInputMask('## ## ## ##') self.tel_declarant_field.setMaximumWidth(600) self.btn = Button_save("Sauvegarder") self.btn.setMaximumWidth(600) self.btn.clicked.connect(self.save) declarant_formbox = QFormLayout() declarant_formbox.addRow(FLabel("<strong>Type de d'immatriculation *: </strong>"), self.type_box) declarant_formbox.addRow(FLabel("<strong>Nom et prénom du declarant *: </strong>"), self.name_declarant_field) declarant_formbox.addRow(FLabel("<strong>En qualité de *: </strong>"), self.quality_box) declarant_formbox.addRow(FLabel("<strong>Procuration *: </strong>"), self.procuration_field) declarant_formbox.addRow(FLabel("<strong>Numéro tel. du declarant *: </strong>"), self.tel_declarant_field) declarant_formbox.addRow(FLabel(""), self.btn) self.declarantGroupBox = QGroupBox("Info. du déclarant de la {} *".format(self.scoop.denomination)) self.declarantGroupBox.setStyleSheet(CSS_CENTER) self.declarantGroupBox.setLayout(declarant_formbox) vbox = QVBoxLayout() # vbox.addWidget(self.infoGroupBox) vbox.addWidget(self.declarantGroupBox) # vbox.addLayout(editbox) self.setLayout(vbox)
def __init__(self, parent, *args, **kwargs): super(FWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.refresh() self.details = FLabel() self.edit_ow_but = Button(u"Mettre à jour") self.edit_ow_but.setIcon(QIcon.fromTheme('document-new', QIcon(u"{}edit_user.png".format(Config.img_cmedia)))) self.edit_ow_but.setEnabled(False) self.edit_ow_but.clicked.connect(self.edit_owner) self.formbox = QGridLayout() self.formbox.addWidget(self.details, 0, 0) self.formbox.addWidget(self.edit_ow_but, 0, 1) # self.formbox.ColumnStretch(4, 2) # self.formbox.RowStretch(6, 2) vbox = QVBoxLayout() vbox.addLayout(self.formbox) self.setLayout(vbox)
class HomeViewWidget(FWidget): """ Shows the home page """ def __init__(self, parent=0, *args, **kwargs): super(HomeViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.parentWidget().setWindowTitle(u"Bienvenu sur transfert Wari") self.title = FPageTitle(u"Tranfert") vbox = QVBoxLayout(self) vbox.addWidget(self.title) self.sttg = SettingsAdmin().select().where(SettingsAdmin.id == 1).get() if self.sttg.can_use: self.createHomeGroupBox() vbox.addWidget(self.homegbox) else: self.activationGroupBox() vbox.addWidget(self.topLeftGroupBoxBtt) self.setLayout(vbox) def createHomeGroupBox(self): self.homegbox = QGroupBox() self.table = OperationTableWidget(parent=self) table_box = QVBoxLayout() self.title_table = FPageTitle(u"Historique des transferts") table_box.addWidget(self.title_table) table_box.addWidget(self.table) # form transfer self.number = LineEdit() self.number.setInputMask("D9.99.99.99") self.number.setAlignment(Qt.AlignCenter) self.number.setFont(QFont("Arial", 17)) self.number.setToolTip(u"""Taper le nom ou le numéro de téléphone du beneficiare""") self.amount = LineEdit() self.amount.setFont(QFont("Arial", 15)) self.amount.setValidator(QIntValidator()) self.amount.setToolTip(u"Taper le montant du transfert") self.password_field = EnterTabbedLineEdit() self.password_field.setFont(QFont("Arial", 15)) self.password_field.setEchoMode(LineEdit.Password) self.password_field.setToolTip(u"Taper le code orange money") self.msg_field = FLabel("") butt = Button(u"Envoyer") butt.clicked.connect(self.get_or_creat_nbr) formbox = QGridLayout() formbox.addWidget(FLabel(u"Numéro"), 0, 0) formbox.addWidget(self.number, 1, 0) formbox.addWidget(FLabel(u"Montant"), 0, 1) formbox.addWidget(self.amount, 1, 1) formbox.addWidget(FLabel(u"code"), 0, 2) formbox.addWidget(self.password_field, 1, 2) formbox.addWidget(self.msg_field, 0, 5) formbox.addWidget(butt, 1, 4) formbox.setColumnStretch(5, 3) transfer_box = QVBoxLayout() # formbox.setSizeConstraint(QLayout.SetFixedSize) transfer_box.addWidget(self.title) transfer_box.addLayout(formbox) transfer_box.addLayout(table_box) # self.setLayout(transfer_box) self.homegbox.setLayout(transfer_box) def activationGroupBox(self): self.topLeftGroupBoxBtt = QGroupBox(self.tr("Nouvelle license")) self.setWindowTitle(u"License") self.parentWidget().setWindowTitle(u"Activation de la license") self.code_field = PyTextViewer( u"""Vous avez besoin du code ci desous pour l'activation:<hr> <b>{code}</b><hr> <h4>Contacts:</h4>{contact}""". format(code=SettingsAdmin().select().get().clean_mac, contact=Constants.TEL_AUT)) self.name_field = LineEdit() self.license_field = QTextEdit() self.pixmap = QPixmap("") self.image = FLabel(self) self.image.setPixmap(self.pixmap) butt = Button_save(u"Enregistrer") butt.clicked.connect(self.add_lience) editbox = QGridLayout() editbox.addWidget(FLabel(u"Nom: "), 0, 0) editbox.addWidget(self.name_field, 0, 1) editbox.addWidget(FLabel(u"License: "), 1, 0) editbox.addWidget(self.license_field, 1, 1) editbox.addWidget(self.code_field, 1, 2) editbox.addWidget(self.image, 5, 1) editbox.addWidget(butt, 6, 1) self.topLeftGroupBoxBtt.setLayout(editbox) def get_or_creat_nbr(self): ''' add operation ''' if not self.is_complete(): return number = unicode(self.number.text().replace('.', '')) amount = unicode(self.amount.text()) Contact.get_or_create(number) data = { "phone_num": [ number, ], "amount": amount, "code": unicode(self.password_field.text()) } # print(data) # multiple_sender(data) self.number.clear() self.amount.clear() self.password_field.clear() self.table.refresh_() self.msg_field.setText( u"Transfert vers ({}) a été effectué.".format(number)) self.msg_field.setStyleSheet("color: green") def is_complete(self): self.amount.setStyleSheet("") self.password_field.setStyleSheet("") if unicode(self.amount.text()) == "": self.amount.setStyleSheet("font-size:20px; color: red") self.amount.setText(u"Ce champ est obligatoire.") return False if unicode(self.password_field.text()) == "": self.password_field.setStyleSheet("font-size:20px; color: red") self.password_field.setText(u"Ce champ est obligatoire.") return False return True def check_license(self, license): self.flog = False if (SettingsAdmin().is_valide_mac(license)): self.pixmap = QPixmap(u"{}accept.png".format(Constants.img_cmedia)) self.image.setToolTip("License correct") self.flog = True else: self.pixmap = QPixmap(u"{}decline.png".format( Constants.img_cmedia)) self.image.setToolTip("License incorrect") self.image.setPixmap(self.pixmap) def add_lience(self): """ add User """ name = unicode(self.name_field.text()).strip() license = unicode(self.license_field.toPlainText()) self.check_license(license) if self.flog: sttg = self.sttg sttg.user = name sttg.license = license sttg.save() raise_success( u"Confirmation", u"""La license (<b>{}</b>) à éte bien enregistré pour cette machine.\n Elle doit être bien gardé""".format(license)) self.goto_archi()
class ContactNewViewWidget(QDialog, FWidget): def __init__(self, parent, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) vbox = QVBoxLayout() vbox.addWidget(FBoxTitle(u"<h3>Ajout de contact </h3>")) self.combo_grp = QComboBox() groups = Group() groups.name = "Aucun" self.list_grp = Group.all() self.list_grp.append(groups) self.list_grp.reverse() for index in self.list_grp: sentence = u"%(name)s" % {'name': index.name} self.combo_grp.addItem(sentence) self.full_name = LineEdit() self.msg_e_or_c = FLabel("") self.full_name.setFont(QFont("Arial", 16)) self.phone_number = IntLineEdit() self.phone_number.setInputMask("D9.99.99.99") self.phone_number.setAlignment(Qt.AlignCenter) self.phone_number.setFont(QFont("Arial", 16)) send_butt = Button(u"Enregistrer") send_butt.clicked.connect(self.save_form) cancel_but = Button(u"Fermer") cancel_but.clicked.connect(self.cancel) formbox = QGridLayout() formbox.addWidget(FLabel(u"Groupes:"), 0, 0) formbox.addWidget(self.combo_grp, 1, 0) formbox.addWidget(FLabel(u"Nom complèt: "), 0, 1) formbox.addWidget(self.full_name, 1, 1) formbox.addWidget(FLabel(u"Numéro: "), 0, 2) formbox.addWidget(self.phone_number, 1, 2) formbox.addWidget(send_butt, 2, 1) formbox.addWidget(cancel_but, 2, 0) formbox.addWidget(self.msg_e_or_c, 3, 0, 3, 2) vbox.addLayout(formbox) self.setLayout(vbox) def cancel(self): self.close() def iscomplet(self): self.phone_number.setStyleSheet("") self.msg_e_or_c.setText("") self.msg_e_or_c.setStyleSheet("") try: int(self.phone_number.text().replace('.', '')) except: self.phone_number.setStyleSheet("border-bottom: 3px solid red;" "background-color:#AFAFAF;") self.phone_number.setToolTip(u"Ce champ est obligatoire.") return False return True def save_form(self): if not self.iscomplet(): return full_name = unicode(self.full_name.text()) phone_number = int(self.phone_number.text().replace('.', '')) try: Contact(number=phone_number, name=full_name).save() except: self.msg_e_or_c.setText(u"Ce numéro existe déjà") self.msg_e_or_c.setStyleSheet("color: red") return grp = unicode(self.list_grp[self.combo_grp.currentIndex()]) if not grp == "Aucun": grp = Group.select().where(Group.name == grp).get() contact = Contact.select().where(Contact.number == phone_number).get() ContactGroup(group=grp.id, contact=contact).save() self.full_name.setText("") self.phone_number.setText("") self.msg_e_or_c.setText(u"Le numéro (<b>{}</b>) à éte bien enregistré" .format(phone_number))
def __init__(self, product="", parent=0, *args, **kwargs): super(InvoiceViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parentWidget().setWindowTitle(Config.APP_NAME + u" Ventes") self.parent = parent vbox = QVBoxLayout() # hbox = QHBoxLayout(self) editbox = QGridLayout() try: next_number = int(Invoice.select().order_by( Invoice.number.desc()).get().number) + 1 except: next_number = 1 self.num_invoice = IntLineEdit(str(next_number)) self.num_invoice.setToolTip(u"Le numéro") self.num_invoice.setMaximumSize( 40, self.num_invoice.maximumSize().height()) self.invoice_date = FormatDate(QDate.currentDate()) # self.name_client_field = LineEdit() self.string_list = [""] + [ "{},{}".format(clt.name, clt.phone) for clt in ProviderOrClient.select().where( ProviderOrClient.type_ == ProviderOrClient.CLT).order_by( ProviderOrClient.name.desc()) ] # self.name_client_field_new = "" self.name_client_field = ExtendedComboBox() self.name_client_field.addItems(self.string_list) self.name_client_field.setMaximumSize( 200, self.name_client_field.maximumSize().height()) self.name_client_field.setToolTip("Nom, numero du client") self.add_clt_btt = BttSmall(u"+") self.add_clt_btt.clicked.connect(self.add_clt) self.add_clt_btt.setFixedWidth(50) # Combobox widget for add store self.liste_type_invoice = [ Invoice.TYPE_FACT, Invoice.TYPE_BON, Invoice.TYPE_PROF ] self.box_type_inv = QComboBox() for index in range(0, len(self.liste_type_invoice)): op = self.liste_type_invoice[index] sentence = u"%(name)s" % {'name': op} self.box_type_inv.addItem(sentence, op) self.search_field = LineEdit() self.search_field.setPlaceholderText("Rechercher un article") self.search_field.textChanged.connect(self.finder) # self.search_field.setFixedWidth(250) self.search_field.setMaximumHeight(40) self.table_invoice = InvoiceTableWidget(parent=self) self.table_resultat = ResultatTableWidget(parent=self) self.table_info = InfoTableWidget(parent=self) self.table_resultat.refresh_("") editbox.addWidget(self.box_type_inv, 0, 2) editbox.addWidget(self.num_invoice, 0, 3) editbox.addWidget(FLabel(u"Doit :"), 1, 2) editbox.addWidget(self.name_client_field, 1, 3) # editbox.addWidget(self.add_clt_btt, 1, 4) editbox.addWidget(self.invoice_date, 0, 6) editbox.setColumnStretch(0, 1) editbox.setColumnStretch(5, 1) splitter = QSplitter(Qt.Horizontal) splitter_left = QSplitter(Qt.Vertical) splitter_left.addWidget(self.search_field) splitter_left.addWidget(self.table_resultat) # splitter_down.resize(15, 20) splitter_down = QSplitter(Qt.Vertical) splitter_down.addWidget(self.table_info) splitter_rigth = QSplitter(Qt.Vertical) # splitter_rigth.setLayout(editbox) splitter_rigth.addWidget(self.table_invoice) splitter_rigth.resize(800, 900) splitter_left.addWidget(splitter_down) splitter.addWidget(splitter_left) splitter.addWidget(splitter_rigth) vbox.addLayout(editbox) vbox.addWidget(splitter) self.setLayout(vbox)
def __init__(self, parent=0, dmd=None, *args, **kwargs): super(CheckListViewWidget, self).__init__( parent=parent, *args, **kwargs) self.parent = parent self.dmd = dmd self.check_list = self.dmd.check_list self.parentWidget().set_window_title("Check-list") row = 0 self.piecesGroupBox = QGroupBox("") # self.piecesGroupBox.setStyleSheet("color: gray; background:#fff") pieces_v_gribox = QGridLayout() css = "font-size:26px;border: 3px solid #000;background: black;color: white;" pieces_v_gribox.addWidget(FHeader( "I. Pièces à vérifier (au dépôt)", css), row, 0, 1, 6) row += 1 self.qualite_declarant_check = self.check_box(QCheckBox()) self.qualite_declarant_check.setChecked( self.check_list.qualite_declarant_check) pieces_v_gribox.addWidget(FRLabel( "Qualité du déclarant (Président, mandataire ou auxiliaire de Justice) "), row, 0) pieces_v_gribox.addWidget(self.qualite_declarant_check, row, 1) # row += 1 self.status_check = self.check_box(QCheckBox("(4)")) self.status_check.setChecked(self.check_list.status_check) pieces_v_gribox.addWidget(FRLabel("Statuts "), row, 2) pieces_v_gribox.addWidget(self.status_check, row, 3) self.pieces_check = self.check_box(QCheckBox("(4)")) self.pieces_check.setChecked(self.check_list.pieces_check) pieces_v_gribox.addWidget( FRLabel("Règlement Intérieur "), row, 4) pieces_v_gribox.addWidget(self.pieces_check, row, 5) row += 1 self.autorisation_pre_immt_check = self.check_box(QCheckBox()) self.autorisation_pre_immt_check.setChecked( self.check_list.autorisation_pre_immt_check) pieces_v_gribox.addWidget(FRLabel( "Autorisations préalables pour les activités réglementées "), row, 0) pieces_v_gribox.addWidget(self.autorisation_pre_immt_check, row, 1) self.demande_immt_check = self.check_box(QCheckBox("(2)")) self.demande_immt_check.setChecked(self.check_list.demande_immt_check) pieces_v_gribox.addWidget( FRLabel("Demande d’Immatriculation "), row, 2) pieces_v_gribox.addWidget(self.demande_immt_check, row, 3) self.pv_check = self.check_box(QCheckBox("(4)")) self.pv_check.setChecked(self.check_list.pv_check) pieces_v_gribox.addWidget(FRLabel("PV "), row, 4) pieces_v_gribox.addWidget(self.pv_check, row, 5) row = 0 pieces_gribox = QGridLayout() self.chronologique_check = self.check_box(QCheckBox()) self.chronologique_check.setChecked( self.check_list.chronologique_check) pieces_gribox.addWidget(FLabel( "Vérifier l’existence du registre des membres tenu par ordre chronologique "), row, 0) pieces_gribox.addWidget(self.chronologique_check, row, 1) pieces_gribox.addWidget(FHeader( "SCOOPS Art 235 et 236 COOP-CA Art 320, 321, 322 et 323", "font-size:15px"), row, 2) row += 1 self.compte_check = self.check_box(QCheckBox()) self.compte_check.setChecked(self.check_list.compte_check) pieces_gribox.addWidget(FLabel( "Vérifier l’existence d’un compte bancaire / Institution de Micro Finance"), row, 0) pieces_gribox.addWidget(self.compte_check, row, 1) pieces_gribox.addWidget(FHeader( "Art 213", "font-size:15px"), row, 2) row += 1 self.dispositions_check = self.check_box(QCheckBox()) self.dispositions_check.setChecked(self.check_list.dispositions_check) pieces_gribox.addWidget(FLabel( "Vérifier le respect des dispositions sur le non cumul des mandats"), row, 0) pieces_gribox.addWidget(self.dispositions_check, row, 1) pieces_gribox.addWidget(FHeader( "Art 300 et 326", "font-size:15px"), row, 2) row += 1 self.pv_delib_ca_check = self.check_box(QCheckBox()) self.pv_delib_ca_check.setChecked(self.check_list.pv_delib_ca_check) pieces_gribox.addWidget(FLabel( "Vérifier l’existence du registre des procès- verbaux de délibération du CA <br/> des COOP-CA coté et paraphé par le tribunal civil compétent"), row, 0) pieces_gribox.addWidget(self.pv_delib_ca_check, row, 1) pieces_gribox.addWidget(FHeader( "Art : 235, (d’ordre général) et COOP-CA 320", "font-size:15px"), row, 2) pieces_gribox.setColumnStretch(row, 2) row = 0 mentions_gribox = QGridLayout() mentions_gribox.addWidget(FHeader( " II. Mentions à vérifier dans les Statuts et le Règlement Intérieur", css), row, 0, 1, 4) row += 1 css = "color:blue;font-size:26px;border: 1px solid #000;background: black;color: white;" mentions_gribox.addWidget(FHeader("Mentions", css=css), row, 0) mentions_gribox.addWidget( FHeader("N° Art des Statuts", css=css), row, 1) mentions_gribox.addWidget(FHeader("N° Art du R.I", css=css), row, 2) mentions_gribox.addWidget( FHeader("Référence OHADA", css=css), row, 3) row += 1 self.forme_scoop_status_field = IntLineEdit(self.rest_d( self.check_list.forme_scoop_status)) self.forme_scoop_ri_field = IntLineEdit(self.rest_d( self.check_list.forme_scoop_ri)) self.add_element(mentions_gribox, row, "<b>01.</b> La forme de la société coopérative", self.forme_scoop_status_field, self.forme_scoop_ri_field, "Art 204 ,215 et 216 Pour la SCOOPS / Art 267 et de 271 à 290 Pour la COOP-CA") row += 1 self.denomination_status_field = IntLineEdit(self.rest_d( self.check_list.denomination_status)) self.denomination_ri_field = IntLineEdit(self.rest_d( self.check_list.denomination_ri)) self.add_element(mentions_gribox, row, "<b>02.</b> Sa dénomination suivie, le cas échéant, de son sigle", self.denomination_status_field, self.denomination_ri_field, "Art 19 et Art 205 Pour la SCOOPS<br/> Art 19 et 205 Pour COOP-CA") row += 1 self.nature_domaine_status_field = IntLineEdit(self.rest_d( self.check_list.nature_domaine_status)) self.nature_domaine_ri_field = IntLineEdit(self.rest_d( self.check_list.nature_domaine_ri)) self.add_element(mentions_gribox, row, "<b>03.</b> La nature et le domaine de son activité et qui forment son objet social", self.nature_domaine_status_field, self.nature_domaine_ri_field, "Art 5, Art 20 et 21 Pour toutes les formes<br/> de Sociétés Coopératives") row += 1 self.duree_status_field = IntLineEdit(self.rest_d( self.check_list.duree_status)) self.duree_ri_field = IntLineEdit(self.rest_d( self.check_list.duree_ri)) self.add_element(mentions_gribox, row, "<b>04.</b> Son siège et sa durée", self.duree_status_field, self.duree_ri_field, "Pour le Siège : Art 22 ,23 et 24 et Pour<br/> la Durée : Art 25, 26, 27et 28") row += 1 self.lien_commun_status_field = IntLineEdit(self.rest_d( self.check_list.lien_commun_status)) self.lien_commun_ri_field = IntLineEdit(self.rest_d( self.check_list.lien_commun_ri)) self.add_element(mentions_gribox, row, "<b>05.</b> Le lien commun qui réunit les membres,", self.lien_commun_status_field, self.lien_commun_ri_field, "Art 8") row += 1 self.coord_initiateur_status_field = IntLineEdit(self.rest_d( self.check_list.coord_initiateur_status)) self.coord_initiateur_ri_field = IntLineEdit(self.rest_d( self.check_list.coord_initiateur_ri)) self.add_element(mentions_gribox, row, "<b>06.</b> Les noms, prénoms et adresse résidentielle de chaque initiateur", self.coord_initiateur_status_field, self.coord_initiateur_ri_field, "Art 87") row += 1 self.max_min_admin_cg_status_field = IntLineEdit(self.rest_d( self.check_list.max_min_admin_cg_status)) self.max_min_admin_cg_ri_field = IntLineEdit(self.rest_d( self.check_list.max_min_admin_cg_ri)) self.add_element(mentions_gribox, row, "<b>07. a.</b> Le nombre précis ou les nombres minimal et maximal de ses administrateurs <br/> ou membres du comité de gestion</p>", self.max_min_admin_cg_status_field, self.max_min_admin_cg_ri_field, "Art 204 et Art 223 Pour la SCOOPS : <br/> (Effectif : 5 Pers au mini : CG=3 au plus si adh de 5 à 99 et CG = 5 si adh de 100 et +.") row += 1 self.max_min_admin_ca_status_field = IntLineEdit(self.rest_d( self.check_list.max_min_admin_ca_status)) self.max_min_admin_ca_ri_field = IntLineEdit(self.rest_d( self.check_list.max_min_admin_ca_ri)) self.add_element(mentions_gribox, row, "<b>07. b.</b> Le nombre précis ou les nombres minimal et maximal de ses <br/> administrateurs ou membres du Conseil d’Administration;", self.max_min_admin_ca_status_field, self.max_min_admin_ca_ri_field, "Art 207 et Art 223 Pour la COOP-CA: (Effectif : 15 Pers au mini : CA=3 au moins et 12 au plus.") row += 1 self.dispositions_cg_status_field = IntLineEdit(self.rest_d( self.check_list.dispositions_cg_status)) self.dispositions_cg_ri_field = IntLineEdit(self.rest_d( self.check_list.dispositions_cg_ri)) self.add_element(mentions_gribox, row, "<b>07. c.</b> Les dispositions portant limitation des pouvoirs des <br/> administrateurs ou membres du comité de gestion", self.dispositions_cg_status_field, self.dispositions_cg_ri_field, "Art 224 à Art 230 Pour la SCOOPS") row += 1 self.dispositions_ca_status_field = IntLineEdit(self.rest_d( self.check_list.dispositions_ca_status)) self.dispositions_ca_ri_field = IntLineEdit(self.rest_d( self.check_list.dispositions_ca_ri)) self.add_element(mentions_gribox, row, "<b>07. d.</b> Les dispositions portant limitation des pouvoirs des administrateurs ou <br/>membres du Conseil d’Administration", self.dispositions_ca_status_field, self.dispositions_ca_ri_field, "Art 296 à Art 307 Pour la COOP-CA et autres pouvoirs de l’Art 314 à l’Art 333") row += 1 self.max_min_cs_s_status_field = IntLineEdit(self.rest_d( self.check_list.max_min_cs_s_status)) self.max_min_cs_s_ri_field = IntLineEdit(self.rest_d( self.check_list.max_min_cs_s_ri)) self.add_element(mentions_gribox, row, "<b>08.</b> Le nombre précis ou les nombres minimal et maximal des membres de la <br/>Commission de Surveillance", self.max_min_cs_s_status_field, self.max_min_cs_s_ri_field, "Art 258 Pour la SCOOPS (de 3 à 5 Pers)") row += 1 self.max_min_cs_ca_status_field = IntLineEdit(self.rest_d( self.check_list.max_min_cs_ca_status)) self.max_min_cs_ca_ri_field = IntLineEdit(self.rest_d( self.check_list.max_min_cs_ca_ri)) self.add_element(mentions_gribox, row, "<b>08. a.</b> Le nombre précis ou les nombres minimal et maximal des membres du <br/>Conseil de Surveillance", self.max_min_cs_ca_status_field, self.max_min_cs_ca_ri_field, "Art 335 Pour la COOP-CA (de 3 à 5 Pers)") row += 1 self.dispositions_mo_status_field = IntLineEdit(self.rest_d( self.check_list.dispositions_mo_status)) self.dispositions_mo_ri_field = IntLineEdit(self.rest_d( self.check_list.dispositions_mo_ri)) self.add_element(mentions_gribox, row, "<b>08. b.</b> Les dispositions relatives à l’exercice efficace des missions de ces organes", self.dispositions_mo_status_field, self.dispositions_mo_ri_field, "Art 263 Pour la SCOOPS /Art 341 Pour la COOP-CA") row += 1 self.mandat_cs_status_field = IntLineEdit(self.rest_d( self.check_list.mandat_cs_status)) self.mandat_cs_ri_field = IntLineEdit(self.rest_d( self.check_list.mandat_cs_ri)) self.add_element(mentions_gribox, row, "<b>09.</b> La durée du mandat des membres du comité de gestion, du conseil d’administration, <br/> du comité de surveillance et du conseil de surveillance", self.mandat_cs_status_field, self.mandat_cs_ri_field, "Art 224 (Réf aux statuts) Pour la SCOOPS /Art 295 Pour la COOP-CA (Réf aux statuts)") row += 1 self.parts_sociales_status_field = IntLineEdit(self.rest_d( self.check_list.parts_sociales_status)) self.parts_sociales_ri_field = IntLineEdit(self.rest_d( self.check_list.parts_sociales_ri)) self.add_element(mentions_gribox, row, "<b>10.</b> Toute limite relative au pourcentage maximal de parts sociales que peut détenir <br/> un seul membre Pour la SCOOPS", self.parts_sociales_status_field, self.parts_sociales_ri_field, "Art 210 Réf aux statuts et ne peut excéder 5 fois <br/> le montant des parts sociales souscrites) Pour la COOP-CA Art 371") row += 1 self.declatation_status_field = IntLineEdit(self.rest_d( self.check_list.declatation_status)) self.declatation_ri_field = IntLineEdit(self.rest_d( self.check_list.declatation_ri)) self.add_element(mentions_gribox, row, "<b>11.</b> Une déclaration précisant que la société coopérative est organisée et exploitée <br/> et exerce ses activités selon les principes coopératifs et le rappel de ces principes", self.declatation_status_field, self.declatation_ri_field, "Art 6") row += 1 self.id_apport_numeraire_status_field = IntLineEdit(self.rest_d( self.check_list.id_apport_numeraire_status)) self.id_apport_numeraire_ri_field = IntLineEdit(self.rest_d( self.check_list.id_apport_numeraire_ri)) self.add_element(mentions_gribox, row, "<b>12.</b> L’identité des apporteurs en numéraires avec pour chacun d’eux le montant des <br/> apports, le nombre et la valeur des parts sociales remis en contrepartie de chaque apport", self.id_apport_numeraire_status_field, self.id_apport_numeraire_ri_field, "Art 30, 31, 32, 33,35, 36,") row += 1 self.id_apport_nature_status_field = IntLineEdit(self.rest_d( self.check_list.id_apport_nature_status)) self.id_apport_nature_ri_field = IntLineEdit(self.rest_d( self.check_list.id_apport_nature_ri)) self.add_element(mentions_gribox, row, "<b>13. a.</b> L’identité des apporteurs en nature", self.id_apport_nature_status_field, self.id_apport_nature_ri_field, "Point 12 de l’Art 18") row += 1 self.evaluation_apport_status_field = IntLineEdit(self.rest_d( self.check_list.evaluation_apport_status)) self.evaluation_apport_ri_field = IntLineEdit(self.rest_d( self.check_list.evaluation_apport_ri)) self.add_element(mentions_gribox, row, "<b>13. b.</b> La nature et l’évaluation de l’apport effectué par chacun d’eux, le nombre et la valeur <br/>des parts sociales remises en contrepartie de chaque apport, Le régime des biens ou valeurs apportés <br/>lorsque leur valeur excède celle des apports exigés ;", self.evaluation_apport_status_field, self.evaluation_apport_ri_field, "Point 13 de l’Art 18") row += 1 self.capital_social_status_field = IntLineEdit(self.rest_d( self.check_list.capital_social_status)) self.capital_social_ri_field = IntLineEdit(self.rest_d( self.check_list.capital_social_ri)) self.add_element(mentions_gribox, row, "<b>14. a.</b> Le montant du capital social, les limitations minimales et maximales y afférentes", self.capital_social_status_field, self.capital_social_ri_field, "Art 53, 57 et 58 en général. Art 207 Pour la SCOOPS et 269 Pour la COOP-CA") row += 1 self.valeur_nominale_status_field = IntLineEdit(self.rest_d( self.check_list.valeur_nominale_status)) self.valeur_nominale_ri_field = IntLineEdit(self.rest_d( self.check_list.valeur_nominale_ri)) self.add_element(mentions_gribox, row, "<b>14. b.</b> La valeur nominale des diverses catégories de parts, les conditions précises de leur émission<br/> ou souscription ;", self.valeur_nominale_status_field, self.valeur_nominale_ri_field, "Art 44 et 45 en général. Pour la COOP-CA Art 376 et 377") row += 1 self.stipulations_status_field = IntLineEdit(self.rest_d( self.check_list.stipulations_status)) self.stipulations_ri_field = IntLineEdit(self.rest_d( self.check_list.stipulations_ri)) self.add_element(mentions_gribox, row, "<b>15.</b> Les stipulations relatives à la répartition du résultat et notamment, des excédents<br/> et des réserves ;", self.stipulations_status_field, self.stipulations_ri_field, "Art 46 alinéa en général. Pour SCOOPS alinéa 2 de l’Art 209 Pour la COOP-CA Art 363 alinéa 4") row += 1 self.modalite_status_field = IntLineEdit(self.rest_d( self.check_list.modalite_status)) self.modalite_ri_field = IntLineEdit(self.rest_d( self.check_list.modalite_ri)) self.add_element(mentions_gribox, row, "<b>16.</b> Les modalités de fonctionnement de la société coopérative ;", self.modalite_status_field, self.modalite_ri_field, "Art 95 à 121 en général .Pour SCOOPS art 217 à 263 Pour la COOP-CA Art 291 à 368") row += 1 self.signature_int_status_field = IntLineEdit(self.rest_d( self.check_list.signature_int_status)) self.signature_int_ri_field = IntLineEdit(self.rest_d( self.check_list.signature_int_ri)) self.add_element(mentions_gribox, row, "<b>17.</b> La signature des initiateurs ou l’apposition de leur empreinte digitale", self.signature_int_status_field, self.signature_int_ri_field, "Point 17 de l’Art 18") row += 1 self.etendue_status_field = IntLineEdit(self.rest_d( self.check_list.etendue_status)) self.etendue_ri_field = IntLineEdit(self.rest_d( self.check_list.etendue_ri)) self.add_element(mentions_gribox, row, "<b>18.</b> L’étendue des transactions avec les usagers non coopérateurs, tout en ayant en vue<br/>la sauvegarde de l’autonomie de la société coopérative ;", self.etendue_status_field, self.etendue_ri_field, "Art 4 al. 2") row += 1 qss = "padding:5px;padding-left:25px;padding-right:25px;background: gray;font-size:30px;color:#fff" mentions_gribox.addWidget(FHeader( "Les mentions facultatives", qss), row, 0, 1, 4) row += 1 self.rendement_status_field = IntLineEdit(self.rest_d( self.check_list.rendement_status)) self.rendement_ri_field = IntLineEdit(self.rest_d( self.check_list.rendement_ri)) self.add_element(mentions_gribox, row, "<b>1. a.</b> Le taux de rendement maximal qui peut être appliqué aux prêts et aux épargnes des membres", self.rendement_status_field, self.rendement_ri_field, "Art 18. 1bis alinéa 1") row += 1 self.remuneration_status_field = IntLineEdit(self.rest_d( self.check_list.remuneration_status)) self.remuneration_ri_field = IntLineEdit(self.rest_d( self.check_list.remuneration_ri)) self.add_element(mentions_gribox, row, "<b>1. b.</b> Le taux de rémunération maximale qui peut être appliqué aux parts de membres ;", self.remuneration_status_field, self.remuneration_ri_field, "Art 239 ; 240 alinéa4 et 231(Art 18. 1bis alinéa 1)") row += 1 self.limite_imposee_status_field = IntLineEdit(self.rest_d( self.check_list.limite_imposee_status)) self.limite_imposee_ri_field = IntLineEdit(self.rest_d( self.check_list.limite_imposee_ri)) self.add_element(mentions_gribox, row, "<b>2.</b> Toute limite imposée aux activités commerciales de la société coopérative.", self.limite_imposee_status_field, self.limite_imposee_ri_field, "COOP–CA Art 313,SCOOPS Art 258 et 259") row += 1 mentions_gribox.addWidget(FHeader( "Règlement Intérieur, outre les mentions obligatoires des statuts, le règlement intérieur contient les prescriptions suivantes :", qss), row, 0, 1, 4) row += 1 self.indemnit_status_field = IntLineEdit(self.rest_d( self.check_list.indemnit_status)) self.indemnit_ri_field = IntLineEdit(self.rest_d( self.check_list.indemnit_ri)) self.add_element(mentions_gribox, row, "<b>1.</b> Les conditions de paiement d’indemnités aux membres du conseil d’administration ou du comité<br/> de gestion, du conseil ou du comité de surveillance, définies dans le respect des dispositions<br/> des articles 225 et 305 ;", self.indemnit_status_field, self.indemnit_ri_field, "Scoops : Art 225; Scoop-CA : Art 305") row += 1 self.souscription_status_field = IntLineEdit(self.rest_d( self.check_list.souscription_status)) self.souscription_ri_field = IntLineEdit(self.rest_d( self.check_list.souscription_ri)) self.add_element(mentions_gribox, row, "<b>2.</b> La souscription de parts sociales supplémentaires et leur nombre par coopérateur ;", self.souscription_status_field, self.souscription_ri_field, "Pour la SCOOPS Art 210 Réf aux statuts et ne peut excéder <br/>5 fois le montant des parts sociales souscrites) Pour la COOP-CA Art 371") row += 1 self.suspension_status_field = IntLineEdit(self.rest_d( self.check_list.suspension_status)) self.suspension_ri_field = IntLineEdit(self.rest_d( self.check_list.suspension_ri)) self.add_element(mentions_gribox, row, "<b>3.</b> Les critères et conditions de suspension des coopérateurs;", self.suspension_status_field, self.suspension_ri_field, "Statut (initiateurs)") row += 1 self.attribution_status_field = IntLineEdit(self.rest_d( self.check_list.attribution_status)) self.attribution_ri_field = IntLineEdit(self.rest_d( self.check_list.attribution_ri)) self.add_element(mentions_gribox, row, "<b>4.</b> La possibilité d’attribution d’un droit de vote plural dans le cas des unions, des fédérations et<br/>des confédérations ;", self.attribution_status_field, self.attribution_ri_field, "Art 138") row += 1 self.prescriptions_status_field = IntLineEdit(self.rest_d( self.check_list.prescriptions_status)) self.prescriptions_ri_field = IntLineEdit(self.rest_d( self.check_list.prescriptions_ri)) self.add_element(mentions_gribox, row, "<b>5.</b> Toutes autres prescriptions jugées nécessaires pour la réalisation de l’objet de la société <br/>coopérative et conformes aux principes coopératifs et aux dispositions impératives du présent<br/> Acte uniforme.", self.prescriptions_status_field, self.prescriptions_ri_field, "AUSCOOP") vbox = QVBoxLayout() vbox.addLayout(pieces_v_gribox) vbox.addLayout(pieces_gribox) vbox.addLayout(mentions_gribox) self.piecesGroupBox.setLayout(vbox) # Durée statutaire de la société coopérative duree_fbox = QFormLayout() self.butt_continous = Button_save(u"Continuer") self.butt_continous.clicked.connect(self.goto_immatriculation) self.butt_continous.setMaximumWidth(200) duree_fbox.addRow("", self.butt_continous) if not self.check_integrity_validation(): self.butt_continous.setEnabled(False) scroll = QScrollArea(self) scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) scroll.setWidgetResizable(True) # scroll.setFixedHeight(200) vbox = QVBoxLayout() vbox.addWidget(FHeader( "<h2>Check-list de Contrôle de dossiers des sociétés coopératives avant l’immatriculation et l’enregistrement par le SLDS-ES</h2>", css="color:green")) vbox.addWidget(FHeader( "<h4>Société Coopérative : {} </h4>".format(self.dmd.scoop))) scroll.setWidget(self.piecesGroupBox) vbox.addWidget(scroll) vbox.addLayout(duree_fbox) self.setLayout(vbox)
class HomeViewWidget(FWidget): """ Shows the home page """ def __init__(self, parent=0, *args, **kwargs): super(HomeViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.root_permission = [u"admin", u"superuser"] blanck = 3 * " " self.parentWidget().setWindowTitle(Config.APP_NAME + blanck + "MENU GENERAL") self.title = FPageTitle(u"{} MENU GENERAL {}".format(blanck, blanck)) self.title.setStyleSheet( "background: url(%s) no-repeat scroll 20px 50px #CCCCCC;" "border-radius: 14px 14px 4px 4px;" "font: 15pt 'URW Bookman L';" % Config.APP_LOGO) self.consultation = Button_menu(_("Consultation")) self.consultation.clicked.connect(self.goto_consultation) self.consultation.setIcon( QIcon.fromTheme('save', QIcon(u"{}dashboard.png".format( Config.img_media)))) self.invoice = Button_menu(_("Facturation")) # Affiche sur le commentaire sur le status bar # invoice.setStatusTip("hhhhhh") self.invoice.setIcon( QIcon.fromTheme('save', QIcon(u"{}invoice.png".format(Config.img_media)))) self.invoice.clicked.connect(self.goto_invoice) # self.admin = Button_menu(_("Administration")) # self.admin.clicked.connect(self.goto_admin) # self.admin.setIcon(QIcon.fromTheme('save', QIcon(u"{}admin.png".format(Config.img_media)))) self.report = Button_menu(_("Rapports d'achats")) self.report.clicked.connect(self.goto_buy) self.report.setIcon( QIcon.fromTheme('save', QIcon(u"{}buy.png".format(Config.img_media)))) self.label = FLabel(self) self.label.setStyleSheet( "background: url('{}center.png') no-repeat scroll 0 0;" "height: 50px;width:50px; margin: 0; padding: 0;".format( Config.img_media)) # editbox.setColumnStretch(50, 2) ########### Mstock ############ self.state = Button_menu(_(u"État des stocks")) self.state.clicked.connect(self.goto_state) self.state.setIcon( QIcon.fromTheme('save', QIcon(u"{}state.png".format(Config.img_media)))) self.output = Button_menu(_("Sortie")) # Affiche sur le commentaire sur le status bar # self.output.setStatusTip("hhhhhh") self.output.setIcon( QIcon.fromTheme('save', QIcon(u"{}out.png".format(Config.img_media)))) self.output.clicked.connect(self.goto_output) self.order = Button_menu(_(u"Faire les commandes")) self.order.clicked.connect(self.goto_order) self.order.setIcon( QIcon.fromTheme('save', QIcon(u"{}order.png".format(Config.img_media)))) self.inputs = Button_menu(_(u"Entrée")) self.inputs.clicked.connect(self.goto_inputs) self.inputs.setIcon( QIcon.fromTheme('save', QIcon(u"{}in.png".format(Config.img_media)))) vbox = QHBoxLayout(self) vbox.addWidget(self.title) # vbox.addLayout(editbox) # if Owner.get(islog=True).login_count > Config.tolerance: # if not is_valide_mac(Config().license): # self.createErroMsGroupBox() # vbox.addWidget(self.chow_ms_err) # self.setLayout(vbox) # return if Config.APP_NAME == Config.M_GESTION: self.createMenuMStockGroupBox() vbox.addWidget(self.mstockgbox) self.setLayout(vbox) if Config.APP_NAME == Config.B_GESTION: self.createMenuBStockGroupBox() vbox.addWidget(self.bstockgbox) self.setLayout(vbox) def createErroMsGroupBox(self): self.chow_ms_err = QGroupBox() ms_err = PyTextViewer("""<h3>Vous n'avez pas le droit d'utiliser ce logiciel sur cette machine, veuillez me contacté </h3> <ul><li><b>Tel:</b> {phone}</li> <li><b>{adress}</b></li><li><b>E-mail:</b> {email}</li></ul></br></br>{mac} """.format(email=Config.EMAIL_AUT, adress=Config.ADRESS_AUT, phone=Config.TEL_AUT, mac=get_mac())) gridbox = QGridLayout() gridbox.addWidget(FPageTitle(_("Erreur de permission")), 0, 2) gridbox.addWidget(ms_err, 1, 2) self.chow_ms_err.setLayout(gridbox) def createMenuMStockGroupBox(self): self.mstockgbox = QGroupBox() editbox = QGridLayout() editbox.addWidget(self.state, 0, 1, 1, 1) editbox.addWidget(self.inputs, 1, 0, 1, 1) editbox.addWidget(self.label, 1, 1, 1, 1) editbox.addWidget(self.output, 1, 2, 1, 1) editbox.addWidget(self.order, 2, 1, 1, 1) self.mstockgbox.setLayout(editbox) def createMenuBStockGroupBox(self): self.bstockgbox = QGroupBox() editbox = QGridLayout() editbox.addWidget(self.consultation, 0, 1, 1, 1) editbox.addWidget(self.invoice, 1, 0, 1, 1) editbox.addWidget(self.label, 1, 1, 1, 1) editbox.addWidget(self.report, 2, 1, 1, 1) # editbox.addWidget(self.admin, 1, 2, 1, 1) self.bstockgbox.setLayout(editbox) def check_log(self, page, permiss=None): if not Config.LOGIN: self.parent.active_menu_ad() self.change_main_context(page) SystemTrayIcon((_(u"Avertissement de Securité"), "({}) Il est vivement souhaité de securiser son \ application".format(Config.APP_NAME)), parent=self) else: try: owner = Owner.get(islog=True) self.parent.active_menu_ad( ) if owner.group in self.root_permission else self.parent.active_menu( ) except OwnerDoesNotExist: return False def goto_consultation(self): self.check_log(DashbordViewWidget, permiss=self.root_permission) def goto_invoice(self): self.root_permission.append("user") self.check_log(InvoiceViewWidget, permiss=self.root_permission) # def goto_admin(self): # self.check_log(AdminViewWidget, permiss=self.root_permission) def goto_buy(self): self.check_log(BuyViewWidget, permiss=self.root_permission) def goto_state(self): self.check_log(StateStockViewWidget, permiss=self.root_permission) def goto_output(self): self.root_permission.append("user") self.check_log(product_outViewWidget, permiss=self.root_permission) def goto_order(self): self.check_log(OrderViewWidget, permiss=self.root_permission) def goto_inputs(self): self.check_log(InViewWidget, permiss=self.root_permission)
class NewOrEditOfficeViewWidget(QDialog, FWidget): def __init__(self, pp=None, owner=None, parent=None, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) self.setWindowTitle(u"Nouvel Organisation") self.parent = parent vbox = QVBoxLayout() self.office_group_box() vbox.addWidget(self.organGroupBoxBtt) self.setLayout(vbox) def office_group_box(self): self.organGroupBoxBtt = QGroupBox( self.tr("Configuration des localités")) self.office_box = QComboBox() self.office_box.currentIndexChanged.connect(self.change_select_office) self.office_list = get_offices() self.region_box = QComboBox() self.region_label = FLabel() self.cercle_label = FLabel() self.phone_field = IntLineEdit() self.phone_field.setInputMask('## ## ## ##') self.bp = LineEdit() self.adress_org = QTextEdit() self.email_org = LineEdit() for index, value in enumerate(self.office_list): self.office_box.addItem("{}".format(office_name(value)), value) formbox = QFormLayout() formbox.addRow(FormLabel(u"Nom service :"), self.office_box) formbox.addRow(FormLabel(u"Région"), self.region_label) formbox.addRow(FormLabel(u"Cercle"), self.cercle_label) formbox.addRow(FormLabel(u"Tel :"), self.phone_field) formbox.addRow(FormLabel(u"B.P :"), self.bp) formbox.addRow(FormLabel(u"E-mail :"), self.email_org) formbox.addRow(FormLabel(u"Adresse complete :"), self.adress_org) butt = Button_save(u"Enregistrer") butt.clicked.connect(self.save_edit) formbox.addRow("", butt) self.organGroupBoxBtt.setLayout(formbox) def change_select_office(self): select_o = self.office_box.itemData(self.office_box.currentIndex()) self.r_select = office_region(select_o) self.c_select = office_cercle(select_o) self.region_label.setText(get_entity_name(self.r_select)) self.cercle_label.setText(get_entity_name(self.c_select)) def is_valide(self): if check_is_empty(self.phone_field): return False return True def save_edit(self): ''' add operation ''' if not self.is_valide(): return office = Office() office.slug = self.office_box.itemData(self.office_box.currentIndex()) office.slug_region = self.r_select office.slug_cercle = self.c_select office.phone = is_int(self.phone_field.text()) office.email_org = str(self.email_org.text()) office.bp = str(self.bp.text()) office.adress_org = str(self.adress_org.toPlainText()) office.save_() self.accept()
def __init__(self, parent, *args, **kwargs): super(FWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent formbox = QFormLayout() formbox.addRow(FLabel( u"<strong>{}</strong> {}".format(DATE_DEMANTE, self.parent.dmd.declaration_date))) formbox.addRow(FLabel( u"<strong>1. {} :</strong> {}".format(DENOMINATION_S_SC, self.parent.scoop.denomination))) formbox.addRow(FLabel( u"<strong>2. {} :</strong> {}".format(NOM_COMMERCIAL, self.parent.scoop.commercial_name))) formbox.addRow(FLabel( u"<strong>3. {} :</strong> {}".format(DATE_CREATION_SC, self.parent.scoop.created_date))) formbox.addRow(FLabel( u"<strong>4. {} :</strong> {}".format(ACTIVITES_E, self.parent.scoop.activity))) formbox.addRow(FLabel( u"<strong>5. {} :</strong> {}".format(FILIERE, self.parent.scoop.spinneret))) formbox.addRow(FLabel( u"<strong>6. {} :</strong> {}".format(FORME_SC, self.parent.scoop.forme))) # Capital Social Initial capital_formbox = QFormLayout() capital_formbox.addRow( FLabel("<strong> {} : </strong> {}".format(MONTANT_PART_S, self.parent.scoop.apports_numeraire + self.parent.scoop.apports_nature + self.parent.scoop.apports_industrie))) capital_formbox.addRow(FLabel( "<strong> 7.1 {} : </strong> {}".format(MONTANT_APPORTS_NUM, self.parent.scoop.apports_numeraire))) capital_formbox.addRow(FLabel( "<strong> 7.2 {} : </strong> {}".format(MONTANT_APPORTS_NAT, self.parent.scoop.apports_nature))) capital_formbox.addRow(FLabel( "<strong> 7.3 {} : </strong> {}".format(MONTANT_APPORTS_INDU, self.parent.scoop.apports_industrie))) self.capitalSGroupBox = QGroupBox("7. " + MONTANT_CAPITAL_SI) self.capitalSGroupBox.setLayout(capital_formbox) # self.capitalSGroupBox.setMaximumWidth(1200) # Adresse du siège social addres_gribox = QGridLayout() addres_gribox.addWidget( FLabel("<strong>{} </strong>{}".format(REGION, self.parent.scoop.display_region())), 0, 0) addres_gribox.addWidget( FLabel("<strong>{} : </strong>{}".format(CERCLE, self.parent.scoop.display_cercle())), 1, 0) # addres_gribox.addWidget(self.vline, 0, 3, 2, 5) addres_gribox.addWidget(FLabel( "<strong>{} : </strong>{}".format(VFQ, self.parent.scoop.display_commune())), 1, 1) addres_gribox.addWidget( FLabel("<strong>{} </strong>{}".format(RUE, self.parent.scoop.rue)), 2, 0) addres_gribox.addWidget( FLabel("<strong>{} </strong>{}".format(PORTE, self.parent.scoop.porte)), 2, 1) addres_gribox.addWidget( FLabel("<strong>Tel : </strong>{}".format(TEL, self.parent.scoop.tel)), 3, 0) addres_gribox.addWidget( FLabel("<strong>{} </strong>{}".format(BP, self.parent.scoop.bp)), 3, 1) addres_gribox.addWidget( FLabel("<strong>{} </strong>{}".format(EMAIL, self.parent.scoop.email)), 3, 2) duree_fbox = QFormLayout() duree_fbox.addRow(FLabel( u"<strong>{} </strong>{}".format(DUREE_STATUTAIRE_SC, self.parent.scoop.duree_statutaire))) self.addresGroupBox = QGroupBox(ADRESSE_SS) self.addresGroupBox.setLayout(addres_gribox) vbox = QVBoxLayout() vbox.addLayout(formbox) vbox.addWidget(self.capitalSGroupBox) vbox.addWidget(self.addresGroupBox) vbox.addLayout(duree_fbox) self.setLayout(vbox)
class InfoTableWidget(FWidget): def __init__(self, parent, *args, **kwargs): super(FWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.refresh() self.info_box = FLabel(" ") self.image = FLabel(" ") self.image_btt = BttSmall("Zoom") self.image_btt.setFlat(True) self.image_btt.clicked.connect(self.show_image) hbox = QHBoxLayout() gridbox = QGridLayout() gridbox.addWidget(self.info_box, 0, 0) gridbox.addWidget(self.image, 1, 0) gridbox.addWidget(self.image_btt, 1, 1) hbox.addLayout(gridbox) self.setLayout(hbox) def refresh_(self, idd): self.prod = Product.get(id=idd) rest_by_store = "" for store in Store.select(): remaining, nbr_parts = store.get_remaining_and_nb_parts(self.prod) if remaining < 10: color_style = 'color: DarkGreen' if remaining <= 5: color_style = 'color: LightCoral' if remaining <= 2: color_style = 'color: red; text-decoration: blink' if remaining >= 10: color_style = 'color: LimeGreen;' color_style = color_style + \ "; border:3px solid green; font-size: 15px" rest_by_store += """<li> {store}: <strong style='{color_style}'> {remaining} </strong> <i>carton</i> ({nbr_parts} <i>pièces</i>) </li>""".format(store=store.name, color_style=color_style, remaining=remaining, nbr_parts=nbr_parts * remaining) width = height = 50 if self.prod.image_link: width = 200 height = 100 self.info_box.setText(u"""<h2>{name}</h2> <h4>Quantité restante:</h4> <ul>{remaining}</ul> """.format(name=self.prod.name, remaining=rest_by_store)) self.image.setText("""<img src="{image}" width='{width}' height='{height}'>""".format(image=self.prod.image_link, width=width, height=height)) def show_image(self): """ afficher l'image complete dans une autre fenetre""" from GCommon.ui.show_image import ShowImageViewWidget try: self.parent.open_dialog( ShowImageViewWidget, modal=False, prod=self.prod) except AttributeError: pass
class HomeViewWidget(FWidget): """ Shows the home page """ def __init__(self, parent=0, *args, **kwargs): super(HomeViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.parentWidget().setWindowTitle(u"Bienvenu sur transfert Wari") self.title = FPageTitle(u"Tranfert") vbox = QVBoxLayout(self) vbox.addWidget(self.title) self.sttg = SettingsAdmin().select().where(SettingsAdmin.id == 1).get() if self.sttg.can_use: self.createHomeGroupBox() vbox.addWidget(self.homegbox) else: self.activationGroupBox() vbox.addWidget(self.topLeftGroupBoxBtt) self.setLayout(vbox) def createHomeGroupBox(self): self.homegbox = QGroupBox() self.table = OperationTableWidget(parent=self) table_box = QVBoxLayout() self.title_table = FPageTitle(u"Historique des transferts") table_box.addWidget(self.title_table) table_box.addWidget(self.table) # form transfer self.number = LineEdit() self.number.setInputMask("D9.99.99.99") self.number.setAlignment(Qt.AlignCenter) self.number.setFont(QFont("Arial", 17)) self.number.setToolTip(u"""Taper le nom ou le numéro de téléphone du beneficiare""") self.amount = LineEdit() self.amount.setFont(QFont("Arial", 15)) self.amount.setValidator(QIntValidator()) self.amount.setToolTip(u"Taper le montant du transfert") self.password_field = EnterTabbedLineEdit() self.password_field.setFont(QFont("Arial", 15)) self.password_field.setEchoMode(LineEdit.Password) self.password_field.setToolTip(u"Taper le code orange money") self.msg_field = FLabel("") butt = Button(u"Envoyer") butt.clicked.connect(self.get_or_creat_nbr) formbox = QGridLayout() formbox.addWidget(FLabel(u"Numéro"), 0, 0) formbox.addWidget(self.number, 1, 0) formbox.addWidget(FLabel(u"Montant"), 0, 1) formbox.addWidget(self.amount, 1, 1) formbox.addWidget(FLabel(u"code"), 0, 2) formbox.addWidget(self.password_field, 1, 2) formbox.addWidget(self.msg_field, 0, 5) formbox.addWidget(butt, 1, 4) formbox.setColumnStretch(5, 3) transfer_box = QVBoxLayout() # formbox.setSizeConstraint(QLayout.SetFixedSize) transfer_box.addWidget(self.title) transfer_box.addLayout(formbox) transfer_box.addLayout(table_box) # self.setLayout(transfer_box) self.homegbox.setLayout(transfer_box) def activationGroupBox(self): self.topLeftGroupBoxBtt = QGroupBox(self.tr("Nouvelle license")) self.setWindowTitle(u"License") self.parentWidget().setWindowTitle(u"Activation de la license") self.code_field = PyTextViewer(u"""Vous avez besoin du code ci desous pour l'activation:<hr> <b>{code}</b><hr> <h4>Contacts:</h4>{contact}""" .format(code=SettingsAdmin().select().get().clean_mac, contact=Constants.TEL_AUT)) self.name_field = LineEdit() self.license_field = QTextEdit() self.pixmap = QPixmap("") self.image = FLabel(self) self.image.setPixmap(self.pixmap) butt = Button_save(u"Enregistrer") butt.clicked.connect(self.add_lience) editbox = QGridLayout() editbox.addWidget(FLabel(u"Nom: "), 0, 0) editbox.addWidget(self.name_field, 0, 1) editbox.addWidget(FLabel(u"License: "), 1, 0) editbox.addWidget(self.license_field, 1, 1) editbox.addWidget(self.code_field, 1, 2) editbox.addWidget(self.image, 5, 1) editbox.addWidget(butt, 6, 1) self.topLeftGroupBoxBtt.setLayout(editbox) def get_or_creat_nbr(self): ''' add operation ''' if not self.is_complete(): return number = unicode(self.number.text().replace('.', '')) amount = unicode(self.amount.text()) Contact.get_or_create(number) data = {"phone_num": [number, ], "amount": amount, "code": unicode(self.password_field.text())} # print(data) # multiple_sender(data) self.number.clear() self.amount.clear() self.password_field.clear() self.table.refresh_() self.msg_field.setText( u"Transfert vers ({}) a été effectué.".format(number)) self.msg_field.setStyleSheet("color: green") def is_complete(self): self.amount.setStyleSheet("") self.password_field.setStyleSheet("") if unicode(self.amount.text()) == "": self.amount.setStyleSheet("font-size:20px; color: red") self.amount.setText(u"Ce champ est obligatoire.") return False if unicode(self.password_field.text()) == "": self.password_field.setStyleSheet("font-size:20px; color: red") self.password_field.setText(u"Ce champ est obligatoire.") return False return True def check_license(self, license): self.flog = False if (SettingsAdmin().is_valide_mac(license)): self.pixmap = QPixmap(u"{}accept.png".format(Constants.img_cmedia)) self.image.setToolTip("License correct") self.flog = True else: self.pixmap = QPixmap( u"{}decline.png".format(Constants.img_cmedia)) self.image.setToolTip("License incorrect") self.image.setPixmap(self.pixmap) def add_lience(self): """ add User """ name = unicode(self.name_field.text()).strip() license = unicode(self.license_field.toPlainText()) self.check_license(license) if self.flog: sttg = self.sttg sttg.user = name sttg.license = license sttg.save() raise_success(u"Confirmation", u"""La license (<b>{}</b>) à éte bien enregistré pour cette machine.\n Elle doit être bien gardé""".format(license)) self.goto_archi()
def __init__(self, parent=0, *args, **kwargs): super(HomeViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.root_permission = ["admin", "superuser"] blanck = 3 * " " self.parentWidget().setWindowTitle(Config.APP_NAME + blanck + "MENU GENERAL") self.title = FPageTitle("{} MENU GENERAL {}".format(blanck, blanck)) self.title.setStyleSheet( "background: url(%s) no-repeat scroll 20px 50px #CCCCCC;" "border-radius: 14px 14px 4px 4px;" "font: 15pt 'URW Bookman L';" % Config.APP_LOGO ) self.consultation = Button_menu(_("Consultation")) self.consultation.clicked.connect(self.goto_consultation) self.consultation.setIcon(QIcon.fromTheme("save", QIcon("{}dashboard.png".format(Config.img_media)))) self.invoice = Button_menu(_("Facturation")) # Affiche sur le commentaire sur le status bar # invoice.setStatusTip("hhhhhh") self.invoice.setIcon(QIcon.fromTheme("save", QIcon("{}invoice.png".format(Config.img_media)))) self.invoice.clicked.connect(self.goto_invoice) # self.admin = Button_menu(_("Administration")) # self.admin.clicked.connect(self.goto_admin) # self.admin.setIcon(QIcon.fromTheme('save', QIcon(u"{}admin.png".format(Config.img_media)))) self.report = Button_menu(_("Rapports d'achats")) self.report.clicked.connect(self.goto_buy) self.report.setIcon(QIcon.fromTheme("save", QIcon("{}buy.png".format(Config.img_media)))) self.label = FLabel(self) self.label.setStyleSheet( "background: url('{}center.png') no-repeat scroll 0 0;" "height: 50px;width:50px; margin: 0; padding: 0;".format(Config.img_media) ) # editbox.setColumnStretch(50, 2) ########### Mstock ############ self.state = Button_menu(_("État des stocks")) self.state.clicked.connect(self.goto_state) self.state.setIcon(QIcon.fromTheme("save", QIcon("{}state.png".format(Config.img_media)))) self.output = Button_menu(_("Sortie")) # Affiche sur le commentaire sur le status bar # self.output.setStatusTip("hhhhhh") self.output.setIcon(QIcon.fromTheme("save", QIcon("{}out.png".format(Config.img_media)))) self.output.clicked.connect(self.goto_output) self.order = Button_menu(_("Faire les commandes")) self.order.clicked.connect(self.goto_order) self.order.setIcon(QIcon.fromTheme("save", QIcon("{}order.png".format(Config.img_media)))) self.inputs = Button_menu(_("Entrée")) self.inputs.clicked.connect(self.goto_inputs) self.inputs.setIcon(QIcon.fromTheme("save", QIcon("{}in.png".format(Config.img_media)))) vbox = QHBoxLayout(self) vbox.addWidget(self.title) # vbox.addLayout(editbox) # if Owner.get(islog=True).login_count > Config.tolerance: # if not is_valide_mac(Config().license): # self.createErroMsGroupBox() # vbox.addWidget(self.chow_ms_err) # self.setLayout(vbox) # return if Config.APP_NAME == Config.M_GESTION: self.createMenuMStockGroupBox() vbox.addWidget(self.mstockgbox) self.setLayout(vbox) if Config.APP_NAME == Config.B_GESTION: self.createMenuBStockGroupBox() vbox.addWidget(self.bstockgbox) self.setLayout(vbox)
class HomeViewWidget(FWidget): """ Shows the home page """ def __init__(self, parent=0, *args, **kwargs): super(HomeViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.root_permission = ["admin", "superuser"] blanck = 3 * " " self.parentWidget().setWindowTitle(Config.APP_NAME + blanck + "MENU GENERAL") self.title = FPageTitle("{} MENU GENERAL {}".format(blanck, blanck)) self.title.setStyleSheet( "background: url(%s) no-repeat scroll 20px 50px #CCCCCC;" "border-radius: 14px 14px 4px 4px;" "font: 15pt 'URW Bookman L';" % Config.APP_LOGO ) self.consultation = Button_menu(_("Consultation")) self.consultation.clicked.connect(self.goto_consultation) self.consultation.setIcon(QIcon.fromTheme("save", QIcon("{}dashboard.png".format(Config.img_media)))) self.invoice = Button_menu(_("Facturation")) # Affiche sur le commentaire sur le status bar # invoice.setStatusTip("hhhhhh") self.invoice.setIcon(QIcon.fromTheme("save", QIcon("{}invoice.png".format(Config.img_media)))) self.invoice.clicked.connect(self.goto_invoice) # self.admin = Button_menu(_("Administration")) # self.admin.clicked.connect(self.goto_admin) # self.admin.setIcon(QIcon.fromTheme('save', QIcon(u"{}admin.png".format(Config.img_media)))) self.report = Button_menu(_("Rapports d'achats")) self.report.clicked.connect(self.goto_buy) self.report.setIcon(QIcon.fromTheme("save", QIcon("{}buy.png".format(Config.img_media)))) self.label = FLabel(self) self.label.setStyleSheet( "background: url('{}center.png') no-repeat scroll 0 0;" "height: 50px;width:50px; margin: 0; padding: 0;".format(Config.img_media) ) # editbox.setColumnStretch(50, 2) ########### Mstock ############ self.state = Button_menu(_("État des stocks")) self.state.clicked.connect(self.goto_state) self.state.setIcon(QIcon.fromTheme("save", QIcon("{}state.png".format(Config.img_media)))) self.output = Button_menu(_("Sortie")) # Affiche sur le commentaire sur le status bar # self.output.setStatusTip("hhhhhh") self.output.setIcon(QIcon.fromTheme("save", QIcon("{}out.png".format(Config.img_media)))) self.output.clicked.connect(self.goto_output) self.order = Button_menu(_("Faire les commandes")) self.order.clicked.connect(self.goto_order) self.order.setIcon(QIcon.fromTheme("save", QIcon("{}order.png".format(Config.img_media)))) self.inputs = Button_menu(_("Entrée")) self.inputs.clicked.connect(self.goto_inputs) self.inputs.setIcon(QIcon.fromTheme("save", QIcon("{}in.png".format(Config.img_media)))) vbox = QHBoxLayout(self) vbox.addWidget(self.title) # vbox.addLayout(editbox) # if Owner.get(islog=True).login_count > Config.tolerance: # if not is_valide_mac(Config().license): # self.createErroMsGroupBox() # vbox.addWidget(self.chow_ms_err) # self.setLayout(vbox) # return if Config.APP_NAME == Config.M_GESTION: self.createMenuMStockGroupBox() vbox.addWidget(self.mstockgbox) self.setLayout(vbox) if Config.APP_NAME == Config.B_GESTION: self.createMenuBStockGroupBox() vbox.addWidget(self.bstockgbox) self.setLayout(vbox) def createErroMsGroupBox(self): self.chow_ms_err = QGroupBox() ms_err = PyTextViewer( "<h3>Vous n'avez pas le droit d'utiliser ce \ logiciel sur cette machine, veuillez me contacté \ </h3> <ul><li><b>Tel:</b> {phone}</li>\ <li><b>{adress}</b></li><li><b>E-mail:</b> \ {email}</li></ul></br></br>{mac} \ ".format( email=Config.EMAIL_AUT, adress=Config.ADRESS_AUT, phone=Config.TEL_AUT, mac=get_mac().replace(":", ":") ) ) gridbox = QGridLayout() gridbox.addWidget(FPageTitle(_("Erreur de permission")), 0, 2) gridbox.addWidget(ms_err, 1, 2) self.chow_ms_err.setLayout(gridbox) def createMenuMStockGroupBox(self): self.mstockgbox = QGroupBox() editbox = QGridLayout() editbox.addWidget(self.state, 0, 1, 1, 1) editbox.addWidget(self.inputs, 1, 0, 1, 1) editbox.addWidget(self.label, 1, 1, 1, 1) editbox.addWidget(self.output, 1, 2, 1, 1) editbox.addWidget(self.order, 2, 1, 1, 1) self.mstockgbox.setLayout(editbox) def createMenuBStockGroupBox(self): self.bstockgbox = QGroupBox() editbox = QGridLayout() editbox.addWidget(self.consultation, 0, 1, 1, 1) editbox.addWidget(self.invoice, 1, 0, 1, 1) editbox.addWidget(self.label, 1, 1, 1, 1) editbox.addWidget(self.report, 2, 1, 1, 1) # editbox.addWidget(self.admin, 1, 2, 1, 1) self.bstockgbox.setLayout(editbox) def check_log(self, page, permiss=None): if not Config.LOGIN: self.parent.active_menu_ad() self.change_main_context(page) SystemTrayIcon( ( _("Avertissement de Securité"), "({}) Il est vivement souhaité de securiser son \ application".format( Config.APP_NAME ), ), parent=self, ) else: try: owner = Owner.get(islog=True) self.parent.active_menu_ad() if owner.group in self.root_permission else self.parent.active_menu() except OwnerDoesNotExist: return False def goto_consultation(self): self.check_log(DashbordViewWidget, permiss=self.root_permission) def goto_invoice(self): self.root_permission.append("user") self.check_log(InvoiceViewWidget, permiss=self.root_permission) # def goto_admin(self): # self.check_log(AdminViewWidget, permiss=self.root_permission) def goto_buy(self): self.check_log(BuyViewWidget, permiss=self.root_permission) def goto_state(self): self.check_log(StateStockViewWidget, permiss=self.root_permission) def goto_output(self): self.root_permission.append("user") self.check_log(product_outViewWidget, permiss=self.root_permission) def goto_order(self): self.check_log(OrderViewWidget, permiss=self.root_permission) def goto_inputs(self): self.check_log(InViewWidget, permiss=self.root_permission)
def __init__(self, parent=0, *args, **kwargs): super(RegistrationViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.parentWidget().set_window_title("FORMULAIRE D’IMMATRICULATION") self.title = FLabel("<h3>FORMULAIRE D’IMMATRICULATION</h3>") self.office = Office.select().where(Office.id == 1).get() self.created_date_field = FormatDate(QDate.currentDate()) self.created_date_field.setMaximumWidth(130) # self.created_date_field.setInputMask('##/##/####') self.rue_field = IntLineEdit() self.porte_field = IntLineEdit() self.tel_field = IntLineEdit() self.tel_field.setInputMask('## ## ## ##') self.tel2_field = IntLineEdit() self.tel2_field.setInputMask('## ## ## ##') self.bp_field = IntLineEdit() self.email_field = LineEdit() self.denomination_field = LineEdit() self.commercial_name_field = LineEdit() self.declaration_date_field = FormatDate(QDate.currentDate()) self.declaration_date_field.setMaximumWidth(130) self.amount_capital_social_initial = FLabel() self.amount_part_social_field = IntLineEdit() self.apports_numeraire_field = IntLineEdit() self.apports_numeraire_field.textChanged.connect(self.cal_total) self.apports_nature_field = IntLineEdit() self.apports_nature_field.textChanged.connect(self.cal_total) self.apports_industrie_field = IntLineEdit() self.apports_industrie_field.textChanged.connect(self.cal_total) self.duree_statutaire_field = IntLineEdit() self.duree_statutaire_field.setMaximumWidth(80) self.spinneret_box = QComboBox() self.spinneret_box.setMaximumWidth(800) self.activites_box = QComboBox() self.activites_box.setMaximumWidth(800) self.activites_box.currentIndexChanged.connect(self.sp_change_select) self.activities_list = get_activities() for index, value in enumerate(self.activities_list): self.activites_box.addItem( "{}".format(self.activities_list.get(value).upper()), value) # if self.store and self.store.name == op.name: # self.box_store.setCurrentIndex(index) self.formes_box = QComboBox() self.formes_box.setMaximumWidth(800) self.formes_list = get_formes() for index, value in enumerate(self.formes_list): self.formes_box.addItem( "{}".format(self.formes_list.get(value).upper()), value) self.commune_list = entity_children(self.office.slug_cercle).items() self.commune_box = ExtendedComboBox() for index, value in enumerate(self.commune_list): self.commune_box.addItem("{}".format(value[1].upper()), value[0]) # self.commune_box.addItems(self.commune_list) self.commune_box.setToolTip("commune") self.commune_box.currentIndexChanged.connect(self.c_change_select) # self.vfq_list = self.get_vfq_list() self.vfq_box = ExtendedComboBox() self.vfq_list = self.get_vfq_list() for index, value in enumerate(self.vfq_list): self.vfq_box.addItem("{}".format(self.vfq_list.get(value).upper()), value) self.vfq_box.setToolTip("vfq") formbox = QFormLayout() formbox.addRow(FLabel(DATE_DEMANTE), self.declaration_date_field) formbox.addRow(FLabel("1. " + DENOMINATION_S_SC), self.denomination_field) formbox.addRow(FLabel("2. " + NOM_COMMERCIAL), self.commercial_name_field) formbox.addRow(FLabel("3. " + DATE_CREATION_SC), self.created_date_field) formbox.addRow(FLabel("4. " + ACTIVITES_E), self.activites_box) formbox.addRow(FLabel("5. " + FILIERE), self.spinneret_box) formbox.addRow(FLabel("6. " + FORME_SC), self.formes_box) # Capital Social Initial capital_formbox = QFormLayout() capital_formbox.addRow(FLabel("7.1. " + MONTANT_PART_S), self.amount_part_social_field) capital_formbox.addRow(FLabel("7.2. " + MONTANT_APPORTS_NUM), self.apports_numeraire_field) capital_formbox.addRow(FLabel("7.3. " + MONTANT_APPORTS_NAT), self.apports_nature_field) capital_formbox.addRow(FLabel("7.4. " + MONTANT_APPORTS_INDU), self.apports_industrie_field) self.capitalSGroupBox = QGroupBox("7. " + MONTANT_CAPITAL_SI) self.capitalSGroupBox.setLayout(capital_formbox) self.capitalSGroupBox.setStyleSheet(CSS) # self.capitalSGroupBox.setMaximumWidth(1300) # Adresse du siège social self.vline = QFrame() self.vline.setFrameShape(QFrame.VLine) self.vline.setFrameShadow(QFrame.Sunken) self.addresGroupBox = QGroupBox("8. " + ADRESSE_SS) self.addresGroupBox.setStyleSheet(CSS) addres_gribox = QGridLayout() addres_gribox.addWidget(FRLabel(CERCLE), 0, 0) addres_gribox.addWidget(FLabel(self.office.cercle_name()), 0, 1) addres_gribox.addWidget(FRLabel(COMMUNE), 1, 0) addres_gribox.addWidget(self.commune_box, 1, 1) # addres_gribox.addWidget(self.vline, 0, 3, 2, 5) addres_gribox.addWidget(FRLabel(VFQ), 2, 0) addres_gribox.addWidget(self.vfq_box, 2, 1) addres_gribox.addWidget(FRLabel(RUE), 0, 2) addres_gribox.addWidget(self.rue_field, 0, 3) addres_gribox.addWidget(FRLabel(PORTE), 1, 2) addres_gribox.addWidget(self.porte_field, 1, 3) addres_gribox.addWidget(FRLabel(BP), 0, 4) addres_gribox.addWidget(self.bp_field, 0, 5) addres_gribox.addWidget(FRLabel(EMAIL), 1, 4) addres_gribox.addWidget(self.email_field, 1, 5) addres_gribox.addWidget(FRLabel(TEL), 2, 2) addres_gribox.addWidget(self.tel_field, 2, 3) addres_gribox.addWidget(FRLabel(TEL2), 2, 4) addres_gribox.addWidget(self.tel2_field, 2, 5) # addres_gribox.setColumnStretch(6, 5) self.addresGroupBox.setLayout(addres_gribox) # self.addresGroupBox.setMaximumWidth(1300) # Durée statutaire de la société coopérative duree_fbox = QFormLayout() duree_fbox.addRow(FLabel("9. " + DUREE_STATUTAIRE_SC), self.duree_statutaire_field) butt = Button_save(SAVE) butt.clicked.connect(self.save_and_goto_manager) butt_and_continous = Button_save(SAVE_AND_CONTINNUES) butt_and_continous.clicked.connect(self.save_and_goto_add_member) butt_and_continous.setMaximumWidth(300) duree_fbox.addRow(FLabel(""), FLabel("")) duree_fbox.addRow(butt, butt_and_continous) vbox = QVBoxLayout() vbox.addLayout(formbox) vbox.addWidget(self.capitalSGroupBox) vbox.addWidget(self.addresGroupBox) vbox.addLayout(duree_fbox) self.setLayout(vbox)
def __init__(self, parent=0, *args, **kwargs): super(HomeViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.root_permission = [u"admin", u"superuser"] blanck = 3 * " " self.parentWidget().setWindowTitle(Config.APP_NAME + blanck + "MENU GENERAL") self.title = FPageTitle(u"{} MENU GENERAL {}".format(blanck, blanck)) self.title.setStyleSheet( "background: url(%s) no-repeat scroll 20px 50px #CCCCCC;" "border-radius: 14px 14px 4px 4px;" "font: 15pt 'URW Bookman L';" % Config.APP_LOGO) self.consultation = Button_menu(_("Consultation")) self.consultation.clicked.connect(self.goto_consultation) self.consultation.setIcon( QIcon.fromTheme('save', QIcon(u"{}dashboard.png".format( Config.img_media)))) self.invoice = Button_menu(_("Facturation")) # Affiche sur le commentaire sur le status bar # invoice.setStatusTip("hhhhhh") self.invoice.setIcon( QIcon.fromTheme('save', QIcon(u"{}invoice.png".format(Config.img_media)))) self.invoice.clicked.connect(self.goto_invoice) # self.admin = Button_menu(_("Administration")) # self.admin.clicked.connect(self.goto_admin) # self.admin.setIcon(QIcon.fromTheme('save', QIcon(u"{}admin.png".format(Config.img_media)))) self.report = Button_menu(_("Rapports d'achats")) self.report.clicked.connect(self.goto_buy) self.report.setIcon( QIcon.fromTheme('save', QIcon(u"{}buy.png".format(Config.img_media)))) self.label = FLabel(self) self.label.setStyleSheet( "background: url('{}center.png') no-repeat scroll 0 0;" "height: 50px;width:50px; margin: 0; padding: 0;".format( Config.img_media)) # editbox.setColumnStretch(50, 2) ########### Mstock ############ self.state = Button_menu(_(u"État des stocks")) self.state.clicked.connect(self.goto_state) self.state.setIcon( QIcon.fromTheme('save', QIcon(u"{}state.png".format(Config.img_media)))) self.output = Button_menu(_("Sortie")) # Affiche sur le commentaire sur le status bar # self.output.setStatusTip("hhhhhh") self.output.setIcon( QIcon.fromTheme('save', QIcon(u"{}out.png".format(Config.img_media)))) self.output.clicked.connect(self.goto_output) self.order = Button_menu(_(u"Faire les commandes")) self.order.clicked.connect(self.goto_order) self.order.setIcon( QIcon.fromTheme('save', QIcon(u"{}order.png".format(Config.img_media)))) self.inputs = Button_menu(_(u"Entrée")) self.inputs.clicked.connect(self.goto_inputs) self.inputs.setIcon( QIcon.fromTheme('save', QIcon(u"{}in.png".format(Config.img_media)))) vbox = QHBoxLayout(self) vbox.addWidget(self.title) # vbox.addLayout(editbox) # if Owner.get(islog=True).login_count > Config.tolerance: # if not is_valide_mac(Config().license): # self.createErroMsGroupBox() # vbox.addWidget(self.chow_ms_err) # self.setLayout(vbox) # return if Config.APP_NAME == Config.M_GESTION: self.createMenuMStockGroupBox() vbox.addWidget(self.mstockgbox) self.setLayout(vbox) if Config.APP_NAME == Config.B_GESTION: self.createMenuBStockGroupBox() vbox.addWidget(self.bstockgbox) self.setLayout(vbox)
class ContactNewViewWidget(QDialog, FWidget): def __init__(self, parent, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) vbox = QVBoxLayout() vbox.addWidget(FBoxTitle(u"<h3>Ajout de contact </h3>")) self.combo_grp = QComboBox() groups = Group() groups.name = "Aucun" self.list_grp = Group.all() self.list_grp.append(groups) self.list_grp.reverse() for index in self.list_grp: sentence = u"%(name)s" % {'name': index.name} self.combo_grp.addItem(sentence) self.full_name = LineEdit() self.msg_e_or_c = FLabel("") self.full_name.setFont(QFont("Arial", 16)) self.phone_number = IntLineEdit() self.phone_number.setInputMask("D9.99.99.99") self.phone_number.setAlignment(Qt.AlignCenter) self.phone_number.setFont(QFont("Arial", 16)) send_butt = Button(u"Enregistrer") send_butt.clicked.connect(self.save_form) cancel_but = Button(u"Fermer") cancel_but.clicked.connect(self.cancel) formbox = QGridLayout() formbox.addWidget(FLabel(u"Groupes:"), 0, 0) formbox.addWidget(self.combo_grp, 1, 0) formbox.addWidget(FLabel(u"Nom complèt: "), 0, 1) formbox.addWidget(self.full_name, 1, 1) formbox.addWidget(FLabel(u"Numéro: "), 0, 2) formbox.addWidget(self.phone_number, 1, 2) formbox.addWidget(send_butt, 2, 1) formbox.addWidget(cancel_but, 2, 0) formbox.addWidget(self.msg_e_or_c, 3, 0, 3, 2) vbox.addLayout(formbox) self.setLayout(vbox) def cancel(self): self.close() def iscomplet(self): self.phone_number.setStyleSheet("") self.msg_e_or_c.setText("") self.msg_e_or_c.setStyleSheet("") try: int(self.phone_number.text().replace('.', '')) except: self.phone_number.setStyleSheet("border-bottom: 3px solid red;" "background-color:#AFAFAF;") self.phone_number.setToolTip(u"Ce champ est obligatoire.") return False return True def save_form(self): if not self.iscomplet(): return full_name = unicode(self.full_name.text()) phone_number = int(self.phone_number.text().replace('.', '')) try: Contact(number=phone_number, name=full_name).save() except: self.msg_e_or_c.setText(u"Ce numéro existe déjà") self.msg_e_or_c.setStyleSheet("color: red") return grp = unicode(self.list_grp[self.combo_grp.currentIndex()]) if not grp == "Aucun": grp = Group.select().where(Group.name == grp).get() contact = Contact.select().where( Contact.number == phone_number).get() ContactGroup(group=grp.id, contact=contact).save() self.full_name.setText("") self.phone_number.setText("") self.msg_e_or_c.setText( u"Le numéro (<b>{}</b>) à éte bien enregistré".format( phone_number))