pisaiah / vpaint

MS-Paint alternative written in V.
https://vpaint.app
MIT License
59 stars 2 forks source link

App starts normal, but switches to something that looks like a design/debug mode #3

Open sjsepan3 opened 6 months ago

sjsepan3 commented 6 months ago

vpaint

Issue:

Appearance changes after running executable a few seconds. This was after running a few times with NO error. Also, warnings during build

Build Output (home path redacted):

src/image_view.v:9:1: notice: [attr] has been deprecated, use @[attr] instead 7 | import os 8 | 9 | [heap] | ^ 10 | struct ImageViewData { 11 | mut: src/paint.v:8:1: notice: [attr] has been deprecated, use @[attr] instead 6 | import gx 7 | 8 | [heap] | ^ 9 | struct App { 10 | mut: src/tools_fillcan.v:5:8: warning: module 'time' is imported but never used 3 | import iui as ui 4 | import gx 5 | import time | ~~~~ 6 | 7 | // Fill Tool ~/.vmodules/iui/src/deprecated_stuff.v:22:3: notice: assigning 0 to a reference field is only allowed in unsafe blocks 20 | return &MenuItem{ 21 | text: text 22 | icon: 0 | ~~~ 23 | click_event_fn: fn (mut win Window, item MenuItem) {} 24 | } ~/.vmodules/iui/src/image.v:43:3: notice: assigning 0 to a reference field is only allowed in unsafe blocks 41 | mut img := &Image{ 42 | text: '' 43 | img: 0 | ~~ 44 | width: width 45 | height: h ~/.vmodules/iui/src/modal.v:39:3: notice: assigning 0 to a reference field is only allowed in unsafe blocks 37 | in_width: 500 38 | in_height: 300 39 | close: 0 | ~~~~ 40 | } 41 | } ~/.vmodules/iui/src/page.v:40:3: notice: assigning 0 to a reference field is only allowed in unsafe blocks 38 | text_cfg: draw_cfg() 39 | in_height: 300 40 | close: 0 | ~~~~ 41 | } 42 | } ~/.vmodules/iui/src/ui.v:314:3: notice: assigning 0 to a reference field is only allowed in unsafe blocks 312 | pub fn Window.new(cfg &WindowConfig) &Window { 313 | mut win := &Window{ 314 | gg: 0 | ~ 315 | theme: cfg.theme 316 | bar: 0 ~/.vmodules/iui/src/ui.v:316:3: notice: assigning 0 to a reference field is only allowed in unsafe blocks 314 | gg: 0 315 | theme: cfg.theme 316 | bar: 0 | ~~ 317 | config: cfg 318 | font_size: cfg.font_size ~/.vmodules/iui/src/ui.v:319:3: notice: assigning 0 to a reference field is only allowed in unsafe blocks 317 | config: cfg 318 | font_size: cfg.font_size 319 | graphics_context: 0 | ~~~~~~~ 320 | } 321 | src/color_picker.v:48:25: notice: accessing a pointer map value requires an or {} block outside unsafe 46 | mut cim := 0 47 | if 'HSL' in win.id_map { 48 | hsl := &int(win.id_map['HSL']) | ~~~ 49 | cim = hsl 50 | } src/color_picker.v:48:25: notice: accessing map value that contain pointers requires an or {} block outside unsafe 46 | mut cim := 0 47 | if 'HSL' in win.id_map { 48 | hsl := &int(win.id_map['HSL']) | ~~~ 49 | cim = hsl 50 | } src/image_view.v:322:3: notice: assigning 0 to a reference field is only allowed in unsafe blocks 320 | pub fn image_from_data(data &ImageViewData) &Image { 321 | return &Image{ 322 | app: 0 | ~~ 323 | data: data 324 | img: data.id src/color_picker.v:52:16: warning: function iui.button_with_icon has been deprecated; Use Button.new(ButtonConfig) 50 | } 51 | 52 | mut btn := ui.button_with_icon(cim) | ~~~~~ 53 | btn.set_area_filled(false) 54 | btn.after_draw_event_fn = hsl_btn_draw_evnt src/color_picker.v:80:21: warning: method iui.Modal.create_close_btn has been deprecated 78 | modal.add_child(aslid) 79 | 80 | mut close := modal.create_close_btn(mut win, false) | ~~~~~~~~ 81 | y := 295 82 | src/color_picker.v:86:19: warning: method iui.Modal.create_close_btn has been deprecated 84 | close.set_bounds(16, y, 216, 30) 85 | 86 | mut can := modal.create_close_btn(mut win, true) | ~~~~~~~ 87 | can.text = 'Cancel' 88 | can.set_bounds(245, y, 200, 30) src/color_picker.v:308:2: warning: unused variable: y 306 | win.gg.draw_rounded_rect_empty(x - 1, cp.my - 8 + com.ry, 16, 16, 32, gx.blue) 307 | 308 | y := cp.btn.ry - 32 | ^ 309 | 310 | ty := cp.btn.ry + cp.btn.height + 4 src/color_picker.v:316:2: warning: unused variable: tcolor 314 | win.gg.draw_rect_filled(cp.btn.rx, ty, cp.bw, 24, cp.color) 315 | 316 | tcolor := gx.rgb(255 - cp.color.r, 255 - cp.color.g, 255 - cp.color.b) | ~~ 317 | 318 | br := f32(cp.color.r) * 299 src/image_save.v:127:19: warning: method iui.Modal.create_close_btn has been deprecated 125 | 126 | mut win := app.win 127 | mut can := modal.create_close_btn(mut win, true) | ~~~~~~~ 128 | can.text = 'Cancel' 129 | can.set_bounds(w - 140, y, 130, 30) src/image_save.v:96:2: warning: unused variable: bw 94 | modal.add_child(close) 95 | y := 250 96 | bw := 210 | ~~ 97 | 98 | close.subscribe_event('mouse_up', fn [app, mut data, mut cb, mut f, mut nam] (mut e ui.MouseEvent) { src/image_save.v:98:59: warning: unused variable: cb 96 | bw := 210 97 | 98 | close.subscribe_event('mouse_up', fn [app, mut data, mut cb, mut f, mut nam] (mut e ui.MouseEvent) { | ~~ 99 | full_path := os.join_path(f.text, nam.text) 100 | typ := os.file_ext(full_path).to_lower() src/menubar.v:154:18: warning: function iui.menuitem has been deprecated; Replaced with menu_item(MenuItemConfig) 152 | mut themes := ui.get_all_themes() 153 | for theme2 in themes { 154 | mut item := ui.menuitem(theme2.name) | ~~~~~ 155 | item.set_click(theme_click) 156 | theme_menu.add_child(item) src/paint.v:46:19: warning: function iui.make_window has been deprecated; Use Window.new 44 | fn main() { 45 | // Create Window 46 | mut window := ui.make_window( | ~~~~ 47 | title: 'vPaint' 48 | width: 700 src/ribbon.v:29:7: warning: method iui.Button.set_click_fn has been deprecated; use subscribe_event 27 | btn.border_radius = 32 28 | 29 | btn.set_click_fn(cbc, color) | ~~~~~~~~ 30 | color_box.add_child(btn) 31 | count += 1 src/ribbon.v:73:16: warning: function iui.button_with_icon has been deprecated; Use Button.new(ButtonConfig) 71 | gg_im := gg.create_image_from_byte_array(data) or { panic(err) } 72 | cim := gg.cache_image(gg_im) 73 | mut btn := ui.button_with_icon(cim) | ~~~~~ 74 | 75 | btn.set_bounds(0, 16, 32, 32) src/ribbon.v:77:6: warning: method iui.Button.set_click_fn has been deprecated; use subscribe_event 75 | btn.set_bounds(0, 16, 32, 32) 76 | 77 | btn.set_click_fn(rgb_btn_click, 0) | ~~~~~~ 78 | return btn 79 | } src/ribbon.v:23:6: warning: unused variable: count 21 | size := 24 22 | 23 | mut count := 0 | ~ 24 | for color in colors { 25 | mut btn := ui.Button.new(text: ' ') src/ribbon.v:93:3: warning: unused variable: id 91 | mut app := win.get&App 92 | bg := if com.text == '' { app.color } else { app.color_2 } 93 | id := if com.text == '' { '1' } else { '2' } | ~~ 94 | com.set_background(bg) 95 | sele := (com.text == ' ' && app.sele_color) || (com.text == '' && !app.sele_color) src/sidebar.v:41:8: warning: method iui.Button.set_click_fn has been deprecated; use subscribe_event 39 | img_resize_file := $embed_file('assets/resize.png') 40 | mut test5 := app.icon_btn(img_resize_file.to_bytes(), &SelectTool{}) 41 | test5.set_click_fn(fn (win &ui.Window, b voidptr, c voidptr) { | ~~~~~~~~~~~~ 42 | mut app := win.get&App 43 | app.show_resize_modal(app.canvas.w, app.canvas.h) src/sidebar.v:128:16: warning: function iui.button_with_icon has been deprecated; Use Button.new(ButtonConfig) 126 | gg_im := gg.create_image_from_byte_array(data) or { panic(err) } 127 | cim := gg.cache_image(gg_im) 128 | mut btn := ui.button_with_icon(cim) | ~~~~~ 129 | 130 | btn.set_bounds(2, 0, 46, 32) src/sidebar.v:138:6: warning: method iui.Button.set_click_fn has been deprecated; use subscribe_event 136 | btn.extra = tool.tool_name 137 | 138 | btn.set_click_fn(tool_btn_click, tool) | ~~~~~~~~~~ 139 | return btn 140 | } src/statusbar.v:27:11: warning: method iui.Button.set_click_fn has been deprecated; use subscribe_event 25 | 26 | mut zoom_inc := app.zoom_btn(1) 27 | zoom_inc.set_click_fn(on_zoom_inc_click, app) | ~~~~~~~~ 28 | zoom_inc.set_bounds(1, 0, 40, 25) 29 | src/statusbar.v:31:11: warning: method iui.Button.set_click_fn has been deprecated; use subscribe_event 29 | 30 | mut zoom_dec := app.zoom_btn(0) 31 | zoom_dec.set_click_fn(on_zoom_dec_click, app) | ~~~~~~~~ 32 | zoom_dec.set_bounds(4, 0, 40, 25) 33 | src/tools_fillcan.v:28:13: warning: method []Point.free must be called from an unsafe block 26 | if this.next.len > 0 { 27 | this.next.clear() 28 | this.next.free() | ~~ 29 | free(this.next) 30 | this.next = []Point{} src/tools_fillcan.v:29:3: warning: function free must be called from an unsafe block 27 | this.next.clear() 28 | this.next.free() 29 | free(this.next) | ~~~ 30 | this.next = []Point{} 31 | this.img.refresh()

sjsepan3 commented 6 months ago

Result:

Project IS built, and executable DOES run.

iUI:

v0.0.20

VLang:

V 0.4.4 c9933da

sjsepan3 commented 6 months ago

System Info:

System: Kernel: 5.15.0-94-generic x86_64 bits: 64 compiler: gcc v: 11.4.0 Desktop: Cinnamon 6.0.4 tk: GTK 3.24.33 wm: muffin vt: 7 dm: LightDM 1.30.0 Distro: Linux Mint 21.3 Virginia base: Ubuntu 22.04 jammy Machine: Type: Desktop System: Dell product: OptiPlex 5040 v: N/A serial: Chassis: type: 3 serial: Mobo: Dell model: 0R790T v: A00 serial: UEFI-[Legacy]: Dell v: 1.2.7 date: 01/15/2016 Battery: Device-1: hidpp_battery_0 model: Logitech M570 serial: charge: 35% rechargeable: yes status: Discharging CPU: Info: quad core model: Intel Core i5-6500 bits: 64 type: MCP smt: arch: Skylake-S rev: 3 cache: L1: 256 KiB L2: 1024 KiB L3: 6 MiB Speed (MHz): avg: 972 high: 1114 min/max: 800/3600 cores: 1: 974 2: 900 3: 900 4: 1114 bogomips: 25599 Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx Graphics: Device-1: NVIDIA GP108 [GeForce GT 1030] driver: nvidia v: 535.154.05 pcie: speed: 8 GT/s lanes: 4 ports: active: none off: HDMI-A-1 empty: DVI-D-1 bus-ID: 01:00.0 chip-ID: 10de:1d01 class-ID: 0300 Device-2: Realtek RTL2838 DVB-T type: USB driver: dvb_usb_rtl28xxu,rtl2832_sdr bus-ID: 1-1:2 chip-ID: 0bda:2838 class-ID: 0000 serial: Display: x11 server: X.Org v: 1.21.1.4 driver: X: loaded: nvidia unloaded: fbdev,modesetting,nouveau,vesa gpu: nvidia display-ID: :0 screens: 1 Screen-1: 0 s-res: 3840x2160 s-dpi: 162 s-size: 602x341mm (23.7x13.4") s-diag: 692mm (27.2") Monitor-1: HDMI-0 res: 3840x2160 hz: 60 dpi: 163 size: 600x340mm (23.6x13.4") diag: 690mm (27.2") OpenGL: renderer: NVIDIA GeForce GT 1030/PCIe/SSE2 v: 4.6.0 NVIDIA 535.154.05 direct render: Yes Audio: Device-1: Intel 100 Series/C230 Series Family HD Audio vendor: Dell driver: snd_hda_intel v: kernel bus-ID: 00:1f.3 chip-ID: 8086:a170 class-ID: 0403 Device-2: NVIDIA GP108 High Definition Audio driver: snd_hda_intel v: kernel pcie: speed: 8 GT/s lanes: 4 bus-ID: 01:00.1 chip-ID: 10de:0fb8 class-ID: 0403 Sound Server-1: ALSA v: k5.15.0-94-generic running: yes Sound Server-2: PulseAudio v: 15.99.1 running: yes Sound Server-3: PipeWire v: 0.3.48 running: yes Network: Device-1: Intel Ethernet I219-V vendor: Dell driver: e1000e v: kernel port: N/A bus-ID: 00:1f.6 chip-ID: 8086:15b8 class-ID: 0200 IF: enp0s31f6 state: up speed: 1000 Mbps duplex: full mac: Drives: Local Storage: total: 2.05 TiB used: 1.95 TiB (95.0%) ID-1: /dev/sda vendor: SanDisk model: SD8SBAT-256G-1006 size: 238.47 GiB speed: 6.0 Gb/s type: SSD serial: rev: 1006 scheme: GPT ID-2: /dev/sdb vendor: Western Digital model: WDS100T2B0A-00SM50 size: 931.51 GiB speed: 6.0 Gb/s type: SSD serial: rev: 20WD scheme: MBR ID-3: /dev/sdd type: USB vendor: Western Digital model: WD My Passport 25E1 size: 931.48 GiB type: N/A serial: rev: 1021 scheme: GPT Partition: ID-1: / size: 233.62 GiB used: 62.52 GiB (26.8%) fs: ext4 dev: /dev/sda3 ID-2: /boot/efi size: 47.2 MiB used: 6 MiB (12.8%) fs: vfat dev: /dev/sda2 ID-3: /home size: 915.82 GiB used: 717.13 GiB (78.3%) fs: ext4 dev: /dev/sdb1 Swap: ID-1: swap-1 type: file size: 2 GiB used: 1.2 MiB (0.1%) priority: -2 file: /swapfile USB: Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 16 rev: 2.0 speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 Device-1: 1-1:2 info: Realtek RTL2838 DVB-T type: Video driver: dvb_usb_rtl28xxu,rtl2832_sdr interfaces: 2 rev: 2.0 speed: 480 Mb/s power: 500mA chip-ID: 0bda:2838 class-ID: 0000 serial: Device-2: 1-3:3 info: 816820090226 type: Mass Storage driver: usb-storage interfaces: 1 rev: 2.0 speed: 480 Mb/s power: 500mA chip-ID: 3207:0300 class-ID: 0806 serial: Device-3: 1-5:4 info: Logitech Unifying Receiver type: Keyboard,Mouse,HID driver: logitech-djreceiver,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s power: 98mA chip-ID: 046d:c52b class-ID: 0300 Device-4: 1-9:5 info: Western Digital My Passport (WD20NMVW) type: Mass Storage driver: usb-storage interfaces: 1 rev: 2.1 speed: 480 Mb/s power: 500mA chip-ID: 1058:25e1 class-ID: 0806 serial: Hub-2: 2-0:1 info: Super-speed hub ports: 10 rev: 3.0 speed: 5 Gb/s chip-ID: 1d6b:0003 class-ID: 0900 Sensors: System Temperatures: cpu: 29.8 C pch: 56.0 C mobo: 27.8 C gpu: nvidia temp: 35 C Fan Speeds (RPM): N/A gpu: nvidia fan: 86% Repos: Packages: note: see --pkg apt: 3728 Active apt repos in: /etc/apt/sources.list 1: deb [trusted=yes] http: //www.raqsoft.com/raqesproc/update/debian/ / Active apt repos in: /etc/apt/sources.list.d/gambas-team-gambas3-jammy.list 1: deb [signed-by=/etc/apt/keyrings/gambas-team-gambas3-jammy.gpg] https: //ppa.launchpadcontent.net/gambas-team/gambas3/ubuntu jammy main Active apt repos in: /etc/apt/sources.list.d/jonaski-strawberry-jammy.list 1: deb [signed-by=/etc/apt/keyrings/jonaski-strawberry-jammy.gpg] https: //ppa.launchpadcontent.net/jonaski/strawberry/ubuntu jammy main Active apt repos in: /etc/apt/sources.list.d/krupkat-code-jammy.list 1: deb [signed-by=/etc/apt/keyrings/krupkat-code-jammy.gpg] https: //ppa.launchpadcontent.net/krupkat/code/ubuntu jammy main Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list 1: deb http: //packages.linuxmint.com virginia main upstream import backport 2: deb http: //archive.ubuntu.com/ubuntu jammy main restricted universe multiverse 3: deb http: //archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse 4: deb http: //archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse 5: deb http: //security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse Active apt repos in: /etc/apt/sources.list.d/vscode.list 1: deb [arch=amd64,arm64,armhf] http: //packages.microsoft.com/repos/code stable main Active apt repos in: /etc/apt/sources.list.d/vscodium.list 1: deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https: //download.vscodium.com/debs vscodium main Info: Processes: 293 Uptime: 8h 24m wakeups: 24 Memory: 15.54 GiB used: 5.92 GiB (38.1%) Init: systemd v: 249 runlevel: 5 Compilers: gcc: 11.4.0 alt: 11/12 clang: 14.0.0-1ubuntu1.1 Client: Unknown python client inxi: 3.3.13

sjsepan3 commented 6 months ago

UPDATE: I discovered what's going on, sort of...

If I press Alt, it toggles this behavior, with the yellow diagonal lines/red BG control-names It might be a debugging behavior, but it was a bit of a surprise. (When I press Alt in my own app (https://gitlab.com/sjsepan/VLangApp1) there is a little red outlining on the lone button, but that is all.)

I'll let you comment and close if you see no problem. It's just that I did not notice anything in the iUI readme about this.