alexandria-book-collection-manager 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +31 -6
  3. data/.rubocop_todo.yml +33 -33
  4. data/.travis.yml +39 -0
  5. data/CHANGELOG.md +8 -0
  6. data/README.md +1 -1
  7. data/Rakefile +4 -2
  8. data/alexandria-book-collection-manager.gemspec +2 -1
  9. data/bin/alexandria +0 -10
  10. data/doc/FAQ +1 -2
  11. data/doc/dependency_decisions.yml +5 -5
  12. data/lib/alexandria.rb +3 -1
  13. data/lib/alexandria/book_providers.rb +1 -4
  14. data/lib/alexandria/book_providers/adlibris.rb +4 -20
  15. data/lib/alexandria/book_providers/amazon_aws.rb +15 -8
  16. data/lib/alexandria/book_providers/amazon_ecs_util.rb +16 -10
  17. data/lib/alexandria/book_providers/barnes_and_noble.rb +1 -1
  18. data/lib/alexandria/book_providers/douban.rb +2 -2
  19. data/lib/alexandria/book_providers/proxis.rb +6 -2
  20. data/lib/alexandria/book_providers/pseudomarc.rb +3 -1
  21. data/lib/alexandria/book_providers/siciliano.rb +24 -27
  22. data/lib/alexandria/book_providers/thalia.rb +1 -1
  23. data/lib/alexandria/book_providers/worldcat.rb +5 -3
  24. data/lib/alexandria/book_providers/z3950.rb +20 -14
  25. data/lib/alexandria/export_library.rb +15 -12
  26. data/lib/alexandria/import_library.rb +65 -65
  27. data/lib/alexandria/library_collection.rb +2 -1
  28. data/lib/alexandria/library_store.rb +18 -7
  29. data/lib/alexandria/models/book.rb +2 -1
  30. data/lib/alexandria/models/library.rb +9 -3
  31. data/lib/alexandria/preferences.rb +13 -6
  32. data/lib/alexandria/scanners/keyboard.rb +2 -2
  33. data/lib/alexandria/smart_library.rb +41 -39
  34. data/lib/alexandria/ui/acquire_dialog.rb +47 -48
  35. data/lib/alexandria/ui/alert_dialog.rb +2 -1
  36. data/lib/alexandria/ui/barcode_animation.rb +6 -5
  37. data/lib/alexandria/ui/book_properties_dialog_base.rb +7 -3
  38. data/lib/alexandria/ui/callbacks.rb +14 -7
  39. data/lib/alexandria/ui/dndable.rb +1 -1
  40. data/lib/alexandria/ui/export_dialog.rb +0 -2
  41. data/lib/alexandria/ui/icons.rb +2 -1
  42. data/lib/alexandria/ui/iconview.rb +5 -3
  43. data/lib/alexandria/ui/import_dialog.rb +6 -8
  44. data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +4 -3
  45. data/lib/alexandria/ui/listview.rb +34 -31
  46. data/lib/alexandria/ui/multi_drag_treeview.rb +3 -2
  47. data/lib/alexandria/ui/new_book_dialog.rb +28 -30
  48. data/lib/alexandria/ui/new_book_dialog_manual.rb +3 -1
  49. data/lib/alexandria/ui/provider_preferences_base_dialog.rb +2 -1
  50. data/lib/alexandria/ui/sidepane_manager.rb +6 -3
  51. data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +5 -3
  52. data/lib/alexandria/ui/ui_manager.rb +22 -12
  53. data/lib/alexandria/version.rb +2 -2
  54. data/po/Makefile +2 -2
  55. data/share/alexandria/glade/acquire_dialog__builder.glade +1 -1
  56. data/share/alexandria/glade/book_properties_dialog__builder.glade +1 -1
  57. data/share/alexandria/glade/new_book_dialog__builder.glade +1 -1
  58. data/share/alexandria/glade/preferences_dialog__builder.glade +1 -1
  59. data/share/gnome/help/alexandria/C/introduction.xml +0 -4
  60. data/share/gnome/help/alexandria/C/searching.xml +1 -1
  61. data/share/gnome/help/alexandria/ja/introduction.xml +0 -4
  62. data/spec/alexandria/book_providers_spec.rb +12 -16
  63. data/spec/alexandria/console_spec.rb +1 -1
  64. data/spec/alexandria/ui/main_app_spec.rb +4 -31
  65. data/spec/alexandria/ui/really_delete_dialog_spec.rb +2 -1
  66. data/tasks/spec.rake +6 -4
  67. data/util/rake/fileinstall.rb +3 -1
  68. metadata +19 -7
  69. data/dogtail/basic_run_test.py +0 -9
  70. data/lib/alexandria/book_providers/renaud.rb +0 -142
  71. data/tasks/dogtail.rake +0 -6
