Skip to content

Commit

Permalink
updated version to v2.0.0-dev0.0.31
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Dec 20, 2023
1 parent 313c945 commit f23cd54
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .goki/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name = "ki"
Desc = ""
Version = "v2.0.0-dev0.0.30"
Version = "v2.0.0-dev0.0.31"
Type = "Library"

[Build]
Expand Down Expand Up @@ -64,6 +64,7 @@ Type = "Library"
YAML = false
SQL = false
GQL = false
Extend = true
[Generate.Gtigen]
Dir = "."
Output = "gtigen.go"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2018, The GoKi Authors
Copyright (c) 2018, The Goki Authors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ See the [Wiki](https://goki.dev/ki/v2/wiki) for more docs, and [Google Groups go

The **Tree** is one of the most flexible, widely-used data structures in programming, including the DOM structure at the core of a web browser, scene graphs for 3D and 2D graphics systems, JSON, XML, SVG, filesystems, programs themselves, etc. This is because trees can capture most relevant forms of *structure* (hierarchical groupings, categories, relationships, etc) and are most powerful when they are fully *generative* -- arbitrary new types can be inserted flexibly.

GoKi provides a general-purpose tree container type, that can support all of these applications, by embedding and extending the `Node` struct type that implements the `Ki` (Ki = Tree in Japanese) `interface`. Unlike many cases in Go, the need to be able to arbitrarily extend the type space of nodes in the tree within a consistent API, means that the more traditional object-oriented model works best here, with a single common base type, and derived types that handle diverse cases (e.g., different types of widgets in a GUI). GoKi stores a Ki interface of each node, enabling correct virtual function calling on these derived types.
Goki provides a general-purpose tree container type, that can support all of these applications, by embedding and extending the `Node` struct type that implements the `Ki` (Ki = Tree in Japanese) `interface`. Unlike many cases in Go, the need to be able to arbitrarily extend the type space of nodes in the tree within a consistent API, means that the more traditional object-oriented model works best here, with a single common base type, and derived types that handle diverse cases (e.g., different types of widgets in a GUI). Goki stores a Ki interface of each node, enabling correct virtual function calling on these derived types.

A virtue of using an appropriate data representation is that some important operations can be performed particularly concisely and efficiently when they are naturally supported by the data structure. For example, matrices and vectors as supported by numpy or MATLAB provide a concise high-level language for expressing many algorithms.

For trees, GoKi leverages the tree structure for automatically computing the appropriate extent of a scenegraph that needs to be updated, with an arbitrary sequence of individual operations, by propagating updating flags through the tree, and tracking the "high water mark" (see UpdateStart / End). This makes the GoGi GUI efficient in terms of what needs to be redrawn, while keeping the code local and simple.
For trees, Goki leverages the tree structure for automatically computing the appropriate extent of a scenegraph that needs to be updated, with an arbitrary sequence of individual operations, by propagating updating flags through the tree, and tracking the "high water mark" (see UpdateStart / End). This makes the GoGi GUI efficient in terms of what needs to be redrawn, while keeping the code local and simple.

In addition, GoKi provides functions that traverse the tree in the usual relevant ways ("natural" me-first depth-first, me-last depth-first, and breadth-first) and take a `func` function argument, so you can easily apply a common operation across the whole tree in a transparent and self-contained manner, like this:
In addition, Goki provides functions that traverse the tree in the usual relevant ways ("natural" me-first depth-first, me-last depth-first, and breadth-first) and take a `func` function argument, so you can easily apply a common operation across the whole tree in a transparent and self-contained manner, like this:

```go
func (n *MyNode) DoSomethingOnMyTree() {
Expand All @@ -36,7 +36,7 @@ func (n *MyNode) DoSomethingOnMyTree() {

Many operations are naturally expressed in terms of these traversal algorithms.

Three core GoKi features include:
Three core Goki features include:

* A `Signal` mechanism that allows nodes to communicate changes and other events to arbitrary lists of other nodes (similar to the signals and slots from Qt).

Expand All @@ -46,13 +46,13 @@ Three core GoKi features include:

In addition, Ki nodes support a general-purpose `Props` property `map`, and the `kit` (Ki Types) package provides a `TypeRegistry` and an `EnumRegistry`, along with various `reflect` utilities, to enable fully-automatic saving / loading of Ki trees from JSON or XML, including converting const int (enum) values to / from strings so those numeric values can change in the code without invalidating existing files.

Ki Nodes can be used as fields in a struct -- they function much like pre-defined Children elements, and all the standard FuncDown* iterators traverse the fields automatically. The Ki Init function automatically names these structs with their field names, and sets the parent to the parent struct. This was essential in the GoKi framework to support separate Widget Parts independent of the larger scenegraph.
Ki Nodes can be used as fields in a struct -- they function much like pre-defined Children elements, and all the standard FuncDown* iterators traverse the fields automatically. The Ki Init function automatically names these structs with their field names, and sets the parent to the parent struct. This was essential in the Goki framework to support separate Widget Parts independent of the larger scenegraph.

## GoGi Graphical Interface and Gide IDE App

The first and most important application of GoKi is the [GoGi](https://github.com/goki/gi) graphical interface system, in the `gi` package, and the [Gide](https://github.com/goki/gide) IDE built on top of GoGi. The scene graph of Ki elements automatically drives minimal refresh updates, and the signaling framework supports gui event delivery and e.g., the "onclick" event signaling from the `Button` widget, etc. In short, GoGi provides a complete interactive 2D and 3D GUI environment in native Go, in a compact codebase. Part of this is the natural elegance of Go, but GoKi enhances that by providing the robust natural primitives needed to express all the GUI functionality. Because GoGi is based around standard CSS styles, SVG rendering, and supports all the major HTML elements, it could even provide a lightweight web browser: [Glide](https://github.com/goki/glide).
The first and most important application of Goki is the [GoGi](https://github.com/goki/gi) graphical interface system, in the `gi` package, and the [Gide](https://github.com/goki/gide) IDE built on top of GoGi. The scene graph of Ki elements automatically drives minimal refresh updates, and the signaling framework supports gui event delivery and e.g., the "onclick" event signaling from the `Button` widget, etc. In short, GoGi provides a complete interactive 2D and 3D GUI environment in native Go, in a compact codebase. Part of this is the natural elegance of Go, but Goki enhances that by providing the robust natural primitives needed to express all the GUI functionality. Because GoGi is based around standard CSS styles, SVG rendering, and supports all the major HTML elements, it could even provide a lightweight web browser: [Glide](https://github.com/goki/glide).

The [GoPi](https://github.com/goki/pi) interactive parsing framework also leverages GoKi trees to represent the AST (abstract syntax tree) of programs in different langauges. Further, the parser grammar itself is written (in a GUI interactive way) as a tree of parsing elements using Ki nodes.
The [GoPi](https://github.com/goki/pi) interactive parsing framework also leverages Goki trees to represent the AST (abstract syntax tree) of programs in different langauges. Further, the parser grammar itself is written (in a GUI interactive way) as a tree of parsing elements using Ki nodes.

# Code Map

Expand Down Expand Up @@ -97,7 +97,7 @@ parent.FuncDownMeFirst(0, nil, func(k Ki, level int, d interface{}) bool {

# Trick for fast finding in a slice

GoKi takes an extra starting index arg for all methods that lookup a value in a slice, such as ChildByName. The search for the item starts at that index, and goes up and down from there. Thus, if you have any idea where the item might be in the list, it can save (considerable for large lists) time finding it.
Goki takes an extra starting index arg for all methods that lookup a value in a slice, such as ChildByName. The search for the item starts at that index, and goes up and down from there. Thus, if you have any idea where the item might be in the list, it can save (considerable for large lists) time finding it.

Furthermore, it enables a robust optimized lookup map that remembers these indexes for each item, but then always searches from the index, so it is always correct under list modifications, but if the list is unchanged, then it is very efficient, and does not require saving pointers, which minimizes any impact on the GC, prevents stale pointers, etc.

Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ module goki.dev/ki/v2
go 1.21

require (
goki.dev/enums v0.9.52
goki.dev/gti v0.1.28
goki.dev/enums v0.9.53
goki.dev/gti v0.1.30
)

require (
goki.dev/glop v0.1.8
goki.dev/grows v0.3.27
goki.dev/ordmap v0.5.8
goki.dev/glop v0.1.9
goki.dev/grows v0.3.28
goki.dev/ordmap v0.5.9
)

require (
github.com/fatih/camelcase v1.0.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
goki.dev/laser v0.1.29 // indirect
goki.dev/laser v0.1.31 // indirect
)
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
goki.dev/enums v0.9.52 h1:q5BYXyJoYZqrLbBdP3NQSzcmedy2yQ331cWu4Xs4zr4=
goki.dev/enums v0.9.52/go.mod h1:T8vLSgJQAkTP0WdPa0aZSS/yMYJHrqPKafqYwQTfWAU=
goki.dev/glop v0.1.8 h1:nB4JctMmBJZzzp216bK/SDZoJ01IBMRFoIJPSkvGJa8=
goki.dev/glop v0.1.8/go.mod h1:Q9TPQIlJ5LL38UITJonRUEmEbPPTHWOJED+xD63VmIg=
goki.dev/grows v0.3.27 h1:Q9HFyZVZYxL8X/nOtNopXqQxfzzHMBA9UNvLTo3bc1U=
goki.dev/grows v0.3.27/go.mod h1:4uZ4GFrqVYIvAPlATTQtDsJcUnyojOwwrO+OQXsmVtA=
goki.dev/gti v0.1.28 h1:gt4iEQms3AnRg/WWOXXLFzTvcH98wZJHepfWUVA+cT8=
goki.dev/gti v0.1.28/go.mod h1:6fFahcbZqEe0nA/AcOaiq/hER/MAPnL/BGEbtxK6164=
goki.dev/laser v0.1.29 h1:y2wBx9WAl8LdW3Iv1TMgBj50bJAvZYLdf3vINY2vYwQ=
goki.dev/laser v0.1.29/go.mod h1:O4RF58kWIrq1tmtGCI/op7aYm7dHISchUT8IBaF0YbA=
goki.dev/ordmap v0.5.8 h1:eFmEyqsmOLa015CHcnBjQ/uxUhJ6y18GyJl3RVQn6Wk=
goki.dev/ordmap v0.5.8/go.mod h1:m3CYoDJcio+Z9aXipUdg3yLUjKspxnVc8es6GWrDAwQ=
goki.dev/enums v0.9.53 h1:oiIbJrStPssystCCT5TINExsAtwQ+Z8xuabEoqMfmAE=
goki.dev/enums v0.9.53/go.mod h1:zQwzN5vvEMIgV37KUGrMOpBEoOyVo2e+OmGHTYa4OLA=
goki.dev/glop v0.1.9 h1:s6FFcCXqNy2FLEG5k+ULvxEvbYtHnW7KoqvEw9uPsP0=
goki.dev/glop v0.1.9/go.mod h1:Q9TPQIlJ5LL38UITJonRUEmEbPPTHWOJED+xD63VmIg=
goki.dev/grows v0.3.28 h1:SwOCGjji3KBLg/plUb9XbWWqDLOPe5D5GszsxtNkdPw=
goki.dev/grows v0.3.28/go.mod h1:ly6R0eZnxrlIB4aVynBT0wKmgebumrAJxBWDvgA+jqk=
goki.dev/gti v0.1.30 h1:AA8ZTavlSwDXGL8v+NCqpKjY06wTwddoqACc8We/urc=
goki.dev/gti v0.1.30/go.mod h1:4koCopi9SEBbX4ecyOFWDINNoRtCy3BLjg9F2I+R3cE=
goki.dev/laser v0.1.31 h1:bvZqwUA3/J3sYAJdK0JQ4JvC+JCEz/iJGRLq+FWnN/Y=
goki.dev/laser v0.1.31/go.mod h1:HimEpC0iEVWLULyA0kzZqncM03CY1f2jCvkAqWu+m58=
goki.dev/ordmap v0.5.9 h1:IKUmvSqkNHP2Ryde0tOlqEVG8jlCPC3JtrkV00aO0fc=
goki.dev/ordmap v0.5.9/go.mod h1:m3CYoDJcio+Z9aXipUdg3yLUjKspxnVc8es6GWrDAwQ=
6 changes: 3 additions & 3 deletions version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f23cd54

Please sign in to comment.