clipboard_manager 1.1.1 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89604845d3cd62950a1d472cd56d92567c7e6204
4
- data.tar.gz: c356ec8f38ab35d00eb476392d3ee8fc270098ae
3
+ metadata.gz: c839018d87470f0e0ef14880764ab2ff0d413505
4
+ data.tar.gz: 1643003d620045d60cf89ccf7548ee617387365d
5
5
  SHA512:
6
- metadata.gz: b05626e3889af33830921e33988d209fff5184643c51ecff5938497bab1764abc2a79358b74f1d530b4083d77b7e8781b121ccf191b4d34d4dc8840cc9a3851d
7
- data.tar.gz: 3705e8887d7f1830c84cb403f81d11962f6220e90d82cf14493c36f31f3666ef5638ddbd9db955beeb5c0acdb256d56315b3a96e0903ceea82a639eac87d235e
6
+ metadata.gz: 0144ebd1f91464cec7f7f233b51e1f227d789eb134544488c026d94a0728b4d5012803b3a715e6e73ddfe7ea77726c570608daeb7867a63a18317dfd852d3876
7
+ data.tar.gz: d48b9dd77d6d9d7cf3f850d626ac252b85723e27f909df85b748644ee3add1d01c1abc4a1e3e8f2c41f5654c7fde24aaffcab0d3146a52a4e7f12903a82a0973
data/README.rdoc CHANGED
@@ -72,6 +72,15 @@ See clipboard_manager/clipboard_manager.rb[https://github.com/carlosjhr64/clipbo
72
72
  for details.
73
73
  Specifically, methods #espeak, #firefox, and #bashit, which are called from #manage.
74
74
 
75
+ == HELP:
76
+
77
+ Usage:
78
+ clipboard_manager [:options+]
79
+ Options:
80
+ -v --version
81
+ -h --help
82
+
83
+
75
84
  == LICENSE:
76
85
 
77
86
  (The MIT License)
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ module ClipboardManager
3
+ VERSION = '2.0.0'
4
+ if _ = ARGV.shift
5
+ if ['-v','--version'].include?(_)
6
+ puts VERSION
7
+ exit 0
8
+ end
9
+ puts <<-HELP
10
+ Usage:
11
+ clipboard_manager [:options+]
12
+ Options:
13
+ -v --version
14
+ -h --help
15
+ HELP
16
+ exit 0
17
+ end
18
+ end
19
+ require 'clipboard_manager'
20
+ Gtk3App.main ClipboardManager
data/data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 2.0.0
@@ -2,10 +2,10 @@
2
2
  require 'timeout'
3
3
 
4
4
  # Work gems
5
+ require 'gtk3app'
5
6
  require 'helpema/zbar'
6
7
 
7
8
  # This Gem
8
- require_relative 'clipboard_manager/version.rb'
9
9
  require_relative 'clipboard_manager/config.rb'
10
10
  require_relative 'clipboard_manager/clipboard_manager.rb'
11
11
 
@@ -1,14 +1,6 @@
1
1
  module ClipboardManager
2
2
  using Rafini::Exception
3
3
 
4
- def self.options=(opts)
5
- @@options=opts
6
- end
7
-
8
- def self.options
9
- @@options
10
- end
11
-
12
4
  def self.run(program)
13
5
  ClipboardManager.new(program)
14
6
  end
@@ -20,22 +12,22 @@ class ClipboardManager
20
12
  @image = program.mini.children.first
21
13
  @timer = nil
22
14
 
23
- @working = Gdk::Pixbuf.new(file: CONFIG[:Working])
24
- @ok = Gdk::Pixbuf.new(file: CONFIG[:Ok])
25
- @nope = Gdk::Pixbuf.new(file: CONFIG[:Nope])
26
- @ready = Gdk::Pixbuf.new(file: CONFIG[:Ready])
27
- @off = Gdk::Pixbuf.new(file: CONFIG[:Off])
15
+ @working = GdkPixbuf::Pixbuf.new(file: CONFIG[:Working])
16
+ @ok = GdkPixbuf::Pixbuf.new(file: CONFIG[:Ok])
17
+ @nope = GdkPixbuf::Pixbuf.new(file: CONFIG[:Nope])
18
+ @ready = GdkPixbuf::Pixbuf.new(file: CONFIG[:Ready])
19
+ @off = GdkPixbuf::Pixbuf.new(file: CONFIG[:Off])
28
20
 
29
21
  @is_pwd = Regexp.new(CONFIG[:IsPwd], Regexp::EXTENDED)
30
22
 
31
- window = program.window
32
- vbox = Such::Box.new window, :vbox!
23
+ @window = program.window
24
+ vbox = Such::Box.new @window, :vbox!
33
25
 
34
26
  @running = Such::CheckButton.new(vbox, :running!, 'toggled'){toggled}
35
- @running.active = ::ClipboardManager.options[:running, true]
27
+ @running.active = true
36
28
 
37
29
  @ask = Such::CheckButton.new vbox, :ask!
38
- @ask.active = ::ClipboardManager.options[:ask, true]
30
+ @ask.active = true
39
31
 
40
32
  Such::Label.new vbox, :tasks!
41
33
 
@@ -64,12 +56,13 @@ class ClipboardManager
64
56
  end
65
57
 
66
58
  status(@ready)
67
- window.show_all
59
+ @window.show_all
68
60
  end
69
61
 
70
62
  # https://github.com/ruby-gnome2/ruby-gnome2/blob/master/gtk3/sample/misc/dialog.rb
71
63
  def do_history!
72
64
  dialog = Gtk3App::Dialog::CancelOk.new(:history_dialog!)
65
+ dialog.transient_for = @window
73
66
  combo = dialog.combo :history_combo!
74
67
  @history.each do |str|
75
68
  if str.length > CONFIG[:MaxString]
@@ -87,7 +80,7 @@ class ClipboardManager
87
80
  end
88
81
 
89
82
  def do_qrcode!
90
- qrcode = Helpema::ZBar.qrcode(CONFIG[:QrcTimeOut])
83
+ qrcode = Helpema::ZBar.cam(CONFIG[:QrcTimeOut])
91
84
  if qrcode.nil?
92
85
  CLIPBOARD.clear
93
86
  status(@nope)
@@ -100,6 +93,7 @@ class ClipboardManager
100
93
  def question?(name)
101
94
  return true unless @ask.active?
102
95
  dialog = Gtk3App::Dialog::NoYes.new :question_dialog!
96
+ dialog.transient_for = @window
103
97
  dialog.label.text = "Run #{name}?"
104
98
  dialog.runs
105
99
  end
@@ -115,9 +109,11 @@ class ClipboardManager
115
109
  end
116
110
 
117
111
  def request_text
118
- text = CLIPBOARD.wait_for_text
119
- text = nil if @is_pwd=~text
120
- return text
112
+ if text = CLIPBOARD.wait_for_text
113
+ text.strip!
114
+ return text unless text.empty? or @is_pwd.match?(text)
115
+ end
116
+ nil
121
117
  end
122
118
 
123
119
  def status(type)
@@ -1,15 +1,6 @@
1
1
  module ClipboardManager
2
2
  using Rafini::String
3
3
 
4
- help = <<-HELP
5
- Usage: gtk3app clipboardmanager [options]
6
- Options:
7
- --ask Ask for confirmation.
8
- --running Start in active mode.
9
- Default for options is true,
10
- use no-ask and no-running for false.
11
- HELP
12
-
13
4
  APPDIR = File.dirname File.dirname __dir__
14
5
 
15
6
  is_pwd =
@@ -29,14 +20,12 @@ use no-ask and no-running for false.
29
20
  #s0 = Rafini::Empty::STRING
30
21
 
31
22
  CONFIG = {
32
- Help: help,
33
-
34
23
  StatusTimeOut: 3,
35
24
  Sleep: 750,
36
25
  MaxHistory: 13,
37
26
  MaxString: 60,
38
27
 
39
- QrcTimeOut: 3,
28
+ QrcTimeOut: 12,
40
29
 
41
30
  IsPwd: is_pwd,
42
31
 
@@ -63,13 +52,13 @@ use no-ask and no-running for false.
63
52
  set_website_label: 'See it at GitHub!',
64
53
  },
65
54
 
66
- DO_TOGGLE: ['Toggle On/Off'],
55
+ DO_TOGGLE: [label:'Toggle On/Off'],
67
56
  do_toggle!: [:DO_TOGGLE, 'activate'],
68
57
 
69
- DO_HISTORY: ['History'],
58
+ DO_HISTORY: [label:'History'],
70
59
  do_history!: [:DO_HISTORY, 'activate'],
71
60
 
72
- DO_QRCODE: ['QR-Code'],
61
+ DO_QRCODE: [label:'QR-Code'],
73
62
  do_qrcode!: [:DO_QRCODE, 'activate'],
74
63
 
75
64
  window: {
@@ -126,7 +115,7 @@ use no-ask and no-running for false.
126
115
  :bashit,
127
116
  "wget --quiet -O - $(youtube-dl -f 5/36/17/18 -g '$1') | mplayer -really-quiet -cache 8192 -cache-min 1 -",
128
117
  ],
129
- firefox: ['^https?://www.amazon.com/', :firefox],
118
+ firefox: ['^https?://', :firefox],
130
119
  espeak: ['.{80,}', :espeak],
131
120
  }
