Skip to content

Commit

Permalink
Merge pull request #1 from ayushkumar-25/version1.1
Browse files Browse the repository at this point in the history
Project Completion Stage 1
  • Loading branch information
ayushkumar-25 authored May 6, 2021
2 parents 5108d53 + 13bfd82 commit 4df845f
Show file tree
Hide file tree
Showing 8 changed files with 250 additions and 12 deletions.
11 changes: 6 additions & 5 deletions Activity/createacc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ def createaccfunction(self):
if len(password) >= 6:
if len(phoneNumber) == 10:
try:
m.auth.create_user_with_email_and_password(email, password)
user = m.auth.create_user_with_email_and_password(email, password)
id = user['localId']
data = {'Name': name, 'Age': age, 'Blood Group': bloodGroup, 'Location': location,
'Phone Number': phoneNumber}
'Phone Number': phoneNumber, 'id': id}
m.db.child('Users').child().push(data)
# m.auth.sign_in_with_email_and_password(email, password)
home = h.Home()
# login = m.Login()
m.widget.addWidget(home)
# home = h.Home()
login = m.Login()
m.widget.addWidget(login)
m.widget.setCurrentIndex(m.widget.currentIndex() + 1)
except:
self.invalid.setText('Please enter valid email.')
Expand Down
34 changes: 34 additions & 0 deletions Activity/display.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import sys
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QDialog, QApplication
from PyQt5.uic import loadUi
import pyrebase

import requestblood as req
import main as m


class Display(QDialog):
def __init__(self):
super(Display, self).__init__()
loadUi(r'..\Resource\display.ui', self)
self.backButton.clicked.connect(self.backtoHome)

# data = [{'Age': '22', 'Blood Group': 'A+', 'Location': 'Kolkata', 'Name': 'Rahul',
# 'Phone Number': '9708942540'},
# {'Age': '32', 'Blood Group': 'O+', 'Location': 'Ranchi', 'Name': 'Aman', 'Phone Number': '1234567890'}]
data = req.lis
row = 0
self.tableWidget.setRowCount(len(data))
for person in data:
self.tableWidget.setItem(row, 0, QtWidgets.QTableWidgetItem(person['Name']))
self.tableWidget.setItem(row, 1, QtWidgets.QTableWidgetItem(person['Age']))
self.tableWidget.setItem(row, 2, QtWidgets.QTableWidgetItem(person['Blood Group']))
self.tableWidget.setItem(row, 3, QtWidgets.QTableWidgetItem(person['Location']))
self.tableWidget.setItem(row, 4, QtWidgets.QTableWidgetItem(person['Phone Number']))
row = row + 1

def backtoHome(self):
request = req.RequestBlood()
m.widget.addWidget(request)
m.widget.setCurrentIndex(m.widget.currentIndex() + 1)
9 changes: 6 additions & 3 deletions Activity/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import home as h
import createacc as acc
import resetpass as req
import resetpass as res

