|
Post by Pjot on Jan 29, 2023 19:47:34 GMT 1
Well, it's done, BaCon now work with TK as a backend as well. Demonstration code:
OPTION GUI TRUE PRAGMA GUI Tk
id = GUIDEFINE(" \ wm title . \"Testing TK\"; \ wm protocol . \"WM_DELETE_WINDOW\" tk_exit; \ text .txt -width 50 -height 20 -wrap none; \ pack .txt; \ set var 4; \ entry .ent; \ pack .ent -padx 5 -pady 5 -side left; \ bind .ent <Return> get_text; \ button .btn -text \"Say Hello\" -command hello; \ pack .btn -padx 5 -pady 5 -side right; \ focus .txt")
LOCAL myvar$
WHILE TRUE SELECT GUIEVENT$(id) CASE "tk_exit" BREAK CASE "get_text" PRINT "entry" CALL GUIFN(id, "set result [.ent get]") CALL GUIGET(id, "result", myvar$) PRINT "In entry:", myvar$ CASE "hello" PRINT "button clicked" CALL GUIGET(id, "var", myvar$) PRINT "Variable value is: ", myvar$ ENDSELECT WEND
PRINT "End"
I will test it a bit more so there might be some slight changes and small tweaks, but the main parts are there.
BR Peter
|
|
|
Post by bigbass on Jan 30, 2023 4:28:29 GMT 1
hello Peter I have some very good news I don't disagree with you that having to upgrade is a big pain and much suffering will happen until you get a solid dev box working because I am very sure I was more frustrated trying to get webkit to work than you until I finally tried Manjaro (*I lost count of my failed attempts on debian rpi3. It now works on debian in bullseye by the way but not when I started to use it) some good news and using your code demos by the way I tested today on manjaro with GTK4 all of your gtk4 demos worked from these links correctly! basic-converter.proboards.com/thread/1149/new-feature-gui-proxy-bacon?page=16basic-converter.proboards.com/thread/1149/new-feature-gui-proxy-bacon?page=17-------------------------------------------------- ======== Manjaro ======== sudo pacman -S webkit2gtk-5.0 resolving dependencies... looking for conflicting packages... Packages (11) bubblewrap-0.7.0-1 enchant-2.3.3-2 harfbuzz-icu-6.0.0-1 hyphen-2.8.8-5 libmanette-0.2.6-3 libwpe-1.14.0-1 libxslt-1.1.37-2 woff2-1.0.2-4 wpebackend-fdo-1.14.0-1 xdg-dbus-proxy-0.1.4-1 webkit2gtk-5.0-2.38.3-1 Total Download Size: 24.95 MiB Total Installed Size: 108.51 MiB :: Proceed with installation? [Y/n] -------------------------------------- if my little RPI3 starts to smoke I will let you know I also tested your first tk demo on debian and Manjaro it works correctly using bacon 4.6 (your source build) tomorrow I will try your baconized GUI code for tk installing the latest fossil and give it a try thanks for all your work! Joe
|
|
|
Post by bigbass on Jan 30, 2023 17:23:33 GMT 1
Hello Peter
using fossil bacon-08da22fdbb
Manjaro RPI3
in a nut shell all that I said in the prior post I trust your coding in gtk and when things don't work for me I first suspect my system is missing something
well ,the same goes for you your gtk code works so something is missing on your system which is much easier to solve but I do understand porting anything to a different gtk version brings problems with it but look the GTK4 stuff you wrote works !
on the good news for today
the tk gui proxy works and bacongui for gtk3 works
thanks again for you work on these it gives us more options to code with
Joe
|
|
|
Post by Pjot on Jan 30, 2023 21:07:37 GMT 1
Thanks for checking the code Joe,
I have been fiddling around with TK now, and within just two hours I already could create the below GUI.
There is a tweak in the TK handling where callback signals starting with a TCL string indication "{" should not be passed back to the BaCon program. So only single terms will be taken into account and come back to BaCon (see latest in Fossil repo).
Of course, the program is not finished yet, but it is progressing nicely. I have to think about the syntax highlighting. But until now, programming with TK has been a pleasant surprise.
BR Peter
OPTION GUI TRUE PRAGMA GUI Tk
id = GUIDEFINE(" \ wm title . \"The BaCon Editor\"; \ wm protocol . \"WM_DELETE_WINDOW\" tk_exit; \ option add *tearOff 0; \ menu .menubar; \ . configure -menu .menubar; \ menu .menubar.file; \ menu .menubar.tools; \ menu .menubar.help; \ .menubar add cascade -menu .menubar.file -label File; \ .menubar.file add command -label \"Open...\" -command openf; \ .menubar.file entryconfigure 0 -accelerator \"CTRL+O\"; \ .menubar.file add command -label \"Close\" -command close; \ .menubar.file add command -label \"Save\" -command save; \ .menubar.file entryconfigure 2 -accelerator \"CTRL+S\"; \ .menubar.file add command -label \"Save as...\" -command saveas; \ .menubar.file add separator; \ .menubar.file add command -label \"Clone Me\" -command clone; \ .menubar.file add separator; \ .menubar.file add command -label \"HTML export\" -command export; \ .menubar.file add separator; \ .menubar.file add command -label \"Exit\" -command exit; \ .menubar add cascade -menu .menubar.tools -label Tools; \ .menubar.tools add command -label \"Execute\" -command execute; \ .menubar.tools entryconfigure 0 -accelerator \"CTRL+E\"; \ .menubar.tools add separator; \ .menubar.tools add checkbutton -label \"Line Numbers\" -variable check -onvalue 1 -offvalue 0; \ .menubar.tools add separator; \ .menubar.tools add command -label \"Indent Code\" -command indent; \ .menubar.tools entryconfigure 4 -accelerator \"CTRL+M\"; \ .menubar.tools add separator; \ .menubar.tools add command -label \"Scratchpad\" -command scratch; \ .menubar add cascade -menu .menubar.help -label Help; \ .menubar.help add command -label \"Context Info\" -command context; \ .menubar.help add command -label \"Documentation\" -command documentation; \ .menubar.help add separator; \ .menubar.help add command -label \"About\" -command about; \ .menubar.help entryconfigure 0 -accelerator \"CTRL+I\"; \ text .txt -width 100 -height 30 -wrap none -bg white -yscrollcommand {.scroll set}; \ scrollbar .scroll -command {.txt yview}; \ grid .txt .scroll -sticky nsew; \ grid columnconfigure . 0 -weight 1; \ grid rowconfigure . 0 -weight 1; \ focus .txt")
LOCAL myvar$
WHILE TRUE SELECT GUIEVENT$(id) CASE "exit", "tk_exit" BREAK CASE "openf" CALL GUIFN(id, "set filename [tk_getOpenFile -title \"Open File\" -filetypes {{{BaCon Source Files} {.bac} TEXT}} ]") CALL GUIGET(id, "filename", myvar$) IF LEN(myvar$) THEN CALL GUISET(id, "myvar", LOAD$(myvar$)) CALL GUIFN(id, ".txt insert 1.0 $myvar") ENDIF CASE "about" CALL GUIFN(id, "tk_messageBox -title \"About This Editor\" -message \"Minimal BaCon Editor\" -icon info -type ok -detail \"(c) 2023 Peter van Eerten\"") ENDSELECT WEND
BR Peter
|
|
|
Post by bigbass on Jan 31, 2023 1:33:21 GMT 1
hello Peter no need to force gtk4 I saw what you mean by classes in the example code it is still in c? maybe at another time anyway it will be awhile until debian (for the docker) even has a package for it go with the flow ~~~~ if you can get these results quickly with tk I think having a bacongui-tk is perfect for small dependencies I would only say that if it worked on my box too looking really good ! latest fossil working Joe
|
|
|
Post by bigbass on Jan 31, 2023 19:48:11 GMT 1
Hello Peter I retract my prior gtk4 comments being something we might use in the future first try using Manjaro gtk4 only testing a few small gtk4 demos and trying to port code I wrote in gtk3 I didn't realize how many things need to change to port from gtk3 to gtk4 they should have renamed the project ( I will be kind and refrain but many names come to mind) I think it will be the off ramp for many to use Qt or some other option *I started at zero with qt5 and can build apps compared to many long years with gtk the official link is dead I found this so others could see the changes for themselves and have some facts to verify web.archive.org/web/20221123115347/https://docs.gtk.org/gtk4/migrating-3to4.htmlgood move to get tk in the bacon world Joe
|
|
|
Post by Pjot on Feb 1, 2023 6:34:05 GMT 1
Hi Joe, Well, the TK toolkit is easy to learn, has an easy design, with good facilities for the programmer - a complete opposite of GTK4 Also I discovered that TK allows "theming", which can beautify the widgets. I'll look more into these possibilities. Regarding the editor in GTK4, I'll leave it for now, and will take a look at it again at a later point in time. The GUI functions still can reach GTK4. BR Peter
|
|
|
Post by Pjot on Feb 5, 2023 14:25:08 GMT 1
All, So it is done, there's a new editor available, now implemented in the good old TK toolkit. I have added it to the BaCon repo as well. To compile successfully, your system needs to have the "tk-dev" library installed (for example: apt install tk-dev). On newer Mint systems, this actually resolves to TK version 8.6.11. The amount of code contains about 450 lines, which is more than the GTK3 version, but which still is far less than the original GTK editor, which conists of more than 3400 lines of code. The reason for the code being more extensive than GTK3 is mainly because the editor contains its own local syntax highlighting implementation. Also, it contains a documentation viewer (the TKhtml3 widget turned out to be not suitable). Attached a screenshot, hope it works fine for everybody. BR Peter Attachments:
|
|
|
Post by bigbass on Feb 5, 2023 22:38:50 GMT 1
Hello Peter tech info feedback I am using bacon-b0f8b00646 I am also very interested to try your new tk gui note that I am not in a docker now just the tarball using Manjaro and fltk is detected and builds bacongui-fltk this is good had to add to bacongui-tk.bac DECLARE DATA_PATH TYPE STRING DATA_PATH="/usr/share"
here OPTION GUI TRUE PRAGMA GUI tk
DECLARE DATA_PATH TYPE STRING DATA_PATH="/usr/share"
OPTION EXPLICIT TRUE then it compiled fine ( hope I didn't overlook some bacon config option for tkgui just wanted to test quickly) excellent thanks for the new TK GUI and cool homemade bacon syntax highlighting a lot of thought went in to do that part great to see what can be done with TK just a quick report will test more later tonight Joe
|
|
|
Post by bigbass on Feb 6, 2023 4:06:55 GMT 1
Hello Peter
UPDATE using make (the right way)
ok checked the make file so we can use the installer first time using it sorry I was in a hurry to try it
./configure --prefix=/usr --enable-gui-tk
========================================== Congratulations, all requirements are met!
- Makefile created. - Using '/usr/bin/ksh' to compile BaCon. - Creating BaConGUI for TK.
Now run 'make' and 'make install' to build and install BaCon. =========================================
it compiles and installs correctly!
great job!
Joe
|
|
|
Post by Pjot on Feb 6, 2023 7:50:11 GMT 1
Thanks for testing Joe!
I will adapt and test the Docker file shortly, to your recommendations, so we can create a container with all 3 editor versions in there.
BR Peter
|
|
|
Post by Pjot on Feb 6, 2023 18:40:07 GMT 1
So this works for me now: FROM debian:bullseye-slim
RUN apt-get update RUN apt-get install -y build-essential libtcmalloc-minimal4 flex indent ksh xterm libfltk1.3-dev libgtk-3-dev \ libgtksourceview-4-dev libwebkit2gtk-4.0-dev tk-dev
COPY . /usr/src/bacon WORKDIR /usr/src/bacon
RUN LDFLAGS=-l:libtcmalloc_minimal.so.4 ./configure --enable-gui-gtk --enable-gui-fltk --enable-gui-tk RUN make RUN make install
RUN apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /tmp
Then, to run a GUI: Also I made some minor tweaks, for example the 'read' in XTerm, which seemed to need an argument when run from the container (see fossil repo).
BR Peter
|
|
|
Post by bigbass on Feb 6, 2023 23:03:26 GMT 1
hello Peter
I am on a new manjaro install and set up a clean docker again
all three GUI's worked correctly and and ran in the docker!
some notes Manjaro doesnt have xhost installed we need to add it to your system not the docker
sudo pacman -S xorg-xhost #this is needed to pass the X11 display into the docker
Joe
Details:
joe@joe-pc bacon_trunk]$ xhost +local: non-network local connections being added to access control list
# I tested them one at a time there was a warning but all ran correctly
[joe@joe-pc bacon_trunk]$ docker run --rm --volume $(pwd):/tmp --user "$(id -u):$(id -g)" --env HOME=/tmp -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY bacon bacongui-gtk
(bacongui-gtk:1): dbind-WARNING **: 21:46:19.286: Couldn't connect to accessibility bus: Failed to connect to socket /run/user/1000/at-spi/bus_0: No such file or directory [joe@joe-pc bacon_trunk]$ docker run --rm --volume $(pwd):/tmp --user "$(id -u):$(id -g)" --env HOME=/tmp -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY bacon bacongui-tk [joe@joe-pc bacon_trunk]$ docker run --rm --volume $(pwd):/tmp --user "$(id -u):$(id -g)" --env HOME=/tmp -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY bacon bacongui-fltk [joe@joe-pc bacon_trunk]$
|
|
|
Post by bigbass on Feb 7, 2023 1:58:13 GMT 1
Hello Peter
while everything is still fossil beta testing you can check on your side trying to optimize the size of the docker where possible bacon-2ebea86d70
I noticed that you are trying to reduce where it is possible you added this
RUN apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*
that's great for the system side of the code a big reduction (thanks)
I wanted to see what was the difference with and without one option --no-install-recommends
without latest fossil
docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE bacon latest 192013458a5e About an hour ago 1.13GB debian bullseye-slim 0e6a9cff1d49 2 days ago 74.3MB
with --no-install-recommends
docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE bacon latest e4f8b23d1eae 43 minutes ago 893MB debian bullseye-slim 0e6a9cff1d49 2 days ago 74.3MB
====================== that's roughly 237MB ======================
snip from the code
RUN apt-get update && apt-get install --no-install-recommends -y \ build-essential libtcmalloc-minimal4 \ flex indent ksh xterm libfltk1.3-dev \ libgtk-3-dev libgtksourceview-4-dev \ libwebkit2gtk-4.0-dev tk-dev
Joe
|
|
|
Post by Pjot on Feb 7, 2023 17:24:10 GMT 1
Thanks Joe,
The '--no-install-recommends' option is very valuable indeed. I have added it to the Dockerfile.
Also, to be able to compile Xaw and Motif widgets, we need to add 'libxaw7-dev' and 'libmotif-dev' as well.
My resulting Docker file now looks as follows:
FROM debian:bullseye-slim
RUN apt-get update RUN apt-get install --no-install-recommends -y build-essential libtcmalloc-minimal4 flex indent ksh xterm \ libxaw7-dev libmotif-dev libfltk1.3-dev libgtk-3-dev libgtksourceview-4-dev libwebkit2gtk-4.0-dev tk-dev
COPY . /usr/src/bacon WORKDIR /usr/src/bacon
RUN LDFLAGS=-l:libtcmalloc_minimal.so.4 ./configure --enable-gui-gtk --enable-gui-fltk --enable-gui-tk RUN make RUN make install
RUN apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /tmp
The resulting image is approx. 300Mb smaller!
BR Peter
|
|