Compare commits

..

27 Commits

Author SHA1 Message Date
Lea Anthony 741558532b Revert "Added possibility to specify platform for dev command (#3117)"
This reverts commit 4b4fcdd47c.
2024-02-08 21:38:24 +11:00
Lea Anthony 772f870eb3 v2.8.0 2024-02-08 21:28:28 +11:00
stffabi e29b375de5 [cli] Bump x/tools to 0.17.0 to fix compatiblity with go 1.22 (#3244) 2024-02-08 22:40:04 +11:00
github-actions[bot] 72e12ef398 chore: update sponsors.svg (#3235)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2024-02-05 22:41:20 +11:00
atterpac 9903ba70d5 Update vue-tsc (#3234)
changelog
2024-02-05 17:12:09 +11:00
github-actions[bot] 9b35616a20 chore: update sponsors.svg (#3223)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2024-01-29 21:33:29 +11:00
github-actions[bot] a988691931 chore: update sponsors.svg (#3218)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2024-01-27 08:43:22 +11:00
William Sjökvist ad7f7f76bc chore: add cfn-tracker to community docs (#3221)
* chore: add cfn tracker to community docs

* run format
2024-01-27 08:41:15 +11:00
github-actions[bot] 55a7d317bd chore: update sponsors.svg (#3217)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2024-01-25 21:04:20 +11:00
github-actions[bot] cec6551c5e chore: update sponsors.svg (#3215)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2024-01-21 17:45:38 +11:00
github-actions[bot] 3a230b563f chore: update sponsors.svg (#3210)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2024-01-19 19:49:09 +11:00
Dana Woodman f9aa4d3b60 Give explicity example of importing JS runtime (#3178)
* Give explicity example of importing JS runtime

No where in the docs, google, github issues or discussions could I find an example of importing the runtime JS but after some experimentation I figured it out.

I think it would help future users if a simple example was shown like this so they have a clear reference of how to import the runtime.

* make generic

* Update changelog.mdx

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-01-17 22:40:12 +11:00
Luke Watts b498cddcad Windows nsis install documentation improvements (#3179)
* Adding additional NSIS install methods (Scoop, Winget) to windows-installer.mdx

Adding Scoop and Winget package managers to the list of methods by which NSIS can be installed.

* Update windows-installer.mdx

Reordering so chocolatey is last, as Scoop or Winget are better/newer options
2024-01-17 22:37:58 +11:00
ALMAS 3e5df3c7f1 [v2/Windows]Set default extension for save file dialog (#3205)
* Set default extension for save file dialog

* add change log

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-01-17 22:35:15 +11:00
github-actions[bot] 9ccb17bfd0 chore: update sponsors.svg (#3204)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2024-01-17 08:27:49 +11:00
dependabot[bot] 12d6336421 Bump follow-redirects from 1.15.2 to 1.15.4 in /website (#3188)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-10 23:32:36 +11:00
dependabot[bot] cf2d16c1fd Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 in /v2 (#3185)
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.3 to 1.3.7.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.3...v1.3.7)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-10 06:14:31 +11:00
ALMAS bf389e3914 [v2/Mac] Handle application terminate (#3157)
* [v2/Mac] Handle application terminate

* add change log

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-01-08 08:08:04 +11:00
Vladimir f7c19469a7 v2 [#3133] SingleInstanceData: Fill missing WD as is (#3154)
* [#3133] SingleInstanceData: Fill missing WD as is

* Apply suggestions from code review

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Fix: missing `import` for AI suggestions

* Add changelog entry

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-01-04 05:26:24 +11:00
github-actions[bot] f1265c527e chore: update sponsors.svg (#3150)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2024-01-03 19:43:00 +11:00
dependabot[bot] b083d1d41c Bump github.com/go-git/go-git/v5 from 5.3.0 to 5.11.0 in /v2 (#3161)
Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.3.0 to 5.11.0.
- [Release notes](https://github.com/go-git/go-git/releases)
- [Commits](https://github.com/go-git/go-git/compare/v5.3.0...v5.11.0)

---
updated-dependencies:
- dependency-name: github.com/go-git/go-git/v5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 19:38:06 +11:00
dependabot[bot] 56fb047d89 Bump tj-actions/verify-changed-files in /.github/workflows (#3164)
Bumps [tj-actions/verify-changed-files](https://github.com/tj-actions/verify-changed-files) from 11.1 to 17.
- [Release notes](https://github.com/tj-actions/verify-changed-files/releases)
- [Changelog](https://github.com/tj-actions/verify-changed-files/blob/main/HISTORY.md)
- [Commits](https://github.com/tj-actions/verify-changed-files/compare/v11.1...v17)

---
updated-dependencies:
- dependency-name: tj-actions/verify-changed-files
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 19:37:41 +11:00
dependabot[bot] ae4cb4e861 Bump tj-actions/changed-files from 35 to 41 in /.github/workflows (#3165)
Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 35 to 41.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](https://github.com/tj-actions/changed-files/compare/v35...v41)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 19:36:40 +11:00
Lykin 33172946ca doc: update screenshot of Tiny RDM to latest version (#3166)
Co-authored-by: Lykin <huangliu3060@qq.com>
2024-01-03 19:35:59 +11:00
dependabot[bot] 3c7a2187db Bump golang.org/x/crypto in /v2/internal/staticanalysis/test/standard (#3143)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-12-19 18:30:43 +11:00
dependabot[bot] 437ca0ffd5 Bump golang.org/x/crypto from 0.14.0 to 0.17.0 in /v2 (#3142)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-12-19 18:29:29 +11:00
dependabot[bot] 162720423f Bump golang.org/x/crypto in /v2/examples/customlayout (#3144)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-19 18:28:42 +11:00
1639 changed files with 43981 additions and 94350 deletions
-140
View File
@@ -1,140 +0,0 @@
name: Build + Test v3 alpha
on:
push:
branches: [v3-alpha]
paths-ignore:
- 'mkdocs-website/**/*'
workflow_dispatch:
jobs:
test_go:
name: Run Go Tests
if: github.repository == 'wailsapp/wails'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
go-version: [1.22]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev javascriptcoregtk-4.1-dev build-essential pkg-config
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Examples
working-directory: ./v3
run: task test:examples
- name: Run tests (mac)
if: matrix.os == 'macos-latest'
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
working-directory: ./v3
run: go test -v ./...
- name: Run tests (!mac)
if: matrix.os != 'macos-latest'
working-directory: ./v3
run: go test -v ./...
test_js:
name: Run JS Tests
if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
working-directory: v2/internal/frontend/runtime
- name: Run tests
run: npm test
working-directory: v2/internal/frontend/runtime
test_templates:
name: Test Templates
needs: test_go
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
template:
[
svelte,
svelte-ts,
vue,
vue-ts,
react,
react-ts,
preact,
preact-ts,
lit,
lit-ts,
vanilla,
vanilla-ts,
]
go-version: [1.22]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Setup Golang caches
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev javascriptcoregtk-4.1-dev build-essential pkg-config
- name: Build Wails3 CLI
run: |
cd ./v3/cmd/wails3
go install
wails3 -help
- name: Generate template '${{ matrix.template }}'
run: |
go install github.com/go-task/task/v3/cmd/task@latest
mkdir -p ./test-${{ matrix.template }}
cd ./test-${{ matrix.template }}
wails3 init -n ${{ matrix.template }} -t ${{ matrix.template }}
cd ${{ matrix.template }}
wails3 build
+3 -3
View File
@@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-11]
go-version: ['1.22']
go-version: ['1.20']
steps:
- name: Checkout code
@@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
node-version: [16.x]
steps:
- name: Checkout code
@@ -90,7 +90,7 @@ jobs:
vanilla-ts,
plain,
]
go-version: ['1.22']
go-version: ['1.20']
steps:
- name: Checkout
uses: actions/checkout@v4
+1 -1
View File
@@ -16,7 +16,7 @@ jobs:
- name: Set Node
uses: actions/setup-node@v2
with:
node-version: 20.x
node-version: 16.x
- name: Update Sponsors
run: cd scripts/sponsors && chmod 755 ./generate-sponsor-image.sh && ./generate-sponsor-image.sh
+7 -28
View File
@@ -6,15 +6,6 @@ on:
types: [submitted]
jobs:
debug_context:
name: Debug Context
runs-on: ubuntu-latest
steps:
- name: Print GitHub Context
run: echo "$GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
check_docs:
name: Check Docs
if: ${{github.repository == 'wailsapp/wails' && contains(github.head_ref,'feature/')}}
@@ -23,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v11.1
uses: tj-actions/verify-changed-files@v17
id: verify-changed-files
with:
files: |
@@ -65,7 +56,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: ['1.22']
go-version: ['1.20']
steps:
- name: Checkout code
@@ -80,26 +71,14 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Run tests (mac) | v2
if: ${{ matrix.os == 'macos-latest' && github.base_ref == 'master' }}
- name: Run tests (mac)
if: matrix.os == 'macos-latest'
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
working-directory: ./v2
run: go test -v ./...
- name: Run tests (!mac) | v2
if: ${{ matrix.os != 'macos-latest' && github.base_ref == 'master' }}
working-directory: ./v2
run: go test -v ./...
- name: Run tests (mac) | v3
if: ${{ matrix.os == 'macos-latest' && github.base_ref == 'v3-alpha' }}
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
working-directory: ./v3
run: go test -v ./...
- name: Run tests (!mac) | v3
if: ${{ matrix.os != 'macos-latest' && github.base_ref == 'v3-alpha' }}
working-directory: ./v3
- name: Run tests (!mac)
if: matrix.os != 'macos-latest'
working-directory: ./v2
run: go test -v ./...
@@ -15,7 +15,7 @@ jobs:
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: 20.x
node-version: 18.x
- name: Install Task
uses: arduino/setup-task@v1
@@ -15,7 +15,7 @@ jobs:
- name: Verify Changed files
id: changed-files
uses: tj-actions/changed-files@v35
uses: tj-actions/changed-files@v41
with:
files: |
website/**/*.mdx
@@ -25,7 +25,7 @@ jobs:
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: 20.x
node-version: 18.x
- name: Setup Task
uses: arduino/setup-task@v1
-35
View File
@@ -1,35 +0,0 @@
name: v3 docs
on:
push:
branches:
- v3-alpha
paths:
- 'mkdocs-website/**/*'
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
defaults:
run:
working-directory: ./mkdocs-website
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: sudo apt-get install pngquant
- run: pip install pillow cairosvg mkdocs-table-reader-plugin mkdocs-static-i18n
- run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
- run: mkdocs build --config-file mkdocs.insiders.yml
- run: mkdocs gh-deploy --force
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
-1
View File
@@ -1 +0,0 @@
v3alpha.wails.io
-5
View File
@@ -16,11 +16,6 @@ includes:
dir: v3
optional: true
docs:
taskfile: mkdocs-website
dir: mkdocs-website
optional: true
tasks:
contributors:check:
cmds:
-1
View File
@@ -1 +0,0 @@
v3alpha.wails.io
-45
View File
@@ -1,45 +0,0 @@
# v3 Docs
This is the documentation for Wails v3. It is currently a work in progress.
If you do not wish to build it locally, it is available online at
[https://wailsapp.github.io/wails/](https://wailsapp.github.io/wails/).
## Recommended Setup Steps
Install the wails3 CLI if you haven't already:
```shell
go install github.com/wailsapp/wails/v3/cmd/wails3@latest
```
The documentation uses mkdocs, so you will need to install
[Python](https://www.python.org/). Once installed, you can setup the
documentation by running the following command:
```bash
wails3 task docs:setup
```
This will install the required dependencies for you.
If you have installed the wails3 CLI, you can run the following command to build
the documentation and serve it locally:
```bash
wails3 task docs:serve
```
### Manual Setup
To install manually, you will need to do the following:
- Install [Python](https://www.python.org/)
- Run `pip install -r requirements.txt` to install the required dependencies
- Run `mkdocs serve` to serve the documentation locally
- Run `mkdocs build` to build the documentation
## Contributing
If you would like to contribute to the documentation, please feel free to open a
PR!
-59
View File
@@ -1,59 +0,0 @@
# https://taskfile.dev
version: '3'
tasks:
setup:
summary: Setup the project
preconditions:
- sh: python{{exeExt}} --version
msg: "Looks like Python isn't installed. Python is required to build the documentation: https://www.python.org/downloads/"
cmds:
- python -m pip install -r requirements.txt --user
setup:insiders:
summary: Setup the project (insiders)
preconditions:
- sh: python{{exeExt}} --version
msg: "Looks like Python isn't installed. Python is required to build the documentation: https://www.python.org/downloads/"
cmds:
- python -m pip install -r requirements.insiders.txt --user
upgrade:insiders:
summary: Upgrade the project (insiders)
preconditions:
- sh: python{{exeExt}} --version
msg: "Looks like Python isn't installed. Python is required to build the documentation: https://www.python.org/downloads/"
cmds:
- python -m pip install -r requirements.insiders.txt --upgrade --user
build:
summary: Builds the documentation
preconditions:
- sh: mkdocs --version
msg: "Looks like mkdocs isn't installed. Run `wails3 task setup` or `task setup` in the documentation directory to install it."
cmds:
- mkdocs build
serve:
summary: Builds the documentation and serves it locally
preconditions:
- sh: mkdocs --version
msg: "Looks like mkdocs isn't installed. Run `wails3 task setup` or `task setup` in the documentation directory to install it."
cmds:
- mkdocs serve
serve:insiders:
summary: Builds the documentation and serves it locally
preconditions:
- sh: mkdocs --version
msg: "Looks like mkdocs isn't installed. Run `wails3 task setup` or `task setup` in the documentation directory to install it."
cmds:
- mkdocs serve --config-file mkdocs.insiders.yml
update:api:
summary: Updates the API documentation
dir: generate
cmds:
- go run .
-1
View File
@@ -1 +0,0 @@
v3alpha.wails.io
-141
View File
@@ -1,141 +0,0 @@
# Cais
Mae'r API cais yn cynorthwyo i greu cais gan ddefnyddio fframwaith Wails.
### Newydd
API: `New(appOptions Options) *App`
`New(appOptions Options)` yn creu cais newydd gan ddefnyddio'r opsiynau cais a ddarperir. Mae'n cymhwyso gwerthoedd rhagosodedig ar gyfer opsiynau heb eu pennu, yn eu cyfuno â'r rhai a ddarparwyd, yn eu cychwyn a'n dychwelyd enghraifft o'r cais.
Os bydd gwall yn ystod y cychwyn, caiff y cais ei atal gyda'r neges gwall a ddarperir.
Dylid nodi, os oes enghraifft gyffredinol o gais yn bodoli eisoes, y bydd yr enghraifft honno'n cael ei dychwelyd yn hytrach na chreu un newydd.
```go title="main.go" hl_lines="6-9"
package main
import "github.com/wailsapp/wails/v3/pkg/application"
func main() {
app := application.New(application.Options{
Name: "Demo Ffenestr Gweddarlunydd",
// Opsiynau eraill
})
// Gweddill y cais
}
```
### Cael
`Get()` yn dychwelyd yr enghraifft gyffredinol o'r cais. Mae'n ddefnyddiol pan fydd angen mynediad i'r cais o wahanol rannau o'ch cod.
```go
// Cael enghraifft o'r cais
app := application.Get()
```
### Galluoedd
API: `Capabilities() capabilities.Capabilities`
`Capabilities()` yn adfer map o'r galluoedd sydd gan y cais ar hyn o bryd. Gall y galluoedd fod ynghylch y nodweddion gwahanol y system weithredu sy'n darparu, fel nodweddion gweddarlunydd.
```go
// Cael galluoedd y cais
capabilities := app.Capabilities()
if capabilities.HasNativeDrag {
// Gwneud rhywbeth
}
```
### GetPID
API: `GetPID() int`
`GetPID()` yn dychwelyd ID y Broses y cais.
```go
pid := app.GetPID()
```
### Rhedeg
API: `Run() error`
`Run()` yn dechrau gweithredu'r cais a'i gydrannau.
```go
app := application.New(application.Options{
//options
})
// Rhedeg y cais
err := application.Run()
if err != nil {
// Ymdrin â'r gwall
}
```
### Gadael
API: `Quit()`
`Quit()` yn gadael y cais trwy ddinistrio ffenestri a rhai cydrannau eraill o bosibl.
```go
// Gadael y cais
app.Quit()
```
### AydunDdyryslyd
API: `IsDarkMode() bool`
`IsDarkMode()` yn gwirio a yw'r cais yn rhedeg mewn modd tywyll. Mae'n dychwelyd gwerth boolean yn nodi a yw'r modd tywyll wedi'i alluogi.
```go
// Gwiriwch a yw'r modd tywyll wedi'i alluogi
if app.IsDarkMode() {
// Gwneud rhywbeth
}
```
### Cuddio
API: `Hide()`
`Hide()` yn cuddio ffenestr y cais.
```go
// Cuddio ffenestr y cais
app.Hide()
```
### Dangos
API: `Show()`
`Show()` yn dangos ffenestr y cais.
```go
// Dangos ffenestr y cais
app.Show()
```
--8<--
./docs/cy/API/application_window.md
./docs/cy/API/application_menu.md
./docs/cy/API/application_dialogs.md
./docs/cy/API/application_events.md
./docs/cy/API/application_screens.md
--8<--
## Opsiynau
```go title="pkg/application/application_options.go"
--8<--
../v3/pkg/application/application_options.go
--8<--
```
@@ -1,67 +0,0 @@
### Dangos Deialog Ynghylch
API: `ShowAboutDialog()`
Mae `ShowAboutDialog()` yn dangos blwch deialog "Ynghylch". Gall ddangos enw'r
cymhwysiad, disgrifiad ac eicon.
```go
// Dangos y deialog ynghylch
app.ShowAboutDialog()
```
### Gwybodaeth
API: `InfoDialog()`
Mae `InfoDialog()` yn creu ac yn dychwelyd esiampl newydd o `MessageDialog` gyda
`InfoDialogType`. Defnyddir y deialog hon fel arfer i ddangos negeseuon
gwybodaeth i'r defnyddiwr.
### Cwestiwn
API: `QuestionDialog()`
Mae `QuestionDialog()` yn creu ac yn dychwelyd esiampl newydd o `MessageDialog`
gyda `QuestionDialogType`. Defnyddir y deialog hon yn aml i ofyn cwestiwn i'r
defnyddiwr a disgwyl ymateb.
### Rhybudd
API: `WarningDialog()`
Mae `WarningDialog()` yn creu ac yn dychwelyd esiampl newydd o `MessageDialog`
gyda `WarningDialogType`. Fel y mae'r enw yn awgrymu, defnyddir y deialog hon yn
bennaf i ddangos negeseuon rhybudd i'r defnyddiwr.
### Gwall
API: `ErrorDialog()`
Mae `ErrorDialog()` yn creu ac yn dychwelyd esiampl newydd o `MessageDialog` gyda
`ErrorDialogType`. Cynlluniwyd y deialog hon i'w defnyddio pan fydd angen
dangos neges gwall i'r defnyddiwr.
### Agor Ffeil
API: `OpenFileDialog()`
Mae `OpenFileDialog()` yn creu ac yn dychwelyd esiampl newydd o
`OpenFileDialogStruct`. Mae'r deialog hon yn annog y defnyddiwr i ddewis un neu
ragor o ffeiliau o'u system ffeiliau.
### Cadw Ffeil
API: `SaveFileDialog()`
Mae `SaveFileDialog()` yn creu ac yn dychwelyd esiampl newydd o
`SaveFileDialogStruct`. Mae'r deialog hon yn annog y defnyddiwr i ddewis lleoliad
yn eu system ffeiliau lle y dylid cadw ffeil.
### Agor Cyfeiriadur
API: `OpenDirectoryDialog()`
Mae `OpenDirectoryDialog()` yn creu ac yn dychwelyd esiampl newydd o
`MessageDialog` gyda `OpenDirectoryDialogType`. Mae'r deialog hon yn galluogi'r
defnyddiwr i ddewis cyfeiriadur o'u system ffeiliau.
@@ -1,13 +0,0 @@
### Ar
API:
`Ar(eventType digwyddiadau.DdigwyddiadweithgangeningApplicationEventType, atebydd func(digwyddiad *Digwyddiad)) func()`
Mae `Ar()` yn cofrestru gwrandäwr digwyddiad ar gyfer digwyddiadau cymhwysiad penodol. Bydd y swyddogaeth atebydd a ddarperir yn cael ei sbarduno pan fydd y digwyddiad cysylltiedig yn digwydd. Mae'r swyddogaeth yn dychwelyd swyddogaeth y gellir ei galw i dynnu'r gwrandäwr.
### CofrestruArgraffwyr
API:
`CofrestruArgraffwyr(eventType digwyddiadau.DdigwyddiadweithgangeningApplicationEventType, atebydd func(digwyddiad *Digwyddiad)) func()`
Mae `CofrestruArgraffwyr()` yn cofrestru atebydd i'w redeg fel crocen yn ystod digwyddiadau penodol. Caiff y crocenau hyn eu rhedeg cyn gwrandawyr sy'n gysylltiedig ag `Ar()`. Mae'r swyddogaeth yn dychwelyd swyddogaeth y gellir ei galw i dynnu'r bâs.
@@ -1,27 +0,0 @@
### RegisterContextMenu
API: `RegisterContextMenu(name string, menu *Menu)`
Mae `RegisterContextMenu()` yn cofrestru dewislen cyd-destun gyda enw penodol. Gellir defnyddio'r dewislen hon yn ddiweddarach yn yr ap.
```go
// Creu dewislen newydd
ctxmenu := app.NewMenu()
// Cofrestru'r dewislen fel dewislen cyd-destun
app.RegisterContextMenu("MyContextMenu", ctxmenu)
```
### SetMenu
API: `SetMenu(menu *Menu)`
Mae `SetMenu()` yn gosod y ddewislen ar gyfer yr ap. Ar Mac, bydd hyn yn fod y ddewislen fyd-eang. Ar gyfer Windows a Linux, bydd hyn yn fod y ddewislen ddiofyn ar gyfer unrhyw ffenestr newydd a grëir.
```go
// Creu dewislen newydd
menu := app.NewMenu()
// Gosod y ddewislen ar gyfer yr ap
app.SetMenu(menu)
```
@@ -1,13 +0,0 @@
### GetPrimaryScreen
API: `GetPrimaryScreen() (*Sgrin, error)`
Mae `GetPrimaryScreen()` yn dychwelyd y sgrin brif y system.
### GetScreens
API: `GetScreens() ([]*Sgrin, error)`
Mae `GetScreens()` yn dychwelyd gwybodaeth am bob sgrin sydd wedi'i chysylltu â'r system.
Dyma grynodeb byr o'r dulliau allforio yn y `App` strwythur a ddarparwyd. Cofiwch, ar gyfer mwy o swyddogaethau neu ystyriaethau manwl, cyfeiriwch at y cod Go gwirioneddol neu ddogfennaeth fewnol bellach.
@@ -1,64 +0,0 @@
Dyma'r testun wedi'i gyfieithu i'r Gymraeg:
### NewWebviewWindow
API: `NewWebviewWindow() *WebviewWindow`
Mae `NewWebviewWindow()` yn creu ffenestr Webview newydd gyda'r opsiynau rhagosodedig, ac yn ei dychwelyd.
```go
// Creu ffenestr webview newydd
window := app.NewWebviewWindow()
```
### NewWebviewWindowWithOptions
API:
`NewWebviewWindowWithOptions(windowOptions WebviewWindowOptions) *WebviewWindow`
Mae `NewWebviewWindowWithOptions()` yn creu ffenestr webview newydd gydag opsiynau custom. Caiff y ffenestr newydd ei ychwanegu at fap o ffenestri a reolir gan y cymhwysiad.
```go
// Creu ffenestr webview newydd gydag opsiynau custom
window := app.NewWebviewWindowWithOptions(WebviewWindowOptions{
Name: "Main",
Title: "Fy Ffenestr",
Width: 800,
Height: 600,
})
```
### OnWindowCreation
API: `OnWindowCreation(callback func(window *WebviewWindow))`
Mae `OnWindowCreation()` yn cofrestru ffwythiant alw-nôl i'w alw pan grëir ffenestr.
```go
// Cofrestru ffwythiant alw-nôl i'w alw pan grëir ffenestr
app.OnWindowCreation(func(window *WebviewWindow) {
// Gwneud rhywbeth
})
```
### GetWindowByName
API: `GetWindowByName(name string) *WebviewWindow`
Mae `GetWindowByName()` yn nôl ac yn dychwelyd ffenestr gyda enw penodol.
```go
// Cael ffenestr drwy ei henw
window := app.GetWindowByName("Main")
```
### CurrentWindow
API: `CurrentWindow() *WebviewWindow`
Mae `CurrentWindow()` yn nôl ac yn dychwelyd cyfeiriad at y ffenestr weithredol yn y cymhwysiad. Os nad oes ffenestr, mae'n dychwelyd nil.
```go
// Cael y ffenestr gyfredol
window := app.CurrentWindow()
```
-50
View File
@@ -1,50 +0,0 @@
# Prif Swyddogaethau Trywydd
Mae'r dulliau hyn yn swyddogaethau cymorth i redeg cod ar y prif drywydd. Mae hyn yn
ofynnol pan fyddwch am redeg cod cyfaddas ar y llwyfan UI.
### InvokeSync
API: `InvokeSync(fn func())`
Mae'r swyddogaeth hon yn rhedeg y swyddogaeth a drosglwyddwyd (`fn`) yn ddilynebol. Mae'n defnyddio WaitGroup
(`wg`) i sicrhau bod y prif drywydd yn aros i `fn` swyddogaeth orffen
cyn iddo barhau. Os bydd panig yn digwydd o fewn `fn`, bydd yn cael ei drosglwyddo i'r
swyddogaeth trin panig `PanicHandler`, a ddiffinnir yn opsiynau'r cymhwysiad.
### InvokeSyncWithResult
API: `InvokeSyncWithResult[T any](fn func() T) (res T)`
Mae'r swyddogaeth hon yn gweithio'n debyg i `InvokeSync(fn func())`, fodd bynnag, mae'n rhoi
canlyniad. Defnyddiwch hyn ar gyfer galw unrhyw swyddogaeth gyda un canlyniad yn unig.
### InvokeSyncWithError
API: `InvokeSyncWithError(fn func() error) (err error)`
Mae'r swyddogaeth hon yn rhedeg `fn` yn ddilynebol ac yn dychwelyd unrhyw wall a gynhyrchir gan `fn`.
Sylwch y bydd y swyddogaeth hon yn adfer o banig os bydd un yn digwydd yn ystod
gweithrediad `fn`.
### InvokeSyncWithResultAndError
API:
`InvokeSyncWithResultAndError[T any](fn func() (T, error)) (res T, err error)`
Mae'r swyddogaeth hon yn rhedeg `fn` yn ddilynebol ac yn dychwelyd canlyniad o fath `T` a
gwall.
### InvokeAsync
API: `InvokeAsync(fn func())`
Mae'r swyddogaeth hon yn rhedeg `fn` yn asyng. Mae'n rhedeg y swyddogaeth a roddir ar y
prif drywydd. Os bydd panig yn digwydd o fewn `fn`, bydd yn cael ei drosglwyddo i'r
swyddogaeth trin panig `PanicHandler`, a ddiffinnir yn opsiynau'r cymhwysiad.
---
_Sylw_: Bydd y swyddogaethau hyn yn rhwystro gweithrediad nes bod `fn` wedi gorffen. Mae'n
hanfodol sicrhau nad yw `fn` yn rhwystro. Os bydd angen i chi redeg swyddogaeth sy'n
rhwystro, defnyddiwch `InvokeAsync` yn lle.

Some files were not shown because too many files have changed in this diff Show More