使用 UV 包管理器

This commit is contained in:
Wang Zhiyu 2025-04-30 23:40:28 +08:00
parent bf400ca9c2
commit f33d7bbec8
33 changed files with 49 additions and 239 deletions

View File

@ -12,7 +12,7 @@ venv.bak/
*.egg-info/
dist/
build/
.tmp
# IDEs and editors
.vscode/
.idea/

View File

@ -1,52 +0,0 @@
import pygame
def selector():
pygame.init()
try:
width = int(input("Frame Width: "))
height = int(input("Frame Height: "))
except:
width = 800
height = 600
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("UI Design Auxiliary Tool")
selecting = False
start_pos = None
end_pos = None
running = True
screen.fill((0,0,0))
while running:
screen.fill((0,0,0))
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1: # 左键
selecting = True
start_pos = event.pos
elif event.type == pygame.MOUSEMOTION:
if selecting:
end_pos = event.pos
elif event.type == pygame.MOUSEBUTTONUP:
if event.button == 1:
selecting = False
if start_pos and end_pos:
rect = pygame.Rect(
start_pos,
(end_pos[0] - start_pos[0], end_pos[1] - start_pos[1]),
)
if selecting and start_pos and end_pos:
rect = pygame.Rect(
start_pos, (end_pos[0] - start_pos[0], end_pos[1] - start_pos[1])
)
pygame.draw.rect(screen, (255, 0, 0), rect, 2) # 绘制选区矩形
pygame.display.flip()
pygame.quit()
if __name__ == "__main__":
main()

View File

@ -1,28 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>图形参数生成器</title>
</head>
<body>
<h1>图形参数生成器</h1>
<label for="shape">图形类型:</label>
<select id="shape">
<option value="rect">矩形</option>
<option value="line">线条</option>
<option value="circle">圆形</option>
<option value="ellipse">椭圆</option>
<option value="polygon">多边形</option>
<option value="arc">弧形</option>
<option value="point"></option>
<option value="lines">线段</option>
</select><br><br>
<div id="params"></div><br>
<button id="generate">生成图形参数</button><br><br>
<div id="result"></div>
<script src="script.js"></script>
</body>
</html>

View File

@ -1,152 +0,0 @@
function generateShapeDict(shape, params) {
if (shape === 'rect') {
return {
method: 'rect',
pos: params.pos || [0, 0],
size: params.size || [1, 1],
color: params.color || [255, 255, 255],
width: params.width || 0
};
} else if (shape === 'line') {
return {
method: 'line',
start_pos: params.start_pos || [0, 0],
end_pos: params.end_pos || [1, 1],
color: params.color || [255, 255, 255]
};
} else if (shape === 'circle') {
return {
method: 'circle',
center: params.center || [0, 0],
radius: params.radius || 1,
color: params.color || [255, 255, 255]
};
} else if (shape === 'ellipse') {
return {
method: 'ellipse',
pos: params.pos || [0, 0],
size: params.size || [1, 1],
color: params.color || [255, 255, 255]
};
} else if (shape === 'polygon') {
return {
method: 'polygon',
pointlist: params.pointlist || [],
color: params.color || [255, 255, 255]
};
} else if (shape === 'arc') {
return {
method: 'arc',
pos: params.pos || [0, 0],
size: params.size || [1, 1],
color: params.color || [255, 255, 255],
start_angle: params.start_angle || 0,
stop_angle: params.stop_angle || 3.14
};
} else if (shape === 'point') {
return {
method: 'point',
pos: params.pos || [0, 0],
color: params.color || [255, 255, 255]
};
} else if (shape === 'lines') {
return {
method: 'lines',
pointlist: params.pointlist || [],
color: params.color || [255, 255, 255]
};
} else {
throw new Error("Unsupported shape type");
}
}
document.addEventListener('DOMContentLoaded', function() {
const shapeSelect = document.getElementById('shape');
const paramsDiv = document.getElementById('params');
const generateButton = document.getElementById('generate');
const resultDiv = document.getElementById('result');
function createInput(label, id, type = 'text') {
const input = document.createElement('input');
input.type = type;
input.id = id;
const labelElement = document.createElement('label');
labelElement.textContent = label + ': ';
labelElement.setAttribute('for', id);
paramsDiv.appendChild(labelElement);
paramsDiv.appendChild(input);
paramsDiv.appendChild(document.createElement('br'));
return input;
}
function updateParamsInputs() {
paramsDiv.innerHTML = '';
const shape = shapeSelect.value;
if (shape === 'rect') {
createInput('矩形位置 (x y)', 'pos');
createInput('矩形大小 (width height)', 'size');
createInput('矩形颜色 (R G B)', 'color');
createInput('矩形边框宽度', 'width', 'number');
} else if (shape === 'line') {
createInput('起始位置 (x y)', 'start_pos');
createInput('结束位置 (x y)', 'end_pos');
createInput('线条颜色 (R G B)', 'color');
} else if (shape === 'circle') {
createInput('圆心位置 (x y)', 'center');
createInput('圆的半径', 'radius', 'number');
createInput('圆的颜色 (R G B)', 'color');
} else if (shape === 'ellipse') {
createInput('椭圆位置 (x y)', 'pos');
createInput('椭圆大小 (width height)', 'size');
createInput('椭圆颜色 (R G B)', 'color');
} else if (shape === 'polygon') {
createInput('多边形的点 (x1 y1 x2 y2 ...)', 'pointlist');
createInput('多边形颜色 (R G B)', 'color');
} else if (shape === 'arc') {
createInput('弧的位置 (x y)', 'pos');
createInput('弧的大小 (width height)', 'size');
createInput('弧的颜色 (R G B)', 'color');
createInput('弧的起始角度 (弧度制)', 'start_angle', 'number');
createInput('弧的结束角度 (弧度制)', 'stop_angle', 'number');
} else if (shape === 'point') {
createInput('点的位置 (x y)', 'pos');
createInput('点的颜色 (R G B)', 'color');
} else if (shape === 'lines') {
createInput('线段的点 (x1 y1 x2 y2 ...)', 'pointlist');
createInput('线段颜色 (R G B)', 'color');
}
}
shapeSelect.addEventListener('change', updateParamsInputs);
updateParamsInputs();
generateButton.addEventListener('click', function() {
const shape = shapeSelect.value;
const params = {};
const inputs = paramsDiv.querySelectorAll('input');
inputs.forEach(input => {
if (input.id === 'pointlist') {
const points = input.value.split(' ').map(Number);
params.pointlist = [];
for (let i = 0; i < points.length; i += 2) {
params.pointlist.push([points[i], points[i + 1]]);
}
} else if (input.id === 'pos' || input.id === 'size' || input.id === 'start_pos' || input.id === 'end_pos' || input.id === 'center' || input.id === 'color') {
params[input.id] = input.value.split(' ').map(Number);
} else if (input.type === 'number') {
params[input.id] = parseFloat(input.value);
} else {
params[input.id] = input.value;
}
});
try {
const shapeDict = generateShapeDict(shape, params);
resultDiv.innerHTML = '<pre>' + JSON.stringify(shapeDict, null, 2) + '</pre>';
} catch (error) {
resultDiv.innerHTML = '<p>错误: ' + error.message + '</p>';
}
});
});

