class
MainWindow(QMainWindow,MainWindowUI.Ui_MainWindow):
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
):
self
.frozen
=
'yes'
self
.bundle_dir
=
sys._MEIPASS
self
.model
=
Model(
self
.bundle_dir)
'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
])
'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)