gui.panels.slide_assistant

Snippets YAML para los 28 tipos de slide disponibles.

  1"""Snippets YAML para los 28 tipos de slide disponibles."""
  2
  3# Indentación de 6 espacios: correcta para insertar dentro de slides:
  4_I = '      '   # 6 espacios — nivel de "- tipo:" en el YAML
  5
  6SNIPPETS: dict[str, str] = {
  7    # ── Texto y listas ────────────────────────────────────────────────────────
  8    'bullets': (
  9        f'{_I}- tipo: bullets\n'
 10        f'{_I}  items:\n'
 11        f'{_I}    - ""\n'
 12        f'{_I}    - ""\n'
 13    ),
 14    'texto': (
 15        f'{_I}- tipo: texto\n'
 16        f'{_I}  texto: ""\n'
 17    ),
 18    'aviso': (
 19        f'{_I}- tipo: aviso\n'
 20        f'{_I}  nivel: warning\n'
 21        f'{_I}  texto: ""\n'
 22    ),
 23    'dos_columnas': (
 24        f'{_I}- tipo: dos_columnas\n'
 25        f'{_I}  izquierda:\n'
 26        f'{_I}    - ""\n'
 27        f'{_I}  derecha:\n'
 28        f'{_I}    - ""\n'
 29    ),
 30    # ── Terminal / consola ───────────────────────────────────────────────────
 31    'terminal': (
 32        f'{_I}- tipo: terminal\n'
 33        f'{_I}  items:\n'
 34        f'{_I}    - {{cmt: ""}}\n'
 35        f'{_I}    - ""\n'
 36    ),
 37    'salida': (
 38        f'{_I}- tipo: salida\n'
 39        f'{_I}  items:\n'
 40        f'{_I}    - ""\n'
 41        f'{_I}    - {{ok: ""}}\n'
 42    ),
 43    'code': (
 44        f'{_I}- tipo: code\n'
 45        f'{_I}  items:\n'
 46        f'{_I}    - {{cmt: ""}}\n'
 47        f'{_I}    - ""\n'
 48    ),
 49    'diagrama': (
 50        f'{_I}- tipo: diagrama\n'
 51        f'{_I}  texto: |\n'
 52        f'{_I}    \n'
 53    ),
 54    # ── Código fuente ─────────────────────────────────────────────────────────
 55    'java': (
 56        f'{_I}- tipo: java\n'
 57        f'{_I}  texto: |\n'
 58        f'{_I}    public class Nombre {{\n'
 59        f'{_I}    }}\n'
 60    ),
 61    'python': (
 62        f'{_I}- tipo: python\n'
 63        f'{_I}  texto: |\n'
 64        f'{_I}    def nombre():\n'
 65        f'{_I}        pass\n'
 66    ),
 67    'javascript': (
 68        f'{_I}- tipo: javascript\n'
 69        f'{_I}  texto: |\n'
 70        f'{_I}    function nombre() {{\n'
 71        f'{_I}    }}\n'
 72    ),
 73    'html': (
 74        f'{_I}- tipo: html\n'
 75        f'{_I}  texto: |\n'
 76        f'{_I}    <!DOCTYPE html>\n'
 77        f'{_I}    <html>\n'
 78        f'{_I}    </html>\n'
 79    ),
 80    'xml': (
 81        f'{_I}- tipo: xml\n'
 82        f'{_I}  texto: |\n'
 83        f'{_I}    <elemento>\n'
 84        f'{_I}    </elemento>\n'
 85    ),
 86    'jsp': (
 87        f'{_I}- tipo: jsp\n'
 88        f'{_I}  texto: |\n'
 89        f'{_I}    <%@ taglib uri="" prefix="c" %>\n'
 90    ),
 91    'css': (
 92        f'{_I}- tipo: css\n'
 93        f'{_I}  texto: |\n'
 94        f'{_I}    .selector {{\n'
 95        f'{_I}    }}\n'
 96    ),
 97    'json': (
 98        f'{_I}- tipo: json\n'
 99        f'{_I}  texto: |\n'
100        f'{_I}    {{\n'
101        f'{_I}    }}\n'
102    ),
103    'yaml': (
104        f'{_I}- tipo: yaml\n'
105        f'{_I}  texto: |\n'
106        f'{_I}    clave: valor\n'
107    ),
108    'codigo': (
109        f'{_I}- tipo: codigo\n'
110        f'{_I}  texto: |\n'
111        f'{_I}    \n'
112    ),
113    # ── Comparaciones ─────────────────────────────────────────────────────────
114    'comparar': (
115        f'{_I}- tipo: comparar\n'
116        f'{_I}  izquierda:\n'
117        f'{_I}    - ""\n'
118        f'{_I}  derecha:\n'
119        f'{_I}    - ""\n'
120    ),
121    'comparar_python': (
122        f'{_I}- tipo: comparar_python\n'
123        f'{_I}  izquierda:\n'
124        f'{_I}    - ""\n'
125        f'{_I}  derecha:\n'
126        f'{_I}    - ""\n'
127    ),
128    'comparar_js': (
129        f'{_I}- tipo: comparar_js\n'
130        f'{_I}  izquierda:\n'
131        f'{_I}    - ""\n'
132        f'{_I}  derecha:\n'
133        f'{_I}    - ""\n'
134    ),
135    'comparar_xml': (
136        f'{_I}- tipo: comparar_xml\n'
137        f'{_I}  izquierda:\n'
138        f'{_I}    - ""\n'
139        f'{_I}  derecha:\n'
140        f'{_I}    - ""\n'
141    ),
142    'comparar_json': (
143        f'{_I}- tipo: comparar_json\n'
144        f'{_I}  izquierda:\n'
145        f'{_I}    - ""\n'
146        f'{_I}  derecha:\n'
147        f'{_I}    - ""\n'
148    ),
149    'comparar_css': (
150        f'{_I}- tipo: comparar_css\n'
151        f'{_I}  izquierda:\n'
152        f'{_I}    - ""\n'
153        f'{_I}  derecha:\n'
154        f'{_I}    - ""\n'
155    ),
156    'comparar_jsp': (
157        f'{_I}- tipo: comparar_jsp\n'
158        f'{_I}  izquierda:\n'
159        f'{_I}    - ""\n'
160        f'{_I}  derecha:\n'
161        f'{_I}    - ""\n'
162    ),
163    # ── Cita ─────────────────────────────────────────────────────────────────
164    'cita': (
165        f'{_I}- tipo: cita\n'
166        f'{_I}  cita: ""\n'
167        f'{_I}  autor: ""\n'
168        f'{_I}  fuente: ""   # opcional\n'
169    ),
170    # ── Tabla e imagen ────────────────────────────────────────────────────────
171    'tabla': (
172        f'{_I}- tipo: tabla\n'
173        f'{_I}  cabeceras: ["Col1", "Col2"]\n'
174        f'{_I}  filas:\n'
175        f'{_I}    - ["", ""]\n'
176    ),
177    'imagen': (
178        f'{_I}- tipo: imagen\n'
179        f'{_I}  ruta: ""\n'
180    ),
181    'imagen_texto': (
182        f'{_I}- tipo: imagen_texto\n'
183        f'{_I}  ruta: ""\n'
184        f'{_I}  texto: ""\n'
185    ),
186}
187
188# Orden por categoría para el QComboBox
189SLIDE_TYPES: list[str] = [
190    'bullets', 'texto', 'cita', 'aviso', 'dos_columnas',
191    'terminal', 'salida', 'code', 'diagrama',
192    'java', 'python', 'javascript', 'html', 'xml', 'jsp', 'css',
193    'json', 'yaml', 'codigo',
194    'comparar', 'comparar_python', 'comparar_js', 'comparar_xml',
195    'comparar_json', 'comparar_css', 'comparar_jsp',
196    'tabla', 'imagen', 'imagen_texto',
197]
198
199
200class SlideAssistant:
201    @staticmethod
202    def get_snippet(tipo: str) -> str:
203        return SNIPPETS.get(tipo, f'{_I}- tipo: {tipo}\n')
SNIPPETS: dict[str, str] = {'bullets': ' - tipo: bullets\n items:\n - ""\n - ""\n', 'texto': ' - tipo: texto\n texto: ""\n', 'aviso': ' - tipo: aviso\n nivel: warning\n texto: ""\n', 'dos_columnas': ' - tipo: dos_columnas\n izquierda:\n - ""\n derecha:\n - ""\n', 'terminal': ' - tipo: terminal\n items:\n - {cmt: ""}\n - ""\n', 'salida': ' - tipo: salida\n items:\n - ""\n - {ok: ""}\n', 'code': ' - tipo: code\n items:\n - {cmt: ""}\n - ""\n', 'diagrama': ' - tipo: diagrama\n texto: |\n \n', 'java': ' - tipo: java\n texto: |\n public class Nombre {\n }\n', 'python': ' - tipo: python\n texto: |\n def nombre():\n pass\n', 'javascript': ' - tipo: javascript\n texto: |\n function nombre() {\n }\n', 'html': ' - tipo: html\n texto: |\n <!DOCTYPE html>\n <html>\n </html>\n', 'xml': ' - tipo: xml\n texto: |\n <elemento>\n </elemento>\n', 'jsp': ' - tipo: jsp\n texto: |\n <%@ taglib uri="" prefix="c" %>\n', 'css': ' - tipo: css\n texto: |\n .selector {\n }\n', 'json': ' - tipo: json\n texto: |\n {\n }\n', 'yaml': ' - tipo: yaml\n texto: |\n clave: valor\n', 'codigo': ' - tipo: codigo\n texto: |\n \n', 'comparar': ' - tipo: comparar\n izquierda:\n - ""\n derecha:\n - ""\n', 'comparar_python': ' - tipo: comparar_python\n izquierda:\n - ""\n derecha:\n - ""\n', 'comparar_js': ' - tipo: comparar_js\n izquierda:\n - ""\n derecha:\n - ""\n', 'comparar_xml': ' - tipo: comparar_xml\n izquierda:\n - ""\n derecha:\n - ""\n', 'comparar_json': ' - tipo: comparar_json\n izquierda:\n - ""\n derecha:\n - ""\n', 'comparar_css': ' - tipo: comparar_css\n izquierda:\n - ""\n derecha:\n - ""\n', 'comparar_jsp': ' - tipo: comparar_jsp\n izquierda:\n - ""\n derecha:\n - ""\n', 'cita': ' - tipo: cita\n cita: ""\n autor: ""\n fuente: "" # opcional\n', 'tabla': ' - tipo: tabla\n cabeceras: ["Col1", "Col2"]\n filas:\n - ["", ""]\n', 'imagen': ' - tipo: imagen\n ruta: ""\n', 'imagen_texto': ' - tipo: imagen_texto\n ruta: ""\n texto: ""\n'}
SLIDE_TYPES: list[str] = ['bullets', 'texto', 'cita', 'aviso', 'dos_columnas', 'terminal', 'salida', 'code', 'diagrama', 'java', 'python', 'javascript', 'html', 'xml', 'jsp', 'css', 'json', 'yaml', 'codigo', 'comparar', 'comparar_python', 'comparar_js', 'comparar_xml', 'comparar_json', 'comparar_css', 'comparar_jsp', 'tabla', 'imagen', 'imagen_texto']
class SlideAssistant:
201class SlideAssistant:
202    @staticmethod
203    def get_snippet(tipo: str) -> str:
204        return SNIPPETS.get(tipo, f'{_I}- tipo: {tipo}\n')
@staticmethod
def get_snippet(tipo: str) -> str:
202    @staticmethod
203    def get_snippet(tipo: str) -> str:
204        return SNIPPETS.get(tipo, f'{_I}- tipo: {tipo}\n')