mireru 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c15bcd415d1a41b3c251afb76654223b50a5874
4
- data.tar.gz: eeb5d54078f6bbe1cd12b6fa4cc0fcac6d18cbdc
3
+ metadata.gz: 3092881913c725d4b4f66aaf07ce442427af5909
4
+ data.tar.gz: 0e0815117616556cf38b6e526b44ccaebedfbfbd
5
5
  SHA512:
6
- metadata.gz: b39993b1e4524e098ad9f7afe5bd5448f54740193092d804022f951e3d8f2c9f0f16b0c84773aebd02f0a9f445afeeac10202c5d7ffec5acd62d63614cec6b5f
7
- data.tar.gz: c72652188dc900e843c31b9e667dfb5edea100c964a9035cf4067016bd14fce169b1b397897f1be1a7f44c0dfb7f068a4f8127f0e66319a31367a4cedf279b43
6
+ metadata.gz: bc329b923edff0cabd97d4934764c70adb933e7a2941ffcc4247a8559baa1f0b85e35066375db61a96490c974c005219663c4447bccaca8606fd8431bbf0a236
7
+ data.tar.gz: 124ed5eb488e633a91fa455546c16cec01de2df57060a8dace25adcec8d6f16c426943f5bcc5151ea9352eaf4a23bf00ce6fd28782cc61a55c0502bb0bd34683
@@ -9,11 +9,13 @@ rvm:
9
9
  - 1.9.3
10
10
  - 2.0.0
11
11
  - 2.1
12
+ - 2.2
12
13
  # - rbx-2
13
14
  - ruby-head
14
15
  matrix:
15
16
  allow_failures:
16
17
  # - rvm: rbx-2
18
+ - rvm: ruby-head
17
19
  fast_finish: true
18
20
  before_install:
19
21
  - ./travis-before-script.sh
data/NEWS.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # NEWS
2
2
 
3
+ ## 0.9.3: 2015-05-12
4
+
5
+ ### Improvements
6
+
7
+ * Use Ruby-GNOME2 2.2.4 or later.
8
+ * Added status bar.
9
+ * Added --width and --height option.
10
+ * Rescue LoadError for extended file types.
11
+
3
12
  ## 0.9.2: 2014-10-19
4
13
 
5
14
  ### Changes
@@ -70,6 +70,14 @@ module Mireru
70
70
  "Hide empty directory") do |boolean|
71
71
  options[:compact] = boolean
72
72
  end
73
+ parser.on("--width=WIDTH",
74
+ "Set window width", Integer) do |width|
75
+ options[:width] = width
76
+ end
77
+ parser.on("--height=HEIGHT",
78
+ "Set window height", Integer) do |height|
79
+ options[:height] = height
80
+ end
73
81
  parser.parse!(arguments)
74
82
 
75
83
  options
@@ -0,0 +1,39 @@
1
+ # Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
2
+ #
3
+ # This program is free software; you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation; either version 2 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License along
14
+ # with this program; if not, write to the Free Software Foundation, Inc.,
15
+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
+
17
+ require "gtk3"
18
+
19
+ module Mireru
20
+ class StatusBar < Gtk::Label
21
+ def initialize
22
+ super()
23
+ @file = nil
24
+ end
25
+
26
+ def set_file(file)
27
+ @file = file
28
+ self.text = "#{modified_time_info}, #{size_info}"
29
+ end
30
+
31
+ def modified_time_info
32
+ "updated: #{File.mtime(@file).strftime("%Y-%m-%d %H:%M:%S")}"
33
+ end
34
+
35
+ def size_info
36
+ "size: #{File.size(@file) / 1024} KiB"
37
+ end
38
+ end
39
+ end
@@ -15,5 +15,5 @@
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
17
  module Mireru
18
- VERSION = "0.9.2"
18
+ VERSION = "0.9.3"
19
19
  end
@@ -15,10 +15,6 @@
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
17
  require "mireru/widget/image"
18
- require "mireru/widget/video"
19
- require "mireru/widget/pdf"
20
- require "mireru/widget/svg"
21
- require "mireru/widget/extracted_text"
22
18
  require "mireru/widget/text"
23
19
  require "mireru/widget/binary"
24
20
 
@@ -27,21 +23,51 @@ module Mireru
27
23
  module_function
28
24
  def create(file, width, height, chupa=false)
29
25
  if chupa
30
- widget = Widget::ExtractedText.new(file)
31
- elsif image?(file)
32
- widget = Widget::Image.new(file, width, height)
33
- elsif video?(file) or music?(file)
34
- widget = Widget::Video.new(file)
35
- elsif pdf?(file)
36
- widget = Widget::PDF.new(file)
37
- elsif svg?(file)
38
- widget = Widget::SVG.new(file)
39
- elsif text?(file)
40
- widget = Widget::Text.new(file)
41
- else
42
- widget = Widget::Binary.new(file)
26
+ check do
27
+ require "mireru/widget/extracted_text"
28
+ return Widget::ExtractedText.new(file)
29
+ end
30
+ end
31
+
32
+ if image?(file)
33
+ return Widget::Image.new(file, width, height)
34
+ end
35
+
36
+ if video?(file) or music?(file)
37
+ check do
38
+ require "mireru/widget/video"
39
+ return Widget::Video.new(file)
40
+ end
41
+ end
42
+
43
+ if pdf?(file)
44
+ check do
45
+ require "mireru/widget/pdf"
46
+ return Widget::PDF.new(file)
47
+ end
48
+ end
49
+
50
+ if svg?(file)
51
+ check do
52
+ require "mireru/widget/svg"
53
+ return Widget::SVG.new(file)
54
+ end
55
+ end
56
+
57
+ if text?(file)
58
+ return Widget::Text.new(file)
59
+ end
60
+
61
+ return Widget::Binary.new(file)
62
+ end
63
+
64
+ # TODO: improve
65
+ def check
66
+ begin
67
+ yield
68
+ rescue LoadError
69
+ $stderr.puts("Warning: #{$!.message}")
43
70
  end
44
- widget
45
71
  end
46
72
 
47
73
  def image?(file)
@@ -17,6 +17,7 @@
17
17
  require "gtk3"
18
18
  require "mireru/widget"
19
19
  require "mireru/navigator"
20
+ require "mireru/status_bar"
20
21
 
21
22
  module Mireru
22
23
  class Window < Gtk::Window
@@ -32,11 +33,23 @@ module Mireru
32
33
  @navigator = Navigator.new(self, files, options)
33
34
  @paned.add(@navigator)
34
35
 
36
+ @main_vbox = Gtk::Box.new(:vertical)
37
+ @paned.add(@main_vbox)
38
+
35
39
  @scroll = Gtk::ScrolledWindow.new
36
40
  @scroll.set_policy(:automatic, :automatic)
37
- @paned.add(@scroll)
38
-
39
- set_default_size(800, 600)
41
+ @main_vbox.pack_start(@scroll, :expand => true,
42
+ :fill => true,
43
+ :padding => 0)
44
+
45
+ @status_bar = StatusBar.new
46
+ @main_vbox.pack_end(@status_bar, :expand => false,
47
+ :fill => false,
48
+ :padding => 0)
49
+
50
+ @default_width = options[:width] || 800
51
+ @default_height = options[:height] || 600
52
+ set_default_size(@default_width, @default_height)
40
53
  signal_connect("destroy") do
41
54
  Gtk.main_quit
42
55
  end
@@ -60,6 +73,7 @@ module Mireru
60
73
  else
61
74
  @scroll.add_with_viewport(@widget)
62
75
  end
76
+ @status_bar.set_file(file)
63
77
  show_all
64
78
  end
65
79
 
@@ -142,13 +156,13 @@ module Mireru
142
156
  when Gdk::Keyval::KEY_h
143
157
  @scroll.hadjustment.value -= 17
144
158
  when Gdk::Keyval::KEY_j
145
- if @widget.is_a?(Widget::PDF)
159
+ if @widget.class.name == "PDF" # TODO: improve
146
160
  @widget.next
147
161
  else
148
162
  @scroll.vadjustment.value += 17
149
163
  end
150
164
  when Gdk::Keyval::KEY_k
151
- if @widget.is_a?(Widget::PDF)
165
+ if @widget.class.name == "PDF" # TODO: improve
152
166
  @widget.prev
153
167
  else
154
168
  @scroll.vadjustment.value -= 17
@@ -19,12 +19,11 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_runtime_dependency("gtk3", "2.2.2")
23
- spec.add_runtime_dependency("gtksourceview3", "2.2.2")
24
- spec.add_runtime_dependency("clutter-gtk", "2.2.2")
25
- spec.add_runtime_dependency("clutter-gstreamer", "2.2.2")
26
- spec.add_runtime_dependency("poppler", "2.2.2")
27
- spec.add_runtime_dependency("rsvg2", "2.2.2")
22
+ spec.add_runtime_dependency("gtksourceview3", ">= 2.2.4")
23
+ spec.add_runtime_dependency("clutter-gtk", ">= 2.2.4")
24
+ spec.add_runtime_dependency("clutter-gstreamer", ">= 2.2.4")
25
+ spec.add_runtime_dependency("poppler", ">= 2.2.4")
26
+ spec.add_runtime_dependency("rsvg2", ">= 2.2.4")
28
27
  spec.add_runtime_dependency("hexdump")
