gtk3app 2.1.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{README.rdoc → README.md} +29 -32
- data/data/VERSION +1 -1
- data/lib/gtk3app.rb +7 -18
- data/lib/gtk3app/config.rb +4 -4
- data/lib/gtk3app/gtk3app.rb +1 -0
- data/lib/gtk3app/program.rb +1 -0
- data/lib/gtk3app/widget/widgets.rb +2 -2
- metadata +3 -4
- data/lib/gtk3app/dialog/dialogs.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25f1d4d3cc539cbaa2e1c8961dc053d5d713bee8a32d95fafe9e4f2914fa9cc6
|
4
|
+
data.tar.gz: 83a1c8e493598daffca2618d0a7ecc10112a8afddab7a709a7f98270c5324105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 676586049ff04b8595e856bffc723a12e009a0165f352918da887af9ee772866d6a7d4db53c4dccce30c703dfcf9fd09446c09c44fdf9a81522e19ea14403b32
|
7
|
+
data.tar.gz: 46ed7d0cd569a66b71f7f8636f5aade898d6da90c3508c27fdcc2a8b00c79737b78adff762fcb975df66bdc912e6d1ce4df73d7db8ed8f5fdb6b4f88d81f0b8e
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,52 +1,49 @@
|
|
1
|
-
|
1
|
+
# gt3applib
|
2
2
|
|
3
|
-
|
3
|
+
## DESCRIPTION:
|
4
4
|
|
5
|
-
|
5
|
+
Gtk3App provides a
|
6
|
+
[Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3)
|
7
|
+
application stub.
|
8
|
+
It automatically provides for user configuration, application menu, and minime window.
|
6
9
|
|
7
|
-
|
10
|
+
## SYNOPSIS:
|
8
11
|
|
9
|
-
|
12
|
+
Given a module file such as `~./my_app.rb` providing `MyApp`, the module is expected to at least provide MyApp.run(program):
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
Given a module file such as ./my_app.rb, the module is expected to at least provide MyApp.run(program):
|
14
|
-
|
15
|
-
module MyApp
|
16
|
-
def self.run(program)
|
14
|
+
module MyApp
|
15
|
+
def self.run(program)
|
17
16
|
window = program.window
|
18
17
|
# develop as you would on a Gtk3::Window object...
|
19
18
|
# ...probably a good idea to show all your work.
|
20
19
|
window.show_all
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
self
|
21
|
+
end
|
22
|
+
def self.finalyze
|
23
|
+
# do any cleanups needed at quit time...
|
24
|
+
end
|
25
|
+
end
|
26
|
+
Gtk3App.main(MyApp)
|
24
27
|
|
25
28
|
That's enough to get you going.
|
26
|
-
The three examples in the ./examples
|
29
|
+
The three examples in the [./examples](https://github.com/carlosjhr64/gtk3app/tree/master/examples)
|
27
30
|
directory fully explains the rest of what Gtk3App can do for you.
|
28
31
|
|
29
|
-
|
32
|
+
## FEATURES:
|
30
33
|
|
31
|
-
* Such
|
32
|
-
* Rafini
|
33
|
-
* UserSpace
|
34
|
+
* [Such](https://github.com/carlosjhr64/Such) wrappers.
|
35
|
+
* [Rafini](https://github.com/carlosjhr64/rafini) refinements.
|
36
|
+
* [UserSpace](https://github.com/carlosjhr64/user_space) XDG support.
|
34
37
|
* MiniMe, an alternative to the deprecated Gtk::StatusIcon.
|
35
38
|
* Popup Application Menu from window button 3 press event (standard left click on application).
|
36
39
|
|
37
|
-
|
38
|
-
|
39
|
-
If in the above example MyApp.run return an object the responds to #finalize,
|
40
|
-
the method will be called before the Gtk main quit.
|
41
|
-
This allows for any cleanups the gui may need to do before exit.
|
42
|
-
|
43
|
-
== INSTALL:
|
40
|
+
## INSTALL:
|
44
41
|
|
45
|
-
|
42
|
+
$ sudo gem install gtk3app
|
46
43
|
|
47
|
-
|
44
|
+
## LICENSE:
|
48
45
|
|
49
|
-
|
46
|
+
* The MIT License
|
50
47
|
|
51
48
|
Copyright (c) 2017
|
52
49
|
|
@@ -69,9 +66,9 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
69
66
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
70
67
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
71
68
|
|
72
|
-
|
69
|
+
## CREDITS
|
73
70
|
|
74
71
|
Stuff here I may have taken from:
|
75
72
|
|
76
|
-
|
77
|
-
|
73
|
+
* [softicons](http://www.softicons.com/application-icons/ruby-programming-icons-by-ahmad-galal/ruby-gtk-icon)
|
74
|
+
* [zetcode](http://zetcode.com/gui/rubygtk/)
|
data/data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/lib/gtk3app.rb
CHANGED
@@ -1,40 +1,29 @@
|
|
1
1
|
module Gtk3App
|
2
|
-
VERSION = '
|
2
|
+
VERSION = '3.0.0'
|
3
3
|
end
|
4
4
|
|
5
5
|
# Standard Libraries
|
6
|
-
|
7
6
|
require 'yaml'
|
8
7
|
require 'sdbm'
|
9
8
|
|
10
9
|
# Supporting Gems
|
11
|
-
|
12
10
|
require 'user_space'
|
13
11
|
require 'rafini'
|
14
12
|
|
15
13
|
# Workhorse Gems
|
16
|
-
|
17
14
|
require 'gtk3'
|
18
|
-
|
19
15
|
require 'such'
|
20
16
|
Such::Things.gtk_widget
|
21
17
|
|
22
18
|
### Gtk3App ###
|
23
|
-
|
24
19
|
# Configuration
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
# Custom Widgets & Dialogs
|
29
|
-
|
30
|
-
require 'gtk3app/widget/widgets.rb'
|
31
|
-
require 'gtk3app/dialog/dialogs.rb'
|
32
|
-
|
20
|
+
require_relative 'gtk3app/config.rb'
|
21
|
+
# Custom Widgets
|
22
|
+
require_relative 'gtk3app/widget/widgets.rb'
|
33
23
|
# Program Flow
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
require 'gtk3app/gtk3app.rb'
|
24
|
+
require_relative 'gtk3app/slot.rb'
|
25
|
+
require_relative 'gtk3app/program.rb'
|
26
|
+
require_relative 'gtk3app/gtk3app.rb'
|
38
27
|
|
39
28
|
# Requires:
|
40
29
|
#`ruby`
|
data/lib/gtk3app/config.rb
CHANGED
@@ -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) 2018 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!',
|
@@ -86,13 +86,13 @@ module Gtk3App
|
|
86
86
|
quit!: [:QUIT, :quit, 'activate'],
|
87
87
|
|
88
88
|
# The app menu configuration.
|
89
|
-
# The application MAY ONLY modify app_menu.
|
89
|
+
# The application MAY ONLY modify app_menu.add_menu_item
|
90
90
|
# by removing un-wanted app menu items.
|
91
91
|
# Note that you can reference the item.key,
|
92
92
|
# see: Gtk3App::Widget::MenuItem < Such::MenuItem
|
93
93
|
APP_MENU: a0,
|
94
94
|
app_menu: {
|
95
|
-
|
95
|
+
add_menu_item: [:fs!, :about!, :help!, :minime!, :quit!],
|
96
96
|
},
|
97
97
|
app_menu!: [:APP_MENU, :app_menu, s0],
|
98
98
|
|
@@ -102,7 +102,7 @@ module Gtk3App
|
|
102
102
|
# minime's app-menu directly).
|
103
103
|
MINI_MENU: a0,
|
104
104
|
mini_menu: {
|
105
|
-
|
105
|
+
add_menu_item: [:quit!],
|
106
106
|
},
|
107
107
|
mini_menu!: [:MINI_MENU, :mini_menu, s0],
|
108
108
|
|
data/lib/gtk3app/gtk3app.rb
CHANGED
data/lib/gtk3app/program.rb
CHANGED
@@ -6,7 +6,7 @@ module Widget
|
|
6
6
|
end
|
7
7
|
|
8
8
|
class Menu < Such::Menu
|
9
|
-
def
|
9
|
+
def add_menu_item(key, &block)
|
10
10
|
item = MenuItem.new(self, key, &block)
|
11
11
|
item.key = key
|
12
12
|
item.show
|
@@ -27,7 +27,7 @@ module Widget
|
|
27
27
|
super(*par)
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
30
|
+
def add_menu_item(key, &block)
|
31
31
|
super(key, &(block || @block))
|
32
32
|
end
|
33
33
|
end
|
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:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- carlosjhr64
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: user_space
|
@@ -93,13 +93,12 @@ executables: []
|
|
93
93
|
extensions: []
|
94
94
|
extra_rdoc_files: []
|
95
95
|
files:
|
96
|
-
- README.
|
96
|
+
- README.md
|
97
97
|
- data/VERSION
|
98
98
|
- data/logo.png
|
99
99
|
- data/ruby.png
|
100
100
|
- lib/gtk3app.rb
|
101
101
|
- lib/gtk3app/config.rb
|
102
|
-
- lib/gtk3app/dialog/dialogs.rb
|
103
102
|
- lib/gtk3app/gtk3app.rb
|
104
103
|
- lib/gtk3app/program.rb
|
105
104
|
- lib/gtk3app/slot.rb
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module Gtk3App
|
2
|
-
module Dialog
|
3
|
-
|
4
|
-
module Runs
|
5
|
-
def initialize(*par,&block)
|
6
|
-
@block = block
|
7
|
-
super(*par)
|
8
|
-
end
|
9
|
-
|
10
|
-
def runs
|
11
|
-
set_window_position(:center) if parent and not parent.visible?
|
12
|
-
show_all
|
13
|
-
response = run
|
14
|
-
if block_given?
|
15
|
-
response = yield(response)
|
16
|
-
elsif @block
|
17
|
-
response = @block.call(child, response)
|
18
|
-
else
|
19
|
-
response = (response==Gtk::ResponseType::OK)
|
20
|
-
end
|
21
|
-
destroy
|
22
|
-
return response
|
23
|
-
end
|
24
|
-
|
25
|
-
# The following is just to save a bit of typing.
|
26
|
-
|
27
|
-
def label(*par)
|
28
|
-
Such::Label.new child, *par
|
29
|
-
end
|
30
|
-
|
31
|
-
def combo(*par)
|
32
|
-
Such::ComboBoxText.new child, *par
|
33
|
-
end
|
34
|
-
|
35
|
-
def entry(*par)
|
36
|
-
Such::Entry.new child, *par
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class CancelOk < Such::Dialog
|
41
|
-
include Runs
|
42
|
-
def initialize(*par)
|
43
|
-
super
|
44
|
-
add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL)
|
45
|
-
add_button(Gtk::Stock::OK, Gtk::ResponseType::OK)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class NoYes < Such::Dialog
|
50
|
-
include Runs
|
51
|
-
def initialize(*par)
|
52
|
-
super
|
53
|
-
add_button('_No', Gtk::ResponseType::CANCEL)
|
54
|
-
add_button('_Yes', Gtk::ResponseType::OK)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
end
|