firebaseConfig = {'apiKey': "AIzaSyD-UKONeVgyG4wmi7Rym-lZYIn9CDpLI3Y",
'authDomain': "fir-auth-ddfd6.firebaseapp.com",
Expand All @@ -33,10 +33,12 @@ def __init__(self):
self.loginMessage.setVisible(False)

def loginfunction(self):
global id
email = self.email.text()
password = self.password.text()
try:
auth.sign_in_with_email_and_password(email, password)
user = auth.sign_in_with_email_and_password(email, password)
id = user['localId']
self.gotoHome()
# self.loginInvalidMessage.setVisible(False)
# self.loginMessage.setVisible(True)
Expand All @@ -56,7 +58,7 @@ def gotoHome(self):
widget.setCurrentIndex(widget.currentIndex() + 1)

def gotoReset(self):
reset = req.ResetPass()
reset = res.ResetPass()
widget.addWidget(reset)
widget.setCurrentIndex(widget.currentIndex() + 1)

Expand All @@ -69,6 +71,7 @@ def gotoReset(self):
widget.setFixedHeight(620)
widget.setWindowTitle('Blood Bank')
widget.setWindowIcon(QtGui.QIcon(r'..\Resource\icon.jpg'))
# app.setStyle(QtWidgets.QStyleFactory.create('Fusion'))
widget.show() # show all the widgets
sys.exit(app.exec_()) # start the app
#app.exec_()
17 changes: 17 additions & 0 deletions Activity/myprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,27 @@


class MyProfile(QDialog):
global datum

def __init__(self):
global datum
super(MyProfile, self).__init__()
loadUi(r'..\Resource\myprofile.ui', self)
self.backButton.clicked.connect(self.backtoHome)
user = m.db.child('Users').get()
for users in user.each():
if users.val()['id'] == m.id:
datum = [users.val()]

row = 0
self.tableWidget.setRowCount(len(datum))
for person in datum:
self.tableWidget.setItem(row, 0, QtWidgets.QTableWidgetItem(person['Name']))
self.tableWidget.setItem(row, 1, QtWidgets.QTableWidgetItem(person['Age']))
self.tableWidget.setItem(row, 2, QtWidgets.QTableWidgetItem(person['Blood Group']))
self.tableWidget.setItem(row, 3, QtWidgets.QTableWidgetItem(person['Location']))
self.tableWidget.setItem(row, 4, QtWidgets.QTableWidgetItem(person['Phone Number']))
row = row + 1

def backtoHome(self):
home = h.Home()
Expand Down
10 changes: 9 additions & 1 deletion Activity/requestblood.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import main as m
import home as h
import display as d


class RequestBlood(QDialog):
Expand All @@ -22,6 +23,8 @@ def backtoHome(self):

def bloodRequest(self):
global g
global lis
lis = []
bloodGroup = self.bloodGroup.currentText()
if bloodGroup == 'A+':
g = ['A+', 'A-', 'O+', 'O-']
Expand All @@ -44,4 +47,9 @@ def bloodRequest(self):
for user in users.each():
for i in g:
if user.val()['Blood Group'] == i and user.val()['Location'] == location:
print(user.val())
lis.append(user.val())
# print(user.val())

display = d.Display()
m.widget.addWidget(display)
m.widget.setCurrentIndex(m.widget.currentIndex() + 1)
114 changes: 114 additions & 0 deletions Resource/display.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>620</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(54, 54, 54);</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>180</x>
<y>90</y>
<width>171</width>
<height>61</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font-size:34px;
color: rgb(225, 225, 225);</string>
</property>
<property name="text">
<string>Donors</string>
</property>
</widget>
<widget class="QPushButton" name="backButton">
<property name="geometry">
<rect>
<x>30</x>
<y>30</y>
<width>71</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(167, 168, 167);
color: rgb(255, 255, 255);
font-size:18px</string>
</property>
<property name="text">
<string>Back</string>
</property>
</widget>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>20</x>
<y>220</y>
<width>451</width>
<height>291</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(238, 238, 238);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QTableWidget" name="tableWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>451</width>
<height>291</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Age</string>
</property>
</column>
<column>
<property name="text">
<string>Blood Group</string>
</property>
</column>
<column>
<property name="text">
<string>Location</string>
</property>
</column>
<column>
<property name="text">
<string>Phone Number</string>
</property>
</column>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>
57 changes: 57 additions & 0 deletions Resource/myprofile.ui
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,63 @@ font-size:18px</string>
<string>Back</string>
</property>
</widget>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>20</x>
<y>220</y>
<width>451</width>
<height>161</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(238, 238, 238);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QTableWidget" name="tableWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>451</width>
<height>161</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Age</string>
</property>
</column>
<column>
<property name="text">
<string>Blood Group</string>
</property>
</column>
<column>
<property name="text">
<string>Location</string>
</property>
</column>
<column>
<property name="text">
<string>Phone Number</string>
</property>
</column>
</widget>
</widget>
</widget>
<resources/>
<connections/>
Expand Down
10 changes: 7 additions & 3 deletions Sample/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ def loadData(self):
# for user in users.each():
# if user.val()['Blood Group'] == 'A+' and user.val()['Location'] == 'Ranchi':
# data = (user.val())
data = [{'Age': '22', 'Blood Group': 'A+', 'Location': 'Kolkata', 'Name': 'Rahul',
'Phone Number': '9708942540'},
{'Age': '32', 'Blood Group': 'O+', 'Location': 'Ranchi', 'Name': 'Aman', 'Phone Number': '1234567890'}]
# data = [{'Age': '22', 'Blood Group': 'A+', 'Location': 'Kolkata', 'Name': 'Rahul',
# 'Phone Number': '9708942540'},
# {'Age': '32', 'Blood Group': 'O+', 'Location': 'Ranchi', 'Name': 'Aman', 'Phone Number': '1234567890'}]
data = [{'Age': '22', 'Blood Group': 'A+', 'Location': 'Ranchi', 'Name': 'Ayush Kumar',
'Phone Number': '9708943540', 'id': 'YSAaSlDDs9eL0k8qAOZuYwoGXg32'},
{'Age': '16', 'Blood Group': 'A+', 'Location': 'Ranchi', 'Name': 'Hiya', 'Phone Number': '1234567890',
'id': 'PF2x92c1CKWJCe1FWCvg4Z37bx32'}]
row = 0
self.tableWidget.setRowCount(len(data))
for person in data:
Expand Down

0 comments on commit 4df845f

Please sign in to comment.