gtcaca 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gtcaca-0.0.2/.github/workflows/release.yml +111 -0
- gtcaca-0.0.2/.gitignore +10 -0
- gtcaca-0.0.2/CMakeLists.txt +149 -0
- gtcaca-0.0.2/PKG-INFO +132 -0
- gtcaca-0.0.2/README.md +120 -0
- gtcaca-0.0.2/demo.sh +32 -0
- gtcaca-0.0.2/examples/cacamacs-config.json +12 -0
- gtcaca-0.0.2/examples/cacamacs-extensions/c-lang-0.0.1/language-configuration.json +27 -0
- gtcaca-0.0.2/examples/cacamacs-extensions/c-lang-0.0.1/package.json +29 -0
- gtcaca-0.0.2/examples/cacamacs-extensions/c-lang-0.0.1/syntaxes/c.tmLanguage.json +44 -0
- gtcaca-0.0.2/examples/cacamacs-extensions/python-0.0.1/language-configuration.json +24 -0
- gtcaca-0.0.2/examples/cacamacs-extensions/python-0.0.1/package.json +23 -0
- gtcaca-0.0.2/examples/cacamacs-extensions/python-0.0.1/syntaxes/python.tmLanguage.json +49 -0
- gtcaca-0.0.2/gtcaca.pc.cmake +8 -0
- gtcaca-0.0.2/pyproject.toml +100 -0
- gtcaca-0.0.2/runccm.sh +24 -0
- gtcaca-0.0.2/scripts/ci/build-libcaca-win.sh +86 -0
- gtcaca-0.0.2/scripts/ci/build-libcaca.sh +109 -0
- gtcaca-0.0.2/scripts/package-cacamacs-macos.sh +93 -0
- gtcaca-0.0.2/src/CMakeLists.txt +119 -0
- gtcaca-0.0.2/src/application.c +104 -0
- gtcaca-0.0.2/src/barchart.c +126 -0
- gtcaca-0.0.2/src/bindings/python/.gitignore +6 -0
- gtcaca-0.0.2/src/bindings/python/CMakeLists.txt +124 -0
- gtcaca-0.0.2/src/bindings/python/Makefile +50 -0
- gtcaca-0.0.2/src/bindings/python/README.md +112 -0
- gtcaca-0.0.2/src/bindings/python/example.py +72 -0
- gtcaca-0.0.2/src/bindings/python/gtcaca/__init__.py +35 -0
- gtcaca-0.0.2/src/bindings/python/gtcaca_module.cpp +537 -0
- gtcaca-0.0.2/src/bindings/python/pyproject.toml +20 -0
- gtcaca-0.0.2/src/box.c +338 -0
- gtcaca-0.0.2/src/button.c +101 -0
- gtcaca-0.0.2/src/calendar.c +160 -0
- gtcaca-0.0.2/src/checkbox.c +85 -0
- gtcaca-0.0.2/src/combobox.c +160 -0
- gtcaca-0.0.2/src/dialog.c +174 -0
- gtcaca-0.0.2/src/editor.c +1107 -0
- gtcaca-0.0.2/src/editor_autoc.c +305 -0
- gtcaca-0.0.2/src/editor_json.c +117 -0
- gtcaca-0.0.2/src/editor_lang.c +257 -0
- gtcaca-0.0.2/src/editor_ops.c +373 -0
- gtcaca-0.0.2/src/editor_search.c +158 -0
- gtcaca-0.0.2/src/editor_tm.c +648 -0
- gtcaca-0.0.2/src/editor_view.c +231 -0
- gtcaca-0.0.2/src/entry.c +145 -0
- gtcaca-0.0.2/src/expander.c +91 -0
- gtcaca-0.0.2/src/filechooser.c +278 -0
- gtcaca-0.0.2/src/frame.c +52 -0
- gtcaca-0.0.2/src/gauge.c +98 -0
- gtcaca-0.0.2/src/hexview.c +157 -0
- gtcaca-0.0.2/src/image.c +125 -0
- gtcaca-0.0.2/src/include/gtcaca/application.h +44 -0
- gtcaca-0.0.2/src/include/gtcaca/barchart.h +52 -0
- gtcaca-0.0.2/src/include/gtcaca/box.h +94 -0
- gtcaca-0.0.2/src/include/gtcaca/button.h +47 -0
- gtcaca-0.0.2/src/include/gtcaca/calendar.h +57 -0
- gtcaca-0.0.2/src/include/gtcaca/checkbox.h +42 -0
- gtcaca-0.0.2/src/include/gtcaca/combobox.h +46 -0
- gtcaca-0.0.2/src/include/gtcaca/dialog.h +57 -0
- gtcaca-0.0.2/src/include/gtcaca/editor.h +552 -0
- gtcaca-0.0.2/src/include/gtcaca/entry.h +48 -0
- gtcaca-0.0.2/src/include/gtcaca/expander.h +44 -0
- gtcaca-0.0.2/src/include/gtcaca/filechooser.h +70 -0
- gtcaca-0.0.2/src/include/gtcaca/frame.h +33 -0
- gtcaca-0.0.2/src/include/gtcaca/gauge.h +47 -0
- gtcaca-0.0.2/src/include/gtcaca/hexview.h +50 -0
- gtcaca-0.0.2/src/include/gtcaca/image.h +40 -0
- gtcaca-0.0.2/src/include/gtcaca/iniparse.h +18 -0
- gtcaca-0.0.2/src/include/gtcaca/json.h +48 -0
- gtcaca-0.0.2/src/include/gtcaca/label.h +35 -0
- gtcaca-0.0.2/src/include/gtcaca/linechart.h +57 -0
- gtcaca-0.0.2/src/include/gtcaca/log.h +18 -0
- gtcaca-0.0.2/src/include/gtcaca/main.h +39 -0
- gtcaca-0.0.2/src/include/gtcaca/map.h +95 -0
- gtcaca-0.0.2/src/include/gtcaca/menu.h +64 -0
- gtcaca-0.0.2/src/include/gtcaca/mindmap.h +81 -0
- gtcaca-0.0.2/src/include/gtcaca/progressbar.h +35 -0
- gtcaca-0.0.2/src/include/gtcaca/radiobutton.h +43 -0
- gtcaca-0.0.2/src/include/gtcaca/scale.h +43 -0
- gtcaca-0.0.2/src/include/gtcaca/segdisplay.h +49 -0
- gtcaca-0.0.2/src/include/gtcaca/separator.h +33 -0
- gtcaca-0.0.2/src/include/gtcaca/sparkline.h +64 -0
- gtcaca-0.0.2/src/include/gtcaca/spinbutton.h +44 -0
- gtcaca-0.0.2/src/include/gtcaca/spinner.h +36 -0
- gtcaca-0.0.2/src/include/gtcaca/statusbar.h +37 -0
- gtcaca-0.0.2/src/include/gtcaca/stb_image.h +7990 -0
- gtcaca-0.0.2/src/include/gtcaca/switch.h +39 -0
- gtcaca-0.0.2/src/include/gtcaca/table.h +64 -0
- gtcaca-0.0.2/src/include/gtcaca/tabs.h +54 -0
- gtcaca-0.0.2/src/include/gtcaca/textlist.h +63 -0
- gtcaca-0.0.2/src/include/gtcaca/textview.h +53 -0
- gtcaca-0.0.2/src/include/gtcaca/theme.h +38 -0
- gtcaca-0.0.2/src/include/gtcaca/tree.h +81 -0
- gtcaca-0.0.2/src/include/gtcaca/utarray.h +239 -0
- gtcaca-0.0.2/src/include/gtcaca/utlist.h +853 -0
- gtcaca-0.0.2/src/include/gtcaca/widget.h +80 -0
- gtcaca-0.0.2/src/include/gtcaca/win_compat.h +131 -0
- gtcaca-0.0.2/src/include/gtcaca/window.h +61 -0
- gtcaca-0.0.2/src/iniparse.c +272 -0
- gtcaca-0.0.2/src/json.c +366 -0
- gtcaca-0.0.2/src/label.c +49 -0
- gtcaca-0.0.2/src/linechart.c +118 -0
- gtcaca-0.0.2/src/log.c +37 -0
- gtcaca-0.0.2/src/main.c +1091 -0
- gtcaca-0.0.2/src/map.c +333 -0
- gtcaca-0.0.2/src/menu.c +253 -0
- gtcaca-0.0.2/src/mindmap.c +362 -0
- gtcaca-0.0.2/src/progressbar.c +86 -0
- gtcaca-0.0.2/src/radiobutton.c +99 -0
- gtcaca-0.0.2/src/scale.c +111 -0
- gtcaca-0.0.2/src/segdisplay.c +145 -0
- gtcaca-0.0.2/src/separator.c +55 -0
- gtcaca-0.0.2/src/sparkline.c +139 -0
- gtcaca-0.0.2/src/spinbutton.c +89 -0
- gtcaca-0.0.2/src/spinner.c +68 -0
- gtcaca-0.0.2/src/statusbar.c +72 -0
- gtcaca-0.0.2/src/switch.c +68 -0
- gtcaca-0.0.2/src/table.c +165 -0
- gtcaca-0.0.2/src/tabs.c +127 -0
- gtcaca-0.0.2/src/textlist.c +169 -0
- gtcaca-0.0.2/src/textview.c +240 -0
- gtcaca-0.0.2/src/theme.c +174 -0
- gtcaca-0.0.2/src/tree.c +291 -0
- gtcaca-0.0.2/src/widget.c +122 -0
- gtcaca-0.0.2/src/window.c +311 -0
- gtcaca-0.0.2/themes/default +21 -0
- gtcaca-0.0.2/tools/gen_docs.py +538 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
name: Build & publish wheels
|
|
2
|
+
|
|
3
|
+
# Wheels are built on every push/PR to catch breakage early, but only
|
|
4
|
+
# *published* to PyPI when you push a version tag like `v0.1.0`.
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches: [master]
|
|
8
|
+
tags: ["v*"]
|
|
9
|
+
pull_request:
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build_wheels:
|
|
18
|
+
name: wheels · ${{ matrix.name }}
|
|
19
|
+
runs-on: ${{ matrix.runner }}
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
include:
|
|
24
|
+
- { name: linux-x86_64, runner: ubuntu-latest, archs: x86_64 }
|
|
25
|
+
- { name: linux-aarch64, runner: ubuntu-24.04-arm, archs: aarch64 }
|
|
26
|
+
- { name: macos-arm64, runner: macos-14, archs: arm64 }
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
with:
|
|
30
|
+
fetch-depth: 0 # setuptools-scm needs full history/tags
|
|
31
|
+
|
|
32
|
+
- name: Build wheels
|
|
33
|
+
uses: pypa/cibuildwheel@v2.23.3
|
|
34
|
+
env:
|
|
35
|
+
CIBW_ARCHS: ${{ matrix.archs }}
|
|
36
|
+
# All other config lives in [tool.cibuildwheel] in pyproject.toml.
|
|
37
|
+
|
|
38
|
+
- uses: actions/upload-artifact@v4
|
|
39
|
+
with:
|
|
40
|
+
name: wheels-${{ matrix.name }}
|
|
41
|
+
path: ./wheelhouse/*.whl
|
|
42
|
+
|
|
43
|
+
# Windows x86_64 is experimental: libcaca has no MSVC build, so we cross-build
|
|
44
|
+
# it with MSYS2/mingw-w64 and link the MSVC extension against a generated
|
|
45
|
+
# import lib. continue-on-error keeps a broken Windows build from blocking the
|
|
46
|
+
# Linux/macOS release; its wheel still publishes when the job goes green.
|
|
47
|
+
build_wheels_windows:
|
|
48
|
+
name: wheels · win-amd64 (experimental)
|
|
49
|
+
runs-on: windows-latest
|
|
50
|
+
continue-on-error: true
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v4
|
|
53
|
+
with:
|
|
54
|
+
fetch-depth: 0
|
|
55
|
+
|
|
56
|
+
- uses: msys2/setup-msys2@v2
|
|
57
|
+
with:
|
|
58
|
+
msystem: MINGW64
|
|
59
|
+
update: true
|
|
60
|
+
install: >-
|
|
61
|
+
base-devel autoconf automake libtool make tar
|
|
62
|
+
mingw-w64-x86_64-gcc
|
|
63
|
+
mingw-w64-x86_64-pkgconf mingw-w64-x86_64-tools-git
|
|
64
|
+
|
|
65
|
+
- name: Build libcaca (mingw) + MSVC import lib
|
|
66
|
+
shell: msys2 {0}
|
|
67
|
+
run: CACA_ROOT=C:/caca-dist bash scripts/ci/build-libcaca-win.sh
|
|
68
|
+
|
|
69
|
+
- name: Build wheels
|
|
70
|
+
uses: pypa/cibuildwheel@v2.23.3
|
|
71
|
+
env:
|
|
72
|
+
CIBW_ARCHS: AMD64
|
|
73
|
+
CIBW_ENVIRONMENT_WINDOWS: CACA_ROOT=C:/caca-dist
|
|
74
|
+
|
|
75
|
+
- uses: actions/upload-artifact@v4
|
|
76
|
+
with:
|
|
77
|
+
name: wheels-win-amd64
|
|
78
|
+
path: ./wheelhouse/*.whl
|
|
79
|
+
|
|
80
|
+
build_sdist:
|
|
81
|
+
name: sdist
|
|
82
|
+
runs-on: ubuntu-latest
|
|
83
|
+
steps:
|
|
84
|
+
- uses: actions/checkout@v4
|
|
85
|
+
with:
|
|
86
|
+
fetch-depth: 0
|
|
87
|
+
- name: Build sdist
|
|
88
|
+
run: pipx run build --sdist
|
|
89
|
+
- uses: actions/upload-artifact@v4
|
|
90
|
+
with:
|
|
91
|
+
name: sdist
|
|
92
|
+
path: ./dist/*.tar.gz
|
|
93
|
+
|
|
94
|
+
publish:
|
|
95
|
+
name: publish to PyPI
|
|
96
|
+
needs: [build_wheels, build_wheels_windows, build_sdist]
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
# Only on a version tag.
|
|
99
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
100
|
+
environment:
|
|
101
|
+
name: pypi
|
|
102
|
+
url: https://pypi.org/p/gtcaca
|
|
103
|
+
permissions:
|
|
104
|
+
id-token: write # OIDC token for PyPI Trusted Publishing
|
|
105
|
+
steps:
|
|
106
|
+
- uses: actions/download-artifact@v4
|
|
107
|
+
with:
|
|
108
|
+
path: dist
|
|
109
|
+
pattern: "*"
|
|
110
|
+
merge-multiple: true # collect all wheels + the sdist into dist/
|
|
111
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
gtcaca-0.0.2/.gitignore
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.20)
|
|
2
|
+
|
|
3
|
+
# Detect the actual macOS SDK path before project() initialises the toolchain,
|
|
4
|
+
# so CMake never warns about a stale/missing CMAKE_OSX_SYSROOT value.
|
|
5
|
+
if(APPLE)
|
|
6
|
+
execute_process(
|
|
7
|
+
COMMAND xcrun --show-sdk-path
|
|
8
|
+
OUTPUT_VARIABLE _detected_sysroot
|
|
9
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
10
|
+
ERROR_QUIET
|
|
11
|
+
)
|
|
12
|
+
if(_detected_sysroot)
|
|
13
|
+
set(CMAKE_OSX_SYSROOT "${_detected_sysroot}" CACHE PATH "macOS SDK path" FORCE)
|
|
14
|
+
endif()
|
|
15
|
+
endif()
|
|
16
|
+
|
|
17
|
+
project(gtcaca-project)
|
|
18
|
+
|
|
19
|
+
message("CMake system name: ${CMAKE_SYSTEM_NAME}")
|
|
20
|
+
|
|
21
|
+
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
|
22
|
+
message(FATAL_ERROR "CMake generation is not allowed within the source directory!
|
|
23
|
+
Remove the CMakeCache.txt file and try again from another folder, e.g.:
|
|
24
|
+
|
|
25
|
+
rm CMakeCache.txt
|
|
26
|
+
mkdir build
|
|
27
|
+
cd build
|
|
28
|
+
cmake ..
|
|
29
|
+
")
|
|
30
|
+
endif()
|
|
31
|
+
|
|
32
|
+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${gtcaca-project_SOURCE_DIR}/cmake)
|
|
33
|
+
|
|
34
|
+
include(GNUInstallDirs)
|
|
35
|
+
|
|
36
|
+
if(APPLE)
|
|
37
|
+
set(CMAKE_MACOSX_RPATH ON)
|
|
38
|
+
set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/src")
|
|
39
|
+
endif()
|
|
40
|
+
|
|
41
|
+
#set(CMAKE_BUILD_TYPE "Release")
|
|
42
|
+
set(CMAKE_BUILD_TYPE "Debug")
|
|
43
|
+
|
|
44
|
+
set(GTCACA_VERSION "0.0.0")
|
|
45
|
+
|
|
46
|
+
include(FindPkgConfig)
|
|
47
|
+
configure_file("${gtcaca-project_SOURCE_DIR}/gtcaca.pc.cmake" "${gtcaca-project_BINARY_DIR}/gtcaca.pc")
|
|
48
|
+
message("pkg config path:${PKG_CONFIG_PATH}")
|
|
49
|
+
install(FILES "${gtcaca-project_BINARY_DIR}/gtcaca.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" COMPONENT Headers)
|
|
50
|
+
|
|
51
|
+
if (DEBUG_MODE)
|
|
52
|
+
add_definitions(-DGTCACA_DEBUG=1)
|
|
53
|
+
set(CMAKE_BUILD_TYPE "Debug")
|
|
54
|
+
if(NOT WIN32)
|
|
55
|
+
add_definitions(-g)
|
|
56
|
+
endif()
|
|
57
|
+
else()
|
|
58
|
+
if(NOT WIN32)
|
|
59
|
+
add_definitions(-O3)
|
|
60
|
+
endif()
|
|
61
|
+
endif()
|
|
62
|
+
if (NOT WIN32)
|
|
63
|
+
add_definitions(-std=c99 -fPIC)
|
|
64
|
+
endif()
|
|
65
|
+
|
|
66
|
+
include(CTest)
|
|
67
|
+
|
|
68
|
+
include(CheckIncludeFiles)
|
|
69
|
+
include(CheckFunctionExists)
|
|
70
|
+
include(CheckLibraryExists)
|
|
71
|
+
|
|
72
|
+
include(GNUInstallDirs)
|
|
73
|
+
|
|
74
|
+
include(TestBigEndian)
|
|
75
|
+
TEST_BIG_ENDIAN(BIGENDIAN)
|
|
76
|
+
if (${BIGENDIAN})
|
|
77
|
+
add_definitions(-DHAVE_LITTLE_ENDIAN=0)
|
|
78
|
+
add_definitions(-DHAVE_BIG_ENDIAN=1)
|
|
79
|
+
else()
|
|
80
|
+
add_definitions(-DHAVE_LITTLE_ENDIAN=1)
|
|
81
|
+
add_definitions(-DHAVE_BIG_ENDIAN=0)
|
|
82
|
+
endif()
|
|
83
|
+
|
|
84
|
+
pkg_check_modules(LIBCACA REQUIRED caca)
|
|
85
|
+
message("libcaca link library: ${LIBCACA_LDFLAGS}")
|
|
86
|
+
|
|
87
|
+
# Oniguruma (optional): enables TextMate grammar (.tmLanguage.json) colourization.
|
|
88
|
+
pkg_check_modules(ONIG oniguruma)
|
|
89
|
+
if(ONIG_FOUND)
|
|
90
|
+
message("oniguruma found: ${ONIG_LDFLAGS}")
|
|
91
|
+
add_compile_definitions(GTCACA_HAVE_ONIG=1)
|
|
92
|
+
endif()
|
|
93
|
+
|
|
94
|
+
message("CMake system: ${CMAKE_SYSTEM_NAME}")
|
|
95
|
+
# Mac OS Specifics
|
|
96
|
+
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
97
|
+
add_definitions(-DMACOS=1)
|
|
98
|
+
endif()
|
|
99
|
+
|
|
100
|
+
if(${CMAKE_SYSTEM_NAME} MATCHES "WIN32")
|
|
101
|
+
add_definitions(-DWIN32=1)
|
|
102
|
+
endif()
|
|
103
|
+
|
|
104
|
+
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
105
|
+
add_definitions(-DLINUX=1)
|
|
106
|
+
set(GTCACA_LINK_LIBRARIES pthread m)
|
|
107
|
+
endif()
|
|
108
|
+
|
|
109
|
+
set(GTCACA_INCLUDE_DIRS "${gtcaca-project_SOURCE_DIR}/src/include/" "${gtcaca-project_BINARY_DIR}/src/include")
|
|
110
|
+
|
|
111
|
+
set(GTCACA_LIBRARY gtcaca)
|
|
112
|
+
if(WIN32)
|
|
113
|
+
set(GTCACA_LIBRARY "${gtcaca-project_BINARY_DIR}/src/${CMAKE_BUILD_TYPE}/gtcaca_static.lib")
|
|
114
|
+
endif(WIN32)
|
|
115
|
+
if(APPLE)
|
|
116
|
+
set(GTCACA_LIBRARY "${gtcaca-project_BINARY_DIR}/src/libgtcaca.dylib")
|
|
117
|
+
endif(APPLE)
|
|
118
|
+
|
|
119
|
+
# Set our env variables
|
|
120
|
+
set(GTCACA_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/gtcaca/")
|
|
121
|
+
add_definitions(-DGTCACA_DATA_DIR="${GTCACA_DATA_DIR}")
|
|
122
|
+
|
|
123
|
+
add_subdirectory(src)
|
|
124
|
+
add_subdirectory(demo)
|
|
125
|
+
add_subdirectory(apps)
|
|
126
|
+
|
|
127
|
+
# Theme data (so installed apps find their default theme rather than falling
|
|
128
|
+
# back to the built-in defaults with a warning).
|
|
129
|
+
install(FILES "${gtcaca-project_SOURCE_DIR}/themes/default"
|
|
130
|
+
DESTINATION "${CMAKE_INSTALL_DATADIR}/gtcaca/themes" COMPONENT Applications)
|
|
131
|
+
|
|
132
|
+
# ── packaging: `make package` ────────────────────────────────────────────────
|
|
133
|
+
# macOS : a productbuild .pkg INSTALLER that installs gtcaca + the apps under
|
|
134
|
+
# /usr/local (so cacamacs/cacasheet/rfmind/rtodo are on $PATH).
|
|
135
|
+
# else : a .tar.gz of the same tree.
|
|
136
|
+
set(CPACK_PACKAGE_NAME "gtcaca")
|
|
137
|
+
set(CPACK_PACKAGE_VENDOR "gtcaca")
|
|
138
|
+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "gtcaca libcaca TUI toolkit and apps (cacamacs, cacasheet, rfmind, rtodo)")
|
|
139
|
+
set(CPACK_PACKAGE_VERSION "${GTCACA_VERSION}")
|
|
140
|
+
set(CPACK_PACKAGE_FILE_NAME "gtcaca-${GTCACA_VERSION}-${CMAKE_SYSTEM_NAME}")
|
|
141
|
+
# install everything in one shot rather than offering per-component choices
|
|
142
|
+
set(CPACK_COMPONENTS_GROUPING "ALL_COMPONENTS_IN_ONE")
|
|
143
|
+
if(APPLE)
|
|
144
|
+
set(CPACK_GENERATOR "productbuild")
|
|
145
|
+
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local")
|
|
146
|
+
else()
|
|
147
|
+
set(CPACK_GENERATOR "TGZ")
|
|
148
|
+
endif()
|
|
149
|
+
include(CPack)
|
gtcaca-0.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: gtcaca
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Python bindings for GTCaca, a libcaca-based terminal UI toolkit
|
|
5
|
+
Keywords: tui,libcaca,terminal,ui,ncurses,widgets
|
|
6
|
+
Author-Email: Seb Tricaud <sebastien.tricaud@proton.me>
|
|
7
|
+
License: Public Domain
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console :: Curses
|
|
10
|
+
Classifier: License :: Public Domain
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: C
|
|
15
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
16
|
+
Project-URL: Homepage, https://github.com/stricaud/gtcaca
|
|
17
|
+
Project-URL: Repository, https://github.com/stricaud/gtcaca
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# GTCaca Python bindings
|
|
22
|
+
|
|
23
|
+
[pybind11](https://pybind11.readthedocs.io/) bindings for **GTCaca**, the
|
|
24
|
+
libcaca-based terminal UI toolkit in this repository.
|
|
25
|
+
|
|
26
|
+
The bindings compile the GTCaca C sources directly into the extension module,
|
|
27
|
+
so the only external runtime dependency is **libcaca** itself — no separately
|
|
28
|
+
installed `libgtcaca` is required.
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- A C/C++ toolchain and CMake ≥ 3.20
|
|
33
|
+
- `libcaca` with its development headers, discoverable via `pkg-config`
|
|
34
|
+
(`pkg-config --exists caca` should succeed)
|
|
35
|
+
- Python ≥ 3.8 and `pybind11`
|
|
36
|
+
- *(optional)* `oniguruma` — not needed; only the editor widget uses it and it
|
|
37
|
+
is not exposed here
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
From this directory (`src/bindings/python`):
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
pip install .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This uses [scikit-build-core](https://scikit-build-core.readthedocs.io/) to drive
|
|
48
|
+
CMake and produces an importable `gtcaca` package.
|
|
49
|
+
|
|
50
|
+
### Building in-tree without installing
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
cmake -S . -B build \
|
|
54
|
+
-Dpybind11_DIR="$(python -m pybind11 --cmakedir)"
|
|
55
|
+
cmake --build build -j
|
|
56
|
+
# the compiled _gtcaca*.so lands in build/; add it to PYTHONPATH or copy it
|
|
57
|
+
# next to the gtcaca/ package directory.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import gtcaca as gt
|
|
64
|
+
|
|
65
|
+
gt.init()
|
|
66
|
+
gt.application_new("Hello")
|
|
67
|
+
win = gt.window_new(None, "Demo", 0, 1, 40, 10)
|
|
68
|
+
gt.label_new(win, "Press q to quit", 2, 2)
|
|
69
|
+
|
|
70
|
+
btn = gt.button_new(win, " OK ", 2, 4)
|
|
71
|
+
def on_key(key):
|
|
72
|
+
if key == gt.KEY_RETURN:
|
|
73
|
+
gt.main_quit()
|
|
74
|
+
return 0 # 0 = event not consumed
|
|
75
|
+
btn.on_key(on_key)
|
|
76
|
+
|
|
77
|
+
win.set_focus()
|
|
78
|
+
gt.main() # blocking event loop
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
See [`example.py`](example.py) for a fuller form with a menu, entries,
|
|
82
|
+
checkbox, progress bar and status bar.
|
|
83
|
+
|
|
84
|
+
## API overview
|
|
85
|
+
|
|
86
|
+
Factory functions create widgets and return widget objects; the first argument
|
|
87
|
+
is the parent (a widget object, or `None` for top-level / canvas-anchored
|
|
88
|
+
widgets):
|
|
89
|
+
|
|
90
|
+
| Factory | Returns | Key methods |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| `init()`, `main()`, `main_quit()`, `redraw()` | — | lifecycle |
|
|
93
|
+
| `canvas_width()`, `canvas_height()` | `int` | canvas size in cells |
|
|
94
|
+
| `application_new(title)` | `Application` | `draw()` |
|
|
95
|
+
| `window_new(parent, title, x, y, w, h)` | `Window` | `set_focus`, `set_focused_child`, `set_default`, `focus_next_child`, `close` |
|
|
96
|
+
| `window_new_centered(parent, title, w, h)` | `Window` | — |
|
|
97
|
+
| `label_new(parent, text, x, y)` | `Label` | — |
|
|
98
|
+
| `button_new(parent, label, x, y)` | `Button` | `on_key(cb)` |
|
|
99
|
+
| `entry_new(parent, x, y, w)` | `Entry` | `get_text`, `set_text`, `set_secret`, `on_key` |
|
|
100
|
+
| `checkbox_new(parent, label, x, y)` | `Checkbox` | `get_checked`, `set_checked`, `on_key` |
|
|
101
|
+
| `radiobutton_new(parent, label, group_id, x, y)` | `RadioButton` | `get_active`, `set_active`, `on_key` |
|
|
102
|
+
| `combobox_new(parent, x, y, w)` | `ComboBox` | `append`, `get_selected`, `get_selected_index`, `on_key` |
|
|
103
|
+
| `progressbar_new(parent, x, y, w)` | `ProgressBar` | `set_value`, `get_value` |
|
|
104
|
+
| `textview_new(parent, x, y, w, h)` | `TextView` | `append`, `clear`, `set_mode`, `on_key` |
|
|
105
|
+
| `statusbar_new(text)` | `StatusBar` | `set_text`, `set_rows_from_bottom` |
|
|
106
|
+
| `menu_new()` | `Menu` | `add_entry`, `add_item`, `add_separator`, `handle_key` |
|
|
107
|
+
|
|
108
|
+
Every widget exposes the shared preamble (`x`, `y`, `width`, `height`,
|
|
109
|
+
`has_focus`, `is_visible`, `id`) plus `show()`, `hide()`, and `as_widget()`
|
|
110
|
+
(used internally for parent passing).
|
|
111
|
+
|
|
112
|
+
### Callbacks
|
|
113
|
+
|
|
114
|
+
- **Key callbacks** (`on_key`) receive the integer key and may return an `int`
|
|
115
|
+
(`0` = not consumed, the default if you return `None`). Key constants are
|
|
116
|
+
exposed as module attributes: `KEY_RETURN`, `KEY_ESCAPE`, `KEY_TAB`,
|
|
117
|
+
`KEY_UP`/`KEY_DOWN`/`KEY_LEFT`/`KEY_RIGHT`, `KEY_F1`, `KEY_F10`, etc.
|
|
118
|
+
- **Menu actions** (the last argument to `menu.add_item`) take no arguments.
|
|
119
|
+
- Exceptions raised inside a callback are reported via `sys.unraisablehook`
|
|
120
|
+
and do not abort the event loop.
|
|
121
|
+
|
|
122
|
+
The GIL is released while `gt.main()` runs and re-acquired inside every
|
|
123
|
+
callback, so callbacks can safely touch other Python state.
|
|
124
|
+
|
|
125
|
+
## Scope
|
|
126
|
+
|
|
127
|
+
The toolkit ships ~40 widgets; these bindings currently cover the core
|
|
128
|
+
lifecycle plus the widgets used in the C demo (`demo/demo.c`). Additional
|
|
129
|
+
widgets (tree, table, tabs, calendar, charts, editor, hexview, …) follow the
|
|
130
|
+
exact same pattern in [`gtcaca_module.cpp`](gtcaca_module.cpp) — bind the struct
|
|
131
|
+
with `bind_common`, add a `*_new` factory with a `return_value_policy::reference`,
|
|
132
|
+
and wire any callback through the shared trampoline.
|
gtcaca-0.0.2/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# GTcaca
|
|
2
|
+
|
|
3
|
+
Graphical Toolkit on top of libcaca.
|
|
4
|
+
|
|
5
|
+
It allows you to use widgets and have an amazing interface using code like this:
|
|
6
|
+
|
|
7
|
+
#include <gtcaca/main.h>
|
|
8
|
+
#include <gtcaca/window.h>
|
|
9
|
+
|
|
10
|
+
int main(int argc, char **argv)
|
|
11
|
+
{
|
|
12
|
+
gtcaca_init(&argc, &argv);
|
|
13
|
+
|
|
14
|
+
gtcaca_window_new("My first window", 1, 1, 50, 20);
|
|
15
|
+
|
|
16
|
+
gtcaca_main();
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Which will make the following:
|
|
22
|
+
|
|
23
|
+
<p align="center"><img src="docs/firstwindow.png"/></p>
|
|
24
|
+
|
|
25
|
+
## Text List widget
|
|
26
|
+
|
|
27
|
+
This code:
|
|
28
|
+
|
|
29
|
+
#include <gtcaca/main.h>
|
|
30
|
+
#include <gtcaca/window.h>
|
|
31
|
+
#include <gtcaca/textlist.h>
|
|
32
|
+
|
|
33
|
+
int textlist_key_press(gtcaca_textlist_widget_t *widget, int key, void *userdata)
|
|
34
|
+
{
|
|
35
|
+
switch(key) {
|
|
36
|
+
case CACA_KEY_RETURN:
|
|
37
|
+
caca_printf(gmo.cv, widget->x, widget->y + 20, "Value:%s", gtcaca_textlist_get_selected(widget));
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
int main(int argc, char **argv)
|
|
43
|
+
{
|
|
44
|
+
gtcaca_textlist_widget_t *textlist;
|
|
45
|
+
|
|
46
|
+
gtcaca_init(&argc, &argv);
|
|
47
|
+
|
|
48
|
+
gtcaca_window_new("coucou", 1, 1, 50, 20);
|
|
49
|
+
|
|
50
|
+
textlist = gtcaca_textlist_new(2, 2);
|
|
51
|
+
gtcaca_textlist_append(textlist, "myfirst");
|
|
52
|
+
gtcaca_textlist_append(textlist, "mysecond");
|
|
53
|
+
gtcaca_textlist_append(textlist, "mythird");
|
|
54
|
+
|
|
55
|
+
gtcaca_textlist_key_cb_register(textlist, textlist_key_press);
|
|
56
|
+
|
|
57
|
+
gtcaca_main();
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Which will make this:
|
|
62
|
+
|
|
63
|
+
<p align="center"><img src="docs/textlistcb.png"/></p>
|
|
64
|
+
|
|
65
|
+
When the user pressed the RETURN key, we printed the value of the selection.
|
|
66
|
+
|
|
67
|
+
## Widgets
|
|
68
|
+
|
|
69
|
+
### Application
|
|
70
|
+
|
|
71
|
+
This is a special widget, describing your application to which you can attach the other widgets.
|
|
72
|
+
|
|
73
|
+
### Text List
|
|
74
|
+
|
|
75
|
+
Choose-able list
|
|
76
|
+
|
|
77
|
+
### Button
|
|
78
|
+
|
|
79
|
+
Button
|
|
80
|
+
|
|
81
|
+
### Label
|
|
82
|
+
|
|
83
|
+
Label
|
|
84
|
+
|
|
85
|
+
### Window
|
|
86
|
+
|
|
87
|
+
A Window.
|
|
88
|
+
|
|
89
|
+
### Editor
|
|
90
|
+
|
|
91
|
+
A multi-line text-editing widget: caret/selection, undo/redo, scrolling, syntax
|
|
92
|
+
colourization (VSCode language configs, TextMate `.tmLanguage.json` grammars via
|
|
93
|
+
Oniguruma, and a built-in JSON mode), autocompletion, folding, annotations and
|
|
94
|
+
Scintilla-style search/replace. See [docs/editor.md](docs/editor.md). The
|
|
95
|
+
[cacamacs](apps/cacamacs.c) app ([docs/cacamacs.md](docs/cacamacs.md)) is an
|
|
96
|
+
Emacs-keybinding editor built on it, reusing installed VSCode extensions for
|
|
97
|
+
language support.
|
|
98
|
+
|
|
99
|
+
## Layout (vbox / hbox)
|
|
100
|
+
|
|
101
|
+
Widgets can be placed by hand (explicit `x, y` in every constructor) or arranged
|
|
102
|
+
automatically with vertical/horizontal box layouts, à la Qt's `QVBoxLayout` /
|
|
103
|
+
`QHBoxLayout`:
|
|
104
|
+
|
|
105
|
+
#include <gtcaca/box.h>
|
|
106
|
+
|
|
107
|
+
gtcaca_box_t *vb = gtcaca_vbox_new();
|
|
108
|
+
gtcaca_box_add(vb, GTCACA_WIDGET(label));
|
|
109
|
+
gtcaca_box_add(vb, GTCACA_WIDGET(entry));
|
|
110
|
+
gtcaca_box_add(vb, GTCACA_WIDGET(button));
|
|
111
|
+
gtcaca_box_apply_window(vb, win); /* compute positions */
|
|
112
|
+
gtcaca_box_free(vb);
|
|
113
|
+
|
|
114
|
+
See [docs/layout.md](docs/layout.md) for the full guide and
|
|
115
|
+
[tests/simple_layout.c](tests/simple_layout.c) for a runnable demo.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# License
|
|
119
|
+
|
|
120
|
+
This is released under public domain.
|
gtcaca-0.0.2/demo.sh
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# Run a gtcaca demo against the freshly-built LOCAL library, not the (possibly
|
|
4
|
+
# stale) system one in /usr/local/lib — the same fix as runccm.sh.
|
|
5
|
+
#
|
|
6
|
+
# Usage: ./demo.sh <name> [args…] e.g. ./demo.sh gallery ./demo.sh tabs
|
|
7
|
+
# BUILD=/path/to/build ./demo.sh … to point at a different build dir
|
|
8
|
+
set -e
|
|
9
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
10
|
+
BUILD="${BUILD:-$HERE/build}"
|
|
11
|
+
|
|
12
|
+
list() {
|
|
13
|
+
echo "available demos:" >&2
|
|
14
|
+
ls "$BUILD/demo" 2>/dev/null | grep -E '^demo_' | sed 's/^demo_/ /' >&2
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
name="$1"
|
|
18
|
+
if [ -z "$name" ]; then
|
|
19
|
+
echo "usage: ./demo.sh <name> [args…] (runs build/demo/demo_<name> with the fresh lib)" >&2
|
|
20
|
+
list; exit 1
|
|
21
|
+
fi
|
|
22
|
+
shift
|
|
23
|
+
|
|
24
|
+
bin="$BUILD/demo/demo_$name"
|
|
25
|
+
[ -x "$bin" ] || bin="$BUILD/demo/$name" # also accept the full "demo_xxx" name
|
|
26
|
+
if [ ! -x "$bin" ]; then
|
|
27
|
+
echo "demo.sh: no demo '$name' in $BUILD/demo (build it first?)" >&2
|
|
28
|
+
list; exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# build/src first so the fresh libgtcaca wins; keep any existing path after it
|
|
32
|
+
exec env DYLD_LIBRARY_PATH="$BUILD/src${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}" "$bin" "$@"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"//": "Copy to ~/.cacamacs/config.json",
|
|
3
|
+
"tabSize": 4,
|
|
4
|
+
"insertSpaces": true,
|
|
5
|
+
"indentSize": 4,
|
|
6
|
+
"edgeColumn": 80,
|
|
7
|
+
"languages": {
|
|
8
|
+
".py": { "tabSize": 4, "insertSpaces": true, "indentSize": 4 },
|
|
9
|
+
".c": { "insertSpaces": false, "tabSize": 8 },
|
|
10
|
+
".md": { "insertSpaces": true, "indentSize": 2 }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
// A standard VSCode language-configuration.json. cacamacs reads the parts it
|
|
3
|
+
// can colourize from: comment delimiters, brackets and auto-closing quotes.
|
|
4
|
+
"comments": {
|
|
5
|
+
"lineComment": "//",
|
|
6
|
+
"blockComment": ["/*", "*/"]
|
|
7
|
+
},
|
|
8
|
+
"brackets": [
|
|
9
|
+
["{", "}"],
|
|
10
|
+
["[", "]"],
|
|
11
|
+
["(", ")"]
|
|
12
|
+
],
|
|
13
|
+
"autoClosingPairs": [
|
|
14
|
+
{ "open": "{", "close": "}" },
|
|
15
|
+
{ "open": "[", "close": "]" },
|
|
16
|
+
{ "open": "(", "close": ")" },
|
|
17
|
+
{ "open": "\"", "close": "\"", "notIn": ["string"] },
|
|
18
|
+
{ "open": "'", "close": "'", "notIn": ["string", "comment"] }
|
|
19
|
+
],
|
|
20
|
+
"surroundingPairs": [
|
|
21
|
+
["{", "}"],
|
|
22
|
+
["[", "]"],
|
|
23
|
+
["(", ")"],
|
|
24
|
+
["\"", "\""],
|
|
25
|
+
["'", "'"]
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "c-lang",
|
|
3
|
+
"displayName": "C/C++ Language Basics",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"engines": { "cacamacs": "*" },
|
|
6
|
+
"contributes": {
|
|
7
|
+
"languages": [
|
|
8
|
+
{
|
|
9
|
+
"id": "c",
|
|
10
|
+
"aliases": ["C"],
|
|
11
|
+
"extensions": [".c", ".h"],
|
|
12
|
+
"configuration": "./language-configuration.json"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "cpp",
|
|
16
|
+
"aliases": ["C++", "Cpp"],
|
|
17
|
+
"extensions": [".cpp", ".cc", ".hpp"],
|
|
18
|
+
"configuration": "./language-configuration.json"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"grammars": [
|
|
22
|
+
{
|
|
23
|
+
"language": "c",
|
|
24
|
+
"scopeName": "source.c",
|
|
25
|
+
"path": "./syntaxes/c.tmLanguage.json"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scopeName": "source.c",
|
|
3
|
+
"name": "C",
|
|
4
|
+
"patterns": [
|
|
5
|
+
{ "include": "#comments" },
|
|
6
|
+
{ "include": "#keywords" },
|
|
7
|
+
{ "include": "#types" },
|
|
8
|
+
{ "include": "#strings" },
|
|
9
|
+
{ "include": "#numbers" },
|
|
10
|
+
{ "include": "#preprocessor" }
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"comments": {
|
|
14
|
+
"patterns": [
|
|
15
|
+
{ "name": "comment.line.double-slash.c", "match": "//.*$" },
|
|
16
|
+
{ "name": "comment.block.c", "begin": "/\\*", "end": "\\*/" }
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"keywords": {
|
|
20
|
+
"name": "keyword.control.c",
|
|
21
|
+
"match": "\\b(if|else|for|while|do|switch|case|default|break|continue|return|goto|sizeof|typedef|struct|union|enum)\\b"
|
|
22
|
+
},
|
|
23
|
+
"types": {
|
|
24
|
+
"name": "storage.type.c",
|
|
25
|
+
"match": "\\b(void|char|short|int|long|float|double|signed|unsigned|const|static|extern|register|volatile|inline|bool|size_t)\\b"
|
|
26
|
+
},
|
|
27
|
+
"strings": {
|
|
28
|
+
"patterns": [
|
|
29
|
+
{ "name": "string.quoted.double.c", "begin": "\"", "end": "\"",
|
|
30
|
+
"patterns": [ { "name": "constant.character.escape.c", "match": "\\\\." } ] },
|
|
31
|
+
{ "name": "string.quoted.single.c", "begin": "'", "end": "'",
|
|
32
|
+
"patterns": [ { "name": "constant.character.escape.c", "match": "\\\\." } ] }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"numbers": {
|
|
36
|
+
"name": "constant.numeric.c",
|
|
37
|
+
"match": "\\b(0[xX][0-9a-fA-F]+|[0-9]+(\\.[0-9]+)?([eE][-+]?[0-9]+)?[fFuUlL]*)\\b"
|
|
38
|
+
},
|
|
39
|
+
"preprocessor": {
|
|
40
|
+
"name": "keyword.control.directive.c",
|
|
41
|
+
"match": "^\\s*#\\s*(include|define|undef|if|ifdef|ifndef|else|elif|endif|pragma|error)\\b"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|