coding utf-8 from qt import from qt_form form2 import import sys prede

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# -*- 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()