29
28
  spec.add_runtime_dependency("chupa-text")
30
29
  spec.add_runtime_dependency("chupa-text-decomposer-html")
@@ -23,28 +23,35 @@ class WindowTest < Test::Unit::TestCase
23
23
  @window = Mireru::Window.new([])
24
24
  end
25
25
 
26
- class AddFromFileTest
27
- def test_scrollable
26
+ class AddFromFileTest < self
27
+ def test_textview
28
28
  file = __FILE__
29
- mock(Mireru::Widget).new(file, *@window.size) do
29
+ stub(Mireru::Widget).create do
30
30
  Gtk::TextView.new
31
31
  end
32
- mock(@window).show_all
32
+ stub(@window).show_all
33
33
  @window.add_from_file(file)
34
- assert_equal(Gtk::ScrolledWindow, @window.child.class)
35
- assert_equal(Gtk::TextView, @window.child.child.class)
34
+ pane = @window.child
35
+ vbox = pane.child2
36
+ scrolled_window = vbox.children[0]
37
+ widget = scrolled_window.child
38
+ assert_kind_of(Gtk::TextView, widget)
36
39
  end
37
40
 
38
- def test_no_scrollable
41
+ def test_viewport
39
42
  file = File.join(fixtures_dir, "nijip.png")
40
- mock(Mireru::Widget).new(file, *@window.size) do
43
+ stub(Mireru::Widget).create do
41
44
  Gtk::Image.new
42
45
  end
43
- mock(@window).show_all
46
+ stub(@window).show_all
44
47
  @window.add_from_file(file)
45
- assert_equal(Gtk::ScrolledWindow, @window.child.class)
46
- assert_equal(Gtk::Viewport, @window.child.child.class)
47
- assert_equal(Gtk::Image, @window.child.child.child.class)
48
+ pane = @window.child
49
+ vbox = pane.child2
50
+ scrolled_window = vbox.children[0]
51
+ view_port = scrolled_window.child
52
+ assert_kind_of(Gtk::Viewport, view_port)
53
+ widget = view_port.child
54
+ assert_kind_of(Gtk::Image, widget)
48
55
  end
49
56
  end
50
57
  end
metadata CHANGED
@@ -1,99 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mireru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Yokoyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-19 00:00:00.000000000 Z
11
+ date: 2015-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: gtk3
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 2.2.2
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 2.2.2
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: gtksourceview3
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - '='
17
+ - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: 2.2.2
19
+ version: 2.2.4
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
- - - '='
24
+ - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: 2.2.2
26
+ version: 2.2.4
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: clutter-gtk
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - '='
31
+ - - ">="
46
32
  - !ruby/object:Gem::Version
47
- version: 2.2.2
33
+ version: 2.2.4
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - '='
38
+ - - ">="
53
39
  - !ruby/object:Gem::Version
54
- version: 2.2.2
40
+ version: 2.2.4
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: clutter-gstreamer
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - '='
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: 2.2.2
47
+ version: 2.2.4
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - '='
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: 2.2.2
54
+ version: 2.2.4
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: poppler
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - '='
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: 2.2.2
61
+ version: 2.2.4
76
62
  type: :runtime
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - '='
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: 2.2.2
68
+ version: 2.2.4
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rsvg2
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - '='
73
+ - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: 2.2.2
75
+ version: 2.2.4
90
76
  type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - '='
80
+ - - ">="
95
81
  - !ruby/object:Gem::Version
96
- version: 2.2.2
82
+ version: 2.2.4
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: hexdump
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -254,6 +240,7 @@ files:
254
240
  - lib/mireru/command.rb
255
241
  - lib/mireru/logger.rb
256
242
  - lib/mireru/navigator.rb
243
+ - lib/mireru/status_bar.rb
257
244
  - lib/mireru/version.rb
258
245
  - lib/mireru/widget.rb
259
246
  - lib/mireru/widget/binary.rb
@@ -318,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
305
  version: '0'
319
306
  requirements: []
320
307
  rubyforge_project:
321
- rubygems_version: 2.4.1
308
+ rubygems_version: 2.4.5
322
309
  signing_key:
323
310
  specification_version: 4
324
311
  summary: Keyboard friendly multitype file viewer by Ruby/GTK3.
@@ -342,3 +329,4 @@ test_files:
342
329
  - test/widget/test-svg.rb
343
330
  - test/widget/test-text.rb
344
331
  - test/widget/test-video.rb
332
+ has_rdoc: