gui.panels.slide_assistant

Snippets YAML para los 28 tipos de slide disponibles.

  1# Copyright (C) 2026  David Vaquero <pepesan@gmail.com>
  2#
  3# This program is free software: you can redistribute it and/or modify
  4# it under the terms of the GNU General Public License as published by
  5# the Free Software Foundation, either version 3 of the License, or
  6# (at your option) any later version.
  7#
  8# This program is distributed in the hope that it will be useful,
  9# but WITHOUT ANY WARRANTY; without even the implied warranty of
 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 11# GNU General Public License for more details.
 12#
 13# You should have received a copy of the GNU General Public License
 14# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 15
 16"""Snippets YAML para los 28 tipos de slide disponibles."""
 17
 18# Indentación de 6 espacios: correcta para insertar dentro de slides:
 19_I = '      '   # 6 espacios — nivel de "- tipo:" en el YAML
 20
 21SNIPPETS: dict[str, str] = {
 22    # ── Texto y listas ────────────────────────────────────────────────────────
 23    'bullets': (
 24        f'{_I}- tipo: bullets\n'
 25        f'{_I}  items:\n'
 26        f'{_I}    - ""\n'
 27        f'{_I}    - ""\n'
 28    ),
 29    'texto': (
 30        f'{_I}- tipo: texto\n'
 31        f'{_I}  texto: ""\n'
 32    ),
 33    'aviso': (
 34        f'{_I}- tipo: aviso\n'
 35        f'{_I}  nivel: warning\n'
 36        f'{_I}  texto: ""\n'
 37    ),
 38    'dos_columnas': (
 39        f'{_I}- tipo: dos_columnas\n'
 40        f'{_I}  izquierda:\n'
 41        f'{_I}    - ""\n'
 42        f'{_I}  derecha:\n'
 43        f'{_I}    - ""\n'
 44    ),
 45    # ── Terminal / consola ───────────────────────────────────────────────────
 46    'terminal': (
 47        f'{_I}- tipo: terminal\n'
 48        f'{_I}  items:\n'
 49        f'{_I}    - {{cmt: ""}}\n'
 50        f'{_I}    - ""\n'
 51    ),
 52    'salida': (
 53        f'{_I}- tipo: salida\n'
 54        f'{_I}  items:\n'
 55        f'{_I}    - ""\n'
 56        f'{_I}    - {{ok: ""}}\n'
 57    ),
 58    'code': (
 59        f'{_I}- tipo: code\n'
 60        f'{_I}  items:\n'
 61        f'{_I}    - {{cmt: ""}}\n'
 62        f'{_I}    - ""\n'
 63    ),
 64    'diagrama': (
 65        f'{_I}- tipo: diagrama\n'
 66        f'{_I}  texto: |\n'
 67        f'{_I}    \n'
 68    ),
 69    # ── Código fuente ─────────────────────────────────────────────────────────
 70    'java': (
 71        f'{_I}- tipo: java\n'
 72        f'{_I}  texto: |\n'
 73        f'{_I}    public class Nombre {{\n'
 74        f'{_I}    }}\n'
 75    ),
 76    'python': (
 77        f'{_I}- tipo: python\n'
 78        f'{_I}  texto: |\n'
 79        f'{_I}    def nombre():\n'
 80        f'{_I}        pass\n'
 81    ),
 82    'javascript': (
 83        f'{_I}- tipo: javascript\n'
 84        f'{_I}  texto: |\n'
 85        f'{_I}    function nombre() {{\n'
 86        f'{_I}    }}\n'
 87    ),
 88    'html': (
 89        f'{_I}- tipo: html\n'
 90        f'{_I}  texto: |\n'
 91        f'{_I}    <!DOCTYPE html>\n'
 92        f'{_I}    <html>\n'
 93        f'{_I}    </html>\n'
 94    ),
 95    'xml': (
 96        f'{_I}- tipo: xml\n'
 97        f'{_I}  texto: |\n'
 98        f'{_I}    <elemento>\n'
 99        f'{_I}    </elemento>\n'
100    ),
101    'jsp': (
102        f'{_I}- tipo: jsp\n'
103        f'{_I}  texto: |\n'
104        f'{_I}    <%@ taglib uri="" prefix="c" %>\n'
105    ),
106    'css': (
107        f'{_I}- tipo: css\n'
108        f'{_I}  texto: |\n'
109        f'{_I}    .selector {{\n'
110        f'{_I}    }}\n'
111    ),
112    'json': (
113        f'{_I}- tipo: json\n'
114        f'{_I}  texto: |\n'
115        f'{_I}    {{\n'
116        f'{_I}    }}\n'
117    ),
118    'yaml': (
119        f'{_I}- tipo: yaml\n'
120        f'{_I}  texto: |\n'
121        f'{_I}    clave: valor\n'
122    ),
123    'codigo': (
124        f'{_I}- tipo: codigo\n'
125        f'{_I}  texto: |\n'
126        f'{_I}    \n'
127    ),
128    # ── Comparaciones ─────────────────────────────────────────────────────────
129    'comparar': (
130        f'{_I}- tipo: comparar\n'
131        f'{_I}  izquierda:\n'
132        f'{_I}    - ""\n'
133        f'{_I}  derecha:\n'
134        f'{_I}    - ""\n'
135    ),
136    'comparar_python': (
137        f'{_I}- tipo: comparar_python\n'
138        f'{_I}  izquierda:\n'
139        f'{_I}    - ""\n'
140        f'{_I}  derecha:\n'
141        f'{_I}    - ""\n'
142    ),
143    'comparar_js': (
144        f'{_I}- tipo: comparar_js\n'
145        f'{_I}  izquierda:\n'
146        f'{_I}    - ""\n'
147        f'{_I}  derecha:\n'
148        f'{_I}    - ""\n'
149    ),
150    'comparar_xml': (
151        f'{_I}- tipo: comparar_xml\n'
152        f'{_I}  izquierda:\n'
153        f'{_I}    - ""\n'
154        f'{_I}  derecha:\n'
155        f'{_I}    - ""\n'
156    ),
157    'comparar_json': (
158        f'{_I}- tipo: comparar_json\n'
159        f'{_I}  izquierda:\n'
160        f'{_I}    - ""\n'
161        f'{_I}  derecha:\n'
162        f'{_I}    - ""\n'
163    ),
164    'comparar_css': (
165        f'{_I}- tipo: comparar_css\n'
166        f'{_I}  izquierda:\n'
167        f'{_I}    - ""\n'
168        f'{_I}  derecha:\n'
169        f'{_I}    - ""\n'
170    ),
171    'comparar_jsp': (
172        f'{_I}- tipo: comparar_jsp\n'
173        f'{_I}  izquierda:\n'
174        f'{_I}    - ""\n'
175        f'{_I}  derecha:\n'
176        f'{_I}    - ""\n'
177    ),
178    # ── Cita ─────────────────────────────────────────────────────────────────
179    'cita': (
180        f'{_I}- tipo: cita\n'
181        f'{_I}  cita: ""\n'
182        f'{_I}  autor: ""\n'
183        f'{_I}  fuente: ""   # opcional\n'
184    ),
185    # ── Tabla e imagen ────────────────────────────────────────────────────────
186    'tabla': (
187        f'{_I}- tipo: tabla\n'
188        f'{_I}  cabeceras: ["Col1", "Col2"]\n'
189        f'{_I}  filas:\n'
190        f'{_I}    - ["", ""]\n'
191    ),
192    'imagen': (
193        f'{_I}- tipo: imagen\n'
194        f'{_I}  ruta: ""\n'
195    ),
196    'imagen_texto': (
197        f'{_I}- tipo: imagen_texto\n'
198        f'{_I}  ruta: ""\n'
199        f'{_I}  texto: ""\n'
200    ),
201}
202
203# Orden por categoría para el QComboBox
204SLIDE_TYPES: list[str] = [
205    'bullets', 'texto', 'cita', 'aviso', 'dos_columnas',
206    'terminal', 'salida', 'code', 'diagrama',
207    'java', 'python', 'javascript', 'html', 'xml', 'jsp', 'css',
208    'json', 'yaml', 'codigo',
209    'comparar', 'comparar_python', 'comparar_js', 'comparar_xml',
210    'comparar_json', 'comparar_css', 'comparar_jsp',
211    'tabla', 'imagen', 'imagen_texto',
212]
213
214
215class SlideAssistant:
216    @staticmethod
217    def get_snippet(tipo: str) -> str:
218        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:
216class SlideAssistant:
217    @staticmethod
218    def get_snippet(tipo: str) -> str:
219        return SNIPPETS.get(tipo, f'{_I}- tipo: {tipo}\n')
@staticmethod
def get_snippet(tipo: str) -> str:
217    @staticmethod
218    def get_snippet(tipo: str) -> str:
219        return SNIPPETS.get(tipo, f'{_I}- tipo: {tipo}\n')