Coder Social home page Coder Social logo

ui's Introduction

V UI 0.0.4

Build Status Sponsor Patreon

Twitter handle

import ui

struct App {
mut:
	window     &ui.Window = unsafe { nil }
	first_name string
	last_name  string
}

fn main() {
	mut app := &App{}
	app.window = ui.window(
		width: 600
		height: 400
		title: 'V UI Demo'
		children: [
			ui.row(
				margin: ui.Margin{10, 10, 10, 10}
				children: [
					ui.column(
						width: 200
						spacing: 13
						children: [
							ui.textbox(
								max_len: 20
								width: 200
								placeholder: 'First name'
								text: &app.first_name
							),
							ui.textbox(
								max_len: 50
								width: 200
								placeholder: 'Last name'
								text: &app.last_name
							),
						]
					),
				]
			),
		]
	)
	ui.run(app.window)
}

Installation

v up
v install ui

Running the examples

cd examples
v run users.v
v run rgb_color.v
v run ...

This is pre-alpha software.

V UI is a cross-platform UI toolkit written in the V programming language for Windows, macOS, Linux, Android, and soon iOS and the web (JS/WASM). V UI uses native widgets on Windows and macOS, on all other platforms the widgets are drawn by V UI. Right now only the non-native widgets are available.

This is a very early version of the library, lots of features are missing, and lots of things will change.

The API is declarative, and there will be hot reloading, similar to SwiftUI and Flutter.

On Linux, V UI will be a full-featured lightweight alternative to GTK and Qt.

0.1 roadmap

Discord: #v-ui channel

Documentation will be available soon. In the meantime use the examples as the documentation. The framework is very simple and straightforward.

Dependencies

Binaries built with V UI will have no dependencies.

To develop V UI apps, you need to install V. This takes a couple of seconds.

On some Linux distros you also need a few development dependencies:

  • Arch: sudo pacman -S libxi libxcursor mesa
  • Debian/Ubuntu: sudo apt install libxi-dev libxcursor-dev mesa-common-dev
  • Fedora: sudo dnf install libXi-devel libXcursor-devel mesa-libGL-devel

On ChromeOS Linux/Crostini, install the Debian dependencies listed above followed by this:

License

V UI is licensed under MIT.

Contributing

Simply open a GitHub pull request.

ui's People

Contributors

05st avatar alexesprit avatar alichraghi avatar andoleal avatar artemkakun avatar avocadocs avatar bafs avatar danieldaeschle avatar delta456 avatar edam avatar elimisteve avatar gladear avatar hex2f avatar larpon avatar lucastarche avatar medvednikov avatar ntrel avatar origel avatar progamateur avatar rcqls avatar serkonda7 avatar shove70 avatar spaceface777 avatar spytheman avatar thecodrr avatar ttytm avatar uwekrueger avatar walkingdevel avatar watzon avatar yuyi98 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ui's Issues

Questions about license

I have some questions about the license. On the Readme.md says:

V UI is licensed under GPL3. A commercial license will be available. Open-source projects will have access to the commercial license for free. Every single feature will be open-sourced right away and available under both licenses. At some point in the future the library will be relicensed under MIT.

Will be a dual license? At some point will be necessary to pay a fee to use? Will be possible to use on closed commercial products at some point?

I want to use this library on my products, but this is a main blocker for me, since I only use open source tools and contribute when possible.

failed to init the font

os: mac
v version:V 0.1.24 7d79709
ui module:lastest version
when I run any examples,It will panic: failed to init the font.
and I found the code in ui.v may some problem.
line 152:
s := os.exec('fc-list') or { panic('failed to fetch system fonts') }
It requires fc-list command. but it is not a system command in mac.
I need install fontconfig by: brew install fontconfig.

and I follow the code to os_nix.v, line 208 may some problem:
'''
res = res.trim_space()
exit_code := vpclose(f)
// if exit_code != 0 {
// return error(res)
// }
'''
when the exit_code is not 0,it will not raise an error

Won't Install Any More

Just tried to update today with v up followed by v install ui and got the following:

v install ui
0

Error in decode() for Mod error_ptr=: %s
0


<style>
...
massive snip
...
</div>


0

Error in decode() for Mod error_ptr=: %s
Errors while retrieving meta data for module ui:
Skipping module "ui", since it is missing name or url information.
Skipping module "ui", since it is missing name or url information.

