added libhandy

This commit is contained in:
Stefan Salewski 2020-08-19 19:59:29 +02:00
commit adc5240aba
6 changed files with 45 additions and 10 deletions

View file

@ -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

31
examples/gtk3/handy.nim Normal file
View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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