# -*- coding: utf-8 -*-
from qt import *
from qt_form.form2 import *
import sys
predefined_settings = [
{'name': u'Нагрівання',
'template': '-tau*(x-TS)',
'solution': 'TS-(TS-T0)*exp(-tau*t)',
'params': {'TS': 5,
'T0': 2,
'tau':0.5},
'xrange': [0,2],
'x_0': 'T0',
},
{'name': u'Охолодження',
'template': '-tau*(x-TS)',
'solution': 'TS-(TS-T0)*exp(-tau*t)',
'params': {'TS': 5,
'T0': 20,
'tau':0.5},
'xrange': [0,2],
'x_0': 'T0',
},
{'name': u'Популяція (ріст)',
'template': 'mu*x*(K-x)/K',
'solution': '',
'params': {'mu': 0.1,
'K': 5000,
},
'xrange': [0,200],
'x_0': '5',
},
{'name': u'Популяція (зменшення)',
'template': 'mu*x*(K-x)/K',
'solution': '',
'params': {'mu': 0.2,
'K': 1000,
},
'xrange': [0,200],
'x_0': '2000',
},
{'name': u'Прігожина (r>mu,x0<K)',
'template': 'r*x*(K-x)-mu*x',
'solution': '',
'params': {'mu': 0.2,
'K': 500,
'r': 0.25,
},
'xrange': [0,200],
'x_0': '200',
},
{'name': u'Економ. динаміка',
'template': 'a*s*x**a-(mu+g)*x',
'solution': '',
'params': {'a': 1,
's': 2,
'mu': 2,
'g': 5,
},
'xrange': [0,2],
'x_0': '5',
},
]
def populate_combobox(form, c_box, predefined_settings=predefined_settings):
c_box.clear()
for setting in predefined_settings[::-1]:
c_box.insertItem(setting['name'],0)
setattr(f,'predefined_settings',predefined_settings)
if __name__ == "__main__":
app = QApplication(sys.argv)
f = Form1()
populate_combobox(f, f.predefinedSettings)
f.populateForm()
f.show()
app.setMainWidget(f)
app.exec_loop()