Skip to content

Commit

Permalink
design project and internship
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarKumar-AK committed Feb 22, 2022
1 parent c54d9ee commit cc6590a
Show file tree
Hide file tree
Showing 30 changed files with 6,476 additions and 0 deletions.
Binary file added design_project/CED17I029-Design-Project.pdf
Binary file not shown.
16 changes: 16 additions & 0 deletions design_project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# DBMS-Project-Desktop-Application
This project is based on **Electricity Distribution System in India**.

### createUser.sql
- This will create our admin for the database. And initially with this user your database will be connected.\
- And after this the particular user it will be connected like (division officer, circle officer, customer, etc.)\
- Be sure to run this file initially before running any python file.

### /server
- This folder contains all the different module related to the backend.

### /client
- This folder contains all the different module related to the frontend.

### main.py
- This will be responsible to connect the database and connect both frontend and backend.
Binary file added design_project/WxPython-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added design_project/__pycache__/const.cpython-38.pyc
Binary file not shown.
Binary file added design_project/__pycache__/initUI.cpython-38.pyc
Binary file not shown.
Binary file added design_project/__pycache__/main.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file added design_project/a.out
Binary file not shown.
Binary file added design_project/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3,809 changes: 3,809 additions & 0 deletions design_project/build.log

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions design_project/const.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
screenWidth, screenHeight = 1920, 1080
companyButtonWidth, companyButtonHeight = int(screenWidth/5), int(screenHeight/20)
companyButtonXAxis, companyButtonYAxis = int(screenWidth/34), int(screenHeight/9)
companyButtonSeparator, companyButtonFontSize = int(screenHeight/13.5), 17
edsWidth, edsHeight = int(screenWidth/2), int(screenHeight/21)

# def InitUI(self):

# menubar = wx.MenuBar()
# fileMenu = wx.Menu()
# fileItem = fileMenu.Append(wx.ID_EXIT, 'Quit', 'Quit application')
# menubar.Append(fileMenu, '&File')
# self.SetMenuBar(menubar)

# self.Bind(wx.EVT_MENU, self.OnClose, fileItem)

# self.headpnl=HeadNewPanel(self)
# imr = 'logor1.png'
# bmp1 = wx.Image(imr, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
# self.bitmap1 = wx.StaticBitmap(self.headpnl, -1, bmp1, (int(w/34),15))
# self.headpnl.SetBackgroundColour("grey16")

# self.homepnl = NewPanel(self)
# imr = 'background.png'
# bmp1 = wx.Image(imr, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
# self.bitmap1 = wx.StaticBitmap(self.homepnl, -1, bmp1, (0,0))

# pcButton = wx.Button(self.homepnl, label='Power Company', pos=(c.companyButtonXAxis, c.companyButtonYAxis),size=(c.companyButtonWidth, c.companyButtonHeight))
# pcButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))

# dcButton = wx.Button(self.homepnl, label='Distribution Company', pos=(c.companyButtonXAxis, c.companyButtonYAxis + c.companyButtonSeparator),size=(c.companyButtonWidth, c.companyButtonHeight))
# dcButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))

# tcButton = wx.Button(self.homepnl, label='Transmission Company', pos=(c.companyButtonXAxis, c.companyButtonYAxis + 2*c.companyButtonSeparator),size=(c.companyButtonWidth, c.companyButtonHeight))
# tcButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))

# ebButton = wx.Button(self.homepnl, label='Electricity Board', pos=(c.companyButtonXAxis, c.companyButtonYAxis + 3*c.companyButtonSeparator),size=(c.companyButtonWidth, c.companyButtonHeight))
# ebButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))



# pcButton.Bind(wx.EVT_BUTTON, self.pc)
# dcButton.Bind(wx.EVT_BUTTON, self.dc)
# tcButton.Bind(wx.EVT_BUTTON, self.tc)
# ebButton.Bind(wx.EVT_BUTTON, self.eb)

# l0 = wx.StaticText(self.homepnl, -1, "Customer Login ",pos=(750,170),size=(1000,1000))
# l0.SetFont(wx.Font(25,wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
# #l0.SetForegroundColour("white")
# errormsg = wx.StaticText(self.homepnl, -1, " ",pos=(750,400), size=(400, 30))
# l1 = wx.StaticText(self.homepnl, -1, "Customer ID : ",pos=(620,260), size=(200,100))
# l1.SetForegroundColour("white")
# l1.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))
# t1 = wx.TextCtrl(self.homepnl,style= wx.TE_PROCESS_ENTER,pos=(810,260),size=(400,40))


