mirror of
https://github.com/storytold/texturecraft.git
synced 2026-11-20 22:40:44 +01:00
Merge pull request #367 from dotCooCoo/feat/self-updater
Updates: Help > Check for Updates and a check at start
This commit is contained in:
21 files changed
+857
-11
No files matched your search
Generated
+449
-5
@@ -412,6 +412,12 @@ version = "0.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.23.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.10.0"
|
||||
@@ -448,6 +454,15 @@ dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block2"
|
||||
version = "0.5.1"
|
||||
@@ -691,6 +706,16 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.7"
|
||||
@@ -704,7 +729,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"core-foundation 0.9.4",
|
||||
"core-graphics-types",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
@@ -717,7 +742,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"core-foundation 0.9.4",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
@@ -770,6 +804,32 @@ dependencies = [
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-update"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=1b34eba41e62138fc2438d2734523b302840b45d#1b34eba41e62138fc2438d2734523b302840b45d"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"dunce",
|
||||
"egui",
|
||||
"flate2",
|
||||
"getrandom 0.3.4",
|
||||
"image",
|
||||
"log",
|
||||
"plist",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"tar",
|
||||
"tempfile",
|
||||
"ureq",
|
||||
"verifysign",
|
||||
"winreg",
|
||||
"winsafe",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-window"
|
||||
version = "0.1.0"
|
||||
@@ -821,6 +881,16 @@ version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cursor-icon"
|
||||
version = "1.2.0"
|
||||
@@ -861,6 +931,22 @@ dependencies = [
|
||||
"syn 3.0.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e"
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dispatch"
|
||||
version = "0.2.0"
|
||||
@@ -920,6 +1006,12 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76"
|
||||
|
||||
[[package]]
|
||||
name = "dunce"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
|
||||
|
||||
[[package]]
|
||||
name = "dyn-clone"
|
||||
version = "1.0.20"
|
||||
@@ -1252,6 +1344,16 @@ version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693"
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.14"
|
||||
@@ -1447,6 +1549,16 @@ dependencies = [
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gethostname"
|
||||
version = "1.1.0"
|
||||
@@ -1457,6 +1569,17 @@ dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.4"
|
||||
@@ -1728,6 +1851,22 @@ version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"itoa",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.65"
|
||||
@@ -2427,6 +2566,12 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
@@ -2776,6 +2921,12 @@ version = "1.21.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-probe"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1"
|
||||
|
||||
[[package]]
|
||||
name = "orbclient"
|
||||
version = "0.3.55"
|
||||
@@ -2978,6 +3129,19 @@ version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
|
||||
|
||||
[[package]]
|
||||
name = "plist"
|
||||
version = "1.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "327a4cb2ad49dc48adfdc9da89e22c64d488b508c67a044d71ba729e4521a285"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"indexmap",
|
||||
"quick-xml 0.42.0",
|
||||
"serde",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.18.1"
|
||||
@@ -3062,6 +3226,12 @@ dependencies = [
|
||||
"zerovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "powerfmt"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958"
|
||||
|
||||
[[package]]
|
||||
name = "presser"
|
||||
version = "0.3.1"
|
||||
@@ -3136,6 +3306,15 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.47"
|
||||
@@ -3320,6 +3499,20 @@ dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.17.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"getrandom 0.2.17",
|
||||
"libc",
|
||||
"untrusted",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rmcp"
|
||||
version = "3.5.1"
|
||||
@@ -3427,6 +3620,80 @@ dependencies = [
|
||||
"rustix 1.1.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
|
||||
dependencies = [
|
||||
"log",
|
||||
"once_cell",
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-native-certs"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4"
|
||||
dependencies = [
|
||||
"openssl-probe",
|
||||
"rustls-pki-types",
|
||||
"schannel",
|
||||
"security-framework",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
|
||||
dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-platform-verifier"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98"
|
||||
dependencies = [
|
||||
"core-foundation 0.10.1",
|
||||
"core-foundation-sys",
|
||||
"jni",
|
||||
"log",
|
||||
"once_cell",
|
||||
"rustls",
|
||||
"rustls-native-certs",
|
||||
"rustls-platform-verifier-android",
|
||||
"rustls-webpki",
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"webpki-root-certs",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-platform-verifier-android"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f"
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.103.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.23"
|
||||
@@ -3442,6 +3709,15 @@ dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "1.2.3"
|
||||
@@ -3480,6 +3756,29 @@ version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "3.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"core-foundation 0.10.1",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"security-framework-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework-sys"
|
||||
version = "2.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "self_cell"
|
||||
version = "1.3.0"
|
||||
@@ -3491,6 +3790,10 @@ name = "semver"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "send_wrapper"
|
||||
@@ -3572,6 +3875,17 @@ dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "2.0.1"
|
||||
@@ -3743,6 +4057,12 @@ version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.119"
|
||||
@@ -3788,6 +4108,16 @@ dependencies = [
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tar"
|
||||
version = "0.4.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
|
||||
dependencies = [
|
||||
"filetime",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.27.0"
|
||||
@@ -3814,6 +4144,7 @@ dependencies = [
|
||||
name = "texturecraft"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"craft-update",
|
||||
"eframe",
|
||||
"egui",
|
||||
"image",
|
||||
@@ -3925,7 +4256,7 @@ dependencies = [
|
||||
"half",
|
||||
"image",
|
||||
"lz4_flex",
|
||||
"quick-xml",
|
||||
"quick-xml 0.41.0",
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -3993,6 +4324,7 @@ version = "0.3.1"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"craft-ui",
|
||||
"craft-update",
|
||||
"craft-window",
|
||||
"eframe",
|
||||
"egui",
|
||||
@@ -4084,6 +4416,36 @@ dependencies = [
|
||||
"zune-jpeg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"num-conv",
|
||||
"powerfmt",
|
||||
"serde_core",
|
||||
"time-core",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-core"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85"
|
||||
dependencies = [
|
||||
"num-conv",
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinystr"
|
||||
version = "0.8.5"
|
||||
@@ -4266,6 +4628,12 @@ version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
|
||||
|
||||
[[package]]
|
||||
name = "uds_windows"
|
||||
version = "1.2.1"
|
||||
@@ -4313,6 +4681,41 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||
|
||||
[[package]]
|
||||
name = "ureq"
|
||||
version = "3.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7be76686bdf7198002062423ca0d8cf9b75a27c8e1de804513b97e97b555d9d"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"flate2",
|
||||
"log",
|
||||
"percent-encoding",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"rustls-platform-verifier",
|
||||
"ureq-proto",
|
||||
"utf8-zero",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ureq-proto"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "622dce33c252115466d83f63e9744a18f12b4406aae51a01c15ad8fcf1185eb3"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"http",
|
||||
"httparse",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "urlencoding"
|
||||
version = "2.1.3"
|
||||
@@ -4328,6 +4731,12 @@ dependencies = [
|
||||
"utf_types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf8-zero"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e"
|
||||
|
||||
[[package]]
|
||||
name = "utf8_iter"
|
||||
version = "1.1.0"
|
||||
@@ -4382,6 +4791,16 @@ dependencies = [
|
||||
"vello_common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "verifysign"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6efd25aadc22c756a9012267fae0b130278d335d6ceb512ec02ce82029b5ca9"
|
||||
dependencies = [
|
||||
"core-foundation 0.10.1",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.5"
|
||||
@@ -4562,7 +4981,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quick-xml",
|
||||
"quick-xml 0.41.0",
|
||||
"quote",
|
||||
]
|
||||
|
||||
@@ -4598,6 +5017,15 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-root-certs"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e49d0e65abc00c142e8f9428da991da9f1a250c39be97459901eb12b9b49f62a"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "weezl"
|
||||
version = "0.1.12"
|
||||
@@ -5096,7 +5524,7 @@ dependencies = [
|
||||
"calloop",
|
||||
"cfg_aliases",
|
||||
"concurrent-queue",
|
||||
"core-foundation",
|
||||
"core-foundation 0.9.4",
|
||||
"core-graphics",
|
||||
"cursor-icon",
|
||||
"dpi",
|
||||
@@ -5141,6 +5569,16 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.55.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winresource"
|
||||
version = "0.1.34"
|
||||
@@ -5457,6 +5895,12 @@ dependencies = [
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"
|
||||
|
||||
[[package]]
|
||||
name = "zerotrie"
|
||||
version = "0.2.5"
|
||||
|
||||
@@ -66,6 +66,8 @@ rustix = { version = "1", default-features = false, features = ["std", "fs", "pr
|
||||
craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "f8f8829cc7be65d466d687dae381d1ca60e31242", features = ["serde"] }
|
||||
# Who draws the window frame, and the app-drawn strip as the title bar (crates/ui-egui/src/titlebar.rs).
|
||||
craft-window = { git = "https://github.com/storytold/craft-libs", rev = "f8f8829cc7be65d466d687dae381d1ca60e31242", features = ["egui"] }
|
||||
# Release checks, the update prompt and the update helper (crates/ui-egui/src/updates_ui.rs).
|
||||
craft-update = { git = "https://github.com/storytold/craft-libs", rev = "1b34eba41e62138fc2438d2734523b302840b45d", features = ["egui"] }
|
||||
|
||||
# egui 0.37 and winit: the suite's forks (storytold/egui, storytold/winit), as craft-libs pins them.
|
||||
[patch.crates-io]
|
||||
|
||||
@@ -30,6 +30,8 @@ ron = "0.12"
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winit = { version = "0.30", default-features = false }
|
||||
winsafe = { version = "0.0.29", default-features = false, features = ["user"] }
|
||||
# The update helper is a copy of this program (`main`).
|
||||
craft-update = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
winresource = "0.1"
|
||||
@@ -165,7 +165,17 @@ impl eframe::App for Shell {
|
||||
}
|
||||
}
|
||||
|
||||
/// A script driving the app gets no network check and no update prompt over its window.
|
||||
fn checks_for_updates_at_start(control: Option<u16>) -> bool {
|
||||
control.is_none()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Windows: the update helper is a copy of this program started with `--finish-update`.
|
||||
#[cfg(windows)]
|
||||
if let Some(result) = craft_update::self_update::finish(&texturecraft_ui_egui::UPDATE_APP, &std::env::args_os().skip(1).collect::<Vec<_>>()) {
|
||||
std::process::exit(i32::from(result.is_err()));
|
||||
}
|
||||
let args = match parse_args() {
|
||||
Ok(Some(a)) => a,
|
||||
Ok(None) => return,
|
||||
@@ -217,6 +227,7 @@ fn main() {
|
||||
let mut app = TextureCraftApp::new(cc, session);
|
||||
app.title_bar = title_bar;
|
||||
app.ui.windows.start = start && app.ui.prefs.start_window;
|
||||
app.set_startup_update_check(checks_for_updates_at_start(control));
|
||||
if let Some(port) = control {
|
||||
app.control = Some(control_server::start(port, cc.egui_ctx.clone()));
|
||||
}
|
||||
@@ -282,6 +293,12 @@ mod tests {
|
||||
assert_eq!(args.gpu.as_deref(), Some("3080"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_a_run_without_a_control_port_checks_for_updates_at_start() {
|
||||
assert!(checks_for_updates_at_start(None));
|
||||
assert!(!checks_for_updates_at_start(Some(9000)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_missing_or_invalid_gpu_args() {
|
||||
assert!(parse_args_from(["--gpu".to_string()]).is_err());
|
||||
|
||||
@@ -30,6 +30,8 @@ zip = { workspace = true }
|
||||
sys-locale = "0.3"
|
||||
# Floating panels open as OS windows.
|
||||
craft-ui = { workspace = true, features = ["native-windows"] }
|
||||
# Help > Check for Updates and the check at start (updates_ui.rs).
|
||||
craft-update = { workspace = true }
|
||||
|
||||
# build.rs: the interface faces lose their Private Use Area, where the icon font draws (the
|
||||
# versions craft-libs' craft-fonts-build subsets with).
|
||||
|
||||
@@ -388,6 +388,17 @@ fn style(ui: &Ui, t: &Tokens) -> DockStyle {
|
||||
s
|
||||
}
|
||||
|
||||
/// Whether a modal layer or update dialog holds the input, so the panels, floating ones included,
|
||||
/// do not take it.
|
||||
pub(crate) fn input_blocked(app: &TextureCraftApp, context: &egui::Context) -> bool {
|
||||
let modal = context.memory(|memory| memory.top_modal_layer()).is_some();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let modal = modal || crate::updates_ui::blocks_input(app);
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let _ = app;
|
||||
modal
|
||||
}
|
||||
|
||||
/// Draw the dock (viewport and panels) into `ui`.
|
||||
pub fn show(app: &mut TextureCraftApp, ui: &mut Ui) {
|
||||
for panel in Panel::ALL {
|
||||
@@ -400,7 +411,7 @@ pub fn show(app: &mut TextureCraftApp, ui: &mut Ui) {
|
||||
let tokens = Tokens::get(&context);
|
||||
let style = style(ui, &tokens);
|
||||
let layout = app.ui.dock.workspace.layout.clone();
|
||||
let mut area = DockArea::new(area_id()).input_blocked(context.memory(|memory| memory.top_modal_layer()).is_some());
|
||||
let mut area = DockArea::new(area_id()).input_blocked(input_blocked(app, &context));
|
||||
if let Some(panel) = app.ui.dock.raise.take() {
|
||||
area = area.raise_panel(panel);
|
||||
}
|
||||
|
||||
@@ -134,13 +134,15 @@ pub fn os_language() -> &'static str {
|
||||
locale.map_or("en", |l| language_for_locale(&l))
|
||||
}
|
||||
|
||||
/// Tests that switch the global UI language, or draw the UI under it, run one at a time.
|
||||
#[cfg(test)]
|
||||
pub(crate) static TEST_LANGUAGE: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::TEST_LANGUAGE as LANGUAGE;
|
||||
use super::*;
|
||||
|
||||
/// Tests that switch the global UI language run one at a time.
|
||||
static LANGUAGE: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
||||
|
||||
/// Every key the UI looks up: `tr("…")` / `trf("…"` literals in the sources, plus the
|
||||
/// static catalogs whose labels are translated where they are shown.
|
||||
fn keys() -> Vec<String> {
|
||||
|
||||
@@ -140,6 +140,7 @@ pub const TABLE: &[(&str, &str)] = &[
|
||||
("Channel", "القناة"),
|
||||
("Channel source: uniform value, procedural, image or anchor", "مصدر القناة: قيمة موحدة، إجرائي، صورة أو نقطة ارتكاز"),
|
||||
("Channels", "القنوات"),
|
||||
("Check for Updates...", "التحقق من وجود تحديثات..."),
|
||||
("Checker", "رقعة شطرنج"),
|
||||
("Clamp", "تقييد القيم"),
|
||||
("Clear", "مسح"),
|
||||
|
||||
@@ -140,6 +140,7 @@ pub const TABLE: &[(&str, &str)] = &[
|
||||
("Channel", "Kanal"),
|
||||
("Channel source: uniform value, procedural, image or anchor", "Kanalquelle: einheitlicher Wert, prozedural, Bild oder Anker"),
|
||||
("Channels", "Kanäle"),
|
||||
("Check for Updates...", "Nach Updates suchen..."),
|
||||
("Checker", "Schachbrett"),
|
||||
("Clamp", "Begrenzen"),
|
||||
("Clear", "Leeren"),
|
||||
|
||||
@@ -140,6 +140,7 @@ pub const TABLE: &[(&str, &str)] = &[
|
||||
("Channel", "Canal"),
|
||||
("Channel source: uniform value, procedural, image or anchor", "Origen del canal: valor uniforme, procedural, imagen o anclaje"),
|
||||
("Channels", "Canales"),
|
||||
("Check for Updates...", "Buscar actualizaciones..."),
|
||||
("Checker", "Damero"),
|
||||
("Clamp", "Limitar"),
|
||||
("Clear", "Borrar"),
|
||||
|
||||
@@ -146,6 +146,7 @@ pub const TABLE: &[(&str, &str)] = &[
|
||||
("Channel", "Canal"),
|
||||
("Channel source: uniform value, procedural, image or anchor", "Source du canal : valeur uniforme, procédural, image ou ancrage"),
|
||||
("Channels", "Canaux"),
|
||||
("Check for Updates...", "Rechercher des mises à jour..."),
|
||||
("Checker", "Damier"),
|
||||
("Clamp", "Limiter"),
|
||||
("Clear", "Effacer"),
|
||||
|
||||
@@ -143,6 +143,7 @@ pub const TABLE: &[(&str, &str)] = &[
|
||||
("Channel", "Canale"),
|
||||
("Channel source: uniform value, procedural, image or anchor", "Sorgente del canale: valore uniforme, procedurale, immagine o ancoraggio"),
|
||||
("Channels", "Canali"),
|
||||
("Check for Updates...", "Controlla aggiornamenti..."),
|
||||
("Checker", "Scacchiera"),
|
||||
("Clamp", "Limita"),
|
||||
("Clear", "Cancella"),
|
||||
|
||||
@@ -146,6 +146,7 @@ pub const TABLE: &[(&str, &str)] = &[
|
||||
("Channel", "チャンネル"),
|
||||
("Channel source: uniform value, procedural, image or anchor", "チャンネルのソース: 均一値、プロシージャル、画像、アンカー"),
|
||||
("Channels", "チャンネル"),
|
||||
("Check for Updates...", "アップデートを確認..."),
|
||||
("Checker", "チェッカー"),
|
||||
("Clamp", "クランプ"),
|
||||
("Clear", "クリア"),
|
||||
|
||||
@@ -140,6 +140,7 @@ pub const TABLE: &[(&str, &str)] = &[
|
||||
("Channel", "채널"),
|
||||
("Channel source: uniform value, procedural, image or anchor", "채널 소스: 균일 값, 프로시저럴, 이미지 또는 앵커"),
|
||||
("Channels", "채널"),
|
||||
("Check for Updates...", "업데이트 확인..."),
|
||||
("Checker", "체커"),
|
||||
("Clamp", "클램프"),
|
||||
("Clear", "지우기"),
|
||||
|
||||
@@ -143,6 +143,7 @@ pub const TABLE: &[(&str, &str)] = &[
|
||||
("Channel", "Canal"),
|
||||
("Channel source: uniform value, procedural, image or anchor", "Origem do canal: valor uniforme, procedural, imagem ou âncora"),
|
||||
("Channels", "Canais"),
|
||||
("Check for Updates...", "Verificar atualizações..."),
|
||||
("Checker", "Xadrez"),
|
||||
("Clamp", "Limitar"),
|
||||
("Clear", "Limpar"),
|
||||
|
||||
@@ -131,6 +131,7 @@ pub const TABLE: &[(&str, &str)] = &[
|
||||
("Channel", "通道"),
|
||||
("Channel source: uniform value, procedural, image or anchor", "通道来源:统一值、程序纹理、图像或锚点"),
|
||||
("Channels", "通道"),
|
||||
("Check for Updates...", "检查更新..."),
|
||||
("Checker", "棋盘格"),
|
||||
("Clamp", "钳制"),
|
||||
("Clear", "清除"),
|
||||
|
||||
@@ -43,6 +43,8 @@ pub mod thumbs;
|
||||
pub mod titlebar;
|
||||
pub mod toolbar;
|
||||
pub mod ui_state_store;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(crate) mod updates_ui;
|
||||
pub mod uv_paint_point;
|
||||
pub mod viewport;
|
||||
pub mod web_files;
|
||||
@@ -60,6 +62,14 @@ use texturecraft_engine::bake::Progress;
|
||||
pub use control::ControlRequest;
|
||||
pub use state::UiState;
|
||||
|
||||
/// The app as the updater knows it: its releases, and the icon and color of its update prompt.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub const UPDATE_APP: craft_update::App = craft_update::App {
|
||||
icon_png: Some(include_bytes!("../../../assets/app-icon/hicolor/128x128/apps/ai.storyteller.texturecraft.png")),
|
||||
accent: Some([0xc2, 0x67, 0x2b]),
|
||||
..craft_update::App::new("texturecraft", "TextureCraft", "3D texture painting", "storytold/texturecraft")
|
||||
};
|
||||
|
||||
/// A texture set resize running on a worker thread (`Session::resize_task`).
|
||||
pub struct ResizeJob {
|
||||
pub progress: Arc<Progress>,
|
||||
@@ -147,6 +157,9 @@ pub struct TextureCraftApp {
|
||||
styled: Option<(theme::Brightness, theme::Accent)>,
|
||||
/// Whether the window had focus last frame.
|
||||
focused: bool,
|
||||
/// The update check and prompt (desktop only).
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(crate) updates_rt: updates_ui::Runtime,
|
||||
}
|
||||
|
||||
impl TextureCraftApp {
|
||||
@@ -201,6 +214,8 @@ impl TextureCraftApp {
|
||||
next_autosave,
|
||||
styled: None,
|
||||
focused: true,
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
updates_rt: updates_ui::Runtime::default(),
|
||||
};
|
||||
app.ui.rename = None;
|
||||
app.ui.windows.new_project = false;
|
||||
@@ -565,6 +580,8 @@ impl eframe::App for TextureCraftApp {
|
||||
web_files::sync_unsaved(self);
|
||||
}
|
||||
self.fonts.update(ctx, i18n::current().code, self.ui.windows.settings);
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
updates_ui::tick(self, ctx);
|
||||
menus::shortcuts(self, ctx);
|
||||
// A stored path being edited repaints its sublayer as its points, brush or material change.
|
||||
if let Err(e) = self.session.path_live() {
|
||||
@@ -595,6 +612,8 @@ impl eframe::App for TextureCraftApp {
|
||||
let frame = if hide { egui::Frame::NONE.fill(tk.viewport) } else { egui::Frame::NONE.fill(tk.chrome).inner_margin(theme::GUTTER) };
|
||||
egui::CentralPanel::default().frame(frame).show(ui, |ui| if hide { viewport::central(self, ui) } else { docking::show(self, ui) });
|
||||
windows::show(self, &ctx);
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
updates_ui::show(self, &ctx);
|
||||
toasts(self, &ctx);
|
||||
let end = now_ms();
|
||||
let dt = (end - t0) as f32;
|
||||
|
||||
@@ -100,6 +100,8 @@ pub const CATALOG: &[Item] = &[
|
||||
it("Help", "Report a bug...", "ui.help.bug", None),
|
||||
sep("Help"),
|
||||
it("Help", "Show log...", "ui.view.log", None),
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
it("Help", "Check for Updates...", "ui.help.checkForUpdates", None),
|
||||
it("Help", "About TextureCraft...", "ui.about", None),
|
||||
];
|
||||
|
||||
@@ -165,6 +167,8 @@ pub fn invoke(app: &mut TextureCraftApp, ctx: &egui::Context, id: &str) {
|
||||
"ui.layout.2d" => app.ui.layout = ViewLayout::Only2D,
|
||||
"ui.help.shortcuts" => app.ui.windows.shortcuts = true,
|
||||
"ui.about" => app.ui.windows.about = true,
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
"ui.help.checkForUpdates" => crate::updates_ui::request_check(app, ctx),
|
||||
"ui.help.discord" => ctx.open_url(egui::OpenUrl::new_tab("https://discord.gg/artcraft")),
|
||||
"ui.help.website" => ctx.open_url(egui::OpenUrl::new_tab("https://getartcraft.com/apps/texturecraft")),
|
||||
"ui.help.docs" => ctx.open_url(egui::OpenUrl::new_tab("https://github.com/storytold/texturecraft#readme")),
|
||||
@@ -279,7 +283,7 @@ fn menu_item(app: &mut TextureCraftApp, ctx: &egui::Context, ui: &mut egui::Ui,
|
||||
/// Keys pressed in a floating panel's own OS window run the shortcuts the main window's keys do.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn forwarded_shortcuts(app: &mut TextureCraftApp, ctx: &egui::Context, events: Vec<egui::Event>, held: Modifiers) {
|
||||
if crate::keymap::capturing(ctx) {
|
||||
if crate::keymap::capturing(ctx) || crate::updates_ui::blocks_input(app) {
|
||||
return;
|
||||
}
|
||||
let active = crate::keymap::active(&app.ui.keymap);
|
||||
@@ -310,6 +314,10 @@ pub fn shortcuts(app: &mut TextureCraftApp, ctx: &egui::Context) {
|
||||
if crate::keymap::capturing(ctx) || (ctx.memory(|memory| memory.focused().is_some()) && ctx.egui_wants_keyboard_input()) {
|
||||
return;
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
if crate::updates_ui::blocks_input(app) {
|
||||
return;
|
||||
}
|
||||
|
||||
ctx.input_mut(|input| {
|
||||
let keys: Vec<_> = input.events.iter().filter_map(|event| clipboard_key(event, input.modifiers)).collect();
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
//! Software updates on the desktop: the check at start, Help > Check for Updates and the update
|
||||
//! prompt. An update that is ready starts its install helper when the app is dropped at exit.
|
||||
|
||||
use craft_update::updater::{Action, Status, Updater};
|
||||
use craft_update::{CheckResultDialog, CheckResultResponse};
|
||||
|
||||
use crate::TextureCraftApp;
|
||||
|
||||
pub(crate) struct Runtime {
|
||||
updater: Updater,
|
||||
/// The desktop app turns the check at start on; tests leave it off.
|
||||
startup_check: bool,
|
||||
check_requested: bool,
|
||||
}
|
||||
|
||||
impl Default for Runtime {
|
||||
fn default() -> Self {
|
||||
Self { updater: Updater::new(&crate::UPDATE_APP, env!("CARGO_PKG_VERSION")), startup_check: false, check_requested: false }
|
||||
}
|
||||
}
|
||||
|
||||
impl TextureCraftApp {
|
||||
/// Whether the app asks for a newer release when it starts (off until the desktop app turns it on).
|
||||
pub fn set_startup_update_check(&mut self, on: bool) {
|
||||
self.updates_rt.startup_check = on;
|
||||
}
|
||||
}
|
||||
|
||||
/// Help > Check for Updates: the next frame starts a check that reports its outcome.
|
||||
pub(crate) fn request_check(app: &mut TextureCraftApp, ctx: &egui::Context) {
|
||||
app.updates_rt.check_requested = true;
|
||||
ctx.request_repaint();
|
||||
}
|
||||
|
||||
/// The update prompt and the modal result window hold the keyboard while they are open, so keys
|
||||
/// do not act on the project behind them.
|
||||
pub(crate) fn blocks_input(app: &TextureCraftApp) -> bool {
|
||||
holds_keyboard(app.updates_rt.updater.status(), app.updates_rt.updater.prompt_open())
|
||||
}
|
||||
|
||||
/// The prompt is modal, and the result window is modal for every status but [`Status::Updated`],
|
||||
/// a notice that leaves the app usable behind it.
|
||||
fn holds_keyboard(status: &Status, prompt_open: bool) -> bool {
|
||||
prompt_open || !matches!(status, Status::Idle | Status::Updated(_))
|
||||
}
|
||||
|
||||
pub(crate) fn tick(app: &mut TextureCraftApp, ctx: &egui::Context) {
|
||||
let rt = &mut app.updates_rt;
|
||||
if std::mem::take(&mut rt.check_requested) {
|
||||
rt.updater.check_now(ctx);
|
||||
} else if rt.startup_check {
|
||||
rt.updater.check_at_start(ctx);
|
||||
}
|
||||
rt.updater.tick(ctx);
|
||||
}
|
||||
|
||||
/// Whether the result window shows: for every status but idle (a requested check, and the first
|
||||
/// start after an update, which reports that it installed or why it failed), and never over the
|
||||
/// update prompt.
|
||||
fn result_window_shows(status: &Status, prompt_open: bool) -> bool {
|
||||
!prompt_open && !matches!(status, Status::Idle)
|
||||
}
|
||||
|
||||
/// Whether an update may install and close the app: the project has no unsaved changes and no
|
||||
/// stroke, bake or resize is running.
|
||||
fn safe_to_close(app: &TextureCraftApp) -> bool {
|
||||
!app.session.modified && !app.session.stroke_active() && app.bake.is_none() && app.resize.is_none()
|
||||
}
|
||||
|
||||
pub(crate) fn show(app: &mut TextureCraftApp, ctx: &egui::Context) {
|
||||
let safe = safe_to_close(app);
|
||||
match app.updates_rt.updater.show_if(ctx, safe) {
|
||||
Action::OpenUrl(url) => ctx.open_url(egui::OpenUrl::new_tab(url)),
|
||||
Action::Close => ctx.send_viewport_cmd(egui::ViewportCommand::Close),
|
||||
Action::None => {}
|
||||
}
|
||||
let rt = &mut app.updates_rt;
|
||||
if result_window_shows(rt.updater.status(), rt.updater.prompt_open()) {
|
||||
match CheckResultDialog::new(&crate::UPDATE_APP, env!("CARGO_PKG_VERSION")).show(ctx, rt.updater.status()) {
|
||||
CheckResultResponse::None => {}
|
||||
CheckResultResponse::Close => rt.updater.dismiss_status(),
|
||||
CheckResultResponse::CheckAgain => rt.check_requested = true,
|
||||
CheckResultResponse::RestartToUpdate => rt.updater.restart_to_update(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, channel};
|
||||
|
||||
use craft_update::updater::CheckSource;
|
||||
use craft_update::{Arch, Asset, Os, PackageKind, Paths, Platform, Release, pick_asset};
|
||||
use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use serde_json::json;
|
||||
use texturecraft_engine::Tool;
|
||||
use texturecraft_engine::bake::Progress;
|
||||
use texturecraft_engine::geom::glam::Vec2;
|
||||
|
||||
use super::*;
|
||||
use crate::state::Mode;
|
||||
|
||||
/// Stands in for GitHub: each check sends one message and finds nothing newer.
|
||||
fn source() -> (CheckSource, Receiver<()>) {
|
||||
let (sent, asked) = channel();
|
||||
let ask: CheckSource = Arc::new(move || {
|
||||
let _ = sent.send(());
|
||||
Ok(None)
|
||||
});
|
||||
(ask, asked)
|
||||
}
|
||||
|
||||
/// The harness draws the UI, and the i18n tests switch the process-wide language to ones
|
||||
/// its fonts cannot draw.
|
||||
fn language() -> std::sync::MutexGuard<'static, ()> {
|
||||
crate::i18n::TEST_LANGUAGE.lock().unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
}
|
||||
|
||||
/// The app with an updater that asks `ask` and keeps its records out of the user's folders.
|
||||
fn harness(modified: bool, test: &str, ask: CheckSource) -> Harness<'static, TextureCraftApp> {
|
||||
let root = std::env::temp_dir().join(format!("texturecraft-updates-{}-{test}", std::process::id()));
|
||||
let mut session = texturecraft_engine::sample_session(256, 64).unwrap();
|
||||
session.modified = modified;
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1600.0, 960.0)).build_eframe(|cc| TextureCraftApp::new(cc, session));
|
||||
h.state_mut().updates_rt.updater =
|
||||
Updater::new(&crate::UPDATE_APP, "0.0.1").with_source(ask).with_paths(Paths::under(&root)).with_pins_path(root.join("pins.json"));
|
||||
h.state_mut().ui.windows.start = false;
|
||||
h.run_steps(2);
|
||||
h
|
||||
}
|
||||
|
||||
fn offer(h: &mut Harness<'static, TextureCraftApp>) {
|
||||
let release = Release {
|
||||
tag: "v99.0.0".into(),
|
||||
version: craft_update::parse_version("99.0.0"),
|
||||
name: "TextureCraft 99.0.0".into(),
|
||||
html_url: "https://github.com/storytold/texturecraft/releases/tag/v99.0.0".into(),
|
||||
..Default::default()
|
||||
};
|
||||
h.state_mut().updates_rt.updater.offer(release);
|
||||
h.run_steps(2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_runtime_is_idle() {
|
||||
let rt = Runtime::default();
|
||||
assert!(!rt.startup_check);
|
||||
assert!(!rt.check_requested);
|
||||
assert!(!rt.updater.prompt_open());
|
||||
assert_eq!(rt.updater.status(), &Status::Idle);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_menu_item_runs_a_check_that_reports_its_outcome() {
|
||||
let _language = language();
|
||||
let (ask, asked) = source();
|
||||
let mut h = harness(false, "menu", ask);
|
||||
let ctx = h.ctx.clone();
|
||||
crate::menus::invoke(h.state_mut(), &ctx, "ui.help.checkForUpdates");
|
||||
h.step();
|
||||
let status = h.state().updates_rt.updater.status().clone();
|
||||
assert!(matches!(status, Status::Checking | Status::UpToDate), "{status:?}");
|
||||
// Dropping the app drops the only sender left when no check started, so this cannot hang.
|
||||
drop(h);
|
||||
assert!(asked.recv().is_ok(), "the check asked for the latest release");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_check_at_start_runs_only_when_the_desktop_app_turns_it_on() {
|
||||
let _language = language();
|
||||
for on in [false, true] {
|
||||
let (ask, asked) = source();
|
||||
let mut h = harness(false, if on { "start-on" } else { "start-off" }, ask);
|
||||
h.state_mut().set_startup_update_check(on);
|
||||
h.step();
|
||||
drop(h);
|
||||
assert_eq!(asked.recv().is_ok(), on, "startup check {on}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_offered_update_shows_the_prompt_and_later_closes_it() {
|
||||
let _language = language();
|
||||
let (ask, _asked) = source();
|
||||
let mut h = harness(false, "prompt", ask);
|
||||
offer(&mut h);
|
||||
assert!(h.state().updates_rt.updater.prompt_open());
|
||||
h.get_by_label("LATER").click();
|
||||
h.run_steps(2);
|
||||
assert!(!h.state().updates_rt.updater.prompt_open());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keys_do_not_reach_the_project_behind_the_prompt() {
|
||||
let _language = language();
|
||||
let (ask, _asked) = source();
|
||||
let mut h = harness(false, "keys", ask);
|
||||
assert_eq!(h.state().ui.mode, Mode::Painting);
|
||||
offer(&mut h);
|
||||
assert!(crate::docking::input_blocked(h.state(), &h.ctx), "floating panels stop taking input");
|
||||
h.key_press(egui::Key::F8);
|
||||
h.step();
|
||||
assert_eq!(h.state().ui.mode, Mode::Painting, "the prompt holds the keyboard");
|
||||
h.get_by_label("LATER").click();
|
||||
h.run_steps(2);
|
||||
assert!(!crate::docking::input_blocked(h.state(), &h.ctx));
|
||||
h.key_press(egui::Key::F8);
|
||||
h.step();
|
||||
assert_eq!(h.state().ui.mode, Mode::Baking, "the key works once the prompt is closed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_path_tools_keys_do_not_reach_the_path_behind_the_prompt() {
|
||||
let _language = language();
|
||||
let (ask, _asked) = source();
|
||||
let mut h = harness(false, "path-keys", ask);
|
||||
let state = h.state_mut();
|
||||
state.session.tool.tool = Tool::Path;
|
||||
texturecraft_engine::execute(&mut state.session, "tool.path", &json!({"uvPoints": [[0.2, 0.5], [0.8, 0.5]]})).unwrap();
|
||||
h.run_steps(2);
|
||||
let points = |h: &Harness<'static, TextureCraftApp>| h.state().session.tool.path.points.len();
|
||||
assert_eq!(points(&h), 2);
|
||||
offer(&mut h);
|
||||
h.key_press(egui::Key::Backspace);
|
||||
h.step();
|
||||
assert_eq!(points(&h), 2, "the prompt holds the keyboard");
|
||||
h.get_by_label("LATER").click();
|
||||
h.run_steps(2);
|
||||
h.key_press(egui::Key::Backspace);
|
||||
h.step();
|
||||
assert_eq!(points(&h), 1, "the key works once the prompt is closed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_result_window_holds_the_keyboard_unless_it_is_the_updated_notice() {
|
||||
let modal = [
|
||||
Status::Checking,
|
||||
Status::UpToDate,
|
||||
Status::Failed("offline".into()),
|
||||
Status::Installing,
|
||||
Status::Ready,
|
||||
Status::Managed,
|
||||
Status::InstallFailed("locked".into()),
|
||||
];
|
||||
for status in &modal {
|
||||
assert!(holds_keyboard(status, false), "{status:?}");
|
||||
}
|
||||
assert!(!holds_keyboard(&Status::Idle, false));
|
||||
assert!(!holds_keyboard(&Status::Updated("99.0.0".into()), false));
|
||||
assert!(holds_keyboard(&Status::Idle, true), "the prompt is modal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unsaved_changes_and_running_work_hold_an_update_back() {
|
||||
let _language = language();
|
||||
let (ask, _asked) = source();
|
||||
let mut h = harness(false, "safe-to-close", ask);
|
||||
assert!(safe_to_close(h.state()));
|
||||
|
||||
h.state_mut().session.modified = true;
|
||||
assert!(!safe_to_close(h.state()), "unsaved changes");
|
||||
h.state_mut().session.modified = false;
|
||||
|
||||
h.state_mut().bake = Some(crate::BakeJob { queue: Vec::new(), current: None, total: 0 });
|
||||
assert!(!safe_to_close(h.state()), "a bake");
|
||||
h.state_mut().bake = None;
|
||||
|
||||
h.state_mut().resize = Some(crate::ResizeJob { progress: Arc::new(Progress::new()), rx: channel().1 });
|
||||
assert!(!safe_to_close(h.state()), "a resize");
|
||||
h.state_mut().resize = None;
|
||||
|
||||
let session = &mut h.state_mut().session;
|
||||
texturecraft_engine::execute(session, "layer.add.paint", &serde_json::Value::Null).unwrap();
|
||||
session.modified = false;
|
||||
session.begin_stroke_uv(Vec2::new(0.5, 0.5), 1.0).unwrap();
|
||||
assert!(!safe_to_close(h.state()), "a stroke");
|
||||
h.state_mut().session.cancel_stroke();
|
||||
assert!(safe_to_close(h.state()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn result_window_shows_every_status_but_idle() {
|
||||
let shown = [
|
||||
Status::Checking,
|
||||
Status::UpToDate,
|
||||
Status::Failed("offline".into()),
|
||||
Status::Installing,
|
||||
Status::Ready,
|
||||
Status::Managed,
|
||||
Status::Updated("99.0.0".into()),
|
||||
Status::InstallFailed("locked".into()),
|
||||
];
|
||||
for status in &shown {
|
||||
assert!(result_window_shows(status, false), "{status:?} shows");
|
||||
assert!(!result_window_shows(status, true), "{status:?} waits for the prompt");
|
||||
}
|
||||
assert!(!result_window_shows(&Status::Idle, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_update_app_finds_the_assets_a_release_publishes() {
|
||||
let names = [
|
||||
"texturecraft-0.4.0-macos-universal.dmg",
|
||||
"texturecraft-0.4.0-windows-x64.msi",
|
||||
"texturecraft-0.4.0-windows-x64-portable.zip",
|
||||
"texturecraft-0.4.0-linux-x86_64.AppImage",
|
||||
"texturecraft-0.4.0-linux-x86_64.tar.gz",
|
||||
"texturecraft-cli-0.4.0-macos-universal.zip",
|
||||
"texturecraft-web-0.4.0.zip",
|
||||
];
|
||||
let assets = names.iter().map(|name| Asset { name: (*name).into(), size: 1, url: String::new(), sha256: None }).collect();
|
||||
let release = Release { assets, ..Default::default() };
|
||||
let stems = [crate::UPDATE_APP.id];
|
||||
let picked = |os, arch, kind| pick_asset(&release, &stems, Platform { os, arch }, &[kind]).map(|(asset, _)| asset.name.clone());
|
||||
assert_eq!(picked(Os::MacOs, Arch::Arm64, PackageKind::Dmg).as_deref(), Some(names[0]));
|
||||
assert_eq!(picked(Os::Windows, Arch::X64, PackageKind::Msi).as_deref(), Some(names[1]));
|
||||
assert_eq!(picked(Os::Windows, Arch::X64, PackageKind::PortableZip).as_deref(), Some(names[2]));
|
||||
assert_eq!(picked(Os::Linux, Arch::X64, PackageKind::AppImage).as_deref(), Some(names[3]));
|
||||
assert_eq!(picked(Os::Linux, Arch::X64, PackageKind::TarGz).as_deref(), Some(names[4]));
|
||||
assert_eq!(crate::UPDATE_APP.bundle_id(), "ai.storyteller.texturecraft");
|
||||
assert_eq!(crate::UPDATE_APP.repo, "storytold/texturecraft");
|
||||
}
|
||||
}
|
||||
@@ -978,6 +978,10 @@ const HANDLE_GRAB: f32 = 8.0;
|
||||
/// Path tool keys: Enter applies the path, Backspace removes its last point (Esc, handled with
|
||||
/// the global shortcuts, cancels it).
|
||||
fn path_keys(app: &mut TextureCraftApp, ui: &Ui) {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
if crate::updates_ui::blocks_input(app) {
|
||||
return;
|
||||
}
|
||||
if app.ui.mode != crate::state::Mode::Painting
|
||||
|| app.session.tool.tool != Tool::Path
|
||||
|| app.session.tool.path.points.is_empty()
|
||||
|
||||
+2
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
Generated by `TC_UPDATE_PARITY=1 cargo test -p texturecraft-ui-egui parity`. Each row is a menu item of the target menu layout with TextureCraft's command id; **live** means the id is implemented. Feature parity beyond menus is tracked in [`ROADMAP.md`](../ROADMAP.md).
|
||||
|
||||
**58 of 58 menu items live (100%).**
|
||||
**59 of 59 menu items live (100%).**
|
||||
|
||||
## File
|
||||
|
||||
@@ -90,5 +90,6 @@ Generated by `TC_UPDATE_PARITY=1 cargo test -p texturecraft-ui-egui parity`. Eac
|
||||
| ArtCraft website... | `ui.help.website` | | live |
|
||||
| Report a bug... | `ui.help.bug` | | live |
|
||||
| Show log... | `ui.view.log` | | live |
|
||||
| Check for Updates... | `ui.help.checkForUpdates` | | live |
|
||||
| About TextureCraft... | `ui.about` | | live |
|
||||
|
||||
Reference in new issue
Block a user