# This file is part of the Coral project.
# Please read the copyright notice in the LICENSE file.

import qt
from coral.modeler.dlg.LanguageSelectionDlg import LanguageSelectionDlg

class LanguageSelectionDlgEx(LanguageSelectionDlg):

    def main(self,languages,modal=1):
        
        self.languages=languages
        
        for l in languages:
            self.languageList.insertItem(l.name+" "+str(l.version)+"."+str(l.revision))

        if modal:
            self.exec_loop()
            if self.result()==qt.QDialog.Rejected:
                return -1
            else:
                return self.languageList.currentItem()
        else:
            self.show()
            return -1

    def describe(self,a0):
        self.description.setText(str(self.languages[self.languageList.currentItem()].description))