# l2 = wx.StaticText(self.homepnl, -1, "Password : ",pos=(620,330), size=(200,100))
# l2.SetForegroundColour("white")
# l2.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))
# t2 = wx.TextCtrl(self.homepnl,style = wx.TE_PASSWORD|wx.TE_PROCESS_ENTER,pos=(810,330),size=(400,40))

# t1.Bind(wx.EVT_TEXT_ENTER,partial(self.Login,t1=t1,t2=t2,errormsg=errormsg))
# t2.Bind(wx.EVT_TEXT_ENTER,partial(self.Login,t1=t1,t2=t2,errormsg=errormsg))

# loginButton = wx.Button(self.homepnl, label='Log In', pos=(980, 450), size=(int(c.companyButtonWidth/2), c.companyButtonHeight))
# loginButton.Bind(wx.EVT_BUTTON, partial(self.Login,t1=t1,t2=t2,errormsg=errormsg))
# loginButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))


# NacButton = wx.Button(self.homepnl, label='Not a Consumer', pos=(700, 450), size=(int(c.companyButtonWidth/1.8), c.companyButtonHeight))
# NacButton.Bind(wx.EVT_BUTTON, partial(self.EmpLoginForm,pt1=t1,pt2=t2,perrormsg=errormsg))
# NacButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))


# newConButton = wx.Button(self.homepnl, label='Apply New Connection', pos=(1400,100),size=(c.companyButtonWidth, c.companyButtonHeight))
# newConButton.Bind(wx.EVT_BUTTON,self.newConnection)
# newConButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))


# statBtn = wx.Button(self.homepnl, label='Know Your Conn. status', pos=(1400,200),size=(c.companyButtonWidth, c.companyButtonHeight))
# statBtn.Bind(wx.EVT_BUTTON,self.ncStat)
# statBtn.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))


# #w,h=wx.GetDisplaySize()
# self.SetSize((w,h))
# self.SetMaxSize((w,h))
# self.SetMinSize((w,h))
# self.SetTitle('Power Distribution System')
# self.Centre()
# self.homepnl.Bind(wx.EVT_PAINT, partial(self.OnPaint,op=self.homepnl))
# #self.Centre()
# #self.Show(True)
9 changes: 9 additions & 0 deletions design_project/creatingUser.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- WE WILL BE USING THIS USERNAME AND PASSWORD FOR CONNECTING TO THE DATABASE WITH ALL PRIVILEGES.
-- This will create user with name="admin" and password="admin"
create user 'amar'@'localhost' identified by 'amar';

-- This provides all the privileges to the admin. With grant option provides user with all the administritive privileges.
grant all privileges on *.* to 'amar'@'localhost' with grant option;

-- This will show you all the grants that are given to the admin, like create, update, insert etc.
show grants for 'admin'@'localhost';
Binary file added design_project/display1.ico
Binary file not shown.
20 changes: 20 additions & 0 deletions design_project/faltu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
loginButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))


BackButton = wx.Button(self.upnl, label='Back', pos=(1400, 40),size=(200,50))
BackButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))

ShowAllButton = wx.Button(self.upnl, label='Show All', pos=(20, 50),size=(200,50))
ShowAllButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))

name = wx.StaticText(self.upnl, -1,"Name:",pos=(250,60),size=(300,25))
name.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))
wx.SearchCtrl(self.upnl,pos=(350,50),size=(200,40))

state = wx.StaticText(self.upnl, -1,"State/UT:",pos=(600,60),size=(300,25))
state.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))
t1 = wx.SearchCtrl(self.upnl,style= wx.TE_PROCESS_ENTER,pos=(750,50),size=(200,40))

msg=wx.StaticText(self.lpnl, -1,"Not available !!", pos=(400,80), size=(300,25))
msg.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))
msg.SetForegroundColour((255,0,0))
99 changes: 99 additions & 0 deletions design_project/initUI.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import os
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from functools import partial
import wx
import string
from random import*
import wx.lib.scrolledpanel as scrolled
import MySQLdb as mdb
import main
import const as c

def InitUI(self):
menubar = wx.MenuBar()
fileMenu = wx.Menu()
fileItem = fileMenu.Append(wx.ID_EXIT, 'Quit', 'Quit application')
menubar.Append(fileMenu, '&File')
self.SetMenuBar(menubar)

self.Bind(wx.EVT_MENU, self.OnClose, fileItem)