@@ -80,80 +80,80 @@ module Alexandria
80
80
  FileUtils.rm_rf(tmpdir) if File.exist?(tmpdir)
81
81
  Dir.mkdir(tmpdir)
82
82
  Dir.chdir(tmpdir) do
83
- begin
84
- system("unzip -qq \"#{filename}\"")
85
- file = File.exist?("bookcase.xml") ? "bookcase.xml" : "tellico.xml"
86
- xml = REXML::Document.new(File.open(file))
87
- raise unless ["bookcase", "tellico"].include? xml.root.name
88
- # FIXME: handle multiple collections
89
- raise unless xml.root.elements.size == 1
83
+ system("unzip -qq \"#{filename}\"")
84
+ file = File.exist?("bookcase.xml") ? "bookcase.xml" : "tellico.xml"
85
+ xml = REXML::Document.new(File.open(file))
86
+ raise unless ["bookcase", "tellico"].include? xml.root.name
87
+ # FIXME: handle multiple collections
88
+ raise unless xml.root.elements.size == 1
90
89
 
91
- collection = xml.root.elements[1]
92
- raise unless collection.name == "collection"
90
+ collection = xml.root.elements[1]
91
+ raise unless collection.name == "collection"
93
92
 
94
- type = collection.attribute("type").value.to_i
95
- raise unless (type == 2) || (type == 5)
93
+ type = collection.attribute("type").value.to_i
94
+ raise unless (type == 2) || (type == 5)
96
95
 
97
- content = []
98
- entries = collection.elements.to_a("entry")
99
- (total = entries.size).times do |n|
100
- entry = entries[n]
101
- elements = entry.elements
102
- # Feed an array in here, tomorrow.
103
- keys = ["isbn", "publisher", "pub_year", "binding"]
96
+ content = []
97
+ entries = collection.elements.to_a("entry")
98
+ (total = entries.size).times do |n|
99
+ entry = entries[n]
100
+ elements = entry.elements
101
+ # Feed an array in here, tomorrow.
102
+ keys = ["isbn", "publisher", "pub_year", "binding"]
104
103
 
105
- book_elements = [neaten(elements["title"].text)]
106
- book_elements += if !elements["authors"].nil?
107
- [elements["authors"].elements.to_a.map \
108
- { |x| neaten(x.text) }]
109
- else
110
- [[]]
111
- end
112
- book_elements += keys.map do |key|
113
- neaten(elements[key].text) if elements[key]
114
- end
115
- # isbn
116
- if book_elements[2].nil? || book_elements[2].strip.empty?
117
- book_elements[2] = nil
118
- else
119
- begin
120
- book_elements[2] = book_elements[2].strip
121
- book_elements[2] = Library.canonicalise_ean(book_elements[2])
122
- rescue StandardError => ex
123
- puts book_elements[2]
124
- puts ex.message
125
- puts ex.backtrace.join("\n> ")
126
- raise ex
127
- end
128
- end
129
- book_elements[4] = book_elements[4].to_i unless book_elements[4].nil? # publishing_year
130
- puts book_elements.inspect
131
- cover = (neaten(elements["cover"].text) if elements["cover"])
132
- puts cover
133
- book = Book.new(*book_elements)
134
- if elements["rating"] && Book::VALID_RATINGS.member?(elements["rating"].text.to_i)
135
- book.rating = elements["rating"].text.to_i
104
+ book_elements = [neaten(elements["title"].text)]
105
+ book_elements += if !elements["authors"].nil?
106
+ [elements["authors"].elements.to_a.map \
107
+ { |x| neaten(x.text) }]
108
+ else
109
+ [[]]
110
+ end
111
+ book_elements += keys.map do |key|
112
+ neaten(elements[key].text) if elements[key]
113
+ end
114
+ # isbn
115
+ if book_elements[2].nil? || book_elements[2].strip.empty?
116
+ book_elements[2] = nil
117
+ else
118
+ begin
119
+ book_elements[2] = book_elements[2].strip
120
+ book_elements[2] = Library.canonicalise_ean(book_elements[2])
121
+ rescue StandardError => ex
122
+ puts book_elements[2]
123
+ puts ex.message
124
+ puts ex.backtrace.join("\n> ")
125
+ raise ex
136
126
  end
137
- book.notes = neaten(elements["comments"].text) if elements["comments"]
138
- content << [book, cover]
139
- on_iterate_cb&.call(n + 1, total)
140
127
  end
128
+ # publishing_year
129
+ book_elements[4] = book_elements[4].to_i unless book_elements[4].nil?
130
+ puts book_elements.inspect
131
+ cover = (neaten(elements["cover"].text) if elements["cover"])
132
+ puts cover
133
+ book = Book.new(*book_elements)
134
+ if elements["rating"]
135
+ rating = elements["rating"].text.to_i
136
+ book.rating = rating if Book::VALID_RATINGS.member? rating
137
+ end
138
+ book.notes = neaten(elements["comments"].text) if elements["comments"]
139
+ content << [book, cover]
140
+ on_iterate_cb&.call(n + 1, total)
141
+ end
141
142
 
142
- library = Library.load(name)
143
- content.each do |book, cover|
144
- unless cover.nil?
145
- library.save_cover(book,
146
- File.join(Dir.pwd, "images",
147
- cover))
148
- end
149
- library << book
150
- library.save(book)
143
+ library = Library.load(name)
144
+ content.each do |book, cover|
145
+ unless cover.nil?
146
+ library.save_cover(book,
147
+ File.join(Dir.pwd, "images",
148
+ cover))
151
149
  end
152
- return [library, []]
153
- rescue StandardError => ex
154
- puts ex.message
155
- return nil
150
+ library << book
151
+ library.save(book)
156
152
  end
153
+ return [library, []]
154
+ rescue StandardError => ex
155
+ puts ex.message
156
+ return nil
157
157
  end
158
158
  end
159
159
 
@@ -24,7 +24,8 @@ module Alexandria
24
24
  deleted = []
25
25
  all_regular_libraries.each do |library|
26
26
  ruined += library.ruined_books
27
- # make deleted books from each library accessible so we don't crash on smart libraries
27
+ # make deleted books from each library accessible so we don't crash on
28
+ # smart libraries
28
29
  deleted += library.deleted_books
29
30
  end
30
31
  @ruined_books = ruined
@@ -45,7 +45,7 @@ module Alexandria
45
45
  library = Library.new(name, self)
46
46
  FileUtils.mkdir_p(library.path) unless File.exist?(library.path)
47
47
  Dir.chdir(library.path) do
48
- Dir["*" + Library::EXT[:book]].each do |filename|
48
+ Dir["*" + Library::EXT[:book]].sort.each do |filename|
49
49
  test[1] = filename if (test[0]).zero?
50
50
 
51
51
  unless File.size? test[1]
@@ -69,25 +69,34 @@ module Alexandria
69
69
  ean = Library.canonicalise_ean(book.isbn)
