Many Thanks, I've solved putting them in the init part of the class so they are translated properly and refer to these messages in a derived QMessageBox, some QmessageBox fails About seems to work but Question (i didn't remember well fails to translate properly the messages).
@
self.toolcyl = self.tr("Cylindrical")
self.toolsph = self.tr("Spherical (Ball)")
self.tooltor = self.tr("Toroidal (Bull)")
self.toolcon = self.tr("Conical")
glb.shape[0] = self.toolcyl
glb.shape[1] = self.toolsph
glb.shape[2] = self.tooltor
glb.shape[3] = self.toolcon
# End of the tool shapes definition
#
######################################################################
EC_L.readTooltable(self)
EC_UA.populateUI(self)
######################################################################
#
# Translatable string goes here i didn't find a method to make it
# work flawlessy in some QMessageBox
#
######################################################################
# Exit Dialog
self.msg_01t = self.tr("<b>Exit Dialog</b>")
self.msg_01m = self.tr("Are You sure you want to exit?")
# About EuroCAM Box
self.msg_02t = self.tr("About ")
self.msg_02m = self.tr("<b>SomeProgram</b> is a program. <br> \
<br> It generates some output to help you in \
figuring out the life, the universe and all other things.")
# @
I'm using them in the About widget without too many problem like this:
@QMessageBox.about(self,self.msg_02t,self.msg_02m) @
For the others MessageBox i have written a def like this:
@
def closeEvent(self, event):
msgBox = QMessageBox()
msgBox.setText(self.msg_01t)
msgBox.setInformativeText(self.msg_01m)
msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.Cancel)
msgBox.setDefaultButton(QMessageBox.Yes)
msgBox.setIcon(QMessageBox.Question)
ret = msgBox.exec_()
event.ignore()
if ret == QMessageBox.Yes:
# Do Something
event.accept()
elif ret == QMessageBox.Cancel:
event.ignore()@
In this manner it works as expected and if you note in the first lines of the examples i have translate some messages that are referenced in another module of the program. After struggling with this behavior I have found this solution that isn't too bad and not too unelegant, but the readability of the code suffers a little.
Regards
Carlo D.