Delete education qualification from list
authorHarishankar <v.harishankar@gmail.com>
Wed, 30 Nov 2011 07:14:46 +0000 (12:44 +0530)
committerHarishankar <v.harishankar@gmail.com>
Wed, 30 Nov 2011 07:14:46 +0000 (12:44 +0530)
Implemented deleting educational qualification from
the list

biacv_mainwindow.py
biacv_mainwindow.ui
biacv_mainwindow_ui.py

index 3133477..ac393f7 100644 (file)
@@ -7,7 +7,27 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
        def __init__ (self):
                PyQt4.QtGui.QMainWindow.__init__ (self)
                self.setupUi (self)
+               self.currentfile = None
 
+       # delete educational qualification
+       def on_delete_education (self):
+               # get the selected items in the education list
+               selitems = self.educationlist.selectedItems ()
+               # if no items are selected
+               if selitems == []:
+                       PyQt4.QtGui.QMessageBox.critical (self, "Cannot delete", "No items selected.")
+               # delete the items after confirmation
+               else:
+                       ans = PyQt4.QtGui.QMessageBox.question (self, "Confirm",
+                               "Are you sure you wish to delete selected item?",
+                               PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
+                       if ans == PyQt4.QtGui.QMessageBox.Yes:
+                               # remove the item selected
+                               for item in selitems:
+                                       self.educationlist.takeTopLevelItem (self.educationlist.indexOfTopLevelItem (item))
+
+
+       # add educational qualification button
        def on_add_education (self):
                # check if the qualification title is set
                if self.degree_name.text () == "":
@@ -21,4 +41,4 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                                        self.grade.text (),
                                        str (self.percentage.value ())
                        ])
-                       self.educationlist.addTopLevelItem (educationitem)
\ No newline at end of file
+                       self.educationlist.addTopLevelItem (educationitem)
index 804b43b..7abd581 100644 (file)
          </widget>
         </item>
         <item row="4" column="6">
-         <widget class="QPushButton" name="editeducation">
+         <widget class="QPushButton" name="updateeducation">
           <property name="text">
-           <string>&amp;Edit</string>
+           <string>&amp;Update</string>
           </property>
          </widget>
         </item>
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
+          <property name="alternatingRowColors">
+           <bool>true</bool>
+          </property>
+          <property name="rootIsDecorated">
+           <bool>false</bool>
+          </property>
+          <property name="uniformRowHeights">
+           <bool>true</bool>
+          </property>
           <column>
            <property name="text">
             <string>Degree</string>
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>deleteeducation</sender>
+   <signal>clicked()</signal>
+   <receiver>biacv_mainwindow</receiver>
+   <slot>on_delete_education()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>677</x>
+     <y>198</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>728</x>
+     <y>437</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>on_add_education()</slot>
+  <slot>on_delete_education()</slot>
  </slots>
 </ui>
index 5fa55f0..b98aa3d 100644 (file)
@@ -2,7 +2,7 @@
 
 # Form implementation generated from reading ui file 'biacv_mainwindow.ui'
 #
-# Created: Wed Nov 30 10:52:18 2011
+# Created: Wed Nov 30 12:43:29 2011
 #      by: PyQt4 UI code generator 4.8.6
 #
 # WARNING! All changes made in this file will be lost!
@@ -258,10 +258,10 @@ class Ui_biacv_mainwindow(object):
         self.addeducation.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Add", None, QtGui.QApplication.UnicodeUTF8))
         self.addeducation.setObjectName(_fromUtf8("addeducation"))
         self.gridLayout_3.addWidget(self.addeducation, 4, 4, 1, 2)
-        self.editeducation = QtGui.QPushButton(self.tab_2)
-        self.editeducation.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Edit", None, QtGui.QApplication.UnicodeUTF8))
-        self.editeducation.setObjectName(_fromUtf8("editeducation"))
-        self.gridLayout_3.addWidget(self.editeducation, 4, 6, 1, 1)
+        self.updateeducation = QtGui.QPushButton(self.tab_2)
+        self.updateeducation.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Update", None, QtGui.QApplication.UnicodeUTF8))
+        self.updateeducation.setObjectName(_fromUtf8("updateeducation"))
+        self.gridLayout_3.addWidget(self.updateeducation, 4, 6, 1, 1)
         self.deleteeducation = QtGui.QPushButton(self.tab_2)
         self.deleteeducation.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Delete", None, QtGui.QApplication.UnicodeUTF8))
         self.deleteeducation.setObjectName(_fromUtf8("deleteeducation"))
@@ -272,6 +272,9 @@ class Ui_biacv_mainwindow(object):
         sizePolicy.setVerticalStretch(0)
         sizePolicy.setHeightForWidth(self.educationlist.sizePolicy().hasHeightForWidth())
         self.educationlist.setSizePolicy(sizePolicy)
+        self.educationlist.setAlternatingRowColors(True)
+        self.educationlist.setRootIsDecorated(False)
+        self.educationlist.setUniformRowHeights(True)
         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))
@@ -509,6 +512,7 @@ class Ui_biacv_mainwindow(object):
         self.retranslateUi(biacv_mainwindow)
         self.pages.setCurrentIndex(0)
         QtCore.QObject.connect(self.addeducation, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_add_education)
+        QtCore.QObject.connect(self.deleteeducation, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_delete_education)
         QtCore.QMetaObject.connectSlotsByName(biacv_mainwindow)
 
     def retranslateUi(self, biacv_mainwindow):