straight_shooter 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -20,6 +20,8 @@ See the ubuntu-setup.sh file for a nice script to install everything you need fo
20
20
 
21
21
  ## TODO
22
22
 
23
+ * Better color depth
24
+ * Fonts!
23
25
  * Make it possible to start xvfb if it's not already running and have Qt use it for rendering
24
26
  * How to run without xvfb?
25
27
  * Prereq install instructions for more platforms
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/bin/straight_shooter CHANGED
@@ -1,11 +1,9 @@
1
- require "straight_shooter/page"
1
+ #! /usr/evn/ruby
2
+
3
+ require "straight_shooter"
2
4
 
3
5
  unless ARGV.length > 0
4
6
  puts "usage: xvfb-run -a straight_shooter http://google.com result.png"
5
7
  end
6
8
 
7
- App = Qt::Application.new(ARGV)
8
-
9
- Page.new(ARGV[0], ARGV[1]).load!
10
-
11
- App.exec
9
+ StraightShooter.render(ARGV[0], ARGV[1])
@@ -1 +1,25 @@
1
+ require "Qt"
2
+ require "qtwebkit"
1
3
  require "straight_shooter/page"
4
+
5
+ class StraightShooter
6
+
7
+ attr_accessor :page, :app
8
+
9
+ def self.render(url, filename = nil)
10
+ self.new(url, filename).run!
11
+ end
12
+
13
+ def initialize(url, filename = nil)
14
+ self.app = Qt::Application.new(ARGV)
15
+ self.page = Page.new(ARGV[0], ARGV[1])
16
+ page.connect(page, SIGNAL('finished(bool)'), app, SLOT('quit()'))
17
+ end
18
+
19
+ def run
20
+ page.load!
21
+ app.exec
22
+ end
23
+ alias :run! :run
24
+
25
+ end
@@ -3,6 +3,7 @@ require "qtwebkit"
3
3
 
4
4
  class Page < Qt::Object
5
5
 
6
+ signals 'finished(bool)'
6
7
  slots 'started()', 'render(bool)'
7
8
 
8
9
  attr_accessor :url, :filename, :web, :page
@@ -10,8 +11,6 @@ class Page < Qt::Object
10
11
  def initialize(url, filename = nil)
11
12
  super()
12
13
 
13
- app # to init the app
14
-
15
14
  self.url = url
16
15
  self.filename = filename ? filename.gsub(/.png$/, "") + ".png" : url.split("//").last.split("/").first + ".png"
17
16
 
@@ -45,7 +44,7 @@ class Page < Qt::Object
45
44
  puts "Page failed to load. No image was saved."
46
45
  end
47
46
 
48
- App.quit
47
+ emit finished(ok)
49
48
  end
50
49
 
51
50
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{straight_shooter}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nathan Herald"]
@@ -16,16 +16,13 @@ Gem::Specification.new do |s|
16
16
  s.executables = ["straight_shooter"]
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE",
19
- "README.markdown",
20
- "TODO"
19
+ "README.markdown"
21
20
  ]
22
21
  s.files = [
23
22
  ".gitignore",
24
- "FIXME",
25
23
  "LICENSE",
26
24
  "README.markdown",
27
25
  "Rakefile",
28
- "TODO",
29
26
  "VERSION",
30
27
  "bin/straight_shooter",
31
28
  "lib/straight_shooter.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: straight_shooter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Herald
@@ -31,14 +31,11 @@ extensions: []
31
31
  extra_rdoc_files:
32
32
  - LICENSE
33
33
  - README.markdown
34
- - TODO
35
34
  files:
36
35
  - .gitignore
37
- - FIXME
38
36
  - LICENSE
39
37
  - README.markdown
40
38
  - Rakefile
41
- - TODO
42
39
  - VERSION
43
40
  - bin/straight_shooter
44
41
  - lib/straight_shooter.rb
data/FIXME DELETED
File without changes
data/TODO DELETED
File without changes