File wellmet/qt_gui/qt_dicebox.py changed (mode: 100644) (index 10e4c37..5610fdb) |
... |
... |
from .. import schemes |
4 |
4 |
from ..candybox import CandyBox |
from ..candybox import CandyBox |
5 |
5 |
from ..dicebox.goal import Goal, Razitko, DiceBox |
from ..dicebox.goal import Goal, Razitko, DiceBox |
6 |
6 |
from ..dicebox.circumtri import CircumTri |
from ..dicebox.circumtri import CircumTri |
|
7 |
|
from ..dicebox._exploration import DumbExploration |
7 |
8 |
import pyqtgraph as pg |
import pyqtgraph as pg |
8 |
9 |
from pyqtgraph.Qt import QtCore, QtWidgets |
from pyqtgraph.Qt import QtCore, QtWidgets |
9 |
10 |
|
|
|
... |
... |
spaces = ['R', 'aR', 'Rn', 'aRn', 'P', 'GK', 'G', 'aG', 'U', 'aU'] |
11 |
12 |
potentials = ['q_psee', 'psee', 'fee', 'fee2', 'ksee', 'chee', 'chee2', 'dd'] |
potentials = ['q_psee', 'psee', 'fee', 'fee2', 'ksee', 'chee', 'chee2', 'dd'] |
12 |
13 |
|
|
13 |
14 |
|
|
|
15 |
|
|
|
16 |
|
class DumbExplorationWidget(pg.parametertree.ParameterTree): |
|
17 |
|
def __init__(self, wt, parent=None): |
|
18 |
|
self.box = wt |
|
19 |
|
super().__init__(parent=parent, showHeader=False) |
|
20 |
|
self._set_param() |
|
21 |
|
self.setParameters(self.param, showTop=False) |
|
22 |
|
|
|
23 |
|
def _set_param(self): |
|
24 |
|
params = list() |
|
25 |
|
params.append({'name': 'q', 'type': 'float', \ |
|
26 |
|
'limits': (1, float('inf')), 'value': 10, 'default': 10}) |
|
27 |
|
|
|
28 |
|
|
|
29 |
|
### Create tree of Parameter objects |
|
30 |
|
# I don't know why that signals do not work for me |
|
31 |
|
# Only sigTreeStateChanged works, but I don't want to struggle with it |
|
32 |
|
# May be I'll report the issue |
|
33 |
|
#self.param.sigValueChanged.connect(self.param_changed) |
|
34 |
|
#self.param.sigValueChanging.connect(self.param_changing) |
|
35 |
|
self.param = pg.parametertree.Parameter.create(name='params', type='group', children=params) |
|
36 |
|
|
|
37 |
|
#č branima sa rekurzii |
|
38 |
|
#оӵ рекурзилы пезьдэт! |
|
39 |
|
self.param_values = self.param.getValues() |
|
40 |
|
|
|
41 |
|
def __getattr__(self, attr): |
|
42 |
|
#č na teoreticky možnou rěkurziju vykašleme |
|
43 |
|
#оӵ рекурзия уз луы |
|
44 |
|
return self.param_values[attr][0] |
|
45 |
|
|
|
46 |
|
def setup_box(self): |
|
47 |
|
#č to je důležité! __getatr__ odsaď bere hodnoty |
|
48 |
|
self.param_values = self.param.getValues() |
|
49 |
|
|
|
50 |
|
self.box.sample_box = DumbExploration( |
|
51 |
|
self.box.sample_box, #č rekurze) |
|
52 |
|
q=self.q) |
|
53 |
|
|
|
54 |
|
|
14 |
55 |
class CircumTriWidget(pg.parametertree.ParameterTree): |
class CircumTriWidget(pg.parametertree.ParameterTree): |
15 |
56 |
def __init__(self, wt, parent=None): |
def __init__(self, wt, parent=None): |
16 |
57 |
self.box = wt |
self.box = wt |
|
... |
... |
class SetupDiceBoxWidget(pg.LayoutWidget): |
351 |
392 |
#č aby je nám Python nehodil |
#č aby je nám Python nehodil |
352 |
393 |
self.tabs = [] |
self.tabs = [] |
353 |
394 |
|
|
|
395 |
|
|
354 |
396 |
box_widget = CircumTriWidget(self.box, self) |
box_widget = CircumTriWidget(self.box, self) |
355 |
397 |
self.tab_widget.addTab(box_widget, "CircumTri") |
self.tab_widget.addTab(box_widget, "CircumTri") |
356 |
398 |
self.tabs.append(box_widget) |
self.tabs.append(box_widget) |
|
... |
... |
class SetupDiceBoxWidget(pg.LayoutWidget): |
365 |
407 |
self.tab_widget.addTab(box_widget, "Razitko") |
self.tab_widget.addTab(box_widget, "Razitko") |
366 |
408 |
self.tabs.append(box_widget) |
self.tabs.append(box_widget) |
367 |
409 |
|
|
|
410 |
|
# Add tab |
|
411 |
|
box_widget = DumbExplorationWidget(self.box, self) |
|
412 |
|
self.tab_widget.addTab(box_widget, "DumbExploration") |
|
413 |
|
self.tabs.append(box_widget) |
|
414 |
|
|
368 |
415 |
# Add tab |
# Add tab |
369 |
416 |
box_widget = DumbDiceBoxWidget(self.box, self) |
box_widget = DumbDiceBoxWidget(self.box, self) |
370 |
417 |
self.tab_widget.addTab(box_widget, "Dumb DiceBox") |
self.tab_widget.addTab(box_widget, "Dumb DiceBox") |