1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
|
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import wx
import os
ID_CONNEXION=100
ID_PRINTER=101
#ID_EXIT=210
ID_ASELL=102
ID_MSELL=103
ID_DSELL=104
ID_APRODUCT=105
ID_MPRODUCT=106
ID_DPRODUCT=107
ID_LPRODUCT=508
ID_ACLIENT=108
ID_MCLIENT=109
ID_DCLIENT=110
ID_LCLIENT=511
ID_BARRE=111
ID_CALCULATRICE=112
ID_HELP=113
ID_ABOUT=114
#ID_PLUS=200
#ID_MOINS=201
ID_STOCK=202
ID_FACTURE=203
ID_BOUTON_OK=300
class Principale(wx.Frame):
def __init__(self, titre):
wx.Frame.__init__(self, None, -1, title = titre, size = (1000, 800))
#Item Menu Files
menuFiles = wx.Menu()
menuFiles.Append(ID_CONNEXION, "&Connexion", "Données de connexion DB")
menuFiles.AppendSeparator()
menuFiles.Append(ID_PRINTER, "Printing\tCTRL+p", "Imprimante par défaut")
menuFiles.AppendSeparator()
menuFiles.Append(wx.ID_EXIT, "&Exit\tCTRL+q", "Quitter l'application")
#Item Menu Sell
menuSell = wx.Menu()
menuSell.Append(ID_ASELL, "New sell", "Nouvelle vente")
menuSell.Append(ID_MSELL, "Modify sell", "Modifier une vente")
menuSell.Append(ID_DSELL, "Delete sell", "Supprimer une vente")
#Item Menu Product
menuProduct = wx.Menu(style = wx.MENU_TEAROFF)
menuProduct.Append(ID_APRODUCT, "New product","Nouveau produit")
#Item Menu Customer
menuCustomer = wx.Menu(style = wx.MENU_TEAROFF)
menuCustomer.Append(ID_ACLIENT, "New Client", "Nouveau client")
menuCustomer.Append(ID_MCLIENT, "Modify client", "Modifier un client")
menuCustomer.Append(ID_DCLIENT, "Delete client", "Supprimer un client")
#Item Menu Tools
menuTools = wx.Menu(style = wx.MENU_TEAROFF)
menuTools.Append(ID_BARRE,"&Barre d'etat", "Afficher ou non la barre d'état",kind=wx.ITEM_CHECK)
menuTools.Append(ID_CALCULATRICE, "&Calculatrice", "Ouvrir la calculatrice")
#Item Menu About
menuAbout = wx.Menu(style = wx.MENU_TEAROFF)
menuAbout.Append(ID_HELP, "&Help", "Please Help Me!")
menuAbout.Append(ID_ABOUT, "&About...", "Shop : what is that ?")
#Item Title Barre Menu
menuBarre = wx.MenuBar()
menuBarre.Append(menuFiles, "&Files")
menuBarre.Append(menuSell, "&Sell")
menuBarre.Append(menuProduct, "&Products")
menuBarre.Append(menuCustomer, "&Clients")
menuBarre.Append(menuTools, "&Tools")
menuBarre.Append(menuAbout, "Help")
self.SetMenuBar(menuBarre)
#Barre de Statut
self.barre = wx.StatusBar(self, -1)
self.barre.SetFieldsCount(2)
self.barre.SetStatusWidths([-1, -1])
self.SetStatusBar(self.barre)
#Item Barre d'outils
outils = wx.ToolBar(self, -1, style = wx.TB_HORIZONTAL | wx.NO_BORDER)
outils.AddSimpleTool(ID_CONNEXION,
wx.Bitmap("connection.png", wx.BITMAP_TYPE_PNG),
shortHelpString = "Connexion",
longHelpString = "Vérifier les données de connexions")
outils.AddSimpleTool(ID_STOCK,
wx.Bitmap("stock.png", wx.BITMAP_TYPE_PNG),
shortHelpString = "Stock",
longHelpString = "Voir les articles en stock")
outils.AddSimpleTool(ID_ASELL,
wx.Bitmap("vente.png", wx.BITMAP_TYPE_PNG),
shortHelpString = "Vente",
longHelpString = "Nouvelle vente")
outils.AddSimpleTool(ID_LPRODUCT,
wx.Bitmap("Products.png", wx.BITMAP_TYPE_PNG),
shortHelpString = "Products",
longHelpString = "Gérer les produits")
outils.AddSimpleTool(ID_LCLIENT,
wx.Bitmap("client.png", wx.BITMAP_TYPE_PNG),
shortHelpString = "Customer",
longHelpString = "Gérer les clients")
outils.AddSimpleTool(ID_FACTURE,
wx.Bitmap("facture.png", wx.BITMAP_TYPE_PNG),
shortHelpString = "Facture",
longHelpString = "Voir une facture")
outils.AddSimpleTool(ID_CALCULATRICE,
wx.Bitmap("Calculatrice.png", wx.BITMAP_TYPE_PNG),
shortHelpString = "Calculatrice",
longHelpString = "Lancer la calculatrice")
outils.AddSimpleTool(wx.ID_EXIT,
wx.Bitmap("Exit.png", wx.BITMAP_TYPE_PNG),
shortHelpString = "Quitter",
longHelpString = "Quitter l'application")
outils.Realize()
self.SetToolBar(outils)
# wx.EVT_MENU(self, wx.ID_OPEN, self.OnOpen)
# wx.EVT_MENU(self, wx.ID_CLOSE, self.OnClose)
# wx.EVT_MENU(self, wx.ID_UNDO, self.Retour)
# wx.EVT_MENU(self, ID_PLUS, self.Plus)
# wx.EVT_MENU(self, ID_MOINS, self.Moins)
wx.EVT_MENU(self, ID_APRODUCT, self.aproduct)
wx.EVT_MENU(self, ID_ACLIENT, self.acustomer)
wx.EVT_MENU(self, ID_CALCULATRICE, self.Calculatrice)
wx.EVT_MENU(self, wx.ID_EXIT, self.OnExit)
wx.EVT_MENU(self, ID_ABOUT, self.About)
wx.EVT_MENU(self, ID_LPRODUCT, self.lproduct)
#Définition des différentes fonctions
def aproduct(self,evt):
self.Clear(True)
wx.StaticText(self, -1, 'Numéro de l\'article :', (10, 20))
wx.StaticText(self, -1, 'Manufacturier :', (10, 60))
wx.StaticText(self, -1, 'Modèle :', (10, 100))
wx.StaticText(self, -1, 'Prix HTVA :', (10, 140))
wx.StaticText(self, -1, 'Taux TVA :', (10, 180))
wx.StaticText(self, -1, 'Montant TVA :', (10, 220))
wx.StaticText(self, -1, 'Prix TVAC :', (10, 260))
wx.StaticText(self, -1, 'Prix promotion :', (10, 300))
wx.StaticText(self, -1, 'Nombre de produit en stock :', (10, 340))
wx.StaticText(self, -1, 'Stock minimum :', (10, 380))
wx.StaticText(self, -1, 'Description :', (10, 420))
self.txt_barre_code = wx.TextCtrl(self, -1, '', (230, 15), (120, -1))
self.txt_manufacturier= wx.TextCtrl(self, -1, '', (230, 55), (320, -1))
self.txtmodele= wx.TextCtrl(self, -1, '', (230, 95), (320, -1))
self.txt_prix_htva= wx.TextCtrl(self, -1, '', (230, 135), (320, -1))
self.txt_taux_tva= wx.TextCtrl(self, -1, '', (230, 175), (320, -1))
self.txt_tva= wx.TextCtrl(self, -1, '', (230, 215), (320, -1))
self.txt_tva= wx.TextCtrl(self, -1, '', (230, 255), (320, -1))
self.txt_prix_promo= wx.TextCtrl(self, -1, '', (230, 295), (320, -1))
self.txt_qtite_stock= wx.TextCtrl(self, -1, '', (230, 335), (320, -1))
self.txt_qtite_min= wx.TextCtrl(self, -1, '', (230, 375), (320, -1))
self.txt_description= wx.TextCtrl(self, -1, '', (230, 415), (320, -1))
btn_retour = wx.Button(self, ID_BOUTON_OK, 'Retour', (230,465), size=(100, 30))
self.Refresh(True)
self.Update()
def lproduct(self,evt):
wx.StaticText(self, -1, 'Numéro d\'article :', (10, 20))
self.txt_barre_code = wx.TextCtrl(self, -1, '', (180, 15), (120, -1))
def acustomer(self,evt):
self.Close()
wx.StaticText(self, -1, 'Numéro de client :', (10, 20))
wx.StaticText(self, -1, 'Nom :', (10, 60))
wx.StaticText(self, -1, 'Prénom :', (10, 100))
wx.StaticText(self, -1, 'Adresse :', (10, 140))
wx.StaticText(self, -1, 'Code postal :', (10, 180))
wx.StaticText(self, -1, 'Ville :', (10, 220))
wx.StaticText(self, -1, 'Pays :', (10, 260))
wx.StaticText(self, -1, 'Numéro de Téléphone :', (10, 300))
wx.StaticText(self, -1, 'Numéro de Fax :', (10, 340))
wx.StaticText(self, -1, 'E-mail :', (10, 380))
wx.StaticText(self, -1, 'Numéro de TVA :', (10, 420))
self.txt_num_client = wx.TextCtrl(self, -1, '', (230, 15), (120, -1))
self.txt_nom = wx.TextCtrl(self, -1, '', (230, 55), (320, -1))
self.txt_prenom = wx.TextCtrl(self, -1, '', (230, 95), (320, -1))
self.txt_adresse = wx.TextCtrl(self, -1, '', (230, 135), (320, -1))
self.txt_code_postal = wx.TextCtrl(self, -1, '', (230, 175), (320, -1))
self.txt_ville = wx.TextCtrl(self, -1, '', (230, 215), (320, -1))
self.txt_pays = wx.TextCtrl(self, -1, '', (230, 255), (320, -1))
self.txt_num_tel = wx.TextCtrl(self, -1, '', (230, 295), (320, -1))
self.txt_num_fax = wx.TextCtrl(self, -1, '', (230, 335), (320, -1))
self.txt_email = wx.TextCtrl(self, -1, '', (230, 375), (320, -1))
self.txt_num_tva = wx.TextCtrl(self, -1, '', (230, 415), (320, -1))
btn_retour = wx.Button(self, ID_BOUTON_OK, 'Retour', (230,465), size=(100, 30))
def Calculatrice(self,evt):
os.system("gcalctool")
def About(self,evt):
dlg = wx.MessageDialog(self, "\nGes v.1.0\n\n"
"Programme écrit en Python / Tkinter / SQL \n"
"et distribué sous licence GNU GPL.\n\n"
"\nCe programme permet de gérer le magasin\n", "- Ges -")
dlg.ShowModal()
dlg.Destroy()
def OnExit(self,evt):
self.Destroy()
class MonApp(wx.App):
def OnInit(self):
fen = Principale(" - SHOP - ")
fen.Show(True)
self.SetTopWindow(fen)
return True
###############################################################################
# Debut du programme
###############################################################################
app = MonApp()
app.MainLoop() |
Partager