mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-08-05 16:26:10 +08:00
use packaged bootstrap icons (#37994)
* vendor bootstrap icons from dependencies * use bootstrap-icons release
This commit is contained in:
@@ -27,6 +27,7 @@ dependencies = [
|
||||
|
||||
# vendored native dependencies
|
||||
"bzip2 @ git+https://github.com/commaai/dependencies.git@release-bzip2#subdirectory=bzip2",
|
||||
"bootstrap-icons @ git+https://github.com/commaai/dependencies.git@release-bootstrap-icons#subdirectory=bootstrap-icons",
|
||||
"capnproto @ git+https://github.com/commaai/dependencies.git@release-capnproto#subdirectory=capnproto",
|
||||
"catch2 @ git+https://github.com/commaai/dependencies.git@release-catch2#subdirectory=catch2",
|
||||
"acados @ git+https://github.com/commaai/dependencies.git@release-acados#subdirectory=acados",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file alias="bootstrap-icons.svg">../../third_party/bootstrap/bootstrap-icons.svg</file>
|
||||
<file alias="bootstrap-icons.svg">@BOOTSTRAP_ICONS_SVG@</file>
|
||||
<file>images/button_continue_triangle.svg</file>
|
||||
<file>icons/circled_check.svg</file>
|
||||
<file>icons/circled_slash.svg</file>
|
||||
|
||||
@@ -3,7 +3,7 @@ set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
ICONS_DIR="$DIR/icons"
|
||||
BOOTSTRAP_SVG="$DIR/../../third_party/bootstrap/bootstrap-icons.svg"
|
||||
BOOTSTRAP_SVG="$(python3 -c 'import bootstrap_icons; print(bootstrap_icons.SVG_PATH)')"
|
||||
|
||||
ICON_IDS=(
|
||||
arrow-right
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/icons/
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d7ecfaac355e51c9b95319fdf4681cf4c423109fd477e961af588b92607a76da
|
||||
size 1087239
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57e798d421bb56bb058ed9b0c83dd97fe1e411cde3a2bd6eb4a8705234f69027
|
||||
size 453096
|
||||
Vendored
-24
@@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
cd $DIR
|
||||
|
||||
if [ ! -d icons/ ]; then
|
||||
git clone https://github.com/twbs/icons/
|
||||
fi
|
||||
|
||||
cd icons
|
||||
git fetch --all
|
||||
git checkout d5aa187483a1b0b186f87adcfa8576350d970d98
|
||||
cp bootstrap-icons.svg ../
|
||||
|
||||
# Convert WOFF → TTF for imgui (imgui only reads TTF/OTF)
|
||||
python3 -c "
|
||||
from fontTools.ttLib import TTFont
|
||||
import io
|
||||
f = TTFont('font/fonts/bootstrap-icons.woff')
|
||||
f.flavor = None
|
||||
f.save('../bootstrap-icons.ttf')
|
||||
print('bootstrap-icons.ttf written')
|
||||
"
|
||||
+13
-1
@@ -2,6 +2,7 @@ import subprocess
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import bootstrap_icons
|
||||
import libusb
|
||||
|
||||
Import('env', 'arch', 'common', 'messaging', 'visionipc', 'cereal', 'replay_lib')
|
||||
@@ -80,10 +81,21 @@ if arch != "Darwin":
|
||||
opendbc_path = '-DOPENDBC_FILE_PATH=\'"%s"\'' % (cabana_env.Dir("../../opendbc/dbc").abspath)
|
||||
cabana_env['CXXFLAGS'] += [opendbc_path]
|
||||
|
||||
def write_assets_qrc(target, source, env):
|
||||
with open(str(source[0])) as f:
|
||||
qrc = f.read()
|
||||
with open(str(target[0]), "w") as f:
|
||||
f.write(qrc.replace("@BOOTSTRAP_ICONS_SVG@", str(bootstrap_icons.SVG_PATH)))
|
||||
|
||||
# build assets
|
||||
assets = "assets/assets.cc"
|
||||
assets_src = "assets/assets.qrc"
|
||||
assets_src = cabana_env.Command(
|
||||
"assets/assets.generated.qrc",
|
||||
"assets/assets.qrc",
|
||||
write_assets_qrc,
|
||||
)
|
||||
cabana_env.Command(assets, assets_src, f"rcc $SOURCES -o $TARGET")
|
||||
cabana_env.Depends(assets_src, str(bootstrap_icons.SVG_PATH))
|
||||
cabana_env.Depends(assets, Glob('/assets/*', exclude=[assets, assets_src, "assets/assets.o"]))
|
||||
|
||||
cabana_srcs = ['mainwin.cc', 'streams/pandastream.cc', 'streams/devicestream.cc', 'streams/livestream.cc', 'streams/abstractstream.cc', 'streams/replaystream.cc', 'binaryview.cc', 'historylog.cc', 'videowidget.cc', 'signalview.cc',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file alias="bootstrap-icons.svg">../../../third_party/bootstrap/bootstrap-icons.svg</file>
|
||||
<file alias="bootstrap-icons.svg">@BOOTSTRAP_ICONS_SVG@</file>
|
||||
<file>cabana-icon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import subprocess
|
||||
import bootstrap_icons
|
||||
import imgui
|
||||
import libusb
|
||||
from opendbc import get_generated_dbcs
|
||||
@@ -16,6 +17,7 @@ jot_env["CPPPATH"] += [imgui.INCLUDE_DIR, libusb.INCLUDE_DIR]
|
||||
jot_env["CXXFLAGS"] += [
|
||||
"-DGLFW_INCLUDE_NONE",
|
||||
'-DJOTP_REPO_ROOT=\'"%s"\'' % os.path.realpath(BASEDIR),
|
||||
'-DBOOTSTRAP_ICONS_TTF=\'"%s"\'' % bootstrap_icons.TTF_PATH,
|
||||
]
|
||||
|
||||
def materialize_generated_dbcs(target, source, env):
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <cmath>
|
||||
|
||||
void icon_add_font(float size, bool merge, const ImFont *base_font) {
|
||||
const std::filesystem::path ttf = repo_root() / "third_party" / "bootstrap" / "bootstrap-icons.ttf";
|
||||
const std::filesystem::path ttf = BOOTSTRAP_ICONS_TTF;
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
ImFontConfig config;
|
||||
config.MergeMode = merge;
|
||||
|
||||
@@ -121,6 +121,11 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c8/b9/275df9607f7fb44317ccb1d4be74827185c0d410f52b6e2cd770fe209118/av-16.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:f49243b1d27c91cd8c66fdba90a674e344eb8eb917264f36117bf2b6879118fd", size = 31752045, upload-time = "2026-01-11T09:57:45.106Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bootstrap-icons"
|
||||
version = "1.10.5.0"
|
||||
source = { git = "https://github.com/commaai/dependencies.git?subdirectory=bootstrap-icons&rev=release-bootstrap-icons#3db70e363cf3471969381bcb8f4ce3ebbab7b369" }
|
||||
|
||||
[[package]]
|
||||
name = "bzip2"
|
||||
version = "1.0.8"
|
||||
@@ -750,6 +755,7 @@ dependencies = [
|
||||
{ name = "aiohttp" },
|
||||
{ name = "aiortc" },
|
||||
{ name = "av" },
|
||||
{ name = "bootstrap-icons" },
|
||||
{ name = "bzip2" },
|
||||
{ name = "capnproto" },
|
||||
{ name = "catch2" },
|
||||
@@ -830,6 +836,7 @@ requires-dist = [
|
||||
{ name = "aiohttp" },
|
||||
{ name = "aiortc" },
|
||||
{ name = "av" },
|
||||
{ name = "bootstrap-icons", git = "https://github.com/commaai/dependencies.git?subdirectory=bootstrap-icons&rev=release-bootstrap-icons" },
|
||||
{ name = "bzip2", git = "https://github.com/commaai/dependencies.git?subdirectory=bzip2&rev=release-bzip2" },
|
||||
{ name = "capnproto", git = "https://github.com/commaai/dependencies.git?subdirectory=capnproto&rev=release-capnproto" },
|
||||
{ name = "catch2", git = "https://github.com/commaai/dependencies.git?subdirectory=catch2&rev=release-catch2" },
|
||||
|
||||
Reference in New Issue
Block a user