gtk3app 5.3.210919 → 5.4.230109
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -8
- data/lib/gtk3app/config.rb +7 -5
- data/lib/gtk3app/program.rb +34 -35
- data/lib/gtk3app/widgets.rb +3 -3
- data/lib/gtk3app.rb +1 -1
- metadata +32 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26d8800694d7bc36b8b9d6837977d6c7bc46305dc8b97cb4e61ef1d3f4a23bbc
|
4
|
+
data.tar.gz: 41876d443e177b2f1acaaaa556449b4da9bcdfd95d18d5be14683e3500584fc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab08539c5e7996d90455703e763c83f801e3898bd573d691eb40153646e78e212468818d114701d31b35681216dcd675fa22cb955a6073ee153668b117d3f69b
|
7
|
+
data.tar.gz: 3dcaf677d90c7bdacf81895cbc24a7465f03617ed63f28a682880f03339ed6056310f398d3f186881975e21ad52f1bb149c74c604be919aa3d28776c41efee6e
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Gtk3App
|
2
2
|
|
3
|
-
* [VERSION 5.
|
3
|
+
* [VERSION 5.4.230109](https://github.com/carlosjhr64/gtk3app/releases)
|
4
4
|
* [github](https://www.github.com/carlosjhr64/gtk3app)
|
5
5
|
* [rubygems](https://rubygems.org/gems/gtk3app)
|
6
6
|
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
## DESCRIPTION:
|
10
10
|
|
11
|
-
Gtk3App provides a
|
11
|
+
`Gtk3App` provides a
|
12
12
|
[Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3)
|
13
13
|
application stub.
|
14
14
|
|
@@ -17,13 +17,10 @@ One for a horizontal toolbar.
|
|
17
17
|
The other for your main stage area.
|
18
18
|
|
19
19
|
## INSTALL:
|
20
|
-
|
21
20
|
```console
|
22
21
|
$ sudo gem install gtk3app
|
23
22
|
```
|
24
|
-
|
25
23
|
## SYNOPSIS:
|
26
|
-
|
27
24
|
```ruby
|
28
25
|
require 'gtk3app'
|
29
26
|
# Expander = Such::Expander < Gtk::Expander
|
@@ -32,10 +29,9 @@ Gtk3App.run do |stage, toolbar, options|
|
|
32
29
|
# add stuff to stage and toolbar
|
33
30
|
end
|
34
31
|
```
|
35
|
-
|
36
32
|
That's enough to get you going.
|
37
33
|
The three examples in the [./examples](https://github.com/carlosjhr64/gtk3app/tree/master/examples)
|
38
|
-
directory fully explains the rest of what Gtk3App can do for you.
|
34
|
+
directory fully explains the rest of what `Gtk3App` can do for you.
|
39
35
|
|
40
36
|
## FEATURES:
|
41
37
|
|
@@ -56,7 +52,7 @@ directory fully explains the rest of what Gtk3App can do for you.
|
|
56
52
|
|
57
53
|
* The MIT License
|
58
54
|
|
59
|
-
Copyright (c)
|
55
|
+
Copyright (c) 2023 CarlosJHR64
|
60
56
|
|
61
57
|
Permission is hereby granted, free of charge, to any person obtaining
|
62
58
|
a copy of this software and associated documentation files (the
|
data/lib/gtk3app/config.rb
CHANGED
@@ -11,10 +11,10 @@ module Gtk3App
|
|
11
11
|
--notdecorated\tDont decorate window
|
12
12
|
HELP
|
13
13
|
|
14
|
-
#
|
14
|
+
# See Such::Convention. Summary:
|
15
15
|
# * Strings and numbers are mixed case.
|
16
|
-
# * Arrays are
|
17
|
-
# * Hashes are
|
16
|
+
# * Arrays are upper case.
|
17
|
+
# * Hashes are lower case.
|
18
18
|
# * Lower case bang! keys have special meaning in Such.
|
19
19
|
# * Note that method keys may have mixed case as the method itself.
|
20
20
|
@@CONFIG = {
|
@@ -29,7 +29,7 @@ module Gtk3App
|
|
29
29
|
# Main window configuration
|
30
30
|
MAIN: a0, # Window.new's parameters
|
31
31
|
main: h0, # window settings
|
32
|
-
main!: [:MAIN,:main],
|
32
|
+
main!: [:MAIN,:main,'key-press-event','delete-event'],
|
33
33
|
|
34
34
|
# Expander stage configuration
|
35
35
|
STAGE: a0,
|
@@ -56,7 +56,7 @@ module Gtk3App
|
|
56
56
|
about_dialog: {
|
57
57
|
set_program_name: 'Gtk3App',
|
58
58
|
set_version: VERSION.semantic(0..1),
|
59
|
-
set_copyright: '(c)
|
59
|
+
set_copyright: '(c) 2023 CarlosJHR64',
|
60
60
|
set_comments: 'A Gtk3 Application Stub',
|
61
61
|
set_website: 'https://github.com/carlosjhr64/gtk3app',
|
62
62
|
set_website_label: 'See it at GitHub!',
|
@@ -103,6 +103,8 @@ module Gtk3App
|
|
103
103
|
},
|
104
104
|
# s0 tells AppMenu not to connect to any signal, otherwise it assumes "clicked".
|
105
105
|
app_menu!: [:APP_MENU, :app_menu, s0],
|
106
|
+
# AppMenu key-binding(ie F1=65470)
|
107
|
+
AppMenu: 65470,
|
106
108
|
}
|
107
109
|
CONFIG = lambda{|k| @@CONFIG[k]}
|
108
110
|
def CONFIG.to_h = @@CONFIG
|
data/lib/gtk3app/program.rb
CHANGED
@@ -1,23 +1,36 @@
|
|
1
1
|
module Gtk3App
|
2
2
|
class << self
|
3
|
-
# Gtk3App.run(version:String?, help:String?,
|
3
|
+
# Gtk3App.run(version:String?, help:String?,
|
4
|
+
# klass:(Class | Module)?), appdir:String?, appname:String?,
|
5
|
+
# config:Hash?)
|
4
6
|
def run(**kw)
|
7
|
+
# :appdir must be evaluated here, else breaks UserSpace's heuristics
|
5
8
|
kw[:appdir] ||= UserSpace.appdir
|
6
9
|
ensure_keywords(kw)
|
7
10
|
@options = HelpParser[kw[:version], kw[:help]]
|
8
11
|
install(kw)
|
9
12
|
|
10
13
|
Such::Thing.configure @@CONFIG
|
11
|
-
@main
|
14
|
+
@main = Such::Window.new :main! do |*_,e,signal|
|
15
|
+
case signal
|
16
|
+
when 'key-press-event'
|
17
|
+
if e.keyval==@@CONFIG[:AppMenu]
|
18
|
+
@appmenu.popup_at_widget @logo,
|
19
|
+
Gdk::Gravity::NORTH_WEST,Gdk::Gravity::NORTH_WEST
|
20
|
+
end
|
21
|
+
when 'delete-event'
|
22
|
+
quit!
|
23
|
+
end
|
24
|
+
end
|
12
25
|
@main.set_decorated false if @options.notdecorated
|
13
26
|
|
14
|
-
vbox
|
15
|
-
hbox
|
27
|
+
vbox = Such::Box.new @main, [:vertical]
|
28
|
+
hbox = Such::Box.new vbox, [:horizontal]
|
16
29
|
|
17
|
-
size
|
18
|
-
@pixbuf
|
19
|
-
logo = Gtk3App::EventImage.new hbox, [pixbuf:@pixbuf]
|
20
|
-
Gtk3App::AppMenu.new(logo, :app_menu!) do |widget,*e,signal|
|
30
|
+
size = @@CONFIG[:LogoSize]
|
31
|
+
@pixbuf = GdkPixbuf::Pixbuf.new(file: @@CONFIG[:Logo]).scale(size,size)
|
32
|
+
@logo = Gtk3App::EventImage.new hbox, [pixbuf:@pixbuf]
|
33
|
+
@appmenu = Gtk3App::AppMenu.new(@logo, :app_menu!) do |widget,*e,signal|
|
21
34
|
case signal
|
22
35
|
when 'activate'
|
23
36
|
send widget.key
|
@@ -41,39 +54,25 @@ class << self
|
|
41
54
|
end
|
42
55
|
|
43
56
|
def raise_argument_error(kw)
|
44
|
-
$stderr.puts
|
45
|
-
|
57
|
+
$stderr.puts <<~SIGNATURE
|
58
|
+
Expected Signature:
|
59
|
+
Gtk3App.run(version:String?, help:String?,
|
60
|
+
klass:Class?, appdir:String?, :appname:String?
|
61
|
+
config:Hash?)
|
62
|
+
SIGNATURE
|
46
63
|
raise ArgumentError, kw.inspect
|
47
64
|
end
|
48
65
|
|
49
66
|
def ensure_keywords(kw)
|
50
|
-
|
51
|
-
|
67
|
+
raise_argument_error(kw) if
|
68
|
+
kw.keys.any?{![:version,:help,:klass,:appdir,:appname,:config].include?_1}
|
52
69
|
klass = kw[:klass]
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
else
|
58
|
-
kw[:version] = (defined? ::VERSION)? ::VERSION : VERSION
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
unless kw[:help]
|
63
|
-
if klass and defined? klass::HELP
|
64
|
-
kw[:help] = klass::HELP
|
65
|
-
else
|
66
|
-
kw[:help] = (defined? ::HELP)? ::HELP : HELP
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
+
kw[:version] ||= (klass and defined? klass::VERSION)?
|
71
|
+
klass::VERSION : (defined? ::VERSION)? ::VERSION : VERSION
|
72
|
+
kw[:help] ||= (klass and defined? klass::HELP)?
|
73
|
+
klass::HELP : (defined? ::HELP)? ::HELP : HELP
|
70
74
|
kw[:appname] ||= klass&.name&.downcase || File.basename($0)
|
71
|
-
|
72
|
-
unless kw[:config]
|
73
|
-
if klass and defined? klass::CONFIG
|
74
|
-
kw[:config] = klass::CONFIG
|
75
|
-
end
|
76
|
-
end
|
75
|
+
kw[:config] ||= klass::CONFIG if klass and defined? klass::CONFIG
|
77
76
|
end
|
78
77
|
|
79
78
|
def transient(window)
|
data/lib/gtk3app/widgets.rb
CHANGED
@@ -12,10 +12,10 @@ module Gtk3App
|
|
12
12
|
end
|
13
13
|
|
14
14
|
class AppMenu < Menu
|
15
|
-
def initialize(
|
15
|
+
def initialize(logo, *par, &block)
|
16
16
|
@block = block
|
17
|
-
|
18
|
-
|
17
|
+
logo.add_events(Gdk::EventMask::BUTTON_PRESS_MASK)
|
18
|
+
logo.signal_connect('button_press_event') do |w,e|
|
19
19
|
if e.button == 3
|
20
20
|
#self.popup(nil, nil, 3, e.time)
|
21
21
|
self.popup_at_pointer #(nil, nil, 3, e.time)
|
data/lib/gtk3app.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gtk3app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.4.230109
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CarlosJHR64
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: help_parser
|
@@ -16,60 +16,60 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '8.
|
19
|
+
version: '8.1'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 8.
|
22
|
+
version: 8.1.221206
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '8.
|
29
|
+
version: '8.1'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 8.
|
32
|
+
version: 8.1.221206
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: user_space
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '5.
|
39
|
+
version: '5.2'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 5.
|
42
|
+
version: 5.2.230101
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '5.
|
49
|
+
version: '5.2'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 5.
|
52
|
+
version: 5.2.230101
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rafini
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '3.
|
59
|
+
version: '3.2'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 3.
|
62
|
+
version: 3.2.221213
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '3.
|
69
|
+
version: '3.2'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 3.
|
72
|
+
version: 3.2.221213
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: rbon
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,7 +79,7 @@ dependencies:
|
|
79
79
|
version: '0.2'
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.2.
|
82
|
+
version: 0.2.221217
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -89,49 +89,49 @@ dependencies:
|
|
89
89
|
version: '0.2'
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: 0.2.
|
92
|
+
version: 0.2.221217
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: gtk3
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
99
|
+
version: '4.0'
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 4.0.5
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '4.0'
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 4.0.5
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: such
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: '2.
|
119
|
+
version: '2.1'
|
120
120
|
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 2.
|
122
|
+
version: 2.1.230106
|
123
123
|
type: :runtime
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: '2.
|
129
|
+
version: '2.1'
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: 2.
|
132
|
+
version: 2.1.230106
|
133
133
|
description: |
|
134
|
-
Gtk3App provides a
|
134
|
+
`Gtk3App` provides a
|
135
135
|
[Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3)
|
136
136
|
application stub.
|
137
137
|
|
@@ -153,7 +153,7 @@ homepage: https://github.com/carlosjhr64/gtk3app
|
|
153
153
|
licenses:
|
154
154
|
- MIT
|
155
155
|
metadata: {}
|
156
|
-
post_install_message:
|
156
|
+
post_install_message:
|
157
157
|
rdoc_options: []
|
158
158
|
require_paths:
|
159
159
|
- lib
|
@@ -168,10 +168,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements:
|
171
|
-
- 'ruby: ruby 3.0
|
172
|
-
rubygems_version: 3.2
|
173
|
-
signing_key:
|
171
|
+
- 'ruby: ruby 3.2.0 (2022-12-25 revision a528908271) [aarch64-linux]'
|
172
|
+
rubygems_version: 3.4.2
|
173
|
+
signing_key:
|
174
174
|
specification_version: 4
|
175
|
-
summary: Gtk3App provides a [Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3) application
|
176
|
-
stub.
|
175
|
+
summary: "`Gtk3App` provides a [Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3) application
|
176
|
+
stub."
|
177
177
|
test_files: []
|