Skip to content

Instantly share code, notes, and snippets.

@alyakhtar
Last active August 29, 2015 14:24
Show Gist options
  • Save alyakhtar/c9c5f285dbe1ac42da4a to your computer and use it in GitHub Desktop.
Save alyakhtar/c9c5f285dbe1ac42da4a to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Importing the required Modules
import psycopg2
import sys
from PyQt4 import QtCore, QtGui
from GUI import Ui_Dialog
con = None
# global_var= ''
#Connecting with the Database
def create_connection(database , user):
cur_db = database
cur_usr = user
try:
con = psycopg2.connect(database = cur_db , user = cur_usr , password = '123456')
except:
con = -1
return con
#Creating Tables
def create_tables(con):
cur = con.cursor()
cur.execute("CREATE TABLE student(Stu_ID INTEGER PRIMARY KEY, Name VARCHAR(40), Address VARCHAR(10) , Sex VARCHAR(5))")
cur.execute("CREATE TABLE department(Dep_Code INTEGER PRIMARY KEY, Dep_Name VARCHAR(40))")
cur.execute("CREATE TABLE course(Cour_No INTEGER PRIMARY KEY , Cour_Name VARCHAR(20))")
cur.execute("CREATE TABLE section(Sec_No INTEGER PRIMARY KEY, Sem VARCHAR(10) ,Year INTEGER)")
cur.execute("CREATE TABLE grade_report(Letter_Grade VARCHAR(2), Num_Grade INTEGER)")
cur.execute("CREATE TABLE log(S_ID INTEGER)")
cur.execute("CREATE TABLE company(ID INTEGER NOT NULL UNIQUE , Name VARCHAR(10) NOT NULL)")
con.commit()
#Insering sample data
def insert_data(con):
cur = con.cursor()
cur.execute("INSERT INTO student VALUES(3 , 'Gama' , 'Delhi' , 'Male')")
cur.execute("INSERT INTO student VALUES(2 , 'Beta' , 'Mumbai' , 'Male')")
cur.execute("INSERT INTO department VALUES(305 , 'Computer Engineering')")
cur.execute("INSERT INTO course VALUES(101 , 'Operating System' )")
con.commit()
#Print data
def show_tables(con):
cur = con.cursor()
cur.execute("SELECT * FROM student")
resp = cur.fetchall()
for row in resp:
print row
#Creating Functions
def create_function(con):
cur = con.cursor()
psql_command = '''CREATE OR REPLACE FUNCTION show_rec_name (rec_id INTEGER , sample CHAR(10))
RETURNS char(20) AS $rec_name$
declare
rec_name char(20);
BEGIN
SELECT name into rec_name FROM student WHERE stu_id = rec_id;
RETURN rec_name;
END;
$rec_name$ LANGUAGE plpgsql;'''
cur.execute(psql_command)
con.commit()
#Testing fucntion with sample input
def func_test():
cur = con.cursor()
cur.execute("select show_rec_name(2)")
resp=cur.fetchone()
print resp[0]
con.commit()
#Creating Views
def create_view(con):
cur = con.cursor()
psql_command = '''CREATE VIEW student_view2 AS
SELECT student.Stu_Id, student.Name, course.Cour_No
FROM student,course;'''
cur.execute(psql_command)
con.commit()
#Creating Triggers
def create_trigger(con):
cur = con.cursor()
psql_command = '''CREATE OR REPLACE FUNCTION log_add_entry()
RETURNS trigger AS $stu$
BEGIN
INSERT INTO log VALUES(new.Stu_ID);
RETURN NEW;
END;
$stu$ LANGUAGE plpgsql;'''
cur.execute(psql_command)
psql_command = '''CREATE TRIGGER test_trig AFTER INSERT ON student
FOR EACH ROW EXECUTE PROCEDURE log_add_entry();'''
cur.execute(psql_command)
con.commit()
#Creating TablesForIndexes
def create_indexes(con):
cur = con.cursor()
cur.execute("CREATE TABLE test (a int, b int, c int, constraint pk_test primary key(a, b))")
cur.execute("CREATE TABLE test2 (a int, b int, c int, constraint uk_test2 unique (b, c))")
cur.execute("CREATE TABLE test3 (a int, b int, c int, constraint uk_test3b unique (b), constraint uk_test3c unique (c),constraint uk_test3ab unique (a, b))")
con.commit()
#Extracting the Tables Info from database
def meta_crawl_tables(con):
cur = con.cursor()
tables=[]
cur.execute("SELECT table_name FROM information_schema.tables "
"WHERE table_schema='public' "
"AND table_type='BASE TABLE'");
resp = cur.fetchall()
for row in resp:
global tables
tables.append(row[0])
#Extracting the Columns Info from database
def meta_crawl_columns(con , tables):
cur = con.cursor()
to_d_col=[]
for table in tables:
cur.execute("SELECT column_name,data_type,character_maximum_length "
"FROM information_schema.columns "
"WHERE table_name = '" + table + "'");
resp = cur.fetchall()
for row in resp:
columns=[]
global columns
global to_d_col
columns.append(table)
columns.append(row[0])
columns.append(row[1])
columns.append(row[2])
to_d_col.append(columns)
#DataTypeID to DataTypeName Mapping
def typeid_to_typename(con , id):
cur = con.cursor()
cur.execute("SELECT typname from pg_type WHERE oid = " + str(id))
resp = cur.fetchone()
return resp[0]
#Extracting the Functions Info from database
def meta_crawl_functions(con):
cur = con.cursor()
to_d_func=[]
user_func=[]
cur.execute("SELECT routine_name FROM information_schema.routines WHERE specific_schema = 'public'")
resp=cur.fetchall()
for row in resp:
user_func.append(row[0])
cur.execute("SELECT proname, prorettype, pronargs, proargnames , proargtypes from pg_proc WHERE proname IN " + str(tuple(user_func)))
resp = cur.fetchall()
for row in resp:
functions=[]
global to_d_func
ret_type_list=[]
functions.append(row[0])
functions.append(typeid_to_typename(con , row[1]))
functions.append(row[2])
functions.append(row[3])
ret_arg = row[4].split()
for item in ret_arg:
ret_type_list.append(typeid_to_typename(con , item))
functions.append(ret_type_list)
to_d_func.append(functions)
#Extracting the Triggers Info from database
def meta_crawl_triggers(con):
cur = con.cursor()
to_d_trig=[]
cur.execute("SELECT trigger_name, action_timing, event_manipulation, event_object_table FROM information_schema.triggers")
resp=cur.fetchall()
for row in resp:
triggers=[]
global to_d_trig
triggers.append(row[0])
triggers.append(row[1])
triggers.append(row[2])
triggers.append(row[3])
to_d_trig.append(triggers)
#Extracting the Views Info from database
def meta_crawl_views(con):
cur = con.cursor()
to_d_view=[]
cur.execute("SELECT table_name FROM information_schema.views WHERE table_schema = 'public'")
resp=cur.fetchall()
for row in resp:
view=[]
view.append(row[0])
tb=[]
cur.execute("SELECT table_name FROM information_schema.view_table_usage WHERE view_name = '"+ str(row[0]) +"'")
sub_resp = cur.fetchall()
for item in sub_resp:
tb.append(item[0])
col=[]
cur.execute("SELECT column_name FROM information_schema.view_column_usage WHERE view_name = '"+ str(row[0]) +"'")
sub_resp = cur.fetchall()
for item in sub_resp:
col.append(item[0])
view.append(tb)
view.append(col)
global to_d_view
to_d_view.append(view)
#Extracting the Constraints Info from database
def meta_crawl_constraints(con):
cur = con.cursor()
cons=[]
to_d_cons=[]
cur.execute("SELECT constraint_name, column_name, table_name "
"FROM information_schema.constraint_column_usage")
resp = cur.fetchall()
for row in resp:
cons=[]
global to_d_cons
cons.append(row[0])
cons.append(row[1])
cons.append(row[2])
to_d_cons.append(cons)
#Extracting the Indexes Info from database
def meta_crawl_indexes(con):
cur = con.cursor();
ind=[]
to_d_ind=[]
cur.execute("SELECT i.relname,t.relname,array_to_string(array_agg(a.attname), ', ') "
"FROM pg_class t, pg_class i, pg_index ix, pg_attribute a "
"WHERE t.oid = ix.indrelid and i.oid = ix.indexrelid and a.attrelid = t.oid and a.attnum = ANY(ix.indkey) and t.relkind = 'r' and t.relname like 'test%' "
"GROUP BY t.relname, i.relname "
"ORDER BY t.relname, i.relname")
resp = cur.fetchall()
for row in resp:
ind=[]
global to_d_ind
ind.append(row[0])
ind.append(row[1])
ind.append(row[2])
to_d_ind.append(ind)
#Creating GUI
class MyDialog(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Dialog()
self.ui.setupUi(self)
self.ui.pushButton.clicked.connect(self.NEXT)
self.ui.pushButton_2.clicked.connect(self.CANCEL)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication))
self.pushButton.setText(QtGui.QApplication.translate("Dialog", "OKAY", None, QtGui.QApplication))
self.label.setText(QtGui.QApplication.translate("Dialog", "WRONG DETAILS GIVEN", None, QtGui.QApplication))
def NEXT(self):
# text = self.ui.textEdit.toPlainText()
text = self.ui.lineEdit.text()
text2 = self.ui.lineEdit_2.text()
text3 = self.ui.lineEdit_3.text()
text4 = self.ui.lineEdit_4.text()
text5 = self.ui.lineEdit_5.text()
var = create_connection(text4, text2)
global var
# print global_var
if (var != -1):
print "were in"
myapp2 = MyDialog2()
# myapp.hide()
myapp2.show()
elif(var == -1):
print "were not in"
def CANCEL(self):
self.close()
class MyDialog2(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Dialog2()
self.ui.setupUi(self)
self.ui.pushButton_5.clicked.connect(self.BACK)
def BACK(self):
# myapp2.hide()
myapp.show()
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_Dialog2(object):
def setupUi(self, Dialog):
# database = "mydb"
# user = "postgres"
# con = create_connection(database, user)
con = var
print con
meta_crawl_tables(con)
meta_crawl_columns(con , tables)
meta_crawl_functions(con)
meta_crawl_triggers(con)
meta_crawl_views(con)
meta_crawl_constraints(con)
meta_crawl_indexes(con)
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.setGeometry(350, 200, 700, 400)
Dialog.setWindowTitle('HEISENBERG')
self.verticalLayout = QtGui.QVBoxLayout(Dialog)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.tabWidget = QtGui.QTabWidget(Dialog)
self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
self.tab = QtGui.QWidget()
self.tab.setObjectName(_fromUtf8("tab"))
self.horizontalLayout = QtGui.QHBoxLayout(self.tab)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.tableWidget_7 = QtGui.QTableWidget(self.tab)
self.tableWidget_7.setGridStyle(QtCore.Qt.NoPen)
self.tableWidget_7.setObjectName(_fromUtf8("tableWidget_7s"))
self.tableWidget_7.setColumnCount(1)
item = QtGui.QTableWidgetItem()
self.tableWidget_7.setRowCount(len(tables))
self.tableWidget_7.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
item = self.tableWidget_7.horizontalHeaderItem(0)
item.setText("TABLES")
for i, row in enumerate(tables):
# for j, value in enumerate(row):
item = QtGui.QTableWidgetItem("%s"% row)
self.tableWidget_7.setItem(i, 0, item)
self.horizontalLayout.addWidget(self.tableWidget_7)
self.tableWidget_7.setColumnWidth(0, 160);
self.tableWidget_7.setColumnWidth(1, 160);
self.tableWidget_7.setColumnWidth(2, 180);
self.tableWidget_7.setColumnWidth(3, 120);
self.tabWidget.addTab(self.tab, _fromUtf8(""))
self.tab_2 = QtGui.QWidget()
self.tab_2.setObjectName(_fromUtf8("tab_2"))
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.tab_2)
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.tableWidget = QtGui.QTableWidget(self.tab_2)
# self.tableWidget.setGridStyle(QtCore.Qt.NoPen)
self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
self.tableWidget.setColumnCount(4)
item = QtGui.QTableWidgetItem()
self.tableWidget.setRowCount(len(to_d_col))
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(3, item)
item = QtGui.QTableWidgetItem()
item = self.tableWidget.horizontalHeaderItem(0)
item.setText("TABLE")
item = self.tableWidget.horizontalHeaderItem(1)
item.setText("COLUMN")
item = self.tableWidget.horizontalHeaderItem(2)
item.setText("TYPE")
item = self.tableWidget.horizontalHeaderItem(3)
item.setText("LENGTH")
for i, row in enumerate(to_d_col):
for j, value in enumerate(row):
item = QtGui.QTableWidgetItem("%s"% value)
self.tableWidget.setItem(i, j, item)
self.horizontalLayout_2.addWidget(self.tableWidget)
self.tableWidget.setColumnWidth(0, 160);
self.tableWidget.setColumnWidth(1, 160);
self.tableWidget.setColumnWidth(2, 180);
self.tableWidget.setColumnWidth(3, 120);
self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
self.tab_3 = QtGui.QWidget()
self.tab_3.setObjectName(_fromUtf8("tab_3"))
self.horizontalLayout_3 = QtGui.QHBoxLayout(self.tab_3)
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.tableWidget_2 = QtGui.QTableWidget(self.tab_3)
self.tableWidget_2.setObjectName(_fromUtf8("tableWidget_2"))
self.tableWidget_2.setColumnCount(5)
item = QtGui.QTableWidgetItem()
self.tableWidget_2.setRowCount(len(to_d_func))
self.tableWidget_2.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(3, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(4, item)
item = QtGui.QTableWidgetItem()
item = self.tableWidget_2.horizontalHeaderItem(0)
item.setText("FUNCTION")
item = self.tableWidget_2.horizontalHeaderItem(1)
item.setText("TYPE")
item = self.tableWidget_2.horizontalHeaderItem(2)
item.setText("ARGUMENTS")
item = self.tableWidget_2.horizontalHeaderItem(3)
item.setText("ARGUMENT NAME")
item = self.tableWidget_2.horizontalHeaderItem(4)
item.setText("ARGUMENT TYPE")
for i, row in enumerate(to_d_func):
for j, value in enumerate(row):
item = QtGui.QTableWidgetItem("%s"% value)
self.tableWidget_2.setItem(i, j, item)
self.horizontalLayout_3.addWidget(self.tableWidget_2)
self.tableWidget_2.setColumnWidth(0, 150);
self.tableWidget_2.setColumnWidth(1, 100);
self.tableWidget_2.setColumnWidth(2, 100);
self.tableWidget_2.setColumnWidth(3, 140);
self.tableWidget_2.setColumnWidth(4, 140);
self.tabWidget.addTab(self.tab_3, _fromUtf8(""))
self.tab_4 = QtGui.QWidget()
self.tab_4.setObjectName(_fromUtf8("tab_4"))
self.horizontalLayout_4 = QtGui.QHBoxLayout(self.tab_4)
self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
self.tableWidget_3 = QtGui.QTableWidget(self.tab_4)
self.tableWidget_3.setObjectName(_fromUtf8("tableWidget_3"))
self.tableWidget_3.setColumnCount(4)
item = QtGui.QTableWidgetItem()
self.tableWidget_3.setRowCount(len(to_d_trig))
self.tableWidget_3.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_3.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_3.setHorizontalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_3.setHorizontalHeaderItem(3, item)
item = QtGui.QTableWidgetItem()
item = self.tableWidget_3.horizontalHeaderItem(0)
item.setText("TRIGGER")
item = self.tableWidget_3.horizontalHeaderItem(1)
item.setText("ACTION")
item = self.tableWidget_3.horizontalHeaderItem(2)
item.setText("EVENT")
item = self.tableWidget_3.horizontalHeaderItem(3)
item.setText("TABLE")
for i, row in enumerate(to_d_trig):
for j, value in enumerate(row):
item = QtGui.QTableWidgetItem("%s"% value)
self.tableWidget_3.setItem(i, j, item)
self.horizontalLayout_4.addWidget(self.tableWidget_3)
self.tableWidget_3.setColumnWidth(0, 170);
self.tableWidget_3.setColumnWidth(1, 160);
self.tableWidget_3.setColumnWidth(2, 180);
self.tableWidget_3.setColumnWidth(3, 120);
self.tabWidget.addTab(self.tab_4, _fromUtf8(""))
self.tab_5 = QtGui.QWidget()
self.tab_5.setObjectName(_fromUtf8("tab_5"))
self.horizontalLayout_5 = QtGui.QHBoxLayout(self.tab_5)
self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
self.tableWidget_4 = QtGui.QTableWidget(self.tab_5)
self.tableWidget_4.setObjectName(_fromUtf8("tableWidget_4"))
self.tableWidget_4.setColumnCount(3)
item = QtGui.QTableWidgetItem()
self.tableWidget_4.setRowCount(len(to_d_view))
self.tableWidget_4.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_4.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_4.setHorizontalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
item = self.tableWidget_4.horizontalHeaderItem(0)
item.setText("VIEW")
item = self.tableWidget_4.horizontalHeaderItem(1)
item.setText("TABLES")
item = self.tableWidget_4.horizontalHeaderItem(2)
item.setText("COLUMNS")
for i, row in enumerate(to_d_view):
for j, value in enumerate(row):
item = QtGui.QTableWidgetItem("%s"% value)
self.tableWidget_4.setItem(i, j, item)
self.horizontalLayout_5.addWidget(self.tableWidget_4)
self.tableWidget_4.setColumnWidth(0, 200);
self.tableWidget_4.setColumnWidth(1, 220);
self.tableWidget_4.setColumnWidth(2, 210);
self.tabWidget.addTab(self.tab_5, _fromUtf8(""))
self.tab_7 = QtGui.QWidget()
self.tab_7.setObjectName(_fromUtf8("tab_7"))
self.horizontalLayout_7 = QtGui.QHBoxLayout(self.tab_7)
self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7"))
self.tableWidget_5 = QtGui.QTableWidget(self.tab_7)
self.tableWidget_5.setObjectName(_fromUtf8("tableWidget_5"))
self.tableWidget_5.setColumnCount(3)
item = QtGui.QTableWidgetItem()
self.tableWidget_5.setRowCount(len(to_d_ind))
self.tableWidget_5.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_5.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_5.setHorizontalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
item = self.tableWidget_5.horizontalHeaderItem(0)
item.setText("INDEX")
item = self.tableWidget_5.horizontalHeaderItem(1)
item.setText("TABLES")
item = self.tableWidget_5.horizontalHeaderItem(2)
item.setText("COLUMNS")
for i, row in enumerate(to_d_ind):
for j, value in enumerate(row):
item = QtGui.QTableWidgetItem("%s"% value)
self.tableWidget_5.setItem(i, j, item)
self.horizontalLayout_7.addWidget(self.tableWidget_5)
self.tableWidget_5.setColumnWidth(0, 200);
self.tableWidget_5.setColumnWidth(1, 220);
self.tableWidget_5.setColumnWidth(2, 210);
self.tabWidget.addTab(self.tab_7, _fromUtf8(""))
self.tab_8 = QtGui.QWidget()
self.tab_8.setObjectName(_fromUtf8("tab_8"))
self.horizontalLayout_8 = QtGui.QHBoxLayout(self.tab_8)
self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8"))
self.tableWidget_6 = QtGui.QTableWidget(self.tab_8)
self.tableWidget_6.setObjectName(_fromUtf8("tableWidget_6"))
self.tableWidget_6.setColumnCount(3)
item = QtGui.QTableWidgetItem()
self.tableWidget_6.setRowCount(len(to_d_cons))
self.tableWidget_6.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_6.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_6.setHorizontalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
item = self.tableWidget_6.horizontalHeaderItem(0)
item.setText("VIEW")
item = self.tableWidget_6.horizontalHeaderItem(1)
item.setText("TABLES")
item = self.tableWidget_6.horizontalHeaderItem(2)
item.setText("COLUMNS")
for i, row in enumerate(to_d_cons):
for j, value in enumerate(row):
item = QtGui.QTableWidgetItem("%s"% value)
self.tableWidget_6.setItem(i, j, item)
self.horizontalLayout_8.addWidget(self.tableWidget_6)
self.tableWidget_6.setColumnWidth(0, 200);
self.tableWidget_6.setColumnWidth(1, 220);
self.tableWidget_6.setColumnWidth(2, 210);
self.tabWidget.addTab(self.tab_8, _fromUtf8(""))
self.tab_6 = QtGui.QWidget()
self.tab_6.setObjectName(_fromUtf8("tab_6"))
self.horizontalLayout_6 = QtGui.QHBoxLayout(self.tab_6)
self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
self.listWidget_6 = QtGui.QListWidget(self.tab_6)
self.listWidget_6.setObjectName(_fromUtf8("listWidget_6"))
item = QtGui.QListWidgetItem("\nTotal Number of Tables : %i"% len(tables))
self.listWidget_6.addItem(item)
item = QtGui.QListWidgetItem("\nTotal Number of Columns : %i"% len(to_d_col))
self.listWidget_6.addItem(item)
item = QtGui.QListWidgetItem("\nTotal Number of Functions : %i"% len(to_d_func))
self.listWidget_6.addItem(item)
item = QtGui.QListWidgetItem("\nTotal Number of Triggers : %i"% len(to_d_trig))
self.listWidget_6.addItem(item)
item = QtGui.QListWidgetItem("\nTotal Number of Views : %i"% len(to_d_view))
self.listWidget_6.addItem(item)
item = QtGui.QListWidgetItem("\nTotal Number of Indexes : %i"% len(to_d_ind))
self.listWidget_6.addItem(item)
item = QtGui.QListWidgetItem("\nTotal Number of Constraints : %i"% len(to_d_cons))
self.listWidget_6.addItem(item)
self.horizontalLayout_6.addWidget(self.listWidget_6)
self.tabWidget.addTab(self.tab_6, _fromUtf8(""))
self.verticalLayout.addWidget(self.tabWidget)
self.pushButton_5 = QtGui.QPushButton(Dialog)
self.pushButton_5.setObjectName(_fromUtf8("pushButton_5"))
self.verticalLayout.addWidget(self.pushButton_5)
self.retranslateUi(Dialog)
self.tabWidget.setCurrentIndex(7)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("Dialog", "Tables", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("Dialog", "Columns", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QtGui.QApplication.translate("Dialog", "Functions", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), QtGui.QApplication.translate("Dialog", "Triggers", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), QtGui.QApplication.translate("Dialog", "Views", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), QtGui.QApplication.translate("Dialog", "Summary", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_7), QtGui.QApplication.translate("Dialog", "Indexes", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_8), QtGui.QApplication.translate("Dialog", "Constraints", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_5.setText(QtGui.QApplication.translate("Dialog", "BACK", None, QtGui.QApplication.UnicodeUTF8))
#Main
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = MyDialog()
# myapp2 = MyDialog2()
myapp.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment