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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddf586a2255db2248e8ad776f217f2fdd3eebe34
4
- data.tar.gz: 706baf185210709db3be9855b2bac867022ee388
3
+ metadata.gz: 339a1ea1a09d13f2e2dabb6ce27ba43dede53e19
4
+ data.tar.gz: 1535976c0781bc36df4531d0bf1656a3c6187c17
5
5
  SHA512:
6
- metadata.gz: a1c31305810de07d7e8f5f6a4e4d91fe18f93191fa5d0edfe1bc6e62a5d2aba72335e80b3d53b05e82d400e56b59ec57bd5bafd7fc20c242ec908110f8a04dff
7
- data.tar.gz: b10be34d19beed5722843a5f3758acfd2de4a2b828d592d480c5b398512fed10e40983ba45a607a04910f9b3e9d01258737196dc0b2a3acb648a1bec6aab8938
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
- * fix rdoc issue
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
- * Working JRuby installation(nothing else!)
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
- == Getting Started:
37
+ == GETTING STARTED:
38
38
 
39
- Step 1 : After installing gem, you can simply run following command once only in your console/terminal.
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 3 : After running above command, one pop-up window will open. You can take screenshot from File > Take Screenshot
48
- or by right clicking system tray icon.
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
 
@@ -1,24 +1,27 @@
1
1
  class Screenshot
2
2
  include Java
3
3
 
4
- import java.awt.Desktop
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(filename = 'screenshot.png')
11
- sleep 1
12
- robot = Robot.new
13
- toolkit = Toolkit.get_default_toolkit
14
- dim = toolkit.get_screen_size
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
- desktop = Desktop.get_desktop
21
- desktop.open(file)
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= 'Tray Application')
8
+ def initialize(name)
9
9
  @menu_items = []
10
- @name = name
11
- puts "Application is started successfully!! Right click on Tray Icon"
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
- item.add_action_listener(block)
16
+ item.add_action_listener(block)
17
17
 
18
- @menu_items << item
18
+ @menu_items << item
19
19
  end
20
20
 
21
21
  def run
22
22
  popup = java.awt.PopupMenu.new
23
- @menu_items.each { |i| popup.add(i)}
23
+ @menu_items.each { |i| popup.add(i)}
24
24
  abs_path = File.dirname(__FILE__)
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
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
- tray = java.awt.SystemTray::system_tray
30
- tray.add(tray_icon)
29
+ tray = java.awt.SystemTray::system_tray
30
+ tray.add(tray_icon)
31
31
  end
32
32
  end
@@ -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 { Screenshot.capture }
30
- fileNew.setAccelerator KeyStroke.getKeyStroke KeyEvent::VK_Q, 10
31
- #10 is a combination of 8 + 2, 8 is ALT, 2 is CTRL
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.2
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-10 00:00:00.000000000 Z
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: '0'
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: deskshot!
51
+ summary: Desktop application for taking screenshot
52
52
  test_files: []