Added "All" option to panel output selection #48

This commit is contained in:
piotr
2021-04-13 00:56:06 +02:00
parent beefe71656
commit 8e3f3e2cfe
2 changed files with 27 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ config_dir = get_config_dir()
configs = {}
editor = None
selector_window = None
outputs = None
outputs = {}
SKELETON_PANEL: dict = {
"name": "",
@@ -538,7 +538,10 @@ class EditorWrapper(object):
self.cb_output = builder.get_object("output")
for key in outputs:
self.cb_output.append(key, key)
if self.panel["output"] and self.panel["output"] in outputs:
self.cb_output.append("All", "All")
if self.panel["output"] and (self.panel["output"] in outputs or self.panel["output"] == "All"):
self.cb_output.set_active_id(self.panel["output"])
screen_width, screen_height = None, None

View File

@@ -251,6 +251,27 @@ def main():
except Exception as e:
print(e)
# Mirror bars to all outputs #48 (if panel["output"] == "All")
to_remove = []
to_append = []
for panel in panels:
check_key(panel, "output", "")
clones = []
if panel["output"] == "All" and len(common.outputs) > 1:
to_remove.append(panel)
for key in common.outputs.keys():
clone = panel.copy()
clone["output"] = key
clones.append(clone)
to_append = to_append + clones
for item in to_remove:
panels.remove(item)
panels = panels + to_append
for panel in panels:
check_key(panel, "icons", "")
icons_path = ""
@@ -259,8 +280,6 @@ def main():
elif panel["icons"] == "dark":
icons_path = os.path.join(common.config_dir, "icons_dark")
check_key(panel, "output", "")
# This is to allow width "auto" value. Actually all non-numeric values will be removed.
if "width" in panel and not isinstance(panel["width"], int):
panel.pop("width")
@@ -380,7 +399,7 @@ def main():
check_key(panel, "layer", "top")
o = panel["output"] if "output" in panel else "undefined"
print("Display: {}, position: {}, layer: {}, width: {}, height: {}".format(o, panel["position"],
print("Output: {}, position: {}, layer: {}, width: {}, height: {}".format(o, panel["position"],
panel["layer"], panel["width"],
panel["height"]))