Add language implemented
[biacv.git] / biacv_mainwindow.py
index 6ec4d1a..801928e 100644 (file)
@@ -9,6 +9,30 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                self.setupUi (self)
                self.currentfile = None
 
+       # add a language to the list of languages known
+       def on_add_lang (self):
+               # check if the language is set
+               if self.language.text () == "":
+                       PyQt4.QtGui.QMessageBox.critical (self, "Cannot add", "A required field is missing.")
+                       return
+               langitem = PyQt4.QtGui.QTreeWidgetItem (
+                               [
+                                       self.language.text (),
+                                       str (self.canspeak.isChecked ()),
+                                       str (self.canreadwrite.isChecked ()),
+                                       str (self.isproficient.isChecked ())
+                               ]
+                       )
+               self.languageslist.addTopLevelItem (langitem)
+               self.reset_language_fields ()
+
+       # reset the language fields
+       def reset_language_fields (self):
+               self.language.setText ("")
+               self.canspeak.setChecked (True)
+               self.canreadwrite.setChecked (False)
+               self.isproficient.setChecked (False)
+
        # update the skill set button event
        def on_update_skill (self):
                # get the selected item