deskshot 0.0.2 → 1.0.0.stable
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/CHANGELOG.rdoc +9 -1
- data/README.rdoc +5 -12
- data/lib/deskshot/screenshot.rb +16 -13
- data/lib/deskshot/tray.rb +11 -11
- data/lib/deskshot/tray_app.rb +2 -2
- data/lib/deskshot.rb +9 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 339a1ea1a09d13f2e2dabb6ce27ba43dede53e19
|
4
|
+
data.tar.gz: 1535976c0781bc36df4531d0bf1656a3c6187c17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a55de3632f33fe626ff9a6db7d7f0481c772832eeb7921f43c7ed55312fb936992015e424e37b08529f5345f8f63a58bb377e7dc5fbbc534a03edf8144c173c1
|
7
|
+
data.tar.gz: cd8747572766095f1ef3aa5947ac155bbb529c3597d91c1e44262f4e818530f7325c17fbb2e6cb2612e00c443485f4405e8d3d49ce34eff2c4fa8f3bb227e116
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
= deskshot CHANGELOG
|
2
2
|
|
3
|
+
== v1.0.0 [12-Feb-2014] :
|
4
|
+
|
5
|
+
* Hide menu when click on 'Take Screenshot'
|
6
|
+
* Save as Dialog for new screenshot
|
7
|
+
* Suppress warning
|
8
|
+
* Matured Product
|
9
|
+
* Update README
|
10
|
+
|
3
11
|
== v0.0.2 [10-Feb-2014] :
|
4
12
|
|
5
13
|
* Fix icon issue
|
6
|
-
*
|
14
|
+
* Fix rdoc issue
|
7
15
|
* Change shortcut to 'CTRL + ALT + Q' to remove conflict in Linux
|
8
16
|
|
9
17
|
== v0.0.1 [10-Feb-2014] :
|
data/README.rdoc
CHANGED
@@ -18,7 +18,7 @@ in Linux then It is for you also!
|
|
18
18
|
|
19
19
|
== REQUIREMENTS:
|
20
20
|
|
21
|
-
*
|
21
|
+
* You have to install JRuby if you already do not have. http://jruby.org/download
|
22
22
|
|
23
23
|
|
24
24
|
== INSTALL:
|
@@ -34,21 +34,14 @@ Install by running:
|
|
34
34
|
* https://rubygems.org/gems/deskshot
|
35
35
|
|
36
36
|
|
37
|
-
==
|
37
|
+
== GETTING STARTED:
|
38
38
|
|
39
|
-
Step 1 : After installing gem, you can simply run following command
|
40
|
-
|
41
|
-
irb -Ilib -rdeskshot
|
42
|
-
|
43
|
-
Step 2 : Next time onwards, you can simply use below command to run app.
|
39
|
+
Step 1 : After installing gem, you can simply run following command in your Windows console/Linux Terminal to start Deskshot app
|
44
40
|
|
45
41
|
irb -rdeskshot
|
46
42
|
|
47
|
-
Step
|
48
|
-
|
49
|
-
|
50
|
-
Step 4 : Actually there is no Step 4!! Just enjoy app if you like it!
|
51
|
-
|
43
|
+
Step 2 : To take screenshot, Follow File > Take Screenshot or by right clicking System Tray Icon.
|
44
|
+
Shortcut : Ctrl + Alt + Q (keep your deskshot app on top while using shortcut)
|
52
45
|
|
53
46
|
== LICENSE:
|
54
47
|
|
data/lib/deskshot/screenshot.rb
CHANGED
@@ -1,24 +1,27 @@
|
|
1
1
|
class Screenshot
|
2
2
|
include Java
|
3
3
|
|
4
|
-
import java.awt.
|
4
|
+
import java.awt.FileDialog #For File save as
|
5
5
|
import java.awt.Robot
|
6
6
|
import java.awt.Toolkit
|
7
7
|
import java.awt.Rectangle
|
8
8
|
import javax.imageio.ImageIO
|
9
9
|
|
10
|
-
def self.capture
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
rectangle = Rectangle.new(0, 0, dim.get_width, dim.get_height)
|
16
|
-
image = robot.create_screen_capture(rectangle)
|
17
|
-
file = java::io::File.new(filename)
|
18
|
-
ImageIO::write(image, "png", file)
|
10
|
+
def self.capture
|
11
|
+
begin
|
12
|
+
output = FileDialog.new(nil, "Save as", FileDialog::SAVE)
|
13
|
+
output.show
|
14
|
+
filename = output.getDirectory + output.getFile
|
19
15
|
|
20
|
-
|
21
|
-
|
16
|
+
sleep 0.5 #to avoide conflict of capturing own menu/window itself
|
17
|
+
robot = Robot.new
|
18
|
+
toolkit = Toolkit.get_default_toolkit
|
19
|
+
dim = toolkit.get_screen_size
|
20
|
+
rectangle = Rectangle.new(0, 0, dim.get_width, dim.get_height)
|
21
|
+
image = robot.create_screen_capture(rectangle)
|
22
|
+
file = java::io::File.new(filename)
|
23
|
+
ImageIO::write(image, "png", file)
|
24
|
+
rescue Exception
|
25
|
+
end
|
22
26
|
end
|
23
|
-
|
24
27
|
end
|
data/lib/deskshot/tray.rb
CHANGED
@@ -5,28 +5,28 @@ class TrayApplication
|
|
5
5
|
|
6
6
|
attr_accessor :menu_items
|
7
7
|
|
8
|
-
def initialize(name
|
8
|
+
def initialize(name)
|
9
9
|
@menu_items = []
|
10
|
-
|
11
|
-
|
10
|
+
@name = name
|
11
|
+
puts "Application is started successfully!! Right click on Tray Icon"
|
12
12
|
end
|
13
13
|
|
14
14
|
def item(label, &block)
|
15
15
|
item = java.awt.MenuItem.new(label)
|
16
|
-
|
16
|
+
item.add_action_listener(block)
|
17
17
|
|
18
|
-
|
18
|
+
@menu_items << item
|
19
19
|
end
|
20
20
|
|
21
21
|
def run
|
22
22
|
popup = java.awt.PopupMenu.new
|
23
|
-
|
23
|
+
@menu_items.each { |i| popup.add(i)}
|
24
24
|
abs_path = File.dirname(__FILE__)
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
image = java.awt.Toolkit::default_toolkit.get_image(abs_path + '/deskshot_icon.png')
|
26
|
+
tray_icon = TrayIcon.new(image, @name, popup)
|
27
|
+
tray_icon.image_auto_size = true
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
tray = java.awt.SystemTray::system_tray
|
30
|
+
tray.add(tray_icon)
|
31
31
|
end
|
32
32
|
end
|
data/lib/deskshot/tray_app.rb
CHANGED
@@ -2,6 +2,6 @@ require_relative 'tray'
|
|
2
2
|
require_relative 'screenshot'
|
3
3
|
|
4
4
|
app = TrayApplication.new('Deskshot')
|
5
|
-
app.item('Take Screenshot') {Screenshot.capture}
|
6
|
-
app.item('Exit') {java.lang.System::exit(0)}
|
5
|
+
app.item('Take Screenshot') { Screenshot.capture }
|
6
|
+
app.item('Exit') {puts "Exit!"; java.lang.System::exit(0)}
|
7
7
|
app.run
|
data/lib/deskshot.rb
CHANGED
@@ -23,15 +23,20 @@ class DeskShot < JFrame
|
|
23
23
|
menubar = JMenuBar.new
|
24
24
|
|
25
25
|
fileMenu = JMenu.new "File"
|
26
|
+
$VERBOSE = nil #to supress warning of setMnemonic
|
26
27
|
fileMenu.setMnemonic KeyEvent::VK_F
|
27
28
|
|
28
29
|
fileNew = JMenuItem.new "Take Screenshot!"
|
29
|
-
fileNew.addActionListener
|
30
|
-
|
31
|
-
|
30
|
+
fileNew.addActionListener do
|
31
|
+
self.setVisible false
|
32
|
+
Screenshot.capture
|
33
|
+
self.setVisible true
|
34
|
+
end
|
35
|
+
fileNew.setAccelerator KeyStroke.getKeyStroke KeyEvent::VK_Q, 10
|
36
|
+
#10 is a combination of 8 + 2, 8 is ALT, 2 is CTRL
|
32
37
|
|
33
38
|
fileExit = JMenuItem.new "Exit"
|
34
|
-
fileExit.addActionListener { System.exit 0 }
|
39
|
+
fileExit.addActionListener { puts "Exit!"; System.exit 0 }
|
35
40
|
fileExit.setAccelerator KeyStroke.getKeyStroke KeyEvent::VK_W, 2
|
36
41
|
|
37
42
|
fileMenu.add fileNew
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deskshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 1.0.0.stable
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Parth Bharadiya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Deskshot allows you to take screenshot of your desktop. It also has system tray application along with. It is implemented using JRuby
|
13
|
+
description: Deskshot allows you to take screenshot of your desktop. It also has system tray application along with. It is implemented using JRuby.
|
14
14
|
email: parthbharadiya007@gmail.com
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
@@ -39,14 +39,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
39
39
|
version: '0'
|
40
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
|
-
- - '
|
42
|
+
- - '>'
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
44
|
+
version: 1.3.1
|
45
45
|
requirements:
|
46
46
|
- Working installation of JRuby
|
47
47
|
rubyforge_project:
|
48
48
|
rubygems_version: 2.1.9
|
49
49
|
signing_key:
|
50
50
|
specification_version: 4
|
51
|
-
summary:
|
51
|
+
summary: Desktop application for taking screenshot
|
52
52
|
test_files: []
|