Update skill set implemented
authorHarishankar <v.harishankar@gmail.com>
Thu, 1 Dec 2011 13:01:48 +0000 (18:31 +0530)
committerHarishankar <v.harishankar@gmail.com>
Thu, 1 Dec 2011 13:01:48 +0000 (18:31 +0530)
Completed implementing the update skill set list
functionality.

biacv_mainwindow.py
biacv_mainwindow.ui
biacv_mainwindow_ui.py

index 99e6b7c..6ec4d1a 100644 (file)
@@ -9,6 +9,35 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                self.setupUi (self)
                self.currentfile = None
 
+       # update the skill set button event
+       def on_update_skill (self):
+               # get the selected item
+               selitems = self.skillslist.selectedItems ()
+               if selitems == []:
+                       PyQt4.QtGui.QMessageBox.critical (self, "Cannot update", "No item selected.")
+                       return
+               if self.skillsettitle.text () == "":
+                       PyQt4.QtGui.QMessageBox.critical (self, "Cannot update", "A required field is missing.")
+                       return
+               selitem = selitems[0]
+
+               selitem.setText (0, self.skillsettitle.text ())
+               selitem.setText (1, self.skilldescription.toPlainText ())
+
+       # selecting a skill from the list event
+       def on_select_skill (self):
+               self.set_skill_fields ()
+
+       # set the skill fields from the selected skill from the list
+       def set_skill_fields (self):
+               # get the selected items
+               selitems = self.skillslist.selectedItems ()
+               if selitems == []:
+                       return
+               selitem = selitems[0]
+               self.skillsettitle.setText (selitem.text (0))
+               self.skilldescription.setPlainText (selitem.text (1))
+
        # delete skill set button is clicked
        def on_delete_skill (self):
                # get the selected items
index 156dd06..2132054 100644 (file)
          </widget>
         </item>
         <item row="2" column="2">
-         <widget class="QPushButton" name="editskill">
+         <widget class="QPushButton" name="updateskill">
           <property name="text">
-           <string>&amp;Edit</string>
+           <string>&amp;Update</string>
           </property>
          </widget>
         </item>
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>skillslist</sender>
+   <signal>activated(QModelIndex)</signal>
+   <receiver>biacv_mainwindow</receiver>
+   <slot>on_select_skill()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>453</x>
+     <y>359</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>730</x>
+     <y>279</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>skillslist</sender>
+   <signal>itemSelectionChanged()</signal>
+   <receiver>biacv_mainwindow</receiver>
+   <slot>on_select_skill()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>602</x>
+     <y>331</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>726</x>
+     <y>413</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>updateskill</sender>
+   <signal>clicked()</signal>
+   <receiver>biacv_mainwindow</receiver>
+   <slot>on_update_skill()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>437</x>
+     <y>243</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>728</x>
+     <y>360</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>on_add_education()</slot>
   <slot>on_update_profession()</slot>
   <slot>on_add_skill()</slot>
   <slot>on_delete_skill()</slot>
+  <slot>on_select_skill()</slot>
+  <slot>on_update_skill()</slot>
  </slots>
 </ui>
index fa451f8..abad310 100644 (file)
@@ -2,7 +2,7 @@
 
 # Form implementation generated from reading ui file 'biacv_mainwindow.ui'
 #
-# Created: Thu Dec  1 15:41:51 2011
+# Created: Thu Dec  1 18:29:14 2011
 #      by: PyQt4 UI code generator 4.8.6
 #
 # WARNING! All changes made in this file will be lost!
@@ -409,10 +409,10 @@ class Ui_biacv_mainwindow(object):
         self.addskill.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Add", None, QtGui.QApplication.UnicodeUTF8))
         self.addskill.setObjectName(_fromUtf8("addskill"))
         self.gridLayout_5.addWidget(self.addskill, 2, 1, 1, 1)
-        self.editskill = QtGui.QPushButton(self.tab_4)
-        self.editskill.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Edit", None, QtGui.QApplication.UnicodeUTF8))
-        self.editskill.setObjectName(_fromUtf8("editskill"))
-        self.gridLayout_5.addWidget(self.editskill, 2, 2, 1, 1)
+        self.updateskill = QtGui.QPushButton(self.tab_4)
+        self.updateskill.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Update", None, QtGui.QApplication.UnicodeUTF8))
+        self.updateskill.setObjectName(_fromUtf8("updateskill"))
+        self.gridLayout_5.addWidget(self.updateskill, 2, 2, 1, 1)
         self.deleteskill = QtGui.QPushButton(self.tab_4)
         self.deleteskill.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Delete", None, QtGui.QApplication.UnicodeUTF8))
         self.deleteskill.setObjectName(_fromUtf8("deleteskill"))
@@ -569,6 +569,9 @@ class Ui_biacv_mainwindow(object):
         QtCore.QObject.connect(self.updatehistory, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_update_profession)
         QtCore.QObject.connect(self.addskill, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_add_skill)
         QtCore.QObject.connect(self.deleteskill, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_delete_skill)
+        QtCore.QObject.connect(self.skillslist, QtCore.SIGNAL(_fromUtf8("activated(QModelIndex)")), biacv_mainwindow.on_select_skill)
+        QtCore.QObject.connect(self.skillslist, QtCore.SIGNAL(_fromUtf8("itemSelectionChanged()")), biacv_mainwindow.on_select_skill)
+        QtCore.QObject.connect(self.updateskill, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_update_skill)
         QtCore.QMetaObject.connectSlotsByName(biacv_mainwindow)
 
     def retranslateUi(self, biacv_mainwindow):