gtk3app 3.0.0 → 4.0.210128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +32 -26
- data/lib/gtk3app.rb +10 -18
- data/lib/gtk3app/config.rb +91 -96
- data/lib/gtk3app/program.rb +142 -68
- data/lib/gtk3app/{widget/widgets.rb → widgets.rb} +19 -16
- metadata +75 -29
- data/data/VERSION +0 -1
- data/data/ruby.png +0 -0
- data/lib/gtk3app/gtk3app.rb +0 -49
- data/lib/gtk3app/slot.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82fe60ac20bffaf0840a5df94109d2d842b1f409e6349b80a1f7f8e4061c1b91
|
4
|
+
data.tar.gz: c7e9504cf4c894c049ecc08da84667746a5c17b372082e113b0ea34b4a00e261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b54f387d4b6b6ca22fe60893bc4055a731261408bf72485f674b62c1a4bd94ea534b9d69bb609cb22494bb903003dd55b48b9d000a9bc6f5189eee79cc7508a1
|
7
|
+
data.tar.gz: 271c4fc554b1e00d5601c789751d97127b1ee932dfd67b1c3db72ae193d6f5555394596157153b690fdfa6b416c7913b154f54b26491624369e84731991b428c
|
data/README.md
CHANGED
@@ -1,29 +1,37 @@
|
|
1
|
-
#
|
1
|
+
# Gtk3App
|
2
|
+
|
3
|
+
* [VERSION 4.0.210128](https://github.com/carlosjhr64/gtk3app/releases)
|
4
|
+
* [github](https://www.github.com/carlosjhr64/gtk3app)
|
5
|
+
* [rubygems](https://rubygems.org/gems/gtk3app)
|
6
|
+
|
7
|
+

|
2
8
|
|
3
9
|
## DESCRIPTION:
|
4
10
|
|
5
11
|
Gtk3App provides a
|
6
12
|
[Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3)
|
7
13
|
application stub.
|
8
|
-
|
14
|
+
|
15
|
+
The stub provides you with two Expander containers.
|
16
|
+
One for a horizontal toolbar.
|
17
|
+
The other for your main stage area.
|
18
|
+
|
19
|
+
## INSTALL:
|
20
|
+
|
21
|
+
```shell
|
22
|
+
$ sudo gem install gtk3app
|
23
|
+
```
|
9
24
|
|
10
25
|
## SYNOPSIS:
|
11
26
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
self
|
21
|
-
end
|
22
|
-
def self.finalyze
|
23
|
-
# do any cleanups needed at quit time...
|
24
|
-
end
|
25
|
-
end
|
26
|
-
Gtk3App.main(MyApp)
|
27
|
+
```ruby
|
28
|
+
require 'gtk3app'
|
29
|
+
# Expander = Such::Expander < Gtk::Expander
|
30
|
+
# Gtk3App.run do |Expander container, Expander toolbar, HelpParser options|
|
31
|
+
Gtk3App.run do |stage, toolbar, options|
|
32
|
+
# add stuff to stage and toolbar
|
33
|
+
end
|
34
|
+
```
|
27
35
|
|
28
36
|
That's enough to get you going.
|
29
37
|
The three examples in the [./examples](https://github.com/carlosjhr64/gtk3app/tree/master/examples)
|
@@ -31,21 +39,19 @@ directory fully explains the rest of what Gtk3App can do for you.
|
|
31
39
|
|
32
40
|
## FEATURES:
|
33
41
|
|
34
|
-
* [
|
35
|
-
* [
|
36
|
-
* [
|
37
|
-
*
|
38
|
-
*
|
39
|
-
|
40
|
-
## INSTALL:
|
42
|
+
* xdg directory maintainance via [UserSpace](https://www.github.com/carlosjhr64/user_space)
|
43
|
+
* cofiguration via [RBON](https://www.github.com/carlosjhr64/rbon)
|
44
|
+
* command line options via [HelpParser](https://www.github.com/carlosjhr64/Ruby-HelpParser)
|
45
|
+
* [Such](https://github.com/carlosjhr64/Such) Gtk::Widget wrappers.
|
46
|
+
* default application menu
|
47
|
+
* minime window
|
41
48
|
|
42
|
-
$ sudo gem install gtk3app
|
43
49
|
|
44
50
|
## LICENSE:
|
45
51
|
|
46
52
|
* The MIT License
|
47
53
|
|
48
|
-
Copyright (c)
|
54
|
+
Copyright (c) 2021 CarlosJHR64
|
49
55
|
|
50
56
|
Permission is hereby granted, free of charge, to any person obtaining
|
51
57
|
a copy of this software and associated documentation files (the
|
data/lib/gtk3app.rb
CHANGED
@@ -1,29 +1,21 @@
|
|
1
|
-
module Gtk3App
|
2
|
-
VERSION = '3.0.0'
|
3
|
-
end
|
4
|
-
|
5
|
-
# Standard Libraries
|
6
|
-
require 'yaml'
|
7
|
-
require 'sdbm'
|
8
|
-
|
9
1
|
# Supporting Gems
|
2
|
+
require 'help_parser'
|
10
3
|
require 'user_space'
|
11
4
|
require 'rafini'
|
5
|
+
require 'rbon'
|
12
6
|
|
13
7
|
# Workhorse Gems
|
14
8
|
require 'gtk3'
|
15
9
|
require 'such'
|
16
|
-
Such::Things.
|
10
|
+
Such::Things.in Gtk::Widget
|
17
11
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# Custom Widgets
|
22
|
-
require_relative 'gtk3app/widget/widgets.rb'
|
23
|
-
# Program Flow
|
24
|
-
require_relative 'gtk3app/slot.rb'
|
25
|
-
require_relative 'gtk3app/program.rb'
|
26
|
-
require_relative 'gtk3app/gtk3app.rb'
|
12
|
+
# This Gem
|
13
|
+
module Gtk3App
|
14
|
+
VERSION = '4.0.210128'
|
27
15
|
|
16
|
+
require 'gtk3app/config'
|
17
|
+
require 'gtk3app/widgets'
|
18
|
+
require 'gtk3app/program'
|
19
|
+
end
|
28
20
|
# Requires:
|
29
21
|
#`ruby`
|
data/lib/gtk3app/config.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
module Gtk3App
|
2
|
-
using Rafini::String
|
2
|
+
using Rafini::String # provides String#semantic
|
3
|
+
extend Rafini::Empty # provides s0, a0, and h0.
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
HELP = <<~HELP
|
6
|
+
Usage:
|
7
|
+
#{File.basename $0} [:options+]
|
8
|
+
Options:
|
9
|
+
--notoggle Minime wont toggle decorated and keep above
|
10
|
+
--notdecorated Dont decorate window
|
11
|
+
HELP
|
10
12
|
|
11
13
|
# CONFIG follows the following conventions:
|
12
14
|
# * Strings and numbers are mixed case.
|
@@ -15,97 +17,90 @@ module Gtk3App
|
|
15
17
|
# * Lower case bang! keys have special meaning in Such.
|
16
18
|
# * Note that method keys may have mixed case as the method itself.
|
17
19
|
CONFIG = {
|
20
|
+
# Application SHOULD modify LOGO to use it's own logo image.
|
21
|
+
Logo: "#{UserSpace::XDG['data']}/gtk3app/logo.png",
|
22
|
+
# Scale logo to this size.
|
23
|
+
LogoSize: 25,
|
18
24
|
|
19
25
|
# The command to open with default application
|
20
|
-
Open: '
|
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
|
-
app_menu!: [:APP_MENU, :app_menu, s0],
|
98
|
-
|
99
|
-
# Minime's app-menu configuration.
|
100
|
-
# The application SHOULD NOT modify
|
101
|
-
# (the application will have the opportunity later to modify
|
102
|
-
# minime's app-menu directly).
|
103
|
-
MINI_MENU: a0,
|
104
|
-
mini_menu: {
|
105
|
-
add_menu_item: [:quit!],
|
106
|
-
},
|
107
|
-
mini_menu!: [:MINI_MENU, :mini_menu, s0],
|
108
|
-
|
26
|
+
Open: 'xdg-open',
|
27
|
+
|
28
|
+
# Main window configuration
|
29
|
+
MAIN: a0, # Window.new's parameters
|
30
|
+
main: h0, # window settings
|
31
|
+
main!: [:MAIN,:main],
|
32
|
+
|
33
|
+
# Expander stage configuration
|
34
|
+
STAGE: a0,
|
35
|
+
stage: {set_expanded:true},
|
36
|
+
stage!: [:STAGE, :stage],
|
37
|
+
|
38
|
+
# Expander toolbar configuration
|
39
|
+
TOOLBAR: a0,
|
40
|
+
toolbar: {set_expanded:true},
|
41
|
+
toolbar!: [:TOOLBAR, :toolbar],
|
42
|
+
|
43
|
+
# Fullscreen app-menu item
|
44
|
+
# Application MAY modify :FS for language
|
45
|
+
FS: [label: 'Full Screen'],
|
46
|
+
fs: h0,
|
47
|
+
fs!: [:FS, :fs, 'activate'],
|
48
|
+
|
49
|
+
# About app-menu item
|
50
|
+
# Application MAY modify :ABOUT for language
|
51
|
+
# Application SHOULD modify :about_dialog
|
52
|
+
ABOUT: [label: 'About'],
|
53
|
+
about: h0,
|
54
|
+
about!: [:ABOUT, :about, 'activate'],
|
55
|
+
about_dialog: {
|
56
|
+
set_program_name: 'Gtk3App',
|
57
|
+
set_version: VERSION.semantic(0..1),
|
58
|
+
set_copyright: '(c) 2021 CarlosJHR64',
|
59
|
+
set_comments: 'A Gtk3 Application Stub',
|
60
|
+
set_website: 'https://github.com/carlosjhr64/gtk3app',
|
61
|
+
set_website_label: 'See it at GitHub!',
|
62
|
+
},
|
63
|
+
# Application SHOULD modify :HelpFile to their own help page.
|
64
|
+
HelpFile: 'https://github.com/carlosjhr64/gtk3app',
|
65
|
+
|
66
|
+
# Help app-menu item
|
67
|
+
# Application MAY modify :HELP for language
|
68
|
+
HELP: [label: 'Help'],
|
69
|
+
help: h0,
|
70
|
+
help!: [:HELP, :help, 'activate'],
|
71
|
+
|
72
|
+
# Minime's app-menu item.
|
73
|
+
# Application MAY modify :MINIME for language.
|
74
|
+
MINIME: [label: 'Minime'],
|
75
|
+
minime: h0,
|
76
|
+
minime!: [:MINIME, :minime, 'activate'],
|
77
|
+
|
78
|
+
# Quit app-menu item.
|
79
|
+
# Application MAY modify :QUIT for language.
|
80
|
+
QUIT: [label: 'Quit'],
|
81
|
+
quit: h0,
|
82
|
+
quit!: [:QUIT, :quit, 'activate'],
|
83
|
+
|
84
|
+
# Quit confirmation dialog.
|
85
|
+
QUIT_URSURE: a0,
|
86
|
+
quit_ursure: {add_label: 'Quit?'},
|
87
|
+
quit_ursure!: [:QUIT_URSURE, :quit_ursure],
|
88
|
+
|
89
|
+
# Quit Exception(raised by finalizer) message
|
90
|
+
QUIT_EXCEPTION: a0,
|
91
|
+
quit_exception: {set_message_type: :info},
|
92
|
+
quit_exception!: [:QUIT_EXCEPTION, :quit_exception],
|
93
|
+
|
94
|
+
# The app menu configuration.
|
95
|
+
# The application MAY ONLY modify app_menu.add_menu_item
|
96
|
+
# by removing un-wanted app menu items.
|
97
|
+
# Note that you can reference the item.key,
|
98
|
+
# see: Gtk3App::Widget::MenuItem < Such::MenuItem
|
99
|
+
APP_MENU: a0,
|
100
|
+
app_menu: {
|
101
|
+
add_menu_item: [ :minime!, :fs!, :help!, :about!, :quit! ],
|
109
102
|
},
|
103
|
+
# s0 tells AppMenu not to connect to any signal, otherwise it assumes "clicked".
|
104
|
+
app_menu!: [:APP_MENU, :app_menu, s0],
|
110
105
|
}
|
111
106
|
end
|
data/lib/gtk3app/program.rb
CHANGED
@@ -1,90 +1,164 @@
|
|
1
1
|
module Gtk3App
|
2
|
-
|
3
|
-
|
2
|
+
class << self
|
3
|
+
# Gtk2App.run(version:String?, help:String?, klass:(Class | Module)?), appdir:String?, appname:String?, config:Hash?)
|
4
|
+
def run(**kw)
|
5
|
+
kw[:appdir] ||= UserSpace.appdir
|
6
|
+
ensure_keywords(kw)
|
7
|
+
@options = HelpParser[kw[:version], kw[:help]]
|
8
|
+
install(kw)
|
4
9
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Widget::MainWindow.set_icon Such::Thing::PARAMETERS[:Logo]
|
10
|
+
Such::Thing.configure CONFIG
|
11
|
+
@main = Such::Window.new :main!, 'delete-event' do quit! end
|
12
|
+
@main.set_decorated false if @options.notdecorated
|
9
13
|
|
10
|
-
|
14
|
+
vbox = Such::Box.new @main, [:vertical]
|
15
|
+
hbox = Such::Box.new vbox, [:horizontal]
|
11
16
|
|
12
|
-
|
13
|
-
|
17
|
+
size = CONFIG[:LogoSize]
|
18
|
+
@pixbuf = GdkPixbuf::Pixbuf.new(file:CONFIG[:Logo]).scale(size,size)
|
19
|
+
logo = Gtk3App::EventImage.new hbox, [pixbuf:@pixbuf]
|
20
|
+
Gtk3App::AppMenu.new(logo, :app_menu!) do |widget,*e,signal|
|
21
|
+
case signal
|
22
|
+
when 'activate'
|
23
|
+
send widget.key
|
24
|
+
when 'button_press_event'
|
25
|
+
@logo_press_event.call(e[0].button) if @logo_press_event
|
14
26
|
end
|
27
|
+
end
|
15
28
|
|
16
|
-
|
17
|
-
|
18
|
-
@mini = Widget::MainWindow.new(:mini, 'delete-event'){quit!}
|
19
|
-
@mini_menu = Widget::AppMenu.new(@mini, :mini_menu!) do |w,*_,s|
|
20
|
-
self.method(w.key).call if s=='activate'
|
21
|
-
minime! if s=='button_press_event'
|
22
|
-
end
|
23
|
-
end
|
29
|
+
@stage = Such::Expander.new vbox, :stage!
|
30
|
+
@toolbar = Such::Expander.new hbox, :toolbar!
|
24
31
|
|
25
|
-
|
26
|
-
@slot = nil
|
27
|
-
@gui = app.run(self)
|
28
|
-
end
|
32
|
+
kw[:klass]&.new(@stage, @toolbar, @options) or yield(@stage, @toolbar, @options)
|
29
33
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
+
@minime = @fs = false
|
35
|
+
@main.show_all
|
36
|
+
Gtk.main
|
37
|
+
end
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
def raise_argument_error(kw)
|
40
|
+
$stderr.puts 'Expected Signature:'
|
41
|
+
$stderr.puts ' Gtk3App.run(version:String?, help:String?, :klass:Class?, appdir:String?, :appname:String? config:Hash?)'
|
42
|
+
raise ArgumentError, kw.inspect
|
43
|
+
end
|
44
|
+
|
45
|
+
def ensure_keywords(kw)
|
46
|
+
keys = [:version, :help, :klass, :appdir, :appname, :config]
|
47
|
+
raise_argument_error(kw) if kw.keys.any?{not keys.include?_1}
|
48
|
+
klass = kw[:klass]
|
49
|
+
|
50
|
+
unless kw[:version]
|
51
|
+
if klass and defined? klass::VERSION
|
52
|
+
kw[:version] = klass::VERSION
|
53
|
+
else
|
54
|
+
kw[:version] = (defined? ::VERSION)? ::VERSION : VERSION
|
55
|
+
end
|
41
56
|
end
|
42
57
|
|
43
|
-
|
44
|
-
|
58
|
+
unless kw[:help]
|
59
|
+
if klass and defined? klass::HELP
|
60
|
+
kw[:help] = klass::HELP
|
61
|
+
else
|
62
|
+
kw[:help] = (defined? ::HELP)? ::HELP : HELP
|
63
|
+
end
|
45
64
|
end
|
46
65
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
66
|
+
kw[:appname] ||= klass&.name&.downcase || File.basename($0)
|
67
|
+
|
68
|
+
unless kw[:config]
|
69
|
+
if klass and defined? klass::CONFIG
|
70
|
+
kw[:config] = klass::CONFIG
|
51
71
|
end
|
52
72
|
end
|
73
|
+
end
|
53
74
|
|
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
|
-
|
75
|
+
def transient(window)
|
76
|
+
window.transient_for = @main
|
77
|
+
end
|
78
|
+
|
79
|
+
def logo_press_event(&block)
|
80
|
+
@logo_press_event = block
|
81
|
+
end
|
82
|
+
|
83
|
+
def fs!
|
84
|
+
@fs ? @main.unfullscreen : @main.fullscreen
|
85
|
+
@fs = !@fs
|
86
|
+
end
|
87
|
+
|
88
|
+
def about!
|
89
|
+
about = Such::AboutDialog.new :about_dialog
|
90
|
+
transient about
|
91
|
+
about.set_logo @pixbuf
|
92
|
+
about.run
|
93
|
+
about.destroy
|
94
|
+
end
|
95
|
+
|
96
|
+
def help!
|
97
|
+
system "#{CONFIG[:Open]} '#{CONFIG[:HelpFile]}'"
|
98
|
+
end
|
99
|
+
|
100
|
+
def minime!
|
101
|
+
if @minime
|
102
|
+
@minime = false
|
103
|
+
unless @options.notoggle
|
104
|
+
@main.set_decorated true unless @options.notdecorated
|
105
|
+
@main.set_keep_above false
|
106
|
+
end
|
107
|
+
@stage.set_expanded true
|
108
|
+
@toolbar.set_expanded true
|
109
|
+
else
|
110
|
+
@minime = true
|
111
|
+
unless @options.notoggle
|
112
|
+
@main.set_decorated false unless @options.notdecorated
|
113
|
+
@main.set_keep_above true
|
81
114
|
end
|
115
|
+
@stage.set_expanded false
|
116
|
+
@toolbar.set_expanded false
|
117
|
+
@main.resize 1,1
|
82
118
|
end
|
119
|
+
end
|
120
|
+
|
121
|
+
using Rafini::Exception
|
122
|
+
def quit!
|
123
|
+
ursure = Gtk3App::YesNoDialog.new :quit_ursure!
|
124
|
+
transient ursure
|
125
|
+
return true unless ursure.ok?
|
126
|
+
@finalize.call if @finalize
|
127
|
+
Gtk.main_quit
|
128
|
+
return false
|
129
|
+
rescue # finalize raised exception
|
130
|
+
$!.puts
|
131
|
+
dialog = Such::MessageDialog.new
|
132
|
+
transient dialog
|
133
|
+
dialog.set_text $!.message
|
134
|
+
dialog.run
|
135
|
+
dialog.destroy
|
136
|
+
return true
|
137
|
+
end
|
138
|
+
|
139
|
+
def finalize(&block)
|
140
|
+
@finalize = block
|
141
|
+
end
|
142
|
+
|
83
143
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
144
|
+
using Rafini::String
|
145
|
+
def install(kw)
|
146
|
+
stub = UserSpace.new parser:RBON,
|
147
|
+
appname:'gtk3app',
|
148
|
+
config:"config-#{VERSION.semantic(0..1)}"
|
149
|
+
stub.configures CONFIG
|
150
|
+
|
151
|
+
# :klass and :config flags user wants xdg maintainance.
|
152
|
+
# :appname, :appdir, and :version are sanity checks.
|
153
|
+
if [:klass,:config,:appname,:appdir,:version].all?{kw[_1]}
|
154
|
+
app = UserSpace.new parser:RBON,
|
155
|
+
# Will be a subdirectory in gtk3app:
|
156
|
+
appname:"gtk3app/#{kw[:appname]}",
|
157
|
+
appdir:kw[:appdir],
|
158
|
+
config:"config-#{kw[:version].semantic(0..1)}"
|
159
|
+
app.configures kw[:config]
|
88
160
|
end
|
161
|
+
CONFIG.merge! kw[:config] if kw[:config]
|
89
162
|
end
|
90
163
|
end
|
164
|
+
end
|
@@ -1,6 +1,4 @@
|
|
1
1
|
module Gtk3App
|
2
|
-
module Widget
|
3
|
-
|
4
2
|
class MenuItem < Such::MenuItem
|
5
3
|
attr_accessor :key
|
6
4
|
end
|
@@ -19,7 +17,8 @@ module Widget
|
|
19
17
|
window.add_events(Gdk::EventMask::BUTTON_PRESS_MASK)
|
20
18
|
window.signal_connect('button_press_event') do |w,e|
|
21
19
|
if e.button == 3
|
22
|
-
self.popup(nil, nil, 3, e.time)
|
20
|
+
#self.popup(nil, nil, 3, e.time)
|
21
|
+
self.popup_at_pointer #(nil, nil, 3, e.time)
|
23
22
|
else
|
24
23
|
block.call(w,e,'button_press_event')
|
25
24
|
end
|
@@ -32,25 +31,29 @@ module Widget
|
|
32
31
|
end
|
33
32
|
end
|
34
33
|
|
35
|
-
class
|
36
|
-
def
|
37
|
-
|
34
|
+
class EventImage < Such::EventBox
|
35
|
+
def initialize(container, ...)
|
36
|
+
super container
|
37
|
+
Such::Image.new(self, ...)
|
38
38
|
end
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
-
|
41
|
+
class YesNoDialog < Such::Dialog
|
42
|
+
def initialize(...)
|
43
|
+
super(...)
|
44
|
+
add_button '_No', Gtk::ResponseType::CANCEL
|
45
|
+
add_button '_Yes', Gtk::ResponseType::OK
|
42
46
|
end
|
43
47
|
|
44
|
-
def
|
45
|
-
|
46
|
-
self.set_icon MainWindow.icon
|
48
|
+
def add_label(text)
|
49
|
+
Such::Label.new(child).text = text
|
47
50
|
end
|
48
51
|
|
49
|
-
def
|
50
|
-
|
51
|
-
|
52
|
+
def ok?
|
53
|
+
show_all
|
54
|
+
response = run
|
55
|
+
destroy
|
56
|
+
response == Gtk::ResponseType::OK
|
52
57
|
end
|
53
58
|
end
|
54
|
-
|
55
|
-
end
|
56
59
|
end
|
metadata
CHANGED
@@ -1,17 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gtk3app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.210128
|
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: 2021-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: help_parser
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '7.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 7.0.200907
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '7.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 7.0.200907
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: user_space
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '5.0'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 5.0.210123
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '5.0'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 5.0.210123
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rafini
|
15
55
|
requirement: !ruby/object:Gem::Requirement
|
16
56
|
requirements:
|
17
57
|
- - "~>"
|
@@ -19,7 +59,7 @@ dependencies:
|
|
19
59
|
version: '3.0'
|
20
60
|
- - ">="
|
21
61
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.0.
|
62
|
+
version: 3.0.210112
|
23
63
|
type: :runtime
|
24
64
|
prerelease: false
|
25
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,85 +69,91 @@ dependencies:
|
|
29
69
|
version: '3.0'
|
30
70
|
- - ">="
|
31
71
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.0.
|
72
|
+
version: 3.0.210112
|
33
73
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
74
|
+
name: rbon
|
35
75
|
requirement: !ruby/object:Gem::Requirement
|
36
76
|
requirements:
|
37
77
|
- - "~>"
|
38
78
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
79
|
+
version: '0.2'
|
40
80
|
- - ">="
|
41
81
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
82
|
+
version: 0.2.210125
|
43
83
|
type: :runtime
|
44
84
|
prerelease: false
|
45
85
|
version_requirements: !ruby/object:Gem::Requirement
|
46
86
|
requirements:
|
47
87
|
- - "~>"
|
48
88
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
89
|
+
version: '0.2'
|
50
90
|
- - ">="
|
51
91
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
92
|
+
version: 0.2.210125
|
53
93
|
- !ruby/object:Gem::Dependency
|
54
94
|
name: gtk3
|
55
95
|
requirement: !ruby/object:Gem::Requirement
|
56
96
|
requirements:
|
57
97
|
- - "~>"
|
58
98
|
- !ruby/object:Gem::Version
|
59
|
-
version: '3.
|
99
|
+
version: '3.4'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 3.4.3
|
60
103
|
type: :runtime
|
61
104
|
prerelease: false
|
62
105
|
version_requirements: !ruby/object:Gem::Requirement
|
63
106
|
requirements:
|
64
107
|
- - "~>"
|
65
108
|
- !ruby/object:Gem::Version
|
66
|
-
version: '3.
|
109
|
+
version: '3.4'
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 3.4.3
|
67
113
|
- !ruby/object:Gem::Dependency
|
68
114
|
name: such
|
69
115
|
requirement: !ruby/object:Gem::Requirement
|
70
116
|
requirements:
|
71
117
|
- - "~>"
|
72
118
|
- !ruby/object:Gem::Version
|
73
|
-
version: '0
|
119
|
+
version: '1.0'
|
74
120
|
- - ">="
|
75
121
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
122
|
+
version: 1.0.210117
|
77
123
|
type: :runtime
|
78
124
|
prerelease: false
|
79
125
|
version_requirements: !ruby/object:Gem::Requirement
|
80
126
|
requirements:
|
81
127
|
- - "~>"
|
82
128
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0
|
129
|
+
version: '1.0'
|
84
130
|
- - ">="
|
85
131
|
- !ruby/object:Gem::Version
|
86
|
-
version: 0.
|
132
|
+
version: 1.0.210117
|
87
133
|
description: |
|
88
|
-
Gtk3App provides a
|
134
|
+
Gtk3App provides a
|
135
|
+
[Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3)
|
136
|
+
application stub.
|
89
137
|
|
90
|
-
|
138
|
+
The stub provides you with two Expander containers.
|
139
|
+
One for a horizontal toolbar.
|
140
|
+
The other for your main stage area.
|
91
141
|
email: carlosjhr64@gmail.com
|
92
142
|
executables: []
|
93
143
|
extensions: []
|
94
144
|
extra_rdoc_files: []
|
95
145
|
files:
|
96
146
|
- README.md
|
97
|
-
- data/VERSION
|
98
147
|
- data/logo.png
|
99
|
-
- data/ruby.png
|
100
148
|
- lib/gtk3app.rb
|
101
149
|
- lib/gtk3app/config.rb
|
102
|
-
- lib/gtk3app/gtk3app.rb
|
103
150
|
- lib/gtk3app/program.rb
|
104
|
-
- lib/gtk3app/
|
105
|
-
- lib/gtk3app/widget/widgets.rb
|
151
|
+
- lib/gtk3app/widgets.rb
|
106
152
|
homepage: https://github.com/carlosjhr64/gtk3app
|
107
153
|
licenses:
|
108
154
|
- MIT
|
109
155
|
metadata: {}
|
110
|
-
post_install_message:
|
156
|
+
post_install_message:
|
111
157
|
rdoc_options: []
|
112
158
|
require_paths:
|
113
159
|
- lib
|
@@ -122,10 +168,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
168
|
- !ruby/object:Gem::Version
|
123
169
|
version: '0'
|
124
170
|
requirements:
|
125
|
-
- 'ruby: ruby
|
126
|
-
|
127
|
-
|
128
|
-
signing_key:
|
171
|
+
- 'ruby: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]'
|
172
|
+
rubygems_version: 3.2.3
|
173
|
+
signing_key:
|
129
174
|
specification_version: 4
|
130
|
-
summary: Gtk3App provides a Gtk3 application
|
175
|
+
summary: Gtk3App provides a [Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3) application
|
176
|
+
stub.
|
131
177
|
test_files: []
|
data/data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.0.0
|
data/data/ruby.png
DELETED
Binary file
|
data/lib/gtk3app/gtk3app.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
module Gtk3App
|
2
|
-
using Rafini::String
|
3
|
-
using Rafini::Hash
|
4
|
-
using Rafini::Exception
|
5
|
-
|
6
|
-
def self.config(mod)
|
7
|
-
# Let's get NameErrors out of the way first
|
8
|
-
appdir = mod::APPDIR
|
9
|
-
config = mod::CONFIG
|
10
|
-
version = mod::VERSION
|
11
|
-
# Create the directory name for UserSpace.
|
12
|
-
appname = mod.name.downcase
|
13
|
-
appname.prepend('gtk3app/') unless mod==Gtk3App
|
14
|
-
# UserSpace does its thing...
|
15
|
-
user_space = UserSpace.new(
|
16
|
-
YAML,
|
17
|
-
ext: 'yml',
|
18
|
-
config: "config-#{version.semantic(0..1)}",
|
19
|
-
appname: appname,
|
20
|
-
appdir: appdir
|
21
|
-
)
|
22
|
-
user_space.install unless user_space.version == version
|
23
|
-
user_space.configures(config)
|
24
|
-
rescue NameError
|
25
|
-
$!.puts 'Application is not using APPDIR, VERSION, or CONFIG.'
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.init(mod)
|
29
|
-
Gtk3App.config mod
|
30
|
-
if thing = mod::CONFIG[:thing]
|
31
|
-
Such::Thing.configure thing
|
32
|
-
end
|
33
|
-
rescue NameError
|
34
|
-
$!.puts 'Application is not using CONFIG.'
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.main(app)
|
38
|
-
@program = nil # initialized
|
39
|
-
Gtk3App.init Gtk3App
|
40
|
-
Gtk3App.init app
|
41
|
-
@program = Program.new app
|
42
|
-
Gtk.main
|
43
|
-
rescue StandardError
|
44
|
-
$!.puts
|
45
|
-
exit 1
|
46
|
-
ensure
|
47
|
-
@program.release if @program
|
48
|
-
end
|
49
|
-
end
|
data/lib/gtk3app/slot.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
module Gtk3App
|
2
|
-
module Slot
|
3
|
-
using Rafini::Array
|
4
|
-
|
5
|
-
def self.dbm
|
6
|
-
SDBM.open(CONFIG[:SlotsDBM]){|db|yield(db)}
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.numbers
|
10
|
-
1.upto(CONFIG[:Slots]){|n|yield(n.to_s)}
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.get
|
14
|
-
Slot.dbm do |db|
|
15
|
-
Slot.numbers do |slot|
|
16
|
-
unless db[slot]
|
17
|
-
db[slot]=$$.to_s
|
18
|
-
return slot.to_i
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
return nil
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.release(slot)
|
26
|
-
Slot.dbm{|db|db.delete(slot.to_s)}
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.gc
|
30
|
-
Thread.new do
|
31
|
-
Slot.dbm do |db|
|
32
|
-
Slot.numbers do |slot|
|
33
|
-
if pid = db[slot]
|
34
|
-
db.delete(slot) unless File.directory?("/proc/#{pid}")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
Slot.gc
|
41
|
-
end
|
42
|
-
end
|