From adc5240aba3a1128a08cbb8079ff625f5db8b1f7 Mon Sep 17 00:00:00 2001 From: Stefan Salewski Date: Wed, 19 Aug 2020 19:59:29 +0200 Subject: [PATCH] added libhandy --- README.adoc | 14 +++++++------- examples/gtk3/handy.nim | 31 +++++++++++++++++++++++++++++++ examples/gtk3/makeAll | 1 + examples/gtk3/makeAllArc | 1 + gintro.nimble | 2 +- tests/gen.nim | 6 ++++-- 6 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 examples/gtk3/handy.nim diff --git a/README.adoc b/README.adoc index fed588b..630eb5b 100644 --- a/README.adoc +++ b/README.adoc @@ -1,6 +1,6 @@ = High level GTK3 (and GTK4) bindings for the Nim programming language (c) Stefan Salewski -//Version 0.8.0 +//Version 0.8.1 :experimental: :imagesdir: http://ssalewski.de/tmp :source-highlighter: pygments @@ -25,12 +25,12 @@ with code inserted from files directly. NOTE: This work is partly based on earlier works of J. Mansour and has been supported by A. Rumpf, E. Bassi and other _Nim_ and _GTK/Gnome_ developers. The `combinatorics` module was kindly provided by R. Behrends. -NOTE: We fixed a few small bugs in the last weeks, so we decided to finally make a 0.8.0 release. -The GTK4 examples from http://ssalewski.de/gtkprogramming.html -should work now, and the existing GTK3 examples seems still to work. This release is already available since a few weeks by -*"nimble install gintro@#head"* command, so we assume that there are no serious issues. -We have added a simple VTE example to the GTK3 example directory. -If you are using Arch Linux you may still have to ensure that +NOTE: This is version 0.8.1 of gintro. Requested by FedericoCeratto we have added libhandy support. +Libhandy is not yet available for GTK4 but seems to work with gtk+-3.24.20. As Gentoo Linux ships still +only a very old libhandy, we tested with latest release from https://gitlab.gnome.org/GNOME/libhandy/ +Only available example is currently /examples/gtk3/handy.nim converted from example.py. + +NOTE: If you are using Arch Linux you may still have to ensure that curl or wget is available, see https://github.com/StefanSalewski/gintro/issues/83. Next release will get support for GList proc parameters and results, but providing that is some non trivial work and may break some other stuff unfortunately. Note that the File type of module gio is now called GFile to diff --git a/examples/gtk3/handy.nim b/examples/gtk3/handy.nim new file mode 100644 index 0000000..519f65d --- /dev/null +++ b/examples/gtk3/handy.nim @@ -0,0 +1,31 @@ +# https://gitlab.gnome.org/GNOME/libhandy/-/blob/master/examples/example.py +# nim c --gc:arc handy.nim +import gintro/[gtk, gobject, handy] + +proc main = + gtk.init() + handy.init() + let window = gtk.newWindow() + let vbox = newBox(Orientation.vertical, 0) + let entry = newEntry() + let keypad = handy.newKeypad(symbolsVisible = true, lettersVisible = true) + window.title = "Keypad Example with Nim" + vbox.add(entry) # widget to show dialed number + vbox.add(keypad) + vbox.setHalign(gtk.Align.center) + vbox.setValign(gtk.Align.center) + vbox.marginStart = 18 + vbox.marginEnd = 18 + vbox.marginTop = 18 + vbox.marginBottom = 18 + vbox.spacing = 18 + keypad.setRowSpacing(6) + keypad.setColumnSpacing(6) + keypad.setEntry(entry) # attach the entry widget + window.connect("destroy", gtk.mainQuit) + window.add(vbox) + window.showAll() + gtk.main() + +main() + diff --git a/examples/gtk3/makeAll b/examples/gtk3/makeAll index 0cc79ff..476dee0 100644 --- a/examples/gtk3/makeAll +++ b/examples/gtk3/makeAll @@ -14,6 +14,7 @@ nim c gaction.nim nim c gearsmenu.nim nim c gsettings.nim nim c gstBasicTutorial1.nim +nim c handy.nim nim c label.nim nim c listview.nim nim c menubar.nim diff --git a/examples/gtk3/makeAllArc b/examples/gtk3/makeAllArc index d7a4cf0..d7bdddd 100644 --- a/examples/gtk3/makeAllArc +++ b/examples/gtk3/makeAllArc @@ -14,6 +14,7 @@ nim c --gc:arc gaction.nim nim c --gc:arc gearsmenu.nim nim c --gc:arc gsettings.nim nim c --gc:arc gstBasicTutorial1.nim +nim c --gc:arc handy.nim nim c --gc:arc label.nim nim c --gc:arc listview.nim nim c --gc:arc menubar.nim diff --git a/gintro.nimble b/gintro.nimble index b69d0c9..fbd35d2 100644 --- a/gintro.nimble +++ b/gintro.nimble @@ -1,6 +1,6 @@ # Package -version = "0.8.0" +version = "0.8.1" author = "Stefan Salewski" description = "High level GObject-Introspection based GTK3/GTK4 bindings" license = "MIT" diff --git a/tests/gen.nim b/tests/gen.nim index adba104..42f1c75 100644 --- a/tests/gen.nim +++ b/tests/gen.nim @@ -1,6 +1,6 @@ # High level gobject-introspection based GTK3/GTK4 bindings for the Nim programming language # nimpretty --maxLineLen:130 gen.nim -# v 0.8.0 2020-JUL-30 +# v 0.8.1 2020-AUG-19 # (c) S. Salewski 2018 # https://wiki.gnome.org/Projects/GObjectIntrospection @@ -2877,6 +2877,7 @@ proc launch() = main("Vte") main("Notify") main("Gst") + main("Handy") main("cairo") else: echo "First we try generating bindings for GTK4, this may fail when GTK4 is not properly installed" @@ -2904,6 +2905,7 @@ proc launch() = # main("Vte") # not yet available for GTK4 main("Notify") main("Gst") + # main("Handy") # not yet available for GTK4 main("cairo") if ISGTK3: @@ -2922,4 +2924,4 @@ proc launch() = supmod4.close launch() -# 2925 lines +# 2927 lines