1
comet/.python-version Normal file
View File

@ -0,0 +1 @@
3.13

0
comet/agent_logs.log Normal file
View File

6
comet/main.py Normal file
View File

@ -0,0 +1,6 @@
def main():
print("Hello from comet!")
if __name__ == "__main__":
main()

7
comet/pyproject.toml Normal file
View File

@ -0,0 +1,7 @@
[project]
name = "Comet"
version = "0.1.0"
description = "A onboard controller implementation of AiraPulsar Flight Control System"
readme = "README.md"
requires-python = ">=3.13"
dependencies = []

0
lib/__init__.py Normal file
View File

Binary file not shown.

4
lib/agency/__init__.py Normal file
View File

@ -0,0 +1,4 @@
from .main import *
version = '0.1.0'
print(f"Powered by Moons Agency, version {version}")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

1
moon/.python-version Normal file
View File

@ -0,0 +1 @@
3.13

6
moon/main.py Normal file
View File

@ -0,0 +1,6 @@
def main():
print("Hello from moon!")
if __name__ == "__main__":
main()

7
moon/pyproject.toml Normal file
View File

@ -0,0 +1,7 @@
[project]
name = "Moon"
version = "0.1.0"
description = "A relay server implementation of AiraPulsar Flight Control System"
readme = "README.md"
requires-python = ">=3.13"
dependencies = []

1
pulsar/.python-version Normal file
View File

@ -0,0 +1 @@
3.13

0
pulsar/agent_logs.log Normal file
View File

Binary file not shown.

View File

@ -1,6 +1,4 @@
import vgl
from lib import vgl
name = "Marking Lines"
def main(window):
@ -22,3 +20,6 @@ def main(window):
for i in lines:
i.set_color('#' + str((info['cursor']['position'][0] + info['cursor']['position'][1]*100 + info['cursor']['position'][0]*10000) % 999999).zfill(6))
observer()
#@vgl.loop # TODO
#def toloop():
# pass

View File

@ -1,9 +1,10 @@
import vgl
from lib import vgl
from lib import agency
import colorama
import os
import importlib.util
window = vgl.Window(title="Pulsar", size=(1024, 768))
window = vgl.Window(title="Pulsar", size=(1600, 1000))
def loader():
components_dir = "components"

7
pulsar/pyproject.toml Normal file
View File

@ -0,0 +1,7 @@
[project]
name = "Pulsar"
version = "0.1.0"
description = "A client implementation of AiraPulsar Flight Control System"
readme = "README.md"
requires-python = ">=3.13"
dependencies = []

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
from vgl.main import *
from .main import *
import pygame
import time