Browse Source

Merge remote-tracking branch 'origin/master' into develop

QMK Bot 5 months ago
parent
commit
bef076f23e
2 changed files with 16 additions and 4 deletions
  1. 3 3
      keyboards/dmqdesign/spin/keyboard.json
  2. 13 1
      lib/python/qmk/path.py

+ 3 - 3
keyboards/dmqdesign/spin/keyboard.json

@@ -49,19 +49,19 @@
                 {"matrix": [0, 0], "x": 0, "y": 0},
                 {"matrix": [1, 0], "x": 1, "y": 0},
                 {"matrix": [2, 0], "x": 2, "y": 0},
-                {"matrix": [2, 4], "x": 3.5, "y": 0},
+                {"matrix": [2, 4], "x": 3.5, "y": 0, "encoder": 0},
 
                 {"matrix": [0, 1], "x": 0, "y": 1},
                 {"matrix": [1, 1], "x": 1, "y": 1},
                 {"matrix": [2, 1], "x": 2, "y": 1},
 
-                {"matrix": [1, 4], "x": 3.5, "y": 1.5},
+                {"matrix": [1, 4], "x": 3.5, "y": 1.5, "encoder": 1},
 
                 {"matrix": [0, 2], "x": 0, "y": 2},
                 {"matrix": [1, 2], "x": 1, "y": 2},
                 {"matrix": [2, 2], "x": 2, "y": 2},
 
-                {"matrix": [0, 4], "x": 3.5, "y": 3},
+                {"matrix": [0, 4], "x": 3.5, "y": 3, "encoder": 2},
                 {"matrix": [0, 3], "x": 0, "y": 3},
                 {"matrix": [1, 3], "x": 1, "y": 3},
                 {"matrix": [2, 3], "x": 2, "y": 3}

+ 13 - 1
lib/python/qmk/path.py

@@ -183,5 +183,17 @@ class FileType(argparse.FileType):
         """normalize and check exists
             otherwise magic strings like '-' for stdin resolve to bad paths
         """
+        # TODO: This should not return both Path and TextIOWrapper as consumers
+        # assume that they can call Path.as_posix without checking type
+
+        # Handle absolute paths and relative paths to CWD
         norm = normpath(string)
-        return norm if norm.exists() else super().__call__(string)
+        if norm.exists():
+            return norm
+
+        # Handle relative paths to QMK_HOME
+        relative = Path(string)
+        if relative.exists():
+            return relative
+
+        return super().__call__(string)