+# BiaCV
# class for main window
import PyQt4
self.setupUi (self)
self.currentfile = None
+ # update a language in the list of languages
+ def on_update_lang (self):
+ # get the selected language
+ selitems = self.languageslist.selectedItems ()
+ if selitems == []:
+ PyQt4.QtGui.QMessageBox.critical (self, "Cannot update", "No item selected.")
+ return
+ # check if the language string is not empty
+ if self.language.text () == "":
+ PyQt4.QtGui.QMessageBox.critical (self, "Cannot update", "A required field is missing.")
+ return
+ selitem = selitems[0]
+ selitem.setText (0, self.language.text ())
+ selitem.setText (1, str (self.canspeak.isChecked ()))
+ selitem.setText (2, str (self.canreadwrite.isChecked ()))
+ selitem.setText (3, str (self.isproficient.isChecked ()))
+
+ # selecting a language from the list of languages
+ def on_select_lang (self):
+ # set the language fields from the selected item
+ self.set_language_fields ()
+
# delete a language from the list of languages known
def on_delete_lang (self):
# get selected language
self.languageslist.addTopLevelItem (langitem)
self.reset_language_fields ()
+ # set the language fields from the selected item
+ def set_language_fields (self):
+ selitems = self.languageslist.selectedItems ()
+ if selitems == []:
+ return
+ selitem = selitems[0]
+ self.language.setText (selitem.text (0))
+ self.canspeak.setChecked (selitem.text (1) == "True")
+ self.canreadwrite.setChecked (selitem.text(2) == "True")
+ self.isproficient.setChecked (selitem.text(3) == "True")
+
# reset the language fields
def reset_language_fields (self):
self.language.setText ("")
</hint>
</hints>
</connection>
+ <connection>
+ <sender>languageslist</sender>
+ <signal>activated(QModelIndex)</signal>
+ <receiver>biacv_mainwindow</receiver>
+ <slot>on_select_lang()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>554</x>
+ <y>224</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>730</x>
+ <y>118</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>languageslist</sender>
+ <signal>itemSelectionChanged()</signal>
+ <receiver>biacv_mainwindow</receiver>
+ <slot>on_select_lang()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>617</x>
+ <y>189</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>730</x>
+ <y>314</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>updatelanguage</sender>
+ <signal>clicked()</signal>
+ <receiver>biacv_mainwindow</receiver>
+ <slot>on_update_lang()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>605</x>
+ <y>140</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>729</x>
+ <y>462</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
<slots>
<slot>on_add_education()</slot>
<slot>on_update_skill()</slot>
<slot>on_add_lang()</slot>
<slot>on_delete_lang()</slot>
+ <slot>on_select_lang()</slot>
+ <slot>on_update_lang()</slot>
</slots>
</ui>
# Form implementation generated from reading ui file 'biacv_mainwindow.ui'
#
-# Created: Fri Dec 2 10:24:51 2011
+# Created: Fri Dec 2 10:52:04 2011
# by: PyQt4 UI code generator 4.8.6
#
# WARNING! All changes made in this file will be lost!
QtCore.QObject.connect(self.updateskill, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_update_skill)
QtCore.QObject.connect(self.addlanguage, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_add_lang)
QtCore.QObject.connect(self.deletelanguage, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_delete_lang)
+ QtCore.QObject.connect(self.languageslist, QtCore.SIGNAL(_fromUtf8("activated(QModelIndex)")), biacv_mainwindow.on_select_lang)
+ QtCore.QObject.connect(self.languageslist, QtCore.SIGNAL(_fromUtf8("itemSelectionChanged()")), biacv_mainwindow.on_select_lang)
+ QtCore.QObject.connect(self.updatelanguage, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_update_lang)
QtCore.QMetaObject.connectSlotsByName(biacv_mainwindow)
def retranslateUi(self, biacv_mainwindow):