PythonType.class.php 898 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. require_once(__DIR__.SLASH.'ReadmeType.class.php');
  3. class PythonType extends ReadmeType{
  4. public static function manifest(){
  5. return array(
  6. 'uid' => 'python',
  7. 'label' => 'Python',
  8. 'icon' => 'fab fa-python',
  9. 'color' => '#ffffff',
  10. 'background' => '#FFD43B',
  11. 'description' => 'Fichier contenant du langage Python',
  12. 'fromExtension' => array('py'),
  13. 'toExtension' => 'py',
  14. 'default' => 'print("Hello python")',
  15. );
  16. }
  17. /* EDITION */
  18. public static function toHtml($resource,$sketch=null){
  19. $infos = self::manifest();
  20. return array(
  21. 'html'=>'<textarea id="content" onblur="hackpoint_resource_save_content()" class="arduino-text">'.$resource->content.'</textarea>',
  22. 'javascript' => "
  23. hackpoint_resource_mirrorify('.arduino-text',{
  24. mode : 'python',
  25. lineNumbers : true,
  26. theme : 'monokai',
  27. readOnly : false
  28. });
  29. "
  30. );
  31. }
  32. }
  33. ?>