slider based options done

This commit is contained in:
Sander Land committed 2020-06-21 11:53:15 +02:00
1 parent 87a1038546
commit 41c2addbdf
5 files changed
+23 -13

No files matched your search

+3 -3
View File
@@ -79,14 +79,14 @@
"opening_moves": 22.0 "opening_moves": 22.0
}, },
"ai:p:weighted": { "ai:p:weighted": {
"weaken_fac": 1.25,
"pick_override": 1.0, "pick_override": 1.0,
"lower_bound": 0.001, "lower_bound": 0.001
"weaken_fac": 1.25
}, },
"ai:p:pick": { "ai:p:pick": {
"pick_override": 0.95, "pick_override": 0.95,
"pick_n": 5, "pick_n": 5,
"pick_frac": 0.33 "pick_frac": 0.35
}, },
"ai:p:local": { "ai:p:local": {
"pick_override": 0.95, "pick_override": 0.95,
+10 -3
View File
@@ -64,10 +64,17 @@ AI_STRENGTH = { # not used
} }
AI_OPTION_VALUES = { AI_OPTION_VALUES = {
"kyu_rank": [(k, f"{k}[strength:kyu]") for k in range(15, 0, -1)] + [(k, f"{1-k}[strength:dan]") for k in range(0, -3, -1)], "kyu_rank": [(k, f"{k}[strength:kyu]") for k in range(15, 0, -1)]
+ [(k, f"{1-k}[strength:dan]") for k in range(0, -3, -1)],
"strength": [0.25, 0.5, 1, 2, 4], "strength": [0.25, 0.5, 1, 2, 4],
"opening_moves": range(0, 51), "opening_moves": range(0, 51),
"pick_override": [0,0.5,0.6,0.7,0.8,0.9,0.95,1], "pick_override": [0, 0.5, 0.6, 0.7, 0.8, 0.85, 0.9, 0.95, 0.99, 1],
"lower_bound": [(v, f"{v:.2%}") for v in [0, 0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05]], "lower_bound": [(v, f"{v:.2%}") for v in [0, 0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05]],
"weaken_fac": [-2,-1,0.5,1,1.25,1.5,2,4] "weaken_fac": [0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 4],
"endgame": [x / 100 for x in range(10, 80, 5)],
"pick_frac": [x / 100 for x in range(0, 101, 5)],
"pick_n": range(0, 26),
"stddev": [x / 2 for x in range(21)],
"line_weight": range(0, 11),
"threshold": [2, 2.5, 3, 3.5, 4, 4.5],
} }
+3 -3
View File
@@ -158,9 +158,9 @@ class QuickConfigGui(MDBoxLayout):
Clock.schedule_once(self.build_and_set_properties, 0) Clock.schedule_once(self.build_and_set_properties, 0)
def collect_properties(self, widget) -> Dict: def collect_properties(self, widget) -> Dict:
if isinstance(widget, (LabelledTextInput, LabelledSpinner, LabelledCheckBox,LabelledSelectionSlider)) and getattr( if isinstance(
widget, "input_property", None widget, (LabelledTextInput, LabelledSpinner, LabelledCheckBox, LabelledSelectionSlider)
): ) and getattr(widget, "input_property", None):
try: try:
ret = {widget.input_property: widget.input_value} ret = {widget.input_property: widget.input_value}
except Exception as e: # TODO : on widget? except Exception as e: # TODO : on widget?
+6 -2
View File
@@ -9,7 +9,6 @@ from kivymd.uix.label import MDLabel
from kivymd.uix.selectioncontrol import Thumb from kivymd.uix.selectioncontrol import Thumb
class SelectionSlider(Widget): class SelectionSlider(Widget):
__events__ = ["on_select"] __events__ = ["on_select"]
active = BooleanProperty(False) active = BooleanProperty(False)
@@ -26,7 +25,12 @@ class SelectionSlider(Widget):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
self.bind(size=self.set_index_and_positions,pos=self.set_index_and_positions,values=self.set_index_and_positions,index=self.set_index_and_positions) self.bind(
size=self.set_index_and_positions,
pos=self.set_index_and_positions,
values=self.set_index_and_positions,
index=self.set_index_and_positions,
)
def set_index_and_positions(self, *_args): def set_index_and_positions(self, *_args):
self.index = max(0, min(self.index, len(self.values) - 1)) self.index = max(0, min(self.index, len(self.values) - 1))
+1 -2
View File
@@ -13,7 +13,6 @@
#:set LIGHTGREY [0.7,0.7,0.7,1] #:set LIGHTGREY [0.7,0.7,0.7,1]
#:import BACKGROUND_COLOR katrain.gui.style.BACKGROUND_COLOR #:import BACKGROUND_COLOR katrain.gui.style.BACKGROUND_COLOR
#:import LIGHTER_BACKGROUND_COLOR katrain.gui.style.LIGHTER_BACKGROUND_COLOR
#:import LIGHTGREY katrain.gui.style.LIGHTGREY #:import LIGHTGREY katrain.gui.style.LIGHTGREY
#:import TEXT_COLOR katrain.gui.style.TEXT_COLOR #:import TEXT_COLOR katrain.gui.style.TEXT_COLOR
@@ -377,7 +376,7 @@
values: root.values values: root.values
on_select: textbox.text = str(slider.value) on_select: textbox.text = str(slider.value)
track_color: LIGHTGREY track_color: LIGHTGREY
thumb_color: LIGHTER_BACKGROUND_COLOR thumb_color: 0.5, 0.6, 0.8, 1
LabelledFloatInput: LabelledFloatInput:
id: textbox id: textbox