Thank you for your answer.
My application has a main window that, in its __init__(), instantiates sub-dialogs. The trouble with the QComboBox
doesn' exist in the subdialogs. The combo are working properly. The trouble occurs
only in the main window.
Here below is the main.py then the MainWindows's __init__().
from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication
import sys
from view.MainWindow import MainWindow
if __name__=='__main__':
current_exit_code=-12345678
app=QApplication(sys.argv)
mainWindow=None
while current_exit_code == -12345678 :
translator = QtCore.QTranslator()
app.installTranslator(translator)
if mainWindow:
mainWindow.close()
#restart from beginning
mainWindow = MainWindow(translator)
MainWindow.show(mainWindow)
current_exit_code=app.exec_()
print('exit code is '+str(current_exit_code))
and an extract of the MainWindow's initialiszation
class MainWindow(QMainWindow,MainWindowUI.Ui_MainWindow):
'''
classdocs
'''
EXIT_CODE_REBOOT = -12345678
###################################################################################################################################
def __init__(self, translator,parent=None):
super(MainWindow,self).__init__(parent)
self.setupUi(self)
self.translator=translator
self.calculator=None
'THIS IS FOR PYINSTALLER ONLY'
'Folder structure is quite different when running in a bundle'
'Please see pyinstaller’s documentation'
self.frozen = 'not'
if getattr(sys, 'frozen', False): #return False if the attribute is not found
self.frozen = 'yes'
self.bundle_dir = sys._MEIPASS
self.model = Model(self.bundle_dir)#we pass the path to database
'the path to the translated .qm files'
self.trad_path=os.path.join(self.bundle_dir ,'translate')
else:
self.frozen='not'
'l’import export is reserved to the frozen application (bundled)'
self.actionImport_Export_Databases.setVisible(False)
self.model = Model()
'the path to the .qm translated files'
(filepath,filename)=os.path.split(__file__)
self.trad_path=os.path.join(filepath,'..','translate')
self.controller = Controller(self.model)
self.unitSetter=UnitSetter(self.model,self)
self.language_setter=LanguageSetter(self.model,self)
if not self.model.language:
self.language_setter.setModal(True)
self.language_setter.show()
else: self.set_language(self.model.language[1])
#IMPORTANT:
#setting of locale is deported in showEvent as language is not ready at this stage of init'
#colors must be set before all dialogs
'due to the translation into util.init_hop_usage_dic , util should be created after setting the language'
self.util=Utils(self.model)
self.util.init_hop_usage_dic()
self.util.init_yeast_form_dic()
self.style_key_list=self.model.style_list
self.set_active_colors()
self.create_constant_list()
self.constant_setter=ConstantDialog(self.model,self.util,self.constant_list)
self.maltDialog=MaltDialog(self.model,self.controller,self.util)
self.malt_chooser=MaltChooser(self.model,self.controller,self.util,self)
self.sugarDialog=SugarDialog(self.model,self.controller,self.util)
self.hopDialog=HopDialog(self.model,self.controller,self.util)
self.restDialog=RestDialog(self.model,self.controller, self.util)
self.yeastDialog=YeastDialog(self.model,self.controller,self.util)
self.recipeDialog = RecipeDialog(self.model,self.controller,self.util)
self.colorDialog = ColorDialog(self.model,self.controller,self.util)
self.ABV_calculator=ABVCalculator(self.model,self.controller, self.util)
self.priming_calculator=PrimingCalculator(self.model,self.controller,self.util)
self.equipmentDialog=EquipmentDialog(self.model,self.controller,self.util)