The massive chunk of CSS and HTML I've omitted seems to be the source code of the V Modules page.

Output HTML-peviewed in Textmate:

SS 2020-05-19 at 16 54 09

button.v:36:10: bad attribute usage

/Users/blahblah/.vmodules/ui/button.v:36:10: bad attribute usage
   34| }
   35| 
   36| [ref_only]
                ^
   37| pub struct Button {
   38| pub mut:

already updated both v itself and the ui module.

listbox.v:126:49: expected `=` or `:=`

/home/crt/.vmodules/ui/listbox.v:126:49: expected = or :=
124|
125| // Returns the ID and the text of the selected item
126| pub fn (lb &ListBox) selected() ?(string, string) {
^
127| if !lb.is_selected() {
128| return error('Nothing is selected')

version: V 0.1.24 0d93eeb

OS: Linux mint

`ft2build.h` not found error

Got the following error while running the example.

➜  ui git:(master) v run examples/users/users.v 
warning: /Users/sr/.vmodules/ui/window.v:311:1: the following imports were never used: 
 * gx
warning: examples/users/users.v:50:2: reference field `Context*.first_name` must be initialized
warning: examples/users/users.v:50:2: reference field `Context*.last_name` must be initialized
warning: examples/users/users.v:50:2: reference field `Context*.age` must be initialized
warning: examples/users/users.v:50:2: reference field `Context*.pbar` must be initialized
warning: examples/users/users.v:50:2: reference field `Context*.window` must be initialized
warning: examples/users/users.v:50:2: reference field `Context*.label` must be initialized
/private/var/folders/kc/vyh4nng11g16mxpgx5zprjnw0000gn/T/v/users.tmp.c:297:10: fatal error: 'ft2build.h' file not found
#include "ft2build.h"
         ^~~~~~~~~~~~
1 error generated.
V error: C error. This should never happen. 
Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose

➜  ~ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.15.2
BuildVersion:	19C57

running well but get many warnings under ubuntu 20.04 alpha.

$ v run .
warning: /home/charles/vlang/vlib/clipboard/clipboard_linux.v:140:21: reference field clipboard.Clipboard*.display must be initialized
warning: /home/charles/vlang/vlib/clipboard/clipboard_linux.v:260:42: reference field XSelectionRequestEvent*.display must be initialized
warning: /home/charles/vlang/vlib/clipboard/clipboard_linux.v:364:19: supported_targets declared and not used
warning: /home/charles/vlang/vlib/ui/window.v:90:2: reference field gg.Cfg.window_user_ptr must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:245:15: reference field ui.TextBox*.parent must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:245:15: reference field ui.TextBox*.ctx must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:246:14: reference field ui.Button*.parent must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:246:14: reference field ui.Button*.ctx must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:247:19: reference field ui.ProgressBar*.parent must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:247:19: reference field ui.ProgressBar*.ctx must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:248:16: reference field ui.CheckBox*.parent must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:248:16: reference field ui.CheckBox*.ctx must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:249:13: reference field ui.Label*.parent must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:249:13: reference field ui.Label*.ctx must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:250:13: reference field ui.Radio*.parent must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:250:13: reference field ui.Radio*.ctx must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:251:15: reference field ui.Picture*.parent must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:251:15: reference field ui.Picture*.ctx must be initialized
warning: /home/charles/vlang/vlib/ui/window.v:306:1: the following imports were never used:

  • gx
    warning: ./users.v:50:2: reference field Context*.first_name must be initialized
    warning: ./users.v:50:2: reference field Context*.last_name must be initialized
    warning: ./users.v:50:2: reference field Context*.age must be initialized
    warning: ./users.v:50:2: reference field Context*.pbar must be initialized
    warning: ./users.v:50:2: reference field Context*.window must be initialized
    warning: ./users.v:50:2: reference field Context*.label must be initialized
    warning: ./users.v:187:1: ctx is declared as mutable, but it was never changed

Some examples don't work on windows os

Tried all ui examples.
All of them builds succesfully.
But some examples stops immediately with an error after program starts:

OS: Windows 10 x64

calculator (OK)
counter (OK)
dropdown (STOPS WITH AN ERROR)
slider (OK)
temperature (OK)
timer (OK)
transitions (STOPS WITH AN ERROR)
users (STOPS WITH AN ERROR)

Sample screenshot:
image

Also I needed to manually add freetype.dll to all example program's folders.
Otherwise program does not start caused by "freetype.dll" not found error.
(freetype directory exists at V's thirdparty directory.)

image

examples/users not working in Debian 9.11

Many warnings but then still fails:

$ v run ~/.vmodules/ui/examples/users/users.v 
warning: .vmodules/ui/ui.v:31:8: enum values cannot contain uppercase letters, use snake_case instead (`Button`)
warning: .vmodules/ui/ui.v:32:8: enum values cannot contain uppercase letters, use snake_case instead (`Canvas`)
warning: .vmodules/ui/ui.v:33:10: enum values cannot contain uppercase letters, use snake_case instead (`CheckBox`)
warning: .vmodules/ui/ui.v:34:7: enum values cannot contain uppercase letters, use snake_case instead (`Label`)
warning: .vmodules/ui/ui.v:35:6: enum values cannot contain uppercase letters, use snake_case instead (`Menu`)
warning: .vmodules/ui/ui.v:36:9: enum values cannot contain uppercase letters, use snake_case instead (`Picture`)
warning: .vmodules/ui/ui.v:37:13: enum values cannot contain uppercase letters, use snake_case instead (`ProgressBar`)
warning: .vmodules/ui/ui.v:38:7: enum values cannot contain uppercase letters, use snake_case instead (`Radio`)
warning: .vmodules/ui/ui.v:39:8: enum values cannot contain uppercase letters, use snake_case instead (`Slider`)
warning: .vmodules/ui/ui.v:40:9: enum values cannot contain uppercase letters, use snake_case instead (`TextBox`)
warning: .vmodules/ui/ui.v:42:1: enum values cannot contain uppercase letters, use snake_case instead (`Dropdown`)
warning: .vmodules/ui/slider.v:213:1: the following imports were never used: 
 * glfw
warning: .vmodules/ui/ui.v:189:1: the following imports were never used: 
 * gx
warning: .vmodules/ui/window.v:262:1: the following imports were never used: 
 * filepath
 * time
 * stbi
 * os
warning: .vmodules/ui/examples/users/users.v:51:2: reference field `App*.first_name` must be initialized
warning: .vmodules/ui/examples/users/users.v:51:2: reference field `App*.last_name` must be initialized
warning: .vmodules/ui/examples/users/users.v:51:2: reference field `App*.age` must be initialized
warning: .vmodules/ui/examples/users/users.v:51:2: reference field `App*.password` must be initialized
warning: .vmodules/ui/examples/users/users.v:51:2: reference field `App*.pbar` must be initialized
warning: .vmodules/ui/examples/users/users.v:51:2: reference field `App*.window` must be initialized
warning: .vmodules/ui/examples/users/users.v:51:2: reference field `App*.label` must be initialized
warning: .vmodules/ui/examples/users/users.v:51:2: reference field `App*.country` must be initialized
failed to create a glfw window, make sure you have a GPU driver installed
create window wnd=(nil) ptr==(nil)
users: /build/glfw3-N0skBB/glfw3-3.2.1/src/window.c:774: glfwSetWindowUserPointer: Assertion `window != NULL' failed.
Aborted

Japanese fonts are garbled

vlang version: 0.1.28 219ecd1

I tried "users" app of https://github.com/vlang/ui#running-the-examples .
The window came up fine.

Then I typed みみなし in the first text box, but it showed up like the screenshot.

スクリーンショット 2020-06-29 2 32 59

I'm new to V and OpenGL, so I didn't know what else to research, but please let me know if there's anything else I should be looking into.

Version 0.1 Roadmap

Many features will need discussion so this thread acts as both a discussion & a task list for contributors/maintainers.

Notes:

  1. All these features won't necessarily make it into the v0.1 but they are planned nonetheless.
  2. Mentions after the each entry means that feature is being worked on by those persons.
  3. Please don't ask for ETAs. We are working on it as much as possible. Once it's done, you will know. You can follow the development on the Discord Channel.

API

  • Declarative style (@thecodrr)
  • Hot code reloading
  • Proper eventing system using eventbus (@thecodrr)
  • RTL support
  • Themes
  • Custom widgets on user level
  • DataBinding to arrays & orm columns
  • Widget customization using properties (color etc.)

Window API

  • Drag & Drop
  • Custom Scaling
  • Resizing

Responsiveness

  • Relative values for dimensions, margins etc. (percentage or px)
  • Hover, focus feedback
  • Animations & Transitions (@memeone)
  • Tab support (focus)

Layout

Widgets

TextBox

  • Multiline textbox
  • Text selection with a mouse (@thecodrr)
  • TextBox Validation
  • Format support

Accessibility

  • Screen reader support

More items will be added as required

Enhancement: Webview

A crossplatform webview with support for Javascript <-> V interop would truly make vlang THE end game programming language.

failed to load /System/Library/Fonts/SFNSText.ttf

os:mac10.15.2
when I run examples/users
v run users.v
got an error:
failed to load /System/Library/Fonts/SFNSText.ttf
gg create image "/var/folders/lk/k709921d2gl4jrh31mt8_ktm0000gn/T/check.png"
gg create image "/var/folders/lk/k709921d2gl4jrh31mt8_ktm0000gn/T/circle.png"
gg create image no such file "/var/folders/lk/k709921d2gl4jrh31mt8_ktm0000gn/T/circle.png"
gg create image "/var/folders/lk/k709921d2gl4jrh31mt8_ktm0000gn/T/selected_radio.png"
gg create image no such file "/var/folders/lk/k709921d2gl4jrh31mt8_ktm0000gn/T/selected_radio.png"
Terminated by signal 11 (SIGSEGV)

Doesn't work in linux

I can't run examples with the latest binary

./v run ~/.vmodules/ui/examples/users.v
warning: vlib/clipboard/clipboard_linux.v:140:21: reference field clipboard.Clipboard*.display must be initialized
warning: vlib/clipboard/clipboard_linux.v:260:42: reference field XSelectionRequestEvent*.display must be initialized
warning: vlib/clipboard/clipboard_linux.v:364:19: supported_targets declared and not used
vlib/glfw/glfw.v:104:17: type Window is private
102| }
103|
104| pub fn (w &Window) destroy() {
^
105| C.glfwDestroyWindow(w.data)
106| }

OS: Linux Elementary 0.4

7GUIs and beyond

Please implement 7GUIs (and possibly the extended proposals) as soon as possible to get deeper understanding how complicated/easy the use of this UI library will be (before the API stabilizes) and to give others a good overview.

  • Counter
  • Temperature Converter
  • Flight Booker
  • Timer
  • CRUD
  • Circle Drawer
  • Cells

Touch interfaces and approximate position spanning different widgets/areas

(copy from https://gist.github.com/vurtun/61b6dbf21ef060bcbbd8d1faa88350d9#gistcomment-2268492 )

I stumbled upon the following special requirement on handling of a "cursor" on touch devices. Namely, that the position of the touch is just approximate and should automatically be "attracted" by all buttons/sliders/whatever based on the Euclidean metric and a previously defined priority of each button/slider/whatever.

The issue is, that this (a click somewhere between buttons/sliders/whatever, but not directly on them) requires 3 costly steps basically in each frame:

  1. evaluation of precise positions of all buttons/sliders/whatever
  2. evaluation of the metric and priority rules - the result is a set of buttons/sliders/whatever which are affected by the cursor position
  3. reaction of the affected buttons/sliders/whatever on the cursor position as well as chained reaction of other parts of the GUI to the changes

My understanding is, that step 1. and 3. are very similar or the same and thus a double-work. Would you also have fear, that it's too slow? There is also this "react first in the second frame" solution. But I wanted a same-frame solution. Any ideas?

HERESY! (Gui Design WSYIWYG)

Just a suggestion:

The guys at XOJO have a very cool IDE for building apps - it's like the old VB6 Professional environment - but better. Obviously the language (a BASIC spin-off) is not terribly interesting - but from a 'What a nice, intuitive IDE for V/UI' perspective - you might want to grab a free download and play around with it. IMO it'd be a very big driver of adoption if the tooling was that good.

System fonts are not detected automatically

V version: 0.1.24 bfaf2a4
VUI: 0.0.1 3030279
OS: Slackware 14.2 x86_64
System fonts:

fc-list | egrep "Arial.ttf|Ubuntu-R.ttf|LiberationSans-R|NotoSans-R|FreeSans.ttf|DejaVuSans.ttf" | sort
/usr/share/fonts/TTF/DejaVuSans.ttf: DejaVu Sans:style=Book
/usr/share/fonts/TTF/LiberationSans-Regular.ttf: Liberation Sans:style=Regular

What did you do?
v -g run examples/calculator.v

What did you expect to see?
Running calculator

What did you see instead?

C compiler=cc
ATTENTION: default value of option vblank_mode overridden by environment.
create window wnd=0x146d1c0 ptr==(nil)
================ V panic ================
   module: ui
 function: system_font_path()
     file: /home/sereg1k/.vmodules/ui/ui.v
     line: 147
  message: Please install at least one of: ["/usr/share/fonts/truetype/msttcorefonts/Arial.ttf", "/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf", "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf", "/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf", "/usr/share/fonts/truetype/freefont/FreeSans.ttf", "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", "/usr/share/fonts/dejavu/DejaVuSans.ttf"]  .
=========================================
/media/data/install/dev/v/vlib/builtin/builtin.v:70: |       0x43288e | ./examples/calculator(panic_debug+0x123) 
/media/data/install/dev/ui/ui.v:148:           |       0x44d6ac | ./examples/calculator(ui__system_font_path+0x271) 
/media/data/install/dev/ui/window.v:78 (discriminator 4): |       0x44dcf0 | ./examples/calculator(ui__new_window+0x198) 
/media/data/install/dev/ui/examples/calculator.v:39: |       0x44f524 | ./examples/calculator(main__main+0x36a) 
/home/sereg1k/.cache/v/calculator.tmp.c:25951: |       0x4511cd | ./examples/calculator(main+0x59) 
                                               | 0x7f685c52a7d0 | /lib64/libc.so.6(__libc_start_main+0xf0) 
/glibc-tmp-95e0907d753adfc89f1c416310f2df8c/glibc-2.23/csu/../sysdeps/x86_64/start.S:121: |       0x418909 | ./examples/calculator(_start+0x29)

Workaround for this problem
Use environment variable VUI_FONT
VUI_FONT=/usr/share/fonts/TTF/DejaVuSans.ttf v -g run examples/calculator.v

Examples not working in MacOS

I'm receiving the following error when running the examples on MacOs

$ v run users/users.v
/Users/user/.vmodules/ui/button.v:15:34: undefined: `freetype.default_font_size` (in module `freetype`)
   13|          // color: gx.white
   14|          color: gx.rgb(38, 38, 38)
   15|          size: freetype.default_font_size
                                                 ^
   16|          align: gx.ALIGN_LEFT
   17|  }

Wayland support

V UI runs on X11 even when Wayland compositor is currently running, causing running of XWayland. I think V UI should support Wayland natively.

Text misalignment on Linux

Version: V master and latest UI
OS: Manjaro Linux

All text parts have a wrong alignment and are positioned slightly below the position they should have.

Screenshot_20200609_120708

Segmentation fault when loading users.exe on windows

OS: Windows 10 1809 (LSTC)

$ v -version
V 0.1.25 050ec5d

$ v users.v
warning: users.v:51:2: reference field App*.window must be initialized
warning: users.v:145:5: reference field ui.PictureConfig.ref must be initialized

$ ./users.exe
Trying to load font from C:\Windows\Fonts\arial.ttf
Segmentation fault

I find C:\Windows\Fonts\arial.ttf right there.

listbox.v:126:49: expected `=` or `:=`

There's an error in the listbox, the complete error is:

/Users/blahblah/.vmodules/ui/listbox.v:126:49: expected `=` or `:=`
  124| 
  125| // Returns the ID and the text of the selected item
  126| pub fn (lb &ListBox) selected() ?(string, string) {
                                                       ^
  127|     if !lb.is_selected() {
  128|         return error('Nothing is selected')

error while loading shared libraries

Dong@DESKTOP-JHQSG53 MINGW64 /d/Dev/vlang/learn
# v run ui1.v
C:/v/v.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

Dong@DESKTOP-JHQSG53 MINGW64 /d/Dev/vlang/learn
# pacman -Qs glfw
local/mingw-w64-x86_64-glfw 3.3.2-1
    A free, open source, portable framework for OpenGL application development (mingw-w64)

Dong@DESKTOP-JHQSG53 MINGW64 /d/Dev/vlang/learn
# pacman -Qs freetype
local/mingw-w64-x86_64-freetype 2.10.2-2
    TrueType font rendering library (mingw-w64)

Dong@DESKTOP-JHQSG53 MINGW64 /d/Dev/vlang/learn
#

What does this mean and what dependent libraries need to be

526205429166

Examples broken by making UI's ft and gg not mutable

It looks like a recent change made ft and gg public but not mutable in UI: https://github.com/vlang/ui/blob/master/ui.v#L21 this causes a bunch of errors in the example programs.

window.v:113:9: error: field `gg` of struct `&ui.UI` is immutable 
  111 |     ui_ctx.gg.window.onkeydown(window_key_down)
  112 |     ui_ctx.gg.window.onchar(window_char)
  113 |     ui_ctx.gg.window.onmousemove(window_mouse_move)
      |            ~~
  114 |     ui_ctx.gg.window.on_click(window_click)
  115 |     ui_ctx.gg.window.on_resize(window_resize)

If the best answer is to make those pub mut instead I'd be excited to sign the CLA and make the change.

How to add new pngs for treeview?

I want add a treeview widget. This widget will use some png images for UI display. I will add pngs resources to project firist. I have read the code pngs.v, this code is gen by command line.
v bin2v images/check.png images/circle.png images/selected_radio.png -p bytes_ -m ui

If I want re-generate this file, I need those files images/check.png images/circle.png and images/selected_radio.png. Can you upload those files? thanks!

Memory leaks in some examples

V version: 0.1.24 2897bac
VUI: 0.0.1 1b17e4a
OS: Slackware 14.2 x86_64

What did you do?

  1. v -g run examples/calculator.v
  2. For some time, randomly move the cursor over the area of the calculator application.

What did you expect to see?
Memory consumption is not growing

What did you see instead?
Fast increase in memory consumption

Addition:
A memory leak is also in the examples/{counter.v, dropdown.v, temperature.v, timer.v, transitions.v, users.v}
No memory leak in examples/{slider.v, switch.v}

Memory usage increases over time

Version: Latest V and UI

I've had users.v running for ~20 minutes now, and the RAM usage has gone from around 25 MB to 101 MB.

c error with -autofree: incompatible type for argument 1 of ‘stbi__Image_free’

V version: V 0.1.29 6eea13e and latest UI
OS: Manjaro

What did you do?
v -autofree run examples/calculator.v

What did you expect to see?
No more memory leaks.

What did you see instead?

      |                                        ~~~~~~~~~~~~^~~~~~~~
/tmp/v/calculator.tmp.c:17449:19: error: incompatible type for argument 1 of ‘stbi__Image_free’
17449 |  stbi__Image_free(&res); // autofreed var
      |                   ^~~~
      |                   |
      |                   stbi__Image *
/tmp/v/calculator.tmp.c:3813:35: note: expected ‘stbi__Image’ but argument is of type ‘stbi__Image *’
 3813 | void stbi__Image_free(stbi__Image img);
      |                       ~~~~~~~~~~~~^~~
/tmp/v/calculator.tmp.c: In function ‘stbi__load_from_memory’:
/tmp/v/calculator.tmp.c:17462:19: error: incompatible type for argument 1 of ‘stbi__Image_free’
17462 |  stbi__Image_free(&res); // autofreed var
...

glfw3.dll not found on windows

image

Steps I followed.

  1. Installed V git clone, make, added it to PATH
  2. v up
  3. v install ui successful
  4. git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries D:\Projects\fun\vlang\v\thirdparty\freetype
  5. cd examples/tetris/ && v run .

Dependencies and static linking on MacOS

The readme says that V ui binaries have no dependencies, but when I run otool on the binary on MacOS it seems to be linking to multiple dynamic libraries, for example freetype and glfw. The readme states that we need these for development and that this dependency will be removed, does that mean that for now the distributed binaries also have dependencies until this is removed? Is there a way to statically link to the appropriate libraries to get a completely standalone binary?

general plan?

What's the general plan of development and evolution of this project?

I'd use this information to gauge interests and plan for our team.

Any bluemap or directions or pointers would be desirable.

Updating module ui failed

Running v update ui everytime throws an error:

Failed updating module "ui".
Failed command: git pull --depth=1
Failed details:
fatal: refusing to merge unrelated histories

I'm using the latest version of V with all new updates.

VUI for Web

One critically attractive point for vui will be to also have a standardized UI presentation for the web as well so that WebASM compilation will produce an equally attractive UI comparable macOS, Windows and Linux.

One problem here could be that there might not be a standardized UI component or presentation set that can be readily used. Hopefully we can decide on something here in this regard or maybe there's something already that exists that makes sense.

I have a couple thoughts from some older interesting projects I've seen that seem to make sense and will try to add these later on when I have some time to find them again.

Weird window artifacts on resize

OS: Manjaro

Changing the size higher than default produces a lot of weird screen artifacts or just blank space in the new window space, as seen in the screenshots. Anything inside the default window size area or below works fine.

Screenshot_20200304_170607
Screenshot_20200304_170640

Group infinite auto expand

Version: V master & latest UI
OS: Manjaro Linux

I found a bug where a groups size slowly increases into infinity. It seems that this only happens if the group is nested under a row and a column.

Reproduction code

import ui

struct App {
mut:
	window &ui.Window = 0
}

fn main() {
	mut app := &App{}
	app.window = ui.window({
		width: 1000
		height: 100
	}, [
		ui.column({}, [
			ui.row({
				height: 50
				spacing: 10
			}, [
				ui.group({
					title: 'test'
				}, [
					ui.button({})
				]),
			]),
		]),
	])
	ui.run(app.window)
}

Error 10057

V Version: V 0.1.28 cff2874
OS: Windows 10 64bit

I'm trying to download V UI. But when i write the commands on README.md, this error message appears. What do I do?
v-ui-crash

ui.v:67:25: error: unexpected `(`, expecting `name`

version
V: 0.1.26 4e01bf4.ea960b2
ui: 0.0.2

on mac

.vmodules/ui/ui.v:67:25: error: unexpected `(`, expecting `name` 
   65|     focus()
   66|     set_pos(x,y int)
   67|     propose_size(w, h int) (int,int)
                                  ^
   68|     size() (int, int)
   69|     is_focused() bool

Windows spanning across multiple screens each having different DPI and size

(copy of https://gist.github.com/vurtun/61b6dbf21ef060bcbbd8d1faa88350d9#gistcomment-2223201 )

Path to full DPI and screen size independency

I'd like V UI to support the following case (which is very common and won't disappear because of huge overlap of lifetimes of screens). Native GUI libs usually don't support it at all, but let's hope there are some workarounds.

Let's assume I have 3 different physical LCD displays and want to use a V UI application on all of them simultaneously (one application window spanning across all three displays). The LCDs are physically placed like this:

final_physical_displays_positioning
(note the bezels which make the physical displaying surface non-continuous)

This is how the physical surface itself looks like:
final_physical_displays_positioning_without_bezels

Graphic cards nowadays support more displays using a "virtual" huge "multibuffer canvas" where all the 3 different "framebuffers", each corresponding to one and only one LCD, must fit in. But because each LCD has not only different physical dimensions, they have also different resolutions and therefore the "multibuffer canvas" (yellow color) used by graphic cards to draw the actual pixels to looks like this:

multibuffer_canvas_after_applying_physical_dpi_of_lcds

The issue is, that all UIs known to me do not have the capability to support different resolutions in different areas of the "multibuffer canvas" and thus they just choose some "random" DPI (usually the DPI of the first physical display in the list of physical displays connected to the running system, which is of course unpredictable) with the following result:

multibuffer_canvas_after_applying_physical_dpi_of_lcds-bad_gui_toolkit

Which looks on the whole physical surface like this:

final_physical_displays_positioning_without_bezels-bad_gui_toolkit

How do I set a dependency on glfw?

How do I set a dependency on glfw? The site only shows Windows: v setup-freetype. I did it. But the examples are not compiled.

the site says:
Fedora:
sudo dnf install glfw glfw-devel freetype-devel
Windows:
v setup-freetype

where glfw for windows?

if I do this:
v install glfw
then I get an error

switch changes state when clicked outside its outline

The switch changes state wherever you click in the window.

It seems that in "sw_click" function of swicht.v, mouse position test is missing.

To cope the issue, just modify the sw_click function as below :

fn sw_click(b mut Switch, e &MouseEvent, w &ui.Window) {
if !b.point_inside(e.x, e.y) { return } //<===== mouse position test added
if e.action == 0 {
b.open = !b.open
if b.onclick != 0 {
b.onclick(w.user_ptr, b)
}
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.