2024.8.23
Loading...
Searching...
No Matches
class.tpl.app.python.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (c) 2021-2024 Bearsampp
4 * License: GNU General Public License version 3 or later; see LICENSE.txt
5 * Author: bear
6 * Website: https://bearsampp.com
7 * Github: https://github.com/Bearsampp
8 */
9
10/**
11 * Class TplAppPython
12 *
13 * This class provides methods to generate menu items and actions for managing Python tools
14 * within the Bearsampp application. It includes functionalities for accessing Python console,
15 * IDLE, and other Python-related executables.
16 */
18{
19 // Constant for the Python menu identifier
20 const MENU = 'python';
21
22 /**
23 * Generates the main Python menu with options to access Python tools.
24 *
25 * @global object $bearsamppLang Provides language support for retrieving language-specific values.
26 *
27 * @return string The generated menu items and actions for Python.
28 */
29 public static function process()
30 {
31 global $bearsamppLang;
32
33 return TplApp::getMenu($bearsamppLang->getValue(Lang::PYTHON), self::MENU, get_called_class());
34 }
35
36 /**
37 * Generates the Python menu with options for accessing the Python console, IDLE, and other tools.
38 *
39 * @global object $bearsamppLang Provides language support for retrieving language-specific values.
40 * @global object $bearsamppTools Provides access to various tools and their configurations.
41 *
42 * @return string The generated menu items and actions for Python tools.
43 */
44 public static function getMenuPython()
45 {
46 global $bearsamppLang, $bearsamppTools;
47
48 // Generate menu item for Python console
49 $resultItems = TplAestan::getItemConsoleZ(
52 $bearsamppTools->getConsoleZ()->getTabTitlePython()
53 ) . PHP_EOL;
54
55 // Generate menu item for Python IDLE
56 $resultItems .= TplAestan::getItemExe(
57 $bearsamppLang->getValue(Lang::PYTHON) . ' IDLE',
58 $bearsamppTools->getPython()->getIdleExe(),
60 ) . PHP_EOL;
61
62 // Generate menu item for Python command prompt
63 $resultItems .= TplAestan::getItemExe(
65 $bearsamppTools->getPython()->getCpExe(),
67 ) . PHP_EOL;
68
69 return $resultItems;
70 }
71}
global $bearsamppLang
const PYTHON
const PYTHON_CONSOLE
const PYTHON_CP
const GLYPH_PYTHON_CP
static getItemConsoleZ($caption, $glyph, $id=null, $title=null, $initDir=null, $command=null)
static getItemExe($caption, $exe, $glyph, $params=null)
static getMenu($caption, $menu, $class)