update matrix generation with new abilities
This commit is contained in:
parent
902fc666c2
commit
346f2af2fb
@ -1,7 +1,7 @@
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from owrx.modes import Modes
|
from owrx.modes import Modes
|
||||||
from owrx.config import Config
|
from owrx.config import Config
|
||||||
from owrx.wsjt import Q65Mode, Q65Profile
|
from owrx.wsjt import Q65Mode, Q65Interval
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
@ -327,28 +327,27 @@ class Q65ModeConverter(Converter):
|
|||||||
|
|
||||||
class Q65ModeMatrix(Input):
|
class Q65ModeMatrix(Input):
|
||||||
def checkbox_id(self, mode, interval):
|
def checkbox_id(self, mode, interval):
|
||||||
return "{0}-{1}-{2}".format(self.id, mode.value, interval)
|
return "{0}-{1}-{2}".format(self.id, mode.value, interval.value)
|
||||||
|
|
||||||
def render_checkbox(self, mode, interval, value):
|
def render_checkbox(self, mode: Q65Mode, interval: Q65Interval, value):
|
||||||
return """
|
return """
|
||||||
<div class="{classes}">
|
<div class="{classes}">
|
||||||
<input class="form-check-input" type="checkbox" id="{id}" name="{id}" {checked}>
|
<input class="form-check-input" type="checkbox" id="{id}" name="{id}" {checked} {disabled}>
|
||||||
<label class="form-check-label" for="{id}">
|
<label class="form-check-label" for="{id}">
|
||||||
{checkboxText}
|
{checkboxText}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
""".format(
|
""".format(
|
||||||
id=self.checkbox_id(mode, interval),
|
|
||||||
classes=self.input_classes(),
|
classes=self.input_classes(),
|
||||||
checked="checked" if [interval, mode.name] in value else "",
|
id=self.checkbox_id(mode, interval),
|
||||||
checkboxText="Mode {} interval {}s".format(mode.name, interval),
|
checked="checked" if "{}{}".format(mode.name, interval.value) in value else "",
|
||||||
|
checkboxText="Mode {} interval {}s".format(mode.name, interval.value),
|
||||||
|
disabled="" if interval.is_available(mode) else "disabled",
|
||||||
)
|
)
|
||||||
|
|
||||||
def render_input(self, value):
|
def render_input(self, value):
|
||||||
checkboxes = "".join(
|
checkboxes = "".join(
|
||||||
self.render_checkbox(mode, interval, value)
|
self.render_checkbox(mode, interval, value) for interval in Q65Interval for mode in Q65Mode
|
||||||
for interval in Q65Profile.availableIntervals
|
|
||||||
for mode in Q65Mode
|
|
||||||
)
|
)
|
||||||
return """
|
return """
|
||||||
<div class="matrix q65-matrix">
|
<div class="matrix q65-matrix">
|
||||||
|
Loading…
Reference in New Issue
Block a user