Skip to content

Commit 61e45b1

Browse files
committed
python: Rename module to just inputmodule
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 7deffa0 commit 61e45b1

File tree

14 files changed

+54
-41
lines changed

14 files changed

+54
-41
lines changed

.github/workflows/software.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
uses: Martin005/pyinstaller-action@main
110110
with:
111111
python_ver: '3.11'
112-
spec: python/framework16_inputmodule/cli.py #'src/build.spec'
112+
spec: python/inputmodule/cli.py #'src/build.spec'
113113
requirements: 'requirements.txt'
114114
upload_exe_with_name: 'ledmatrixgui'
115115
options: --onefile, --windowed, --add-data 'res;res'

python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This repository contains a python library and scripts to control the
88
Pre-requisites: Python with pip
99

1010
```sh
11-
python3 -m pip install framework16_inputmodule
11+
python3 -m pip install inputmodule
1212
```
1313

1414
## Control from the host

python/framework16_inputmodule/cli.py renamed to python/inputmodule/cli.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from serial.tools import list_ports
77

88
# Local dependencies
9-
from framework16_inputmodule import gui
10-
from framework16_inputmodule.inputmodule import (
9+
from inputmodule import gui
10+
from inputmodule.inputmodule import (
1111
INPUTMODULE_PIDS,
1212
send_command,
1313
get_version,
@@ -18,15 +18,15 @@
1818
GameOfLifeStartParam,
1919
GameControlVal,
2020
)
21-
from framework16_inputmodule.gui.games import (
21+
from inputmodule.gui.games import (
2222
snake,
2323
snake_embedded,
2424
pong_embedded,
2525
game_of_life_embedded,
2626
wpm_demo,
2727
)
28-
from framework16_inputmodule.gui.ledmatrix import random_eq, clock, blinking
29-
from framework16_inputmodule.inputmodule.ledmatrix import (
28+
from inputmodule.gui.ledmatrix import random_eq, clock, blinking
29+
from inputmodule.inputmodule.ledmatrix import (
3030
eq,
3131
breathing,
3232
camera,
@@ -44,7 +44,7 @@
4444
image_bl,
4545
image_greyscale,
4646
)
47-
from framework16_inputmodule.inputmodule.b1display import (
47+
from inputmodule.inputmodule.b1display import (
4848
b1image_bl,
4949
invert_screen_cmd,
5050
screen_saver_cmd,
@@ -56,7 +56,7 @@
5656
display_on_cmd,
5757
display_string,
5858
)
59-
from framework16_inputmodule.inputmodule.c1minimal import (
59+
from inputmodule.inputmodule.c1minimal import (
6060
set_color,
6161
get_color,
6262
RGB_COLORS,
@@ -121,12 +121,14 @@ def main_cli():
121121
help="Display a PNG or GIF image in greyscale",
122122
type=argparse.FileType("rb"),
123123
)
124-
parser.add_argument("--camera", help="Stream from the webcam", action="store_true")
124+
parser.add_argument(
125+
"--camera", help="Stream from the webcam", action="store_true")
125126
parser.add_argument("--video", help="Play a video", type=str)
126127
parser.add_argument(
127128
"--percentage", help="Fill a percentage of the screen", type=int
128129
)
129-
parser.add_argument("--clock", help="Display the current time", action="store_true")
130+
parser.add_argument(
131+
"--clock", help="Display the current time", action="store_true")
130132
parser.add_argument(
131133
"--string", help="Display a string or number, like FPS", type=str
132134
)
@@ -146,7 +148,8 @@ def main_cli():
146148
"--breathing", help="Breathing of the current pattern", action="store_true"
147149
)
148150
parser.add_argument("--eq", help="Equalizer", nargs="+", type=int)
149-
parser.add_argument("--random-eq", help="Random Equalizer", action="store_true")
151+
parser.add_argument(
152+
"--random-eq", help="Random Equalizer", action="store_true")
150153
parser.add_argument("--wpm", help="WPM Demo", action="store_true")
151154
parser.add_argument("--snake", help="Snake", action="store_true")
152155
parser.add_argument(
@@ -207,7 +210,8 @@ def main_cli():
207210
parser.add_argument(
208211
"--set-power-mode", help="Set screen power mode", choices=["high", "low"]
209212
)
210-
parser.add_argument("--get-fps", help="Set screen FPS", action="store_true")
213+
parser.add_argument("--get-fps", help="Set screen FPS",
214+
action="store_true")
211215
parser.add_argument(
212216
"--get-power-mode", help="Set screen power mode", action="store_true"
213217
)
@@ -236,7 +240,8 @@ def main_cli():
236240
gui.popup(args.gui, "No device found")
237241
sys.exit(1)
238242
elif args.serial_dev is not None:
239-
filtered_devs = [port for port in ports if port.name in args.serial_dev]
243+
filtered_devs = [
244+
port for port in ports if port.name in args.serial_dev]
240245
if not filtered_devs:
241246
print("Failed to find requested device")
242247
sys.exit(1)
File renamed without changes.

python/framework16_inputmodule/gui/__init__.py renamed to python/inputmodule/gui/__init__.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
import PySimpleGUI as sg
66

7-
from framework16_inputmodule.inputmodule import (
7+
from inputmodule.inputmodule import (
88
send_command,
99
get_version,
1010
brightness,
1111
get_brightness,
1212
bootloader,
1313
CommandVals,
1414
)
15-
from framework16_inputmodule.gui.games import snake
16-
from framework16_inputmodule.gui.ledmatrix import countdown, random_eq, clock
17-
from framework16_inputmodule.gui.gui_threading import stop_thread, is_dev_disconnected
18-
from framework16_inputmodule.inputmodule.ledmatrix import (
15+
from inputmodule.gui.games import snake
16+
from inputmodule.gui.ledmatrix import countdown, random_eq, clock
17+
from inputmodule.gui.gui_threading import stop_thread, is_dev_disconnected
18+
from inputmodule.inputmodule.ledmatrix import (
1919
percentage,
2020
pattern,
2121
animate,
@@ -98,7 +98,8 @@ def run_gui(devices):
9898
[sg.HorizontalSeparator()],
9999
[sg.Text("Countdown Timer")],
100100
[
101-
sg.Spin([i for i in range(1, 60)], initial_value=10, k="-COUNTDOWN-"),
101+
sg.Spin([i for i in range(1, 60)],
102+
initial_value=10, k="-COUNTDOWN-"),
102103
sg.Text("Seconds"),
103104
sg.Button("Start", k="-START-COUNTDOWN-"),
104105
sg.Button("Stop", k="-STOP-COUNTDOWN-"),
@@ -115,13 +116,15 @@ def run_gui(devices):
115116
sg.Column(
116117
[
117118
[sg.Text("Greyscale Image")],
118-
[sg.Button("Send greyscale.gif", k="-SEND-GREY-IMAGE-")],
119+
[sg.Button("Send greyscale.gif",
120+
k="-SEND-GREY-IMAGE-")],
119121
]
120122
),
121123
],
122124
[sg.HorizontalSeparator()],
123125
[sg.Text("Display Current Time")],
124-
[sg.Button("Start", k="-START-TIME-"), sg.Button("Stop", k="-STOP-TIME-")],
126+
[sg.Button("Start", k="-START-TIME-"),
127+
sg.Button("Stop", k="-STOP-TIME-")],
125128
[sg.HorizontalSeparator()],
126129
[
127130
sg.Column(
@@ -200,7 +203,8 @@ def run_gui(devices):
200203
thread.start()
201204

202205
if event == "-START-TIME-":
203-
thread = threading.Thread(target=clock, args=(dev,), daemon=True)
206+
thread = threading.Thread(
207+
target=clock, args=(dev,), daemon=True)
204208
thread.start()
205209

206210
if event == "-PLAY-SNAKE-":
@@ -249,7 +253,8 @@ def run_gui(devices):
249253
image_bl(dev, path)
250254

251255
if event == "-SEND-GREY-IMAGE-":
252-
path = os.path.join(resource_path(), "res", "greyscale.gif")
256+
path = os.path.join(
257+
resource_path(), "res", "greyscale.gif")
253258
image_greyscale(dev, path)
254259

255260
if event == "-SEND-TEXT-":

python/framework16_inputmodule/gui/games.py renamed to python/inputmodule/gui/games.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
import time
55
import threading
66

7-
from framework16_inputmodule.inputmodule import (
7+
from inputmodule.inputmodule import (
88
GameControlVal,
99
send_command,
1010
CommandVals,
1111
Game,
1212
)
13-
from framework16_inputmodule.inputmodule.ledmatrix import (
13+
from inputmodule.inputmodule.ledmatrix import (
1414
show_string,
1515
WIDTH,
1616
HEIGHT,
@@ -181,7 +181,8 @@ def snake(dev):
181181
elif head == food:
182182
body.insert(0, oldhead)
183183
while food == head:
184-
food = (random.randint(0, WIDTH - 1), random.randint(0, HEIGHT - 1))
184+
food = (random.randint(0, WIDTH - 1),
185+
random.randint(0, HEIGHT - 1))
185186
elif body:
186187
body.pop()
187188
body.insert(0, oldhead)

python/framework16_inputmodule/gui/ledmatrix.py renamed to python/inputmodule/gui/ledmatrix.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
import time
33
import random
44

5-
from framework16_inputmodule.gui.gui_threading import (
5+
from inputmodule.gui.gui_threading import (
66
reset_thread,
77
is_thread_stopped,
88
is_dev_disconnected,
99
)
10-
from framework16_inputmodule.inputmodule.ledmatrix import (
10+
from inputmodule.inputmodule.ledmatrix import (
1111
light_leds,
1212
show_string,
1313
eq,
1414
breathing,
1515
)
16-
from framework16_inputmodule.inputmodule import brightness
16+
from inputmodule.inputmodule import brightness
1717

1818

1919
def countdown(dev, seconds):

python/framework16_inputmodule/inputmodule/__init__.py renamed to python/inputmodule/inputmodule/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import serial
33

44
# TODO: Make independent from GUI
5-
from framework16_inputmodule.gui.gui_threading import disconnect_dev
5+
from inputmodule.gui.gui_threading import disconnect_dev
66

77
FWK_MAGIC = [0x32, 0xAC]
88
FWK_VID = 0x32AC

python/framework16_inputmodule/inputmodule/b1display.py renamed to python/inputmodule/inputmodule/b1display.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import sys
22

3-
from framework16_inputmodule.inputmodule import send_command, CommandVals, FWK_MAGIC
3+
from inputmodule.inputmodule import send_command, CommandVals, FWK_MAGIC
44

55
B1_WIDTH = 300
66
B1_HEIGHT = 400
77
GREYSCALE_DEPTH = 32
88

9-
SCREEN_FPS = ["quarter", "half", "one", "two", "four", "eight", "sixteen", "thirtytwo"]
9+
SCREEN_FPS = ["quarter", "half", "one", "two",
10+
"four", "eight", "sixteen", "thirtytwo"]
1011
HIGH_FPS_MASK = 0b00010000
1112
LOW_FPS_MASK = 0b00000111
1213

python/framework16_inputmodule/inputmodule/c1minimal.py renamed to python/inputmodule/inputmodule/c1minimal.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from framework16_inputmodule.inputmodule import send_command, CommandVals
1+
from inputmodule.inputmodule import send_command, CommandVals
22

3-
RGB_COLORS = ["white", "black", "red", "green", "blue", "cyan", "yellow", "purple"]
3+
RGB_COLORS = ["white", "black", "red", "green",
4+
"blue", "cyan", "yellow", "purple"]
45

56

67
def get_color(dev):

python/framework16_inputmodule/inputmodule/ledmatrix.py renamed to python/inputmodule/inputmodule/ledmatrix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import serial
44

5-
from framework16_inputmodule import font
6-
from framework16_inputmodule.inputmodule import (
5+
from inputmodule import font
6+
from inputmodule.inputmodule import (
77
send_command,
88
CommandVals,
99
PatternVals,

python/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["hatchling", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

55
[project]
6-
name = "framework16_inputmodule"
6+
name = "inputmodule"
77
# TODO: Dynamic version from git (requires tags)
88
#dynamic = ["version"]
99
version = "0.1.1"
@@ -38,16 +38,16 @@ Source = "https://github.com/FrameworkComputer/inputmodule-rs"
3838

3939
# TODO: Figure out how to add a runnable-script
4040
[project.scripts]
41-
ledmatrixctl = "framework16_inputmodule.cli:main_cli"
41+
ledmatrixctl = "inputmodule.cli:main_cli"
4242

4343
[project.gui-scripts]
44-
ledmatrixgui = "framework16_inputmodule.cli:main_gui"
44+
ledmatrixgui = "inputmodule.cli:main_gui"
4545

4646
#[tool.hatch.version]
4747
#source = "vcs"
4848
#
4949
#[tool.hatch.build.hooks.vcs]
50-
#version-file = "framework16_inputmodule/_version.py"
50+
#version-file = "inputmodule/_version.py"
5151

5252
[tool.hatch.build.targets.sdist]
5353
exclude = [

0 commit comments

Comments
 (0)