File: demo-pickers.lua

package info (click to toggle)
lua-lgi 0.9.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,388 kB
  • sloc: ansic: 5,082; makefile: 169; sh: 31
file content (100 lines) | stat: -rw-r--r-- 1,867 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
return function(parent, dir)

local lgi = require 'lgi'
local Gtk = lgi.Gtk

local window = Gtk.Window {
   title = "Pickers",
   border_width = 10,
   Gtk.Grid {
      border_width = 10,
      row_spacing = 3,
      column_spacing = 10,
      {
	 left_attach = 0, top_attach = 0,
	 Gtk.Label {
	    label = "Color:",
	    halign = 'START',
	    valign = 'CENTER',
	    hexpand = true,
	 },
      },
      {
	 left_attach = 1, top_attach = 0,
	 Gtk.ColorButton {},
      },
      {
	 left_attach = 0, top_attach = 1,
	 Gtk.Label {
	    label = "Font:",
	    halign = 'START',
	    valign = 'CENTER',
	    hexpand = true,
	 },
      },
      {
	 left_attach = 1, top_attach = 1,
	 Gtk.FontButton {},
      },
      {
	 left_attach = 0, top_attach = 2,
	 Gtk.Label {
	    label = "File:",
	    halign = 'START',
	    valign = 'CENTER',
	    hexpand = true,
	 },
      },
      {
	 left_attach = 1, top_attach = 2,
	 Gtk.FileChooserButton {
	    title = "Pick a File",
	    action = 'OPEN',
	 },
      },
      {
	 left_attach = 0, top_attach = 3,
	 Gtk.Label {
	    label = "Folder:",
	    halign = 'START',
	    valign = 'CENTER',
	    hexpand = true,
	 },
      },
      {
	 left_attach = 1, top_attach = 3,
	 Gtk.FileChooserButton {
	    title = "Pick a Folder",
	    action = 'SELECT_FOLDER',
	 },
      },
      {
	 left_attach = 0, top_attach = 4,
	 Gtk.Label {
	    label = "Mail:",
	    halign = 'START',
	    valign = 'CENTER',
	    hexpand = true,
	 },
      },
      {
	 left_attach = 1, top_attach = 4,
	 Gtk.AppChooserButton {
	    content_type = 'x-scheme-handler/mailto',
	    show_dialog_item = true,
	 },
      },
   }
}

window:show_all()
return window
end,

"Pickers",

table.concat {
   [[These widgets are mainly intended for use in preference ]],
   [[dialogs. They allow to select colors, fonts, files, directories ]],
   [[and applications.]]
}