70
70
  book.isbn = ean if ean
71
71
 
72
- book.publishing_year = book.publishing_year.to_i unless book.publishing_year.nil?
72
+ unless book.publishing_year.nil?
73
+ book.publishing_year = book.publishing_year.to_i
74
+ end
73
75
 
74
76
  # Or if isbn has changed
75
77
  raise "#{test[1]} isbn is not okay" unless book.isbn == old_isbn
76
78
 
77
79
  # Re-save book if Alexandria::DATA_VERSION changes
78
- raise "#{test[1]} version is not okay" unless book.version == Alexandria::DATA_VERSION
80
+ unless book.version == Alexandria::DATA_VERSION
81
+ raise "#{test[1]} version is not okay"
82
+ end
79
83
 
80
84
  # Or if publishing year has changed
81
- raise "#{test[1]} pub year is not okay" unless book.publishing_year == old_pub_year
85
+ unless book.publishing_year == old_pub_year
86
+ raise "#{test[1]} pub year is not okay"
87
+ end
82
88
 
83
89
  # ruined_books << [book, book.isbn, library]
84
90
  book.library = library.name
85
91
 
86
92
  ## TODO copy cover image file, if necessary
87
- # due to #26909 cover files for books without ISBN are re-saved as "g#{ident}.cover"
93
+ # due to #26909 cover files for books without ISBN are re-saved as
94
+ # "g#{ident}.cover"
88
95
  if book.isbn.nil? || book.isbn.empty?
89
96
  if File.exist? library.old_cover(book)
90
- log.debug { "#{library.name}; book #{book.title} has no ISBN, fixing cover image" }
97
+ log.debug do
98
+ "#{library.name}; book #{book.title} has no ISBN, fixing cover image"
99
+ end
91
100
  FileUtils::Verbose.mv(library.old_cover(book), library.cover(book))
92
101
  end
93
102
  end
@@ -122,7 +131,9 @@ module Alexandria
122
131
 
123
132
  md = /(.+)\.cover/.match(cover)
124
133
  ean = Library.canonicalise_ean(md[1]) || md[1]
125
- FileUtils.mv(cover, ean + Library::EXT[:cover]) unless cover == ean + Library::EXT[:cover]
134
+ unless cover == ean + Library::EXT[:cover]
135
+ FileUtils.mv(cover, ean + Library::EXT[:cover])
136
+ end
126
137
  end
127
138
 
128
139
  FileUtils.rm_f(Dir["*_small.jpg"])
@@ -8,7 +8,8 @@ module Alexandria
8
8
  class Book
9
9
  attr_accessor :title, :authors, :isbn, :publisher, :publishing_year,
10
10
  :edition, :notes, :loaned, :loaned_since,
11
- :loaned_to, :saved_ident, :redd, :redd_when, :own, :want, :tags, :version, :library
11
+ :loaned_to, :saved_ident, :redd, :redd_when, :own, :want,
12
+ :tags, :version, :library
12
13
 
13
14
  attr_reader :rating
14
15
 
@@ -53,7 +53,9 @@ module Alexandria
53
53
  dest = dest_library.path
54
54
  books.each do |book|
55
55
  FileUtils.mv(source_library.yaml(book), dest)
56
- FileUtils.mv(source_library.cover(book), dest) if File.exist?(source_library.cover(book))
56
+ if File.exist?(source_library.cover(book))
57
+ FileUtils.mv(source_library.cover(book), dest)
58
+ end
57
59
 
58
60
  source_library.changed
59
61
  source_library.old_delete(book)
@@ -181,7 +183,9 @@ module Alexandria
181
183
  book.saved_ident = book.ident if book.saved_ident.nil? || book.saved_ident.empty?
182
184
  if book.ident != book.saved_ident
183
185
  FileUtils.rm(yaml(book.saved_ident))
