]> git.mar77i.info Git - zenbook_gui/commitdiff
integrate draggable in ui library
authormar77i <mar77i@protonmail.ch>
Mon, 22 Sep 2025 17:45:30 +0000 (19:45 +0200)
committermar77i <mar77i@protonmail.ch>
Mon, 22 Sep 2025 17:45:30 +0000 (19:45 +0200)
create_desktop_file.sh
keyboard/layout.py
ui/__init__.py
ui/draggable_button.py [moved from keyboard/draggable.py with 93% similarity]

index 77dc1ac0f003fda50831c5188dc4080afb038232..c749c436015fadabf6556ccc931daa30b1a12911 100755 (executable)
@@ -3,13 +3,14 @@
 script_dir="$(realpath -Pe "$(dirname "${0}")")"
 executable="${script_dir}/zenbook_conf.py"
 icon="${script_dir}/laptop-single.svg"
+name="Zenbook Duo Settings"
 
 help() {
     echo " ${0} [--executable PATH] [--icon PATH] [--virtual-env PATH] | -h|--help"
     echo "Create a desktop launcher for zenbook_conf.py"
     echo "  --executable PATH   specify the executable"
     echo "  --icon PATH         specify the icon"
-    echo "  --virtual-env PATH  specify a VIRTUAL_ENV path"
+    echo "  --name NAME         specify the name"
     echo "  -h | --help        show this help message"
     exit 0
 }
@@ -26,6 +27,10 @@ while (( $# )); do
         icon="${2}"
         shift
         ;;
+    --name)
+        name="${2}"
+        shift
+        ;;
     -h|--help)
         help=1
         ;;
@@ -45,6 +50,6 @@ fi
 echo "[Desktop Entry]"
 echo "Type=Application"
 echo "Exec=$(realpath -Pe "${executable}")"
-echo "Icon=$(realpath -Pe "${icon}")"
+echo "Icon=${icon}"
 echo ""
-echo "Name=Zenbook Duo settings"
+echo "Name=${name}"
index 73c1bc4d2f25fd43a5095c35f8e9a9f62b345fee..6f4f39984b947b8360d80d7a74a30f6c28865ed8 100644 (file)
@@ -3,10 +3,9 @@ from functools import partial
 
 import pygame
 
-from ui import Child, LabelledRect, QuittableModal, Rect
+from ui import Child, DraggableButton, LabelledRect, QuittableModal, Rect
 
 from .clock import ClockWidget
-from .draggable import DraggableButton
 from .key import apply_y_spans, get_key_size
 from .mousepad import MousePadWidget
 from .touchbutton import TouchButton
index 8b2ecc1b62f4092d6ac426f2bd590b26eabc401b..b664dd12577f5f2b52cd24d739ef51a7077d9a90 100644 (file)
@@ -1,6 +1,7 @@
 from .button import Button
 from .child import Child
 from .color_button import ColorButton
+from .draggable_button import DraggableButton
 from .drop_down import DropDown
 from .event_method_dispatcher import EventMethodDispatcher
 from .fps_widget import FPSWidget
@@ -24,6 +25,7 @@ __all__ = [
     "Button",
     "Child",
     "ColorButton",
+    "DraggableButton",
     "DropDown",
     "EventMethodDispatcher",
     "FloatSpinner",
similarity index 93%
rename from keyboard/draggable.py
rename to ui/draggable_button.py
index c3d76d4263029e829d3d39d55c09a516a4ccbdda..396ed5e6ea54316f78a7a1f6c3ddf1891d1ff7a3 100644 (file)
@@ -5,14 +5,17 @@ from ui.multitouch import MultitouchHandler
 
 
 class DraggableButton(Child):
-    def __init__(self, parent, rect, surf, dests, callback, highlight=False):
+    def __init__(self, parent, rect, surf, dests, callback):
+        """
+        dests is a list of rects, or a tuple (check_func, rect)
+        that allows defining as drop zone that differs from the actual destination
+        """
         super().__init__(parent)
         assert rect.size == surf.get_size()
         self.rect = rect
         self.surface = surf
         self.dests = dests
         self.callback = callback
-        self.highlight = highlight
         self.pushed = None
         self.drag_pos = None
         self.drag_rel = None