132
121
  }
metadata CHANGED
@@ -1,44 +1,67 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clipboard_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.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: 2015-12-29 00:00:00.000000000 Z
11
+ date: 2017-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gtk3app
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.1
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: helpema
15
35
  requirement: !ruby/object:Gem::Requirement
16
36
  requirements:
17
37
  - - "~>"
18
38
  - !ruby/object:Gem::Version
19
- version: '0.1'
39
+ version: '1.0'
20
40
  - - ">="
21
41
  - !ruby/object:Gem::Version
22
- version: 0.1.0
42
+ version: 1.0.1
23
43
  type: :runtime
24
44
  prerelease: false
25
45
  version_requirements: !ruby/object:Gem::Requirement
26
46
  requirements:
27
47
  - - "~>"
28
48
  - !ruby/object:Gem::Version
29
- version: '0.1'
49
+ version: '1.0'
30
50
  - - ">="
31
51
  - !ruby/object:Gem::Version
32
- version: 0.1.0
33
- description: |
34
- Ruby Gtk3App Clipboard Manager.
52
+ version: 1.0.1
53
+ description: 'Ruby Gtk3App Clipboard Manager.
54
+
55
+ '
35
56
  email: carlosjhr64@gmail.com
36
- executables: []
57
+ executables:
58
+ - clipboard_manager
37
59
  extensions: []