self.headpnl=main.HeadNewPanel(self)
imr = 'logor1.png'
bmp1 = wx.Image(imr, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
self.bitmap1 = wx.StaticBitmap(self.headpnl, -1, bmp1, (int(c.screenWidth/34),15))
self.headpnl.SetBackgroundColour("grey16")

self.homepnl = main.NewPanel(self)
imr = 'background.png'
bmp1 = wx.Image(imr, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
self.bitmap1 = wx.StaticBitmap(self.homepnl, -1, bmp1, (0,0))

pcButton = wx.Button(self.homepnl, label='Power Company', pos=(c.companyButtonXAxis, c.companyButtonYAxis),size=(c.companyButtonWidth, c.companyButtonHeight))
pcButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))

dcButton = wx.Button(self.homepnl, label='Distribution Company', pos=(c.companyButtonXAxis, c.companyButtonYAxis + c.companyButtonSeparator),size=(c.companyButtonWidth, c.companyButtonHeight))
dcButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))

tcButton = wx.Button(self.homepnl, label='Transmission Company', pos=(c.companyButtonXAxis, c.companyButtonYAxis + 2*c.companyButtonSeparator),size=(c.companyButtonWidth, c.companyButtonHeight))
tcButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))

ebButton = wx.Button(self.homepnl, label='Electricity Board', pos=(c.companyButtonXAxis, c.companyButtonYAxis + 3*c.companyButtonSeparator),size=(c.companyButtonWidth, c.companyButtonHeight))
ebButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))



pcButton.Bind(wx.EVT_BUTTON, self.pc)
dcButton.Bind(wx.EVT_BUTTON, self.dc)
tcButton.Bind(wx.EVT_BUTTON, self.tc)
ebButton.Bind(wx.EVT_BUTTON, self.eb)

l0 = wx.StaticText(self.homepnl, -1, "Customer Login ",pos=(750,170),size=(1000,1000))
l0.SetFont(wx.Font(25,wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
#l0.SetForegroundColour("white")
errormsg = wx.StaticText(self.homepnl, -1, " ",pos=(750,400), size=(400, 30))
l1 = wx.StaticText(self.homepnl, -1, "Customer ID : ",pos=(620,260), size=(200,100))
l1.SetForegroundColour("white")
l1.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))
t1 = wx.TextCtrl(self.homepnl,style= wx.TE_PROCESS_ENTER,pos=(810,260),size=(400,40))


l2 = wx.StaticText(self.homepnl, -1, "Password : ",pos=(620,330), size=(200,100))
l2.SetForegroundColour("white")
l2.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))
t2 = wx.TextCtrl(self.homepnl,style = wx.TE_PASSWORD|wx.TE_PROCESS_ENTER,pos=(810,330),size=(400,40))

t1.Bind(wx.EVT_TEXT_ENTER,partial(self.Login,t1=t1,t2=t2,errormsg=errormsg))
t2.Bind(wx.EVT_TEXT_ENTER,partial(self.Login,t1=t1,t2=t2,errormsg=errormsg))

loginButton = wx.Button(self.homepnl, label='Log In', pos=(980, 450), size=(int(c.companyButtonWidth/2), c.companyButtonHeight))
loginButton.Bind(wx.EVT_BUTTON, partial(self.Login,t1=t1,t2=t2,errormsg=errormsg))
loginButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))


NacButton = wx.Button(self.homepnl, label='Not a Consumer', pos=(700, 450), size=(int(c.companyButtonWidth/1.8), c.companyButtonHeight))
NacButton.Bind(wx.EVT_BUTTON, partial(self.EmpLoginForm,pt1=t1,pt2=t2,perrormsg=errormsg))
NacButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))


newConButton = wx.Button(self.homepnl, label='Apply New Connection', pos=(1400,100),size=(c.companyButtonWidth, c.companyButtonHeight))
newConButton.Bind(wx.EVT_BUTTON,self.newConnection)
newConButton.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))


statBtn = wx.Button(self.homepnl, label='Know Your Conn. status', pos=(1400,200),size=(c.companyButtonWidth, c.companyButtonHeight))
statBtn.Bind(wx.EVT_BUTTON,self.ncStat)
statBtn.SetFont(wx.Font(c.companyButtonFontSize, wx.FONTFAMILY_DEFAULT, 0, 90, underline = False,faceName =""))


#w,h=wx.GetDisplaySize()
self.SetSize((c.screenWidth,c.screenHeight))
self.SetMaxSize((c.screenWidth,c.screenHeight))
self.SetMinSize((c.screenWidth,c.screenHeight))
self.SetTitle('Power Distribution System')
self.Centre()
self.homepnl.Bind(wx.EVT_PAINT, partial(self.OnPaint,op=self.homepnl))
#self.Centre()
#self.Show(True)
Binary file added design_project/logor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added design_project/logor1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cc6590a

Please sign in to comment.