Aktraiser
commited on
Commit
·
98b6105
1
Parent(s):
dae98db
probleme init2
Browse files- tools/__init__.py +1 -2
- tools/figjam.py +5 -17
- tools/figma_design.py +7 -7
- tools/test_creation.py +0 -21
tools/__init__.py
CHANGED
@@ -7,5 +7,4 @@ from .config import *
|
|
7 |
from .navigation import *
|
8 |
from .user_account import *
|
9 |
from .figma_design import *
|
10 |
-
from .figjam import *
|
11 |
-
from .test_creation import *
|
|
|
7 |
from .navigation import *
|
8 |
from .user_account import *
|
9 |
from .figma_design import *
|
10 |
+
from .figjam import *
|
|
tools/figjam.py
CHANGED
@@ -24,7 +24,7 @@ def create_figjam_sticky_note(x: str, y: str, text: str, width: str = "240", hei
|
|
24 |
x_pos, y_pos = float(x), float(y)
|
25 |
w, h = float(width), float(height)
|
26 |
|
27 |
-
comment_text = f"
|
28 |
|
29 |
comment_data = {
|
30 |
"message": comment_text,
|
@@ -46,7 +46,7 @@ def create_figjam_sticky_note(x: str, y: str, text: str, width: str = "240", hei
|
|
46 |
|
47 |
def create_figjam_connector_between_elements(element1_name: str, element2_name: str, style: str = "solid") -> str:
|
48 |
"""
|
49 |
-
Crée un connecteur entre deux éléments FigJam
|
50 |
|
51 |
Args:
|
52 |
element1_name (str): Nom du premier élément à connecter
|
@@ -59,7 +59,7 @@ def create_figjam_connector_between_elements(element1_name: str, element2_name:
|
|
59 |
if not figma_config["file_id"]:
|
60 |
return "❌ ID du fichier requis. Utilisez configure_figma_file_id() d'abord."
|
61 |
|
62 |
-
comment_text = f"
|
63 |
|
64 |
comment_data = {
|
65 |
"message": comment_text,
|
@@ -78,7 +78,7 @@ def create_figjam_connector_between_elements(element1_name: str, element2_name:
|
|
78 |
|
79 |
def create_figjam_shape_with_text(x: str, y: str, shape_type: str, text: str, width: str = "208", height: str = "208") -> str:
|
80 |
"""
|
81 |
-
Crée une forme avec texte intégré dans FigJam
|
82 |
|
83 |
Args:
|
84 |
x (str): Position X de la forme en pixels
|
@@ -98,19 +98,7 @@ def create_figjam_shape_with_text(x: str, y: str, shape_type: str, text: str, wi
|
|
98 |
x_pos, y_pos = float(x), float(y)
|
99 |
w, h = float(width), float(height)
|
100 |
|
101 |
-
|
102 |
-
supported_shapes = {
|
103 |
-
"rectangle": "ROUNDED_RECTANGLE",
|
104 |
-
"circle": "ELLIPSE",
|
105 |
-
"triangle": "TRIANGLE",
|
106 |
-
"diamond": "DIAMOND",
|
107 |
-
"star": "STAR",
|
108 |
-
"hexagon": "HEXAGON"
|
109 |
-
}
|
110 |
-
|
111 |
-
figma_shape = supported_shapes.get(shape_type.lower(), "ROUNDED_RECTANGLE")
|
112 |
-
|
113 |
-
comment_text = f"🔶 **Forme avec texte FigJam (API officielle) :**\n- Position: ({x_pos}, {y_pos})\n- Type: {shape_type} → {figma_shape}\n- Taille: {w}x{h}px (défaut: 208x208)\n- Texte: \"{text}\"\n\n📋 **Code Plugin Figma :**\n```javascript\nconst shape = figma.createShapeWithText()\nshape.x = {x_pos}\nshape.y = {y_pos}\nshape.resize({w}, {h})\nshape.shapeType = '{figma_shape}'\nawait figma.loadFontAsync(shape.text.fontName)\nshape.text.characters = '{text}'\n```"
|
114 |
|
115 |
comment_data = {
|
116 |
"message": comment_text,
|
|
|
24 |
x_pos, y_pos = float(x), float(y)
|
25 |
w, h = float(width), float(height)
|
26 |
|
27 |
+
comment_text = f"Sticky Note a creer a ({x_pos}, {y_pos}) taille {w}x{h} texte: {text}"
|
28 |
|
29 |
comment_data = {
|
30 |
"message": comment_text,
|
|
|
46 |
|
47 |
def create_figjam_connector_between_elements(element1_name: str, element2_name: str, style: str = "solid") -> str:
|
48 |
"""
|
49 |
+
Crée un connecteur entre deux éléments FigJam.
|
50 |
|
51 |
Args:
|
52 |
element1_name (str): Nom du premier élément à connecter
|
|
|
59 |
if not figma_config["file_id"]:
|
60 |
return "❌ ID du fichier requis. Utilisez configure_figma_file_id() d'abord."
|
61 |
|
62 |
+
comment_text = f"Connecteur a creer entre {element1_name} et {element2_name} style {style}"
|
63 |
|
64 |
comment_data = {
|
65 |
"message": comment_text,
|
|
|
78 |
|
79 |
def create_figjam_shape_with_text(x: str, y: str, shape_type: str, text: str, width: str = "208", height: str = "208") -> str:
|
80 |
"""
|
81 |
+
Crée une forme avec texte intégré dans FigJam.
|
82 |
|
83 |
Args:
|
84 |
x (str): Position X de la forme en pixels
|
|
|
98 |
x_pos, y_pos = float(x), float(y)
|
99 |
w, h = float(width), float(height)
|
100 |
|
101 |
+
comment_text = f"Forme {shape_type} avec texte a creer a ({x_pos}, {y_pos}) taille {w}x{h} texte: {text}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
comment_data = {
|
104 |
"message": comment_text,
|
tools/figma_design.py
CHANGED
@@ -25,8 +25,8 @@ def create_figma_rectangle(x: str, y: str, width: str, height: str, name: str =
|
|
25 |
x_pos, y_pos = float(x), float(y)
|
26 |
w, h = float(width), float(height)
|
27 |
|
28 |
-
#
|
29 |
-
comment_text = f"
|
30 |
|
31 |
comment_data = {
|
32 |
"message": comment_text,
|
@@ -41,7 +41,7 @@ def create_figma_rectangle(x: str, y: str, width: str, height: str, name: str =
|
|
41 |
if "error" in result:
|
42 |
return f"❌ Erreur lors de la création du commentaire : {result['error']}"
|
43 |
|
44 |
-
return f"✅ Rectangle {name} créé
|
45 |
|
46 |
except ValueError:
|
47 |
return "❌ Les coordonnées et dimensions doivent être des nombres"
|
@@ -67,7 +67,7 @@ def create_figma_frame(x: str, y: str, width: str, height: str, name: str = "Fra
|
|
67 |
x_pos, y_pos = float(x), float(y)
|
68 |
w, h = float(width), float(height)
|
69 |
|
70 |
-
comment_text = f"
|
71 |
|
72 |
comment_data = {
|
73 |
"message": comment_text,
|
@@ -82,7 +82,7 @@ def create_figma_frame(x: str, y: str, width: str, height: str, name: str = "Fra
|
|
82 |
if "error" in result:
|
83 |
return f"❌ Erreur lors de la création du commentaire : {result['error']}"
|
84 |
|
85 |
-
return f"✅ Frame {name} créé
|
86 |
|
87 |
except ValueError:
|
88 |
return "❌ Les coordonnées et dimensions doivent être des nombres"
|
@@ -108,7 +108,7 @@ def create_figma_text(x: str, y: str, text: str, name: str = "Text", font_size:
|
|
108 |
x_pos, y_pos = float(x), float(y)
|
109 |
size = float(font_size)
|
110 |
|
111 |
-
comment_text = f"
|
112 |
|
113 |
comment_data = {
|
114 |
"message": comment_text,
|
@@ -123,7 +123,7 @@ def create_figma_text(x: str, y: str, text: str, name: str = "Text", font_size:
|
|
123 |
if "error" in result:
|
124 |
return f"❌ Erreur lors de la création du commentaire : {result['error']}"
|
125 |
|
126 |
-
return f"✅ Texte
|
127 |
|
128 |
except ValueError:
|
129 |
return "❌ Les coordonnées et la taille doivent être des nombres"
|
|
|
25 |
x_pos, y_pos = float(x), float(y)
|
26 |
w, h = float(width), float(height)
|
27 |
|
28 |
+
# Message simple sans code JavaScript complexe
|
29 |
+
comment_text = f"Rectangle a creer: {name} a ({x_pos}, {y_pos}) taille {w}x{h} couleur {color}"
|
30 |
|
31 |
comment_data = {
|
32 |
"message": comment_text,
|
|
|
41 |
if "error" in result:
|
42 |
return f"❌ Erreur lors de la création du commentaire : {result['error']}"
|
43 |
|
44 |
+
return f"✅ Rectangle {name} créé à ({x_pos}, {y_pos}) avec la taille {w}x{h}"
|
45 |
|
46 |
except ValueError:
|
47 |
return "❌ Les coordonnées et dimensions doivent être des nombres"
|
|
|
67 |
x_pos, y_pos = float(x), float(y)
|
68 |
w, h = float(width), float(height)
|
69 |
|
70 |
+
comment_text = f"Frame a creer: {name} a ({x_pos}, {y_pos}) taille {w}x{h}"
|
71 |
|
72 |
comment_data = {
|
73 |
"message": comment_text,
|
|
|
82 |
if "error" in result:
|
83 |
return f"❌ Erreur lors de la création du commentaire : {result['error']}"
|
84 |
|
85 |
+
return f"✅ Frame {name} créé à ({x_pos}, {y_pos}) avec la taille {w}x{h}"
|
86 |
|
87 |
except ValueError:
|
88 |
return "❌ Les coordonnées et dimensions doivent être des nombres"
|
|
|
108 |
x_pos, y_pos = float(x), float(y)
|
109 |
size = float(font_size)
|
110 |
|
111 |
+
comment_text = f"Texte a creer: {name} a ({x_pos}, {y_pos}) contenu: {text} taille: {size}px"
|
112 |
|
113 |
comment_data = {
|
114 |
"message": comment_text,
|
|
|
123 |
if "error" in result:
|
124 |
return f"❌ Erreur lors de la création du commentaire : {result['error']}"
|
125 |
|
126 |
+
return f"✅ Texte {text} créé à ({x_pos}, {y_pos})"
|
127 |
|
128 |
except ValueError:
|
129 |
return "❌ Les coordonnées et la taille doivent être des nombres"
|
tools/test_creation.py
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
🧪 Test d'une fonction de création simple
|
3 |
-
"""
|
4 |
-
from .config import figma_config
|
5 |
-
|
6 |
-
def test_create_simple_element(x: str, y: str, name: str = "Test") -> str:
|
7 |
-
"""
|
8 |
-
Fonction de test pour créer un élément simple.
|
9 |
-
|
10 |
-
Args:
|
11 |
-
x (str): Position X en pixels
|
12 |
-
y (str): Position Y en pixels
|
13 |
-
name (str): Nom de l'élément (défaut: Test)
|
14 |
-
|
15 |
-
Returns:
|
16 |
-
str: Message de confirmation
|
17 |
-
"""
|
18 |
-
if not figma_config["file_id"]:
|
19 |
-
return "❌ ID du fichier requis"
|
20 |
-
|
21 |
-
return f"✅ Test élément {name} créé à ({x}, {y})"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|