gtk2keypress123 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b6e64bfcb983dab1d9bd688224ce97ed04e66688
4
+ data.tar.gz: 91110b9efef66a1674bdb1c29aa9ebd323249a3a
5
+ SHA512:
6
+ metadata.gz: 46b35d64b33e308a85e64075104c49eee478539958adca16a10a7d76d93df12e400e0a9371d16d5bce819d8321670e0a7f74c3e4436a743555aae0bc45dc517c
7
+ data.tar.gz: 57ccc4350db4a5e3df77f67a4324c9360503be4a99ce1b7fc0fcd00e12f1a5a29a98a6c95093bcaf7b715b66b9ba29074a477868bb6004f7f2356efe1dbba7a0
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: gtk2keypress123.rb
4
+
5
+ require 'gtk2'
6
+ require 'gtk2keypress'
7
+ require 'dynarex'
8
+
9
+
10
+
11
+ class GtkKeyPress123 < Gtk2KeyPress
12
+
13
+ def initialize(timeout: 0.8, notifier: nil, exit_on_success: false,
14
+ keywords: nil, terminator: 'qq', debug: false)
15
+
16
+ @terminator, @debug = terminator, debug
17
+
18
+ @h = if keywords then
19
+
20
+ obj, _ = RXFHelper.read keywords
21
+
22
+ if obj and obj.respond_to? :to_h then
23
+ obj.to_h
24
+ else
25
+ {}
26
+ end
27
+ end
28
+
29
+ @buffer = []
30
+ @timeout, @notifier, @exit = timeout, notifier, exit_on_success
31
+
32
+ window = Gtk::Window.new 'Gtk2KeyPress123'
33
+
34
+ window.add(Gtk::Label.new("Press 1 or more Keys!"))
35
+
36
+ key = super(window)
37
+ window.set_default_size(300, 120).show_all
38
+
39
+ window.signal_connect( "destroy" ) {
40
+ destroy( nil )
41
+ }
42
+
43
+ end
44
+
45
+ def on_keypress(e)
46
+
47
+ t = Time.now
48
+ puts 'key press ' + e.name if @debug
49
+ @buffer ||= []
50
+ @buffer << e.name
51
+
52
+ Thread.new do
53
+
54
+ # after the time has elapsed the message will be sent unless
55
+ # the buffer is empty
56
+
57
+ while t + @timeout > Time.now do
58
+ sleep 0.2
59
+ end
60
+
61
+ if @buffer.length > 0 then
62
+
63
+ destroy(nil) if @h and @terminator == @buffer.join
64
+
65
+ if @h and @notifier then
66
+ s = @buffer.all? {|x| x.length < 2} ? '' : ', '
67
+ fqm = @h[@buffer.join(s)]
68
+ @notifier.notice fqm if fqm
69
+ end
70
+
71
+ @buffer = []
72
+
73
+ if @exit then
74
+ puts 'bye'
75
+ sleep 0.4
76
+ exit
77
+ end
78
+ end
79
+
80
+ end
81
+
82
+ end
83
+
84
+ def start
85
+ Gtk.main
86
+ end
87
+
88
+ private
89
+
90
+ def destroy( widget)
91
+ Gtk.main_quit
92
+ end
93
+
94
+
95
+ end
96
+
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gtk2keypress123
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwODA1MTgwOTM2WhcN
15
+ MTkwODA1MTgwOTM2WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDVQvPW
17
+ jPNZ8TnRqmsCngqHO228aXv2DGp3zg5eFFzUuV9MP98v74bJoJqkHr0m6IyQVk0n
18
+ oXN6Yce+UxacEhdlfkku1Hu/EpWPLaRyasbhP4QApBHaExilbZpqbPi+yLQ3kyUQ
19
+ vFtIvf+2eUiX3tYItdsJfCTNIh4WvvgJTzKTATl/i4xp+f3ylYMWyn7vOzEGPYmU
20
+ XBaMoYsGRoR07ZJYvsG/mu+K1sItxnnvV3kWD3KSJwJBNhDT3Y/t8+bvKPtFfqBY
21
+ QxXZzKKW/fACGjVRh2euyCIGuXL17XBAMVcqH0ZtDRu9gMy1q6jRBZfMx/DUZYCF
22
+ I5ZdDWY1yI6AAR73AgMBAAGjgYowgYcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
23
+ HQYDVR0OBBYEFLjEqvcBv3X7o2wN+qdvQAZjGDSLMCYGA1UdEQQfMB2BG2dlbW1h
24
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTAmBgNVHRIEHzAdgRtnZW1tYXN0ZXJAamFt
25
+ ZXNyb2JlcnRzb24uZXUwDQYJKoZIhvcNAQEFBQADggEBAGIyrIubmMiGhEPO/32V
26
+ AECly24yQswjRELDidcq8EZGvCoHyGqOQjYLWix2gm6ZcjrvJL7N3ub9t7eLez1s
27
+ V7qm9t2k/dyHXO0EOvirGLMPFmvYQqXVTJbBY9lz751u9CJjVUWQlirgFX4TWxUV
28
+ e3Ze4VmZjLq8jt2FuGAlIQrQ8msAXQ4CbJ9jUwMMH8L5MT7gGE0B5LhwHp2a9ACA
29
+ 9eWnvveaX8nHv2n5xqTT23/o9F6WiCxMiZe2e4X2O8fRXgQYH1InWVLtITE0g10S
30
+ POA9e2vRKMc+552RSt8TBGm2LDRih+iul+eRcDW6ZDeVy+AKOsL+ANsI/T1URGKH
31
+ as8=
32
+ -----END CERTIFICATE-----
33
+ date: 2018-08-05 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: gtk2
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '3.2'
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 3.2.7
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - "~>"
50
+ - !ruby/object:Gem::Version
51
+ version: '3.2'
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.7
55
+ - !ruby/object:Gem::Dependency
56
+ name: gtk2keypress
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.1'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.1.1
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '0.1'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.1.1
75
+ - !ruby/object:Gem::Dependency
76
+ name: dynarex
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.8'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 1.8.1
85
+ type: :runtime
86
+ prerelease: false
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '1.8'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 1.8.1
95
+ description:
96
+ email: james@jamesrobertson.eu
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - lib/gtk2keypress123.rb
102
+ homepage: https://github.com/jrobertson/gtk2keypress123
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.6.13
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: A minimal GTK2 app which captures 1 or more key presses which can trigger
126
+ outgoing notifications.
127
+ test_files: []
metadata.gz.sig ADDED
Binary file