projects
/
biacv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Separate file for language strings
[biacv.git]
/
biacv_mainwindow.py
diff --git
a/biacv_mainwindow.py
b/biacv_mainwindow.py
index
feaa8d3
..
0f0f9ad
100644
(file)
--- a/
biacv_mainwindow.py
+++ b/
biacv_mainwindow.py
@@
-3,6
+3,7
@@
import PyQt4
import biacv_mainwindow_ui as bui
import PyQt4
import biacv_mainwindow_ui as bui
+import biacv_lang as lang
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
def __init__ (self):
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
def __init__ (self):
@@
-15,11
+16,11
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
# get the selected language
selitems = self.languageslist.selectedItems ()
if selitems == []:
# get the selected language
selitems = self.languageslist.selectedItems ()
if selitems == []:
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot update", "No item selected."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_UPDATE, lang.ERROR_NO_SELECTION
)
return
# check if the language string is not empty
if self.language.text () == "":
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."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_UPDATE, lang.ERROR_REQ_MISSING
)
return
selitem = selitems[0]
selitem.setText (0, self.language.text ())
return
selitem = selitems[0]
selitem.setText (0, self.language.text ())
@@
-37,11
+38,10
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
# get selected language
selitems = self.languageslist.selectedItems ()
if selitems == []:
# get selected language
selitems = self.languageslist.selectedItems ()
if selitems == []:
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot delete", "No items selected."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_DELETE, lang.ERROR_REQ_MISSING
)
return
# confirm
return
# confirm
- ans = PyQt4.QtGui.QMessageBox.question (self, "Confirm",
- "Are you sure you wish to delete the selected item?",
+ ans = PyQt4.QtGui.QMessageBox.question (self, lang.CONFIRM, lang.CONFIRM_DELETE,
PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
if ans == PyQt4.QtGui.QMessageBox.Yes:
for item in selitems:
PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
if ans == PyQt4.QtGui.QMessageBox.Yes:
for item in selitems:
@@
-53,7
+53,7
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
def on_add_lang (self):
# check if the language is set
if self.language.text () == "":
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."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_ADD, lang.ERROR_REQ_MISSING
)
return
langitem = PyQt4.QtGui.QTreeWidgetItem (
[
return
langitem = PyQt4.QtGui.QTreeWidgetItem (
[
@@
-89,10
+89,10
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
# get the selected item
selitems = self.skillslist.selectedItems ()
if selitems == []:
# get the selected item
selitems = self.skillslist.selectedItems ()
if selitems == []:
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot update", "No item selected."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_UPDATE, lang.ERROR_NO_SELECTION
)
return
if self.skillsettitle.text () == "":
return
if self.skillsettitle.text () == "":
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot update", "A required field is missing."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_UPDATE, lang.ERROR_REQ_MISSING
)
return
selitem = selitems[0]
return
selitem = selitems[0]
@@
-118,11
+118,10
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
# get the selected items
selitems = self.skillslist.selectedItems ()
if selitems == []:
# get the selected items
selitems = self.skillslist.selectedItems ()
if selitems == []:
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot delete", "No items selected."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_DELETE, lang.ERROR_NO_SELECTION
)
return
# confirm
return
# confirm
- ans = PyQt4.QtGui.QMessageBox.question (self, "Confirm",
- "Are you sure you wish to delete the selected item?",
+ ans = PyQt4.QtGui.QMessageBox.question (self, lang.CONFIRM, lang.CONFIRM_DELETE,
PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
# answer is yes
if ans == PyQt4.QtGui.QMessageBox.Yes:
PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
# answer is yes
if ans == PyQt4.QtGui.QMessageBox.Yes:
@@
-135,7
+134,7
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
def on_add_skill (self):
# if the skill title is blank
if self.skillsettitle.text () == "":
def on_add_skill (self):
# if the skill title is blank
if self.skillsettitle.text () == "":
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot add", "A required field is missing."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_ADD, lang.ERROR_REQ_MISSING
)
return
skillitem = PyQt4.QtGui.QTreeWidgetItem (
[
return
skillitem = PyQt4.QtGui.QTreeWidgetItem (
[
@@
-156,12
+155,12
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
# get the selected item
selitems = self.professionlist.selectedItems ()
if selitems == []:
# get the selected item
selitems = self.professionlist.selectedItems ()
if selitems == []:
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot update", "No item selected."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_UPDATE, lang.ERROR_NO_SELECTION
)
return
selitem = selitems[0]
# if designation is not set
if self.designation.text () == "":
return
selitem = selitems[0]
# if designation is not set
if self.designation.text () == "":
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot update", "A required field is missing."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_UPDATE, lang.ERROR_REQ_MISSING
)
return
# if currently employed in that position, leaving date is to be disabled
# and set to "current"
return
# if currently employed in that position, leaving date is to be disabled
# and set to "current"
@@
-170,8
+169,7
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
else:
# if the leaving date is < join date
if self.leavedate.date () < self.joindate.date ():
else:
# if the leaving date is < join date
if self.leavedate.date () < self.joindate.date ():
- PyQt4.QtGui.QMessageBox.critical (self, "Cannot add",
- "Leaving date cannot be earlier than join date.")
+ PyQt4.QtGui.QMessageBox.critical (self, lang.ERROR_ADD, lang.ERROR_DATE)
return
leavedatestr = self.leavedate.date ().toString ("dd MMM, yyyy")
return
leavedatestr = self.leavedate.date ().toString ("dd MMM, yyyy")
@@
-186,11
+184,10
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
# get the selected items
selitems = self.professionlist.selectedItems ()
if selitems == []:
# get the selected items
selitems = self.professionlist.selectedItems ()
if selitems == []:
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot delete", "No item selected."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_DELETE, lang.ERROR_NO_SELECTION
)
return
# confirm deletion
return
# confirm deletion
- ans = PyQt4.QtGui.QMessageBox.question (self, "Confirm",
- "Are you sure you wish to delete the selected item?",
+ ans = PyQt4.QtGui.QMessageBox.question (self, lang.CONFIRM, lang.CONFIRM_DELETE,
PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
# if confirmed
if ans == PyQt4.QtGui.QMessageBox.Yes:
PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
# if confirmed
if ans == PyQt4.QtGui.QMessageBox.Yes:
@@
-201,7
+198,7
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
# add professional history button is clicked
def on_add_profession (self):
if self.designation.text () == "":
# add professional history button is clicked
def on_add_profession (self):
if self.designation.text () == "":
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot add", "A required field is missing."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_ADD, lang.ERROR_REQ_MISSING
)
return
# if currently employed in that position, leaving date is to be disabled
# and set to "current"
return
# if currently employed in that position, leaving date is to be disabled
# and set to "current"
@@
-210,8
+207,7
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
else:
# if the leaving date is < join date
if self.leavedate.date () < self.joindate.date ():
else:
# if the leaving date is < join date
if self.leavedate.date () < self.joindate.date ():
- PyQt4.QtGui.QMessageBox.critical (self, "Cannot add",
- "Leaving date cannot be earlier than join date.")
+ PyQt4.QtGui.QMessageBox.critical (self, lang.ERROR_ADD, lang.ERROR_DATE)
return
leavedatestr = self.leavedate.date ().toString ("dd MMM, yyyy")
return
leavedatestr = self.leavedate.date ().toString ("dd MMM, yyyy")
@@
-273,11
+269,10
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
selitems = self.educationlist.selectedItems ()
# if no items are selected
if selitems == []:
selitems = self.educationlist.selectedItems ()
# if no items are selected
if selitems == []:
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot delete", "No items selected."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_DELETE, lang.ERROR_NO_SELECTION
)
# delete the items after confirmation
else:
# delete the items after confirmation
else:
- ans = PyQt4.QtGui.QMessageBox.question (self, "Confirm",
- "Are you sure you wish to delete selected item?",
+ ans = PyQt4.QtGui.QMessageBox.question (self, lang.CONFIRM, lang.CONFIRM_DELETE,
PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
if ans == PyQt4.QtGui.QMessageBox.Yes:
# remove the item selected
PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
if ans == PyQt4.QtGui.QMessageBox.Yes:
# remove the item selected
@@
-294,11
+289,11
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
selitems = self.educationlist.selectedItems ()
# if no item is selected
if selitems == []:
selitems = self.educationlist.selectedItems ()
# if no item is selected
if selitems == []:
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot update", "No item selected"
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_UPDATE, lang.ERROR_NO_SELECTION
)
return
# if the qualification title is not set
if self.degree_name.text () == "":
return
# if the qualification title is not set
if self.degree_name.text () == "":
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot update", "A required field is missing."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_UPDATE, lang.ERROR_REQ_MISSING
)
return
selitem = selitems[0]
return
selitem = selitems[0]
@@
-313,7
+308,7
@@
class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
def on_add_education (self):
# check if the qualification title is set
if self.degree_name.text () == "":
def on_add_education (self):
# check if the qualification title is set
if self.degree_name.text () == "":
- PyQt4.QtGui.QMessageBox.critical (self,
"Cannot add", "A required fields is missing."
)
+ PyQt4.QtGui.QMessageBox.critical (self,
lang.ERROR_ADD, lang.ERROR_REQ_MISSING
)
return
educationitem = PyQt4.QtGui.QTreeWidgetItem ([
self.degree_name.text (),
return
educationitem = PyQt4.QtGui.QTreeWidgetItem ([
self.degree_name.text (),