Implemented "add" for educational qualification
authorHarishankar <v.harishankar@gmail.com>
Wed, 30 Nov 2011 05:30:12 +0000 (11:00 +0530)
committerHarishankar <v.harishankar@gmail.com>
Wed, 30 Nov 2011 05:30:12 +0000 (11:00 +0530)
Implemented the "add" button for educational qualification.

biacv_mainwindow.py
biacv_mainwindow.ui
biacv_mainwindow_ui.py

index 5b27e6d..3133477 100644 (file)
@@ -9,4 +9,16 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                self.setupUi (self)
 
        def on_add_education (self):
-               print "Education"
\ No newline at end of file
+               # check if the qualification title is set
+               if self.degree_name.text () == "":
+                       PyQt4.QtGui.QMessageBox.critical (self, "Cannot add", "Some required fields are missing.")
+               else:
+                       educationitem = PyQt4.QtGui.QTreeWidgetItem ([
+                                       self.degree_name.text (),
+                                       self.yearofpassing.date ().toString ("MMM, yyyy"),
+                                       self.institution.text (),
+                                       self.university.text (),
+                                       self.grade.text (),
+                                       str (self.percentage.value ())
+                       ])
+                       self.educationlist.addTopLevelItem (educationitem)
\ No newline at end of file
index 30f8de2..804b43b 100644 (file)
@@ -28,7 +28,7 @@
     <item row="1" column="0" colspan="2">
      <widget class="QTabWidget" name="pages">
       <property name="currentIndex">
-       <number>1</number>
+       <number>0</number>
       </property>
       <widget class="QWidget" name="tab">
        <attribute name="title">
          </widget>
         </item>
         <item row="5" column="0" colspan="8">
-         <widget class="QColumnView" name="educationlist">
+         <widget class="QTreeWidget" name="educationlist">
           <property name="sizePolicy">
            <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
             <horstretch>0</horstretch>
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
+          <column>
+           <property name="text">
+            <string>Degree</string>
+           </property>
+          </column>
+          <column>
+           <property name="text">
+            <string>Graduation date</string>
+           </property>
+          </column>
+          <column>
+           <property name="text">
+            <string>Institution</string>
+           </property>
+          </column>
+          <column>
+           <property name="text">
+            <string>University</string>
+           </property>
+          </column>
+          <column>
+           <property name="text">
+            <string>Grade</string>
+           </property>
+          </column>
+          <column>
+           <property name="text">
+            <string>Percentage</string>
+           </property>
+          </column>
          </widget>
         </item>
        </layout>
   <widget class="QStatusBar" name="statusbar"/>
   <action name="action_New">
    <property name="text">
-    <string>&amp;New...</string>
+    <string>&amp;New</string>
    </property>
   </action>
   <action name="action_Save">
    <property name="text">
-    <string>&amp;Open</string>
+    <string>&amp;Open...</string>
    </property>
   </action>
   <action name="action_Save_2">
index 65fbd07..5fa55f0 100644 (file)
@@ -2,7 +2,7 @@
 
 # Form implementation generated from reading ui file 'biacv_mainwindow.ui'
 #
-# Created: Wed Nov 30 10:05:57 2011
+# Created: Wed Nov 30 10:52:18 2011
 #      by: PyQt4 UI code generator 4.8.6
 #
 # WARNING! All changes made in this file will be lost!
@@ -266,13 +266,19 @@ class Ui_biacv_mainwindow(object):
         self.deleteeducation.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Delete", None, QtGui.QApplication.UnicodeUTF8))
         self.deleteeducation.setObjectName(_fromUtf8("deleteeducation"))
         self.gridLayout_3.addWidget(self.deleteeducation, 4, 7, 1, 1)
-        self.educationlist = QtGui.QColumnView(self.tab_2)
+        self.educationlist = QtGui.QTreeWidget(self.tab_2)
         sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         sizePolicy.setHorizontalStretch(0)
         sizePolicy.setVerticalStretch(0)
         sizePolicy.setHeightForWidth(self.educationlist.sizePolicy().hasHeightForWidth())
         self.educationlist.setSizePolicy(sizePolicy)
         self.educationlist.setObjectName(_fromUtf8("educationlist"))
+        self.educationlist.headerItem().setText(0, QtGui.QApplication.translate("biacv_mainwindow", "Degree", None, QtGui.QApplication.UnicodeUTF8))
+        self.educationlist.headerItem().setText(1, QtGui.QApplication.translate("biacv_mainwindow", "Graduation date", None, QtGui.QApplication.UnicodeUTF8))
+        self.educationlist.headerItem().setText(2, QtGui.QApplication.translate("biacv_mainwindow", "Institution", None, QtGui.QApplication.UnicodeUTF8))
+        self.educationlist.headerItem().setText(3, QtGui.QApplication.translate("biacv_mainwindow", "University", None, QtGui.QApplication.UnicodeUTF8))
+        self.educationlist.headerItem().setText(4, QtGui.QApplication.translate("biacv_mainwindow", "Grade", None, QtGui.QApplication.UnicodeUTF8))
+        self.educationlist.headerItem().setText(5, QtGui.QApplication.translate("biacv_mainwindow", "Percentage", None, QtGui.QApplication.UnicodeUTF8))
         self.gridLayout_3.addWidget(self.educationlist, 5, 0, 1, 8)
         self.pages.addTab(self.tab_2, _fromUtf8(""))
         self.tab_3 = QtGui.QWidget()
@@ -463,10 +469,10 @@ class Ui_biacv_mainwindow(object):
         self.statusbar.setObjectName(_fromUtf8("statusbar"))
         biacv_mainwindow.setStatusBar(self.statusbar)
         self.action_New = QtGui.QAction(biacv_mainwindow)
-        self.action_New.setText(QtGui.QApplication.translate("biacv_mainwindow", "&New...", None, QtGui.QApplication.UnicodeUTF8))
+        self.action_New.setText(QtGui.QApplication.translate("biacv_mainwindow", "&New", None, QtGui.QApplication.UnicodeUTF8))
         self.action_New.setObjectName(_fromUtf8("action_New"))
         self.action_Save = QtGui.QAction(biacv_mainwindow)
-        self.action_Save.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Open", None, QtGui.QApplication.UnicodeUTF8))
+        self.action_Save.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Open...", None, QtGui.QApplication.UnicodeUTF8))
         self.action_Save.setObjectName(_fromUtf8("action_Save"))
         self.action_Save_2 = QtGui.QAction(biacv_mainwindow)
         self.action_Save_2.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Save", None, QtGui.QApplication.UnicodeUTF8))
@@ -501,7 +507,7 @@ class Ui_biacv_mainwindow(object):
         self.menubar.addAction(self.menu_Help.menuAction())
 
         self.retranslateUi(biacv_mainwindow)
-        self.pages.setCurrentIndex(1)
+        self.pages.setCurrentIndex(0)
         QtCore.QObject.connect(self.addeducation, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_add_education)
         QtCore.QMetaObject.connectSlotsByName(biacv_mainwindow)