From af2f737f8a7fd79ae16607a18a0936bb74281caf Mon Sep 17 00:00:00 2001 From: Harishankar Date: Thu, 1 Dec 2011 18:56:41 +0530 Subject: [PATCH] Add language implemented Add language to list of languages implemented --- biacv_mainwindow.py | 24 ++++++++++++++++ biacv_mainwindow.ui | 63 ++++++++++++++++++++++++++++++++++++------ biacv_mainwindow_ui.py | 52 +++++++++++++++++++--------------- 3 files changed, 109 insertions(+), 30 deletions(-) diff --git a/biacv_mainwindow.py b/biacv_mainwindow.py index 6ec4d1a..801928e 100644 --- a/biacv_mainwindow.py +++ b/biacv_mainwindow.py @@ -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 diff --git a/biacv_mainwindow.ui b/biacv_mainwindow.ui index 2132054..9f6c3ad 100644 --- a/biacv_mainwindow.ui +++ b/biacv_mainwindow.ui @@ -800,10 +800,10 @@ - + - + Spoken @@ -813,14 +813,14 @@ - + - Written + Read/write - + Proficient @@ -834,9 +834,9 @@ - + - &Edit + &Update @@ -848,7 +848,37 @@ - + + + true + + + false + + + true + + + + Language + + + + + Can speak + + + + + Can read/write + + + + + Proficient + + + @@ -1238,6 +1268,22 @@ + + addlanguage + clicked() + biacv_mainwindow + on_add_lang() + + + 545 + 138 + + + 729 + 88 + + + on_add_education() @@ -1253,5 +1299,6 @@ on_delete_skill() on_select_skill() on_update_skill() + on_add_lang() diff --git a/biacv_mainwindow_ui.py b/biacv_mainwindow_ui.py index abad310..7c27b0d 100644 --- a/biacv_mainwindow_ui.py +++ b/biacv_mainwindow_ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'biacv_mainwindow.ui' # -# Created: Thu Dec 1 18:29:14 2011 +# Created: Thu Dec 1 18:55:17 2011 # by: PyQt4 UI code generator 4.8.6 # # WARNING! All changes made in this file will be lost! @@ -448,36 +448,43 @@ class Ui_biacv_mainwindow(object): self.label_33.setText(QtGui.QApplication.translate("biacv_mainwindow", "Language", None, QtGui.QApplication.UnicodeUTF8)) self.label_33.setObjectName(_fromUtf8("label_33")) self.gridLayout_6.addWidget(self.label_33, 1, 0, 1, 1) - self.lineEdit = QtGui.QLineEdit(self.frame) - self.lineEdit.setObjectName(_fromUtf8("lineEdit")) - self.gridLayout_6.addWidget(self.lineEdit, 1, 1, 1, 1) - self.checkBox_2 = QtGui.QCheckBox(self.frame) - self.checkBox_2.setText(QtGui.QApplication.translate("biacv_mainwindow", "Spoken", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_2.setChecked(True) - self.checkBox_2.setObjectName(_fromUtf8("checkBox_2")) - self.gridLayout_6.addWidget(self.checkBox_2, 1, 2, 1, 1) - self.checkBox_3 = QtGui.QCheckBox(self.frame) - self.checkBox_3.setText(QtGui.QApplication.translate("biacv_mainwindow", "Written", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_3.setObjectName(_fromUtf8("checkBox_3")) - self.gridLayout_6.addWidget(self.checkBox_3, 1, 3, 1, 2) - self.checkBox_4 = QtGui.QCheckBox(self.frame) - self.checkBox_4.setText(QtGui.QApplication.translate("biacv_mainwindow", "Proficient", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_4.setObjectName(_fromUtf8("checkBox_4")) - self.gridLayout_6.addWidget(self.checkBox_4, 1, 5, 1, 2) + self.language = QtGui.QLineEdit(self.frame) + self.language.setObjectName(_fromUtf8("language")) + self.gridLayout_6.addWidget(self.language, 1, 1, 1, 1) + self.canspeak = QtGui.QCheckBox(self.frame) + self.canspeak.setText(QtGui.QApplication.translate("biacv_mainwindow", "Spoken", None, QtGui.QApplication.UnicodeUTF8)) + self.canspeak.setChecked(True) + self.canspeak.setObjectName(_fromUtf8("canspeak")) + self.gridLayout_6.addWidget(self.canspeak, 1, 2, 1, 1) + self.canreadwrite = QtGui.QCheckBox(self.frame) + self.canreadwrite.setText(QtGui.QApplication.translate("biacv_mainwindow", "Read/write", None, QtGui.QApplication.UnicodeUTF8)) + self.canreadwrite.setObjectName(_fromUtf8("canreadwrite")) + self.gridLayout_6.addWidget(self.canreadwrite, 1, 3, 1, 2) + self.isproficient = QtGui.QCheckBox(self.frame) + self.isproficient.setText(QtGui.QApplication.translate("biacv_mainwindow", "Proficient", None, QtGui.QApplication.UnicodeUTF8)) + self.isproficient.setObjectName(_fromUtf8("isproficient")) + self.gridLayout_6.addWidget(self.isproficient, 1, 5, 1, 2) self.addlanguage = QtGui.QPushButton(self.frame) self.addlanguage.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Add", None, QtGui.QApplication.UnicodeUTF8)) self.addlanguage.setObjectName(_fromUtf8("addlanguage")) self.gridLayout_6.addWidget(self.addlanguage, 2, 2, 1, 2) - self.editlanguage = QtGui.QPushButton(self.frame) - self.editlanguage.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Edit", None, QtGui.QApplication.UnicodeUTF8)) - self.editlanguage.setObjectName(_fromUtf8("editlanguage")) - self.gridLayout_6.addWidget(self.editlanguage, 2, 4, 1, 2) + self.updatelanguage = QtGui.QPushButton(self.frame) + self.updatelanguage.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Update", None, QtGui.QApplication.UnicodeUTF8)) + self.updatelanguage.setObjectName(_fromUtf8("updatelanguage")) + self.gridLayout_6.addWidget(self.updatelanguage, 2, 4, 1, 2) self.deletelanguage = QtGui.QPushButton(self.frame) self.deletelanguage.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Delete", None, QtGui.QApplication.UnicodeUTF8)) self.deletelanguage.setObjectName(_fromUtf8("deletelanguage")) self.gridLayout_6.addWidget(self.deletelanguage, 2, 6, 1, 1) - self.languageslist = QtGui.QColumnView(self.frame) + self.languageslist = QtGui.QTreeWidget(self.frame) + self.languageslist.setAlternatingRowColors(True) + self.languageslist.setRootIsDecorated(False) + self.languageslist.setUniformRowHeights(True) self.languageslist.setObjectName(_fromUtf8("languageslist")) + self.languageslist.headerItem().setText(0, QtGui.QApplication.translate("biacv_mainwindow", "Language", None, QtGui.QApplication.UnicodeUTF8)) + self.languageslist.headerItem().setText(1, QtGui.QApplication.translate("biacv_mainwindow", "Can speak", None, QtGui.QApplication.UnicodeUTF8)) + self.languageslist.headerItem().setText(2, QtGui.QApplication.translate("biacv_mainwindow", "Can read/write", None, QtGui.QApplication.UnicodeUTF8)) + self.languageslist.headerItem().setText(3, QtGui.QApplication.translate("biacv_mainwindow", "Proficient", None, QtGui.QApplication.UnicodeUTF8)) self.gridLayout_6.addWidget(self.languageslist, 3, 0, 1, 7) self.gridLayout_7.addWidget(self.frame, 0, 0, 1, 1) self.label_34 = QtGui.QLabel(self.tab_5) @@ -572,6 +579,7 @@ class Ui_biacv_mainwindow(object): 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.QObject.connect(self.addlanguage, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_add_lang) QtCore.QMetaObject.connectSlotsByName(biacv_mainwindow) def retranslateUi(self, biacv_mainwindow): -- 2.20.1