38
60
  extra_rdoc_files:
39
61
  - README.rdoc
40
62
  files:
41
63
  - README.rdoc
64
+ - bin/clipboard_manager
42
65
  - data/VERSION
43
66
  - data/logo.png
44
67
  - data/nope.png
@@ -49,7 +72,6 @@ files:
49
72
  - lib/clipboard_manager.rb
50
73
  - lib/clipboard_manager/clipboard_manager.rb
51
74
  - lib/clipboard_manager/config.rb
52
- - lib/clipboard_manager/version.rb
53
75
  homepage: https://github.com/carlosjhr64/clipboard_manager
54
76
  licenses:
55
77
  - MIT
@@ -71,16 +93,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
93
  - !ruby/object:Gem::Version
72
94
  version: '0'
73
95
  requirements:
74
- - 'ruby: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]'
75
- - 'gtk3app: 1.5.1'
76
- - 'zbarcam: 0.10'
77
- - 'firefox: Mozilla Firefox 38.0.5'
78
- - 'espeak: eSpeak text-to-speech: 1.47.11 03.May.13 Data at: /usr/share/espeak-data'
79
- - 'wget: GNU Wget 1.16.1 built on linux-gnu.'
80
- - 'youtube-dl: 2015.12.18'
96
+ - 'ruby: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]'
81
97
  - 'system: linux/bash'
98
+ - 'zbarcam: 0.20'
99
+ - 'firefox: Mozilla Firefox 57.0.1'
100
+ - 'espeak: eSpeak text-to-speech: 1.48.03 04.Mar.14 Data at: /usr/share/espeak-data'
101
+ - 'wget: GNU Wget 1.19.2 built on linux-gnu.'
102
+ - 'youtube-dl: 2017.11.15'
82
103
  rubyforge_project:
83
- rubygems_version: 2.4.5.1
104
+ rubygems_version: 2.6.13
84
105
  signing_key:
85
106
  specification_version: 4
86
107
  summary: Ruby Gtk3App Clipboard Manager.
@@ -1,3 +0,0 @@
1
- module ClipboardManager
2
- VERSION = '1.1.1'
3
- end