Add language implemented
authorHarishankar <v.harishankar@gmail.com>
Thu, 1 Dec 2011 13:26:41 +0000 (18:56 +0530)
committerHarishankar <v.harishankar@gmail.com>
Thu, 1 Dec 2011 13:26:41 +0000 (18:56 +0530)
Add language to list of languages implemented

biacv_mainwindow.py
biacv_mainwindow.ui
biacv_mainwindow_ui.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
index 2132054..9f6c3ad 100644 (file)
             </widget>
            </item>
            <item row="1" column="1">
-            <widget class="QLineEdit" name="lineEdit"/>
+            <widget class="QLineEdit" name="language"/>
            </item>
            <item row="1" column="2">
-            <widget class="QCheckBox" name="checkBox_2">
+            <widget class="QCheckBox" name="canspeak">
              <property name="text">
               <string>Spoken</string>
              </property>
             </widget>
            </item>
            <item row="1" column="3" colspan="2">
-            <widget class="QCheckBox" name="checkBox_3">
+            <widget class="QCheckBox" name="canreadwrite">
              <property name="text">
-              <string>Written</string>
+              <string>Read/write</string>
              </property>
             </widget>
            </item>
            <item row="1" column="5" colspan="2">
-            <widget class="QCheckBox" name="checkBox_4">
+            <widget class="QCheckBox" name="isproficient">
              <property name="text">
               <string>Proficient</string>
              </property>
             </widget>
            </item>
            <item row="2" column="4" colspan="2">
-            <widget class="QPushButton" name="editlanguage">
+            <widget class="QPushButton" name="updatelanguage">
              <property name="text">
-              <string>&amp;Edit</string>
+              <string>&amp;Update</string>
              </property>
             </widget>
            </item>
             </widget>
            </item>
            <item row="3" column="0" colspan="7">
-            <widget class="QColumnView" name="languageslist"/>
+            <widget class="QTreeWidget" name="languageslist">
+             <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>Language</string>
+              </property>
+             </column>
+             <column>
+              <property name="text">
+               <string>Can speak</string>
+              </property>
+             </column>
+             <column>
+              <property name="text">
+               <string>Can read/write</string>
+              </property>
+             </column>
+             <column>
+              <property name="text">
+               <string>Proficient</string>
+              </property>
+             </column>
+            </widget>
            </item>
           </layout>
          </widget>
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>addlanguage</sender>
+   <signal>clicked()</signal>
+   <receiver>biacv_mainwindow</receiver>
+   <slot>on_add_lang()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>545</x>
+     <y>138</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>729</x>
+     <y>88</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>on_add_education()</slot>
   <slot>on_delete_skill()</slot>
   <slot>on_select_skill()</slot>
   <slot>on_update_skill()</slot>
+  <slot>on_add_lang()</slot>
  </slots>
 </ui>
index abad310..7c27b0d 100644 (file)
@@ -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):