184
- FileUtils.mv(cover(book.saved_ident), cover(book.ident)) if File.exist?(cover(book.saved_ident))
186
+ if File.exist?(cover(book.saved_ident))
187
+ FileUtils.mv(cover(book.saved_ident), cover(book.ident))
188
+ end
185
189
  end
186
190
  book.saved_ident = book.ident
187
191
 
@@ -199,7 +203,9 @@ module Alexandria
199
203
 
200
204
  if book.ident != book.saved_ident
201
205
  FileUtils.rm(yaml(book.saved_ident))
202
- FileUtils.mv(cover(book.saved_ident), cover(book.ident)) if File.exist?(cover(book.saved_ident))
206
+ if File.exist?(cover(book.saved_ident))
207
+ FileUtils.mv(cover(book.saved_ident), cover(book.ident))
208
+ end
203
209
 
204
210
  # Notify before updating the saved identifier, so the views
205
211
  # can still use the old one to update their models.
@@ -48,7 +48,10 @@ module Alexandria
48
48
  def save!
49
49
  log.debug { "preferences save!" }
50
50
  @changed_settings.each do |variable_name|
51
- log.debug { "saving preference #{variable_name} / #{@alexandria_settings[variable_name].class}" }
51
+ log.debug do
52
+ klass = @alexandria_settings[variable_name].class
53
+ "saving preference #{variable_name} / #{klass}"
54
+ end
52
55
  generic_save_setting(variable_name, @alexandria_settings[variable_name])
53
56
  end
54
57
  @changed_settings.clear
@@ -125,7 +128,9 @@ module Alexandria
125
128
  end
126
129
  rescue StandardError => ex
127
130
  log.debug { new_value.inspect }
128
- log.error { "Could not set GConf setting #{variable_name} to value: #{new_value.inspect}" }
131
+ log.error do
132
+ "Could not set GConf setting #{variable_name} to value: #{new_value.inspect}"
133
+ end
129
134
  log << ex.message
130
135
  log << ex
131
136
  end
@@ -177,7 +182,7 @@ module Alexandria
177
182
  type = get_gconf_type(new_value)
178
183
  value_str = new_value
179
184
  if new_value.is_a? String
180
- new_value.gsub!(/\"/, '\\"')
185
+ new_value = new_value.gsub(/\"/, '\\"')
181
186
  value_str = "\"#{new_value}\""
182
187
  end
183
188
  puts value_str if /cols_width/.match?(var_path)
@@ -226,7 +231,9 @@ module Alexandria
226
231
  hash = {}
227
232
  vals = all_vals.split(/$/)
228
233
  vals.each do |val|
229
- hash[Regexp.last_match[1]] = discriminate(Regexp.last_match[2]) if /([a-z_]+) = (.*)/ =~ val
234
+ if /([a-z_]+) = (.*)/ =~ val
235
+ hash[Regexp.last_match[1]] = discriminate(Regexp.last_match[2])
236
+ end
230
237
  end
231
238
  hash
232
239
  end
@@ -246,9 +253,9 @@ module Alexandria
246
253
  elsif value =~ /^\((.*)\)$/ # pair (assume of type int)
247
254
  begin
248
255
  pair = Regexp.last_match[1].split(",")
249
- return [discriminate(pair.first), discriminate(pair.last)]
256
+ [discriminate(pair.first), discriminate(pair.last)]
250
257
  rescue StandardError
251
- return [0, 0]
258
+ [0, 0]
252
259
  end
253
260
  else
254
261
  value # string
@@ -44,9 +44,9 @@ module Alexandria
44
44
  def decode(data)
45
45
  data.gsub!(/\s/, "")
46
46
  if data.length == 10
47
- return data
47
+ data
48
48
  elsif data.length >= 13
49
- return data[0, 13]
49
+ data[0, 13]
50
50
  else
51
51
  raise "Unknown scan data #{data}"
52
52
  end
@@ -359,45 +359,47 @@ module Alexandria
359
359
  IS_BEFORE = Operator.new(:is_before,
360
360
  _("is before"),
361
361
  proc { |x, y| x.to_i < y.to_i && !x.nil? })
362
- IS_IN_LAST = Operator.new(:is_in_last_days,
363
- _("is in last"),
364
- proc { |x, y|
365
- begin
366
- if x.nil? || x.empty?
367
- false
368
- else
369
- log.debug { "Given Date: #{x.inspect} #{x.class}" }
370
- given_date = Time.parse(x)
371
- days = y.to_i * (24 * 60 * 60)
372
-
373
- Time.now - given_date <= days
374
- end
375
- rescue StandardError => ex
376
- trace = ex.backtrace.join("\n >")
377
- log.warn { "Date matching failed #{ex} #{trace}" }
378
- false
379
- end
380
- })
381
- IS_NOT_IN_LAST = Operator.new(:is_not_in_last_days,
382
- _("is not in last"),
383
- proc { |x, y|
384
- begin
385
- if x.nil? || x.empty?
386
- false
387
- else
388
- log.debug { "Given Date: #{x.inspect} #{x.class}" }
389
- given_date = Time.parse(x)
390
- days = y.to_i * (24 * 60 * 60)
391
-
392
- Time.now - given_date > days
393
- end
394
- rescue StandardError => ex
395
- trace = ex.backtrace.join("\n >")
396
- log.warn { "Date matching failed #{ex} #{trace}" }
397
- false
398
- end
399
- # Time.now - x > 3600*24*y
400
- })
362
+ IS_IN_LAST =
363
+ Operator.new(:is_in_last_days,
364
+ _("is in last"),
365
+ proc { |x, y|
366
+ begin
367
+ if x.nil? || x.empty?
368
+ false
369
+ else
370
+ log.debug { "Given Date: #{x.inspect} #{x.class}" }
371
+ given_date = Time.parse(x)
372
+ days = y.to_i * (24 * 60 * 60)
373
+
374
+ Time.now - given_date <= days
375
+ end
376
+ rescue StandardError => ex
377
+ trace = ex.backtrace.join("\n >")
378
+ log.warn { "Date matching failed #{ex} #{trace}" }
379
+ false
380
+ end
381
+ })
382
+ IS_NOT_IN_LAST =
383
+ Operator.new(:is_not_in_last_days,
384
+ _("is not in last"),
385
+ proc { |x, y|
386
+ begin
387
+ if x.nil? || x.empty?
388
+ false
389
+ else
390
+ log.debug { "Given Date: #{x.inspect} #{x.class}" }
391
+ given_date = Time.parse(x)
392
+ days = y.to_i * (24 * 60 * 60)
393
+
394
+ Time.now - given_date > days
395
+ end
396
+ rescue StandardError => ex
397
+ trace = ex.backtrace.join("\n >")
398
+ log.warn { "Date matching failed #{ex} #{trace}" }
399
+ false
400
+ end
401
+ # Time.now - x > 3600*24*y
402
+ })
401
403
 
402
404
  ALL = constants.map \
403
405
  { |x| module_eval(x.to_s) }.select \
@@ -329,67 +329,63 @@ module Alexandria
329
329
 
330
330
  def lookup_book(isbn)
331
331
  Thread.new do
332
- begin
333
- start_search
334
- results = Alexandria::BookProviders.isbn_search(isbn)
335
- book = results[0]
336
- cover_uri = results[1]
337
- @book_results[isbn] = results
338
- set_cover_image_async(isbn, cover_uri)
339
-
340
- @barcodes_treeview.model.freeze_notify do
341
- @barcodes_treeview.model.each do |model, path, iter|
342
- if iter[0] == isbn
343
- iter[2] = book.title
344
- model.row_changed(path, iter)
345
- end
332
+ start_search
333
+ results = Alexandria::BookProviders.isbn_search(isbn)
334
+ book = results[0]
335
+ cover_uri = results[1]
336
+ @book_results[isbn] = results
337
+ set_cover_image_async(isbn, cover_uri)
338
+
339
+ @barcodes_treeview.model.freeze_notify do
340
+ @barcodes_treeview.model.each do |model, path, iter|
341
+ if iter[0] == isbn
342
+ iter[2] = book.title
343
+ model.row_changed(path, iter)
346
344
  end
347
345
  end
348
-
349
- @add_button.sensitive = true
350
- rescue StandardError => ex
351
- log.error { "Book Search failed: #{ex.message}" }
352
- log << ex if log.error?
353
- ensure
354
- stop_search
355
346
  end
347
+
348
+ @add_button.sensitive = true
349
+ rescue StandardError => ex
350
+ log.error { "Book Search failed: #{ex.message}" }
351
+ log << ex if log.error?
352
+ ensure
353
+ stop_search
356
354
  end
357
355
  end
358
356
 
359
357
  def set_cover_image_async(isbn, cover_uri)
360
358
  Thread.new do
361
- begin
362
- pixbuf = nil
363
- if cover_uri
364
- image_data = nil
365
- if URI.parse(cover_uri).scheme.nil?
366
- File.open(cover_uri, "r") do |io|
367
- image_data = io.read
368
- end
369
- else
370
- image_data = URI.parse(cover_uri).read
359
+ pixbuf = nil
360
+ if cover_uri
361
+ image_data = nil
362
+ if URI.parse(cover_uri).scheme.nil?
363
+ File.open(cover_uri, "r") do |io|
364
+ image_data = io.read
371
365
  end
372
- loader = GdkPixbuf::PixbufLoader.new
373
- loader.last_write(image_data)
374
- pixbuf = loader.pixbuf
375
366
  else
376
- pixbuf = Icons::BOOK
367
+ image_data = URI.parse(cover_uri).read
377
368
  end
369
+ loader = GdkPixbuf::PixbufLoader.new
370
+ loader.last_write(image_data)
371
+ pixbuf = loader.pixbuf
372
+ else
373
+ pixbuf = Icons::BOOK
374
+ end
378
375
 
379
- @barcodes_treeview.model.freeze_notify do
380
- @barcodes_treeview.model.each do |model, path, iter|
381
- if iter[0] == isbn
382
- iter[1] = pixbuf
383
- model.row_changed(path, iter)
384
- end
376
+ @barcodes_treeview.model.freeze_notify do
377
+ @barcodes_treeview.model.each do |model, path, iter|
378
+ if iter[0] == isbn
379
+ iter[1] = pixbuf
380
+ model.row_changed(path, iter)
385
381
  end
386
382
  end
387
- rescue StandardError => ex
388
- log.error do
389
- "Failed to load cover image icon: #{ex.message}"
390
- end
391
- log << ex if log.error?
392
383
  end
384
+ rescue StandardError => ex
385
+ log.error do
386
+ "Failed to load cover image icon: #{ex.message}"
387
+ end
388
+ log << ex if log.error?
393
389
  end
394
390
  end
395
391
 
@@ -422,7 +418,8 @@ module Alexandria
422
418
  @scan_area.grab_focus
423
419
  end
424
420
  @scan_area.signal_connect("focus-in-event") do |_widget, _event|
425
- @barcode_label.label = _(format("%s _Barcode Scanner Ready", _(@scanner.display_name)))
421
+ @barcode_label.label =
422
+ _(format("%s _Barcode Scanner Ready", _(@scanner.display_name)))
426
423
  @scanner_buffer = ""
427
424
  begin
428
425
  @animation.set_active
@@ -494,7 +491,9 @@ module Alexandria
494
491
  @interval = 0
495
492
 
496
493
  else
497
- log.debug { "Buffer has changed while waiting, reading more characters..." }
494
+ log.debug do
495
+ "Buffer has changed while waiting, reading more characters..."
496
+ end
498
497
  end
499
498
  end
500
499