alexandria-book-collection-manager 0.6.9.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rubocop.yml +68 -0
- data/.rubocop_todo.yml +200 -0
- data/CHANGELOG.md +23 -0
- data/COPYING +339 -0
- data/ChangeLog.0 +3598 -0
- data/Gemfile +9 -0
- data/INSTALL.rdoc +156 -0
- data/PACKAGING +36 -0
- data/README.md +88 -0
- data/RELEASE_CHECKLIST +18 -0
- data/Rakefile +264 -0
- data/TODO +24 -0
- data/alexandria-book-collection-manager.gemspec +35 -0
- data/alexandria.desktop.in +10 -0
- data/bin/alexandria +82 -0
- data/doc/AUTHORS +60 -0
- data/doc/BUGS +31 -0
- data/doc/FAQ +369 -0
- data/doc/HACKING +19 -0
- data/doc/NEWS +341 -0
- data/doc/alexandria.1 +120 -0
- data/doc/cuecat_support.rdoc +67 -0
- data/lib/alexandria.rb +85 -0
- data/lib/alexandria/about.rb +82 -0
- data/lib/alexandria/book_providers.rb +411 -0
- data/lib/alexandria/book_providers/adlibris.rb +235 -0
- data/lib/alexandria/book_providers/amazon_aws.rb +261 -0
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +405 -0
- data/lib/alexandria/book_providers/barnes_and_noble.rb +229 -0
- data/lib/alexandria/book_providers/bol_it.rb +162 -0
- data/lib/alexandria/book_providers/deastore.rb +277 -0
- data/lib/alexandria/book_providers/douban.rb +135 -0
- data/lib/alexandria/book_providers/ibs_it.rb +149 -0
- data/lib/alexandria/book_providers/mcu.rb +177 -0
- data/lib/alexandria/book_providers/proxis.rb +205 -0
- data/lib/alexandria/book_providers/pseudomarc.rb +185 -0
- data/lib/alexandria/book_providers/renaud.rb +142 -0
- data/lib/alexandria/book_providers/siciliano.rb +271 -0
- data/lib/alexandria/book_providers/thalia.rb +197 -0
- data/lib/alexandria/book_providers/web.rb +59 -0
- data/lib/alexandria/book_providers/webster_it.rb +173 -0
- data/lib/alexandria/book_providers/worldcat.rb +251 -0
- data/lib/alexandria/book_providers/z3950.rb +422 -0
- data/lib/alexandria/config.rb +8 -0
- data/lib/alexandria/console.rb +31 -0
- data/lib/alexandria/execution_queue.rb +96 -0
- data/lib/alexandria/export_library.rb +536 -0
- data/lib/alexandria/import_library.rb +316 -0
- data/lib/alexandria/import_library_csv.rb +270 -0
- data/lib/alexandria/logging.rb +159 -0
- data/lib/alexandria/models/book.rb +72 -0
- data/lib/alexandria/models/library.rb +714 -0
- data/lib/alexandria/net.rb +53 -0
- data/lib/alexandria/preferences.rb +324 -0
- data/lib/alexandria/scanners.rb +42 -0
- data/lib/alexandria/scanners/cuecat.rb +118 -0
- data/lib/alexandria/scanners/keyboard.rb +57 -0
- data/lib/alexandria/smart_library.rb +525 -0
- data/lib/alexandria/ui.rb +53 -0
- data/lib/alexandria/ui/builder_base.rb +43 -0
- data/lib/alexandria/ui/callbacks.rb +389 -0
- data/lib/alexandria/ui/completion_models.rb +228 -0
- data/lib/alexandria/ui/dialogs/about_dialog.rb +59 -0
- data/lib/alexandria/ui/dialogs/acquire_dialog.rb +640 -0
- data/lib/alexandria/ui/dialogs/alert_dialog.rb +68 -0
- data/lib/alexandria/ui/dialogs/bad_isbns_dialog.rb +43 -0
- data/lib/alexandria/ui/dialogs/barcode_animation.rb +159 -0
- data/lib/alexandria/ui/dialogs/book_properties_dialog.rb +210 -0
- data/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb +432 -0
- data/lib/alexandria/ui/dialogs/export_dialog.rb +172 -0
- data/lib/alexandria/ui/dialogs/import_dialog.rb +205 -0
- data/lib/alexandria/ui/dialogs/misc_dialogs.rb +85 -0
- data/lib/alexandria/ui/dialogs/new_book_dialog.rb +639 -0
- data/lib/alexandria/ui/dialogs/new_book_dialog_manual.rb +153 -0
- data/lib/alexandria/ui/dialogs/new_smart_library_dialog.rb +67 -0
- data/lib/alexandria/ui/dialogs/preferences_dialog.rb +587 -0
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +56 -0
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog_base.rb +432 -0
- data/lib/alexandria/ui/dndable.rb +81 -0
- data/lib/alexandria/ui/gtk_thread_help.rb +88 -0
- data/lib/alexandria/ui/icons.rb +100 -0
- data/lib/alexandria/ui/iconview.rb +91 -0
- data/lib/alexandria/ui/iconview_tooltips.rb +162 -0
- data/lib/alexandria/ui/init.rb +93 -0
- data/lib/alexandria/ui/libraries_combo.rb +75 -0
- data/lib/alexandria/ui/listview.rb +310 -0
- data/lib/alexandria/ui/main_app.rb +67 -0
- data/lib/alexandria/ui/multi_drag_treeview.rb +150 -0
- data/lib/alexandria/ui/sidepane.rb +194 -0
- data/lib/alexandria/ui/sound.rb +107 -0
- data/lib/alexandria/ui/ui_manager.rb +1308 -0
- data/lib/alexandria/undo_manager.rb +78 -0
- data/lib/alexandria/utils.rb +30 -0
- data/lib/alexandria/version.rb +24 -0
- data/lib/alexandria/web_themes.rb +75 -0
- data/misc/sounds/README +15 -0
- data/misc/sounds/bad_scan.csd +62 -0
- data/misc/sounds/good_scan.csd +61 -0
- data/misc/sounds/scanning.csd +46 -0
- data/po/ChangeLog +488 -0
- data/po/Makefile +44 -0
- data/po/README +29 -0
- data/po/commit-po +72 -0
- data/po/cs.po +1437 -0
- data/po/cy.po +1521 -0
- data/po/de.po +1400 -0
- data/po/el.po +1379 -0
- data/po/es.po +1376 -0
- data/po/fr.po +1420 -0
- data/po/ga.po +1359 -0
- data/po/gl.po +1397 -0
- data/po/it.po +1406 -0
- data/po/ja.po +1355 -0
- data/po/mk.po +1373 -0
- data/po/nb.po +1386 -0
- data/po/nl.po +1405 -0
- data/po/pl.po +1373 -0
- data/po/pt.po +1398 -0
- data/po/pt_BR.po +1409 -0
- data/po/ru.po +1372 -0
- data/po/sk.po +1380 -0
- data/po/sv.po +1402 -0
- data/po/uk.po +1423 -0
- data/po/zh_TW.po +1394 -0
- data/schemas/alexandria.schemas +300 -0
- data/share/alexandria/glade/acquire_dialog__builder.glade +201 -0
- data/share/alexandria/glade/book_properties_dialog__builder.glade +910 -0
- data/share/alexandria/glade/main_app__builder.glade +229 -0
- data/share/alexandria/glade/new_book_dialog__builder.glade +379 -0
- data/share/alexandria/glade/preferences_dialog__builder.glade +733 -0
- data/share/alexandria/icons/alexandria.png +0 -0
- data/share/alexandria/icons/alexandria_small.png +0 -0
- data/share/alexandria/icons/book.png +0 -0
- data/share/alexandria/icons/book_icon.png +0 -0
- data/share/alexandria/icons/book_small.png +0 -0
- data/share/alexandria/icons/cuecat.png +0 -0
- data/share/alexandria/icons/cuecat_inactive.png +0 -0
- data/share/alexandria/icons/favorite_tag.png +0 -0
- data/share/alexandria/icons/less.png +0 -0
- data/share/alexandria/icons/library.png +0 -0
- data/share/alexandria/icons/library_small.png +0 -0
- data/share/alexandria/icons/lookup.png +0 -0
- data/share/alexandria/icons/more.png +0 -0
- data/share/alexandria/icons/no_cover.png +0 -0
- data/share/alexandria/icons/smart_library.png +0 -0
- data/share/alexandria/icons/smart_library_small.png +0 -0
- data/share/alexandria/icons/star_set.png +0 -0
- data/share/alexandria/icons/star_unset.png +0 -0
- data/share/alexandria/icons/view_as_icons.png +0 -0
- data/share/alexandria/icons/view_as_list.png +0 -0
- data/share/alexandria/ui/menus.xml +91 -0
- data/share/alexandria/ui/popups.xml +91 -0
- data/share/alexandria/web-themes/clean/clean.css +85 -0
- data/share/alexandria/web-themes/clean/preview.jpg +0 -0
- data/share/alexandria/web-themes/list/list.css +105 -0
- data/share/alexandria/web-themes/list/preview.jpg +0 -0
- data/share/app-icon/16x16/alexandria.png +0 -0
- data/share/app-icon/16x16/alexandria.svg +263 -0
- data/share/app-icon/22x22/alexandria.png +0 -0
- data/share/app-icon/22x22/alexandria.svg +465 -0
- data/share/app-icon/24x24/alexandria.png +0 -0
- data/share/app-icon/32x32/alexandria.png +0 -0
- data/share/app-icon/32x32/alexandria.svg +813 -0
- data/share/app-icon/32x32/alexandria.xpm +241 -0
- data/share/app-icon/48x48/alexandria.png +0 -0
- data/share/app-icon/scalable/alexandria.svg +700 -0
- data/share/gnome/help/alexandria/C/about.xml +44 -0
- data/share/gnome/help/alexandria/C/adding-books.xml +339 -0
- data/share/gnome/help/alexandria/C/alexandria.xml +185 -0
- data/share/gnome/help/alexandria/C/bugs.xml +18 -0
- data/share/gnome/help/alexandria/C/editing-book-properties.xml +124 -0
- data/share/gnome/help/alexandria/C/exporting.xml +81 -0
- data/share/gnome/help/alexandria/C/figures/adding_books_acquire_from_scanner_process.png +0 -0
- data/share/gnome/help/alexandria/C/figures/adding_books_add_by_isbn.png +0 -0
- data/share/gnome/help/alexandria/C/figures/adding_books_isbn_import.png +0 -0
- data/share/gnome/help/alexandria/C/figures/adding_books_manual_details.png +0 -0
- data/share/gnome/help/alexandria/C/figures/adding_books_rename_library_after_import.png +0 -0
- data/share/gnome/help/alexandria/C/figures/adding_books_search_results.png +0 -0
- data/share/gnome/help/alexandria/C/figures/editing_book_properties_info.png +0 -0
- data/share/gnome/help/alexandria/C/figures/editing_book_properties_loaning.png +0 -0
- data/share/gnome/help/alexandria/C/figures/exporting_information_html.png +0 -0
- data/share/gnome/help/alexandria/C/figures/getting_started_first_launched.png +0 -0
- data/share/gnome/help/alexandria/C/figures/searching_filtering_views_list_view.png +0 -0
- data/share/gnome/help/alexandria/C/figures/searching_filtering_views_list_view_search.png +0 -0
- data/share/gnome/help/alexandria/C/figures/settings_providers_new_z3950.png +0 -0
- data/share/gnome/help/alexandria/C/figures/smart_libraries_new_smart_library.png +0 -0
- data/share/gnome/help/alexandria/C/figures/working_with_libraries_library_pane.png +0 -0
- data/share/gnome/help/alexandria/C/getting-started.xml +154 -0
- data/share/gnome/help/alexandria/C/gnu-fdl-1.2.xml +543 -0
- data/share/gnome/help/alexandria/C/introduction.xml +142 -0
- data/share/gnome/help/alexandria/C/searching.xml +90 -0
- data/share/gnome/help/alexandria/C/settings.xml +140 -0
- data/share/gnome/help/alexandria/C/smart-libraries.xml +160 -0
- data/share/gnome/help/alexandria/C/working-with-libraries.xml +76 -0
- data/share/gnome/help/alexandria/ChangeLog +99 -0
- data/share/gnome/help/alexandria/fr/alexandria.xml +2292 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_add_button.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_add_by_isbn_1.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_add_by_search_1.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_add_manually.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_add_z3950.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_close_button.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_edit_info.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_export_web_page.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_importing.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_library_pane.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_list_view.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_list_view_search.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_loaning.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_main_window.png +0 -0
- data/share/gnome/help/alexandria/fr/figures/alexandria_remove_button.png +0 -0
- data/share/gnome/help/alexandria/ja/about.xml +33 -0
- data/share/gnome/help/alexandria/ja/adding-books.xml +314 -0
- data/share/gnome/help/alexandria/ja/alexandria.xml +172 -0
- data/share/gnome/help/alexandria/ja/bugs.xml +11 -0
- data/share/gnome/help/alexandria/ja/editing-book-properties.xml +100 -0
- data/share/gnome/help/alexandria/ja/exporting.xml +98 -0
- data/share/gnome/help/alexandria/ja/figures/adding_books_acquire_from_scanner_process.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/adding_books_add_by_isbn.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/adding_books_isbn_import.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/adding_books_manual_details.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/adding_books_rename_library_after_import.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/adding_books_search_results.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/editing_book_properties_info.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/editing_book_properties_loaning.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/exporting_information_html.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/getting_started_first_launched.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/searching_filtering_views_list_view.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/searching_filtering_views_list_view_search.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/settings_providers_new_z3950.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/smart_libraries_new_smart_library.png +0 -0
- data/share/gnome/help/alexandria/ja/figures/working_with_libraries_library_pane.png +0 -0
- data/share/gnome/help/alexandria/ja/getting-started.xml +144 -0
- data/share/gnome/help/alexandria/ja/gnu-fdl-1.2.xml +541 -0
- data/share/gnome/help/alexandria/ja/introduction.xml +134 -0
- data/share/gnome/help/alexandria/ja/searching.xml +104 -0
- data/share/gnome/help/alexandria/ja/settings.xml +129 -0
- data/share/gnome/help/alexandria/ja/smart-libraries.xml +140 -0
- data/share/gnome/help/alexandria/ja/working-with-libraries.xml +88 -0
- data/share/menu/alexandria +7 -0
- data/share/omf/alexandria/alexandria-C.omf.in +27 -0
- data/share/omf/alexandria/alexandria-fr.omf.in +30 -0
- data/share/sounds/alexandria/bad_scan.ogg +0 -0
- data/share/sounds/alexandria/bad_scan.wav +0 -0
- data/share/sounds/alexandria/good_scan.ogg +0 -0
- data/share/sounds/alexandria/good_scan.wav +0 -0
- data/share/sounds/alexandria/scanning.ogg +0 -0
- data/share/sounds/alexandria/scanning.wav +0 -0
- data/spec/alexandria/library_spec.rb +205 -0
- data/spec/alexandria/preferences_spec.rb +22 -0
- data/spec/alexandria/scanners/cuecat_spec.rb +68 -0
- data/spec/alexandria/smart_library_spec.rb +22 -0
- data/spec/alexandria/ui/dialogs_spec.rb +90 -0
- data/spec/alexandria/ui/iconview_spec.rb +27 -0
- data/spec/alexandria/ui/listview_spec.rb +28 -0
- data/spec/alexandria/ui/main_app_spec.rb +48 -0
- data/spec/alexandria/ui/sidepane_spec.rb +27 -0
- data/spec/alexandria/ui/ui_manager_spec.rb +26 -0
- data/spec/alexandria/ui/ui_utilities_spec.rb +60 -0
- data/spec/alexandria/utilities_spec.rb +50 -0
- data/spec/data/libraries/0.6.1-noisbn/My Library/0201398257.yaml +10 -0
- data/spec/data/libraries/0.6.1-noisbn/My Library/1565920007.yaml +10 -0
- data/spec/data/libraries/0.6.1/My Library/0192812173.yaml +9 -0
- data/spec/data/libraries/0.6.1/My Library/0201398257.cover +0 -0
- data/spec/data/libraries/0.6.1/My Library/0201398257.yaml +10 -0
- data/spec/data/libraries/0.6.1/My Library/1565920007.yaml +10 -0
- data/spec/data/libraries/0.6.2/My Library/9780140266146.cover +0 -0
- data/spec/data/libraries/0.6.2/My Library/9780140266146.yaml +16 -0
- data/spec/data/libraries/0.6.2/My Library/9780140278781.cover +0 -0
- data/spec/data/libraries/0.6.2/My Library/9780140278781.yaml +21 -0
- data/spec/data/libraries/0.6.2/My Library/9780571147168.cover +0 -0
- data/spec/data/libraries/0.6.2/My Library/9780571147168.yaml +20 -0
- data/spec/data/libraries/0.6.2/My Library/9780575079038.cover +0 -0
- data/spec/data/libraries/0.6.2/My Library/9780575079038.yaml +20 -0
- data/spec/data/libraries/0.6.2/My Library/9780755322800.cover +0 -0
- data/spec/data/libraries/0.6.2/My Library/9780755322800.yaml +20 -0
- data/spec/spec_helper.rb +46 -0
- data/tasks/rdoc.rake +6 -0
- data/tasks/setup.rb +30 -0
- data/tasks/spec.rake +29 -0
- data/tasks/test.rake +38 -0
- data/test/application_test.rb +39 -0
- data/test/book_test.rb +34 -0
- data/test/data/isbns.txt +3 -0
- data/test/isbn_test.rb +68 -0
- data/test/providers_test.rb +254 -0
- data/test/test_helper.rb +42 -0
- data/util/rake/fileinstall.rb +313 -0
- data/util/rake/gettextgenerate.rb +158 -0
- data/util/rake/omfgenerate.rb +79 -0
- metadata +452 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
# Copyright (C) 2004-2006 Laurent Sansonetti
|
2
|
+
#
|
3
|
+
# Alexandria is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU General Public License as
|
5
|
+
# published by the Free Software Foundation; either version 2 of the
|
6
|
+
# License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Alexandria 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 GNU
|
11
|
+
# General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public
|
14
|
+
# License along with Alexandria; see the file COPYING. If not,
|
15
|
+
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
16
|
+
# Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
|
18
|
+
# HIG compliant error dialog boxes
|
19
|
+
module Alexandria
|
20
|
+
module UI
|
21
|
+
class AlertDialog < Gtk::Dialog
|
22
|
+
def initialize(parent, title, stock_icon, buttons, message = nil)
|
23
|
+
super('', parent, Gtk::Dialog::DESTROY_WITH_PARENT, *buttons)
|
24
|
+
|
25
|
+
self.border_width = 6
|
26
|
+
self.resizable = false
|
27
|
+
self.has_separator = false
|
28
|
+
vbox.spacing = 12
|
29
|
+
|
30
|
+
hbox = Gtk::HBox.new(false, 12)
|
31
|
+
hbox.border_width = 6
|
32
|
+
vbox.pack_start(hbox)
|
33
|
+
|
34
|
+
image = Gtk::Image.new(stock_icon,
|
35
|
+
Gtk::IconSize::DIALOG)
|
36
|
+
image.set_alignment(0.5, 0)
|
37
|
+
hbox.pack_start(image)
|
38
|
+
|
39
|
+
vbox = Gtk::VBox.new(false, 6)
|
40
|
+
hbox.pack_start(vbox)
|
41
|
+
|
42
|
+
label = Gtk::Label.new
|
43
|
+
label.set_alignment(0, 0)
|
44
|
+
label.wrap = label.selectable = true
|
45
|
+
label.markup = "<b><big>#{title}</big></b>"
|
46
|
+
vbox.pack_start(label)
|
47
|
+
|
48
|
+
if message
|
49
|
+
label = Gtk::Label.new
|
50
|
+
label.set_alignment(0, 0)
|
51
|
+
label.wrap = label.selectable = true
|
52
|
+
label.markup = message.strip
|
53
|
+
vbox.pack_start(label)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class ErrorDialog < AlertDialog
|
59
|
+
def initialize(parent, title, message = nil)
|
60
|
+
super(parent, title, Gtk::Stock::DIALOG_ERROR,
|
61
|
+
[[Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK]], message)
|
62
|
+
self.default_response = Gtk::Dialog::RESPONSE_OK
|
63
|
+
show_all and run
|
64
|
+
destroy
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (C) 2007 Joseph Method
|
2
|
+
#
|
3
|
+
# Alexandria is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU General Public License as
|
5
|
+
# published by the Free Software Foundation; either version 2 of the
|
6
|
+
# License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Alexandria 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 GNU
|
11
|
+
# General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public
|
14
|
+
# License along with Alexandria; see the file COPYING. If not,
|
15
|
+
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
16
|
+
# Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
|
18
|
+
module Alexandria
|
19
|
+
module UI
|
20
|
+
# Generalized Dialog for lists of bad isbns. Used for on_import. Can also
|
21
|
+
# be used for on_load library conversions.
|
22
|
+
class BadIsbnsDialog < Gtk::MessageDialog
|
23
|
+
def initialize(parent, message = nil, list = nil)
|
24
|
+
message = _("There's a problem") unless message
|
25
|
+
super(parent, Gtk::Dialog::MODAL, Gtk::MessageDialog::WARNING, Gtk::MessageDialog::BUTTONS_CLOSE, message)
|
26
|
+
isbn_container = Gtk::HBox.new
|
27
|
+
the_vbox = children.first
|
28
|
+
the_vbox.pack_start(isbn_container)
|
29
|
+
the_vbox.reorder_child(isbn_container, 3)
|
30
|
+
scrolley = Gtk::ScrolledWindow.new
|
31
|
+
isbn_container.pack_start(scrolley)
|
32
|
+
textview = Gtk::TextView.new(Gtk::TextBuffer.new)
|
33
|
+
textview.editable = false
|
34
|
+
textview.cursor_visible = false
|
35
|
+
scrolley.add(textview)
|
36
|
+
list.each do |li|
|
37
|
+
textview.buffer.insert_at_cursor("#{li}\n")
|
38
|
+
end
|
39
|
+
show_all
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#--
|
3
|
+
# Copyright (C) 2011 Cathal Mc Ginley
|
4
|
+
# Modifications Copyright (C) 2011 Matijs van Zuijlen
|
5
|
+
#
|
6
|
+
# This file is part of Alexandria, a GNOME book collection manager.
|
7
|
+
#
|
8
|
+
# Alexandria is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# Alexandria is distributed in the hope that it will be useful, but
|
14
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
16
|
+
# General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with Alexandria; see the file COPYING. If not, write to the
|
20
|
+
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
21
|
+
# Boston, MA 02110-1301 USA.
|
22
|
+
#++
|
23
|
+
|
24
|
+
# require 'goocanvas'
|
25
|
+
|
26
|
+
module Alexandria
|
27
|
+
module UI
|
28
|
+
class BarcodeAnimation
|
29
|
+
attr_reader :canvas
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
@canvas = Goo::Canvas.new
|
33
|
+
@canvas.set_size_request(300, 70)
|
34
|
+
@canvas.set_bounds(0, 0, 350, 70)
|
35
|
+
@root = @canvas.root_item
|
36
|
+
|
37
|
+
@barcode_bars = []
|
38
|
+
@barcode_data = []
|
39
|
+
|
40
|
+
@hpos = 0
|
41
|
+
|
42
|
+
@scale = 3
|
43
|
+
@bar_left_edge = 0
|
44
|
+
@bar_top = 8
|
45
|
+
@bar_height = 50
|
46
|
+
|
47
|
+
create_ean_barcode_data
|
48
|
+
draw_barcode_bars
|
49
|
+
|
50
|
+
@timeout = nil
|
51
|
+
@index = 0
|
52
|
+
@fade_opacity = 255
|
53
|
+
set_active
|
54
|
+
@canvas.show
|
55
|
+
end
|
56
|
+
|
57
|
+
def start
|
58
|
+
@timeout = Gtk.timeout_add(20) do
|
59
|
+
scan_animation
|
60
|
+
(@index >= 0)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def destroy
|
65
|
+
@canvas.destroy
|
66
|
+
@canvas = nil
|
67
|
+
end
|
68
|
+
|
69
|
+
def set_active
|
70
|
+
@canvas.set_property(:background_color, 'white')
|
71
|
+
@barcode_bars.each { |rect| rect.set_property(:fill_color, 'white') }
|
72
|
+
end
|
73
|
+
|
74
|
+
def set_passive
|
75
|
+
if @canvas
|
76
|
+
passive_bg = '#F4F4F4'
|
77
|
+
@canvas.set_property(:background_color, passive_bg)
|
78
|
+
@barcode_bars.each { |rect| rect.set_property(:fill_color, passive_bg) }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def manual_input
|
83
|
+
# TODO distinguish between scanner and manual input
|
84
|
+
# @canvas.set_property(:background_color, "#FFF8C0")
|
85
|
+
end
|
86
|
+
|
87
|
+
def scanner_input
|
88
|
+
# TODO distinguish between scanner and manual input
|
89
|
+
# @canvas.set_property(:background_color, "white")
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def create_ean_barcode_data
|
95
|
+
d = '211113123121112331122131113211111123122211132321112311231111'
|
96
|
+
# ####911113... but that's too much padding on the left...
|
97
|
+
while d.size > 0
|
98
|
+
space_width = d[0].chr.to_i
|
99
|
+
bar_width = d[1].chr.to_i
|
100
|
+
d = d[2..-1]
|
101
|
+
@barcode_data << [space_width, bar_width]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def draw_barcode_bars
|
106
|
+
@barcode_data.each do |space_width, bar_width|
|
107
|
+
@hpos += space_width
|
108
|
+
rect_item = Goo::CanvasRect.new(@root,
|
109
|
+
@bar_left_edge + @scale * @hpos, @bar_top,
|
110
|
+
@scale * bar_width, @bar_height,
|
111
|
+
line_width: 0,
|
112
|
+
fill_color: 'white')
|
113
|
+
@hpos += bar_width
|
114
|
+
@barcode_bars << rect_item
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def scan_animation
|
119
|
+
if @index < @barcode_bars.size
|
120
|
+
if @index < 0
|
121
|
+
@index = 0
|
122
|
+
end
|
123
|
+
alpha = 7 * (@index + 1)
|
124
|
+
@barcode_bars.each_with_index do |rect, i|
|
125
|
+
rect.set_property(:fill_color_rgba, 0xFF000000 + alpha)
|
126
|
+
if i >= @index
|
127
|
+
break
|
128
|
+
end
|
129
|
+
end
|
130
|
+
@index += 1
|
131
|
+
else
|
132
|
+
@index = -1
|
133
|
+
Gtk.timeout_add(5) do
|
134
|
+
@barcode_bars.each { |rect| rect.set_property(:fill_color_rgba, 0x000000C0) }
|
135
|
+
Gtk.timeout_add(15) do
|
136
|
+
fade_animation
|
137
|
+
(@fade_opacity != -1)
|
138
|
+
end
|
139
|
+
false
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def fade_animation
|
146
|
+
if @fade_opacity == -1
|
147
|
+
@fade_opacity = 255
|
148
|
+
end
|
149
|
+
if @fade_opacity >= 0
|
150
|
+
grey = 0x00000000 + @fade_opacity
|
151
|
+
@barcode_bars.each { |rect| rect.set_property(:fill_color_rgba, grey) }
|
152
|
+
@fade_opacity -= 5
|
153
|
+
else
|
154
|
+
@fade_opacity = -1
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -0,0 +1,210 @@
|
|
1
|
+
# Copyright (C) 2004-2006 Laurent Sansonetti
|
2
|
+
#
|
3
|
+
# Alexandria is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU General Public License as
|
5
|
+
# published by the Free Software Foundation; either version 2 of the
|
6
|
+
# License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Alexandria 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 GNU
|
11
|
+
# General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public
|
14
|
+
# License along with Alexandria; see the file COPYING. If not,
|
15
|
+
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
16
|
+
# Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
|
18
|
+
module Alexandria
|
19
|
+
module UI
|
20
|
+
class BookPropertiesDialog < BookPropertiesDialogBase
|
21
|
+
include Logging
|
22
|
+
include GetText
|
23
|
+
extend GetText
|
24
|
+
GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: 'UTF-8')
|
25
|
+
|
26
|
+
def initialize(parent, library, book)
|
27
|
+
super(parent, library.cover(book))
|
28
|
+
puts 'Initializing Book Properties Dialog...' if $DEBUG
|
29
|
+
|
30
|
+
cancel_button = Gtk::Button.new(Gtk::Stock::CANCEL)
|
31
|
+
cancel_button.signal_connect('clicked') { on_cancel }
|
32
|
+
cancel_button.show
|
33
|
+
@button_box << cancel_button
|
34
|
+
|
35
|
+
close_button = Gtk::Button.new(Gtk::Stock::SAVE)
|
36
|
+
close_button.signal_connect('clicked') { on_close }
|
37
|
+
close_button.show
|
38
|
+
@button_box << close_button
|
39
|
+
|
40
|
+
help_button = Gtk::Button.new(Gtk::Stock::HELP)
|
41
|
+
help_button.signal_connect('clicked') { on_help }
|
42
|
+
help_button.show
|
43
|
+
@button_box << help_button
|
44
|
+
@button_box.set_child_secondary(help_button, true)
|
45
|
+
|
46
|
+
@entry_title.text = @book_properties_dialog.title = book.title
|
47
|
+
@entry_isbn.text = (book.isbn or '')
|
48
|
+
@entry_publisher.text = book.publisher
|
49
|
+
@entry_publish_date.text = book.publishing_year.to_s
|
50
|
+
@entry_publish_date.signal_connect('focus-out-event') do
|
51
|
+
text = @entry_publish_date.text
|
52
|
+
if text.empty?
|
53
|
+
false
|
54
|
+
else
|
55
|
+
year = text.to_i
|
56
|
+
if year == 0 or year > (Time.now.year + 10) or year < 10
|
57
|
+
@entry_publish_date.text = ''
|
58
|
+
@entry_publish_date.grab_focus
|
59
|
+
true
|
60
|
+
elsif year < 100
|
61
|
+
@entry_publish_date.text = '19' + year.to_s
|
62
|
+
false
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
@entry_edition.text = book.edition
|
67
|
+
if book.tags
|
68
|
+
@entry_tags.text = book.tags.join(',') # tags are comma-separated
|
69
|
+
end
|
70
|
+
|
71
|
+
book.authors.each do |author|
|
72
|
+
iter = @treeview_authors.model.append
|
73
|
+
iter[0] = author
|
74
|
+
iter[1] = true
|
75
|
+
end
|
76
|
+
|
77
|
+
buffer = Gtk::TextBuffer.new
|
78
|
+
buffer.text = (book.notes or '')
|
79
|
+
@textview_notes.buffer = buffer
|
80
|
+
|
81
|
+
@library, @book = library, book
|
82
|
+
self.cover = Icons.cover(library, book)
|
83
|
+
self.rating = (book.rating or Book::DEFAULT_RATING)
|
84
|
+
|
85
|
+
if (@checkbutton_loaned.active = book.loaned?)
|
86
|
+
@entry_loaned_to.text = (book.loaned_to or '')
|
87
|
+
self.loaned_since = book.loaned_since
|
88
|
+
@date_loaned_since.sensitive = true
|
89
|
+
else
|
90
|
+
@date_loaned_since.sensitive = false
|
91
|
+
end
|
92
|
+
|
93
|
+
@checkbutton_own.active = book.own?
|
94
|
+
if (@checkbutton_redd.active = book.redd?)
|
95
|
+
@redd_date.sensitive = true
|
96
|
+
if book.redd_when.nil?
|
97
|
+
puts 'no redd_when'
|
98
|
+
else
|
99
|
+
@redd_date.text = format_date(book.redd_when)
|
100
|
+
end
|
101
|
+
# self.redd_when = (book.redd_when or Time.now)
|
102
|
+
else
|
103
|
+
@redd_date.sensitive = false
|
104
|
+
end
|
105
|
+
@checkbutton_want.active = book.want?
|
106
|
+
|
107
|
+
if (@checkbutton_own.active = book.own?)
|
108
|
+
@checkbutton_want.inconsistent = true
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
#######
|
113
|
+
private
|
114
|
+
#######
|
115
|
+
|
116
|
+
def on_close
|
117
|
+
if @entry_isbn.text == ''
|
118
|
+
# If set to nil .to_yaml in library.save causes crash
|
119
|
+
@book.isbn = ''
|
120
|
+
else
|
121
|
+
ary = @library.select { |book| book.ident == @entry_isbn.text }
|
122
|
+
unless ary.empty? or (ary.length == 1 and ary.first == @book)
|
123
|
+
ErrorDialog.new(@parent,
|
124
|
+
_("Couldn't modify the book"),
|
125
|
+
_('The EAN/ISBN you provided is already ' \
|
126
|
+
'used in this library.'))
|
127
|
+
return
|
128
|
+
end
|
129
|
+
@book.isbn = begin
|
130
|
+
Library.canonicalise_ean(@entry_isbn.text)
|
131
|
+
rescue Alexandria::Library::InvalidISBNError
|
132
|
+
ErrorDialog.new(@parent,
|
133
|
+
_("Couldn't modify the book"),
|
134
|
+
_("Couldn't validate the EAN/ISBN you " \
|
135
|
+
'provided. Make sure it is written ' \
|
136
|
+
'correcty, and try again.'))
|
137
|
+
return
|
138
|
+
end
|
139
|
+
end
|
140
|
+
@book.title = @entry_title.text
|
141
|
+
@book.publisher = @entry_publisher.text
|
142
|
+
year = @entry_publish_date.text.to_i
|
143
|
+
@book.publishing_year = year == 0 ? nil : year
|
144
|
+
@book.edition = @entry_edition.text
|
145
|
+
@book.authors = []
|
146
|
+
@treeview_authors.model.each { |_m, _p, i| @book.authors << i[0] }
|
147
|
+
@book.notes = @textview_notes.buffer.text
|
148
|
+
@book.rating = @current_rating
|
149
|
+
|
150
|
+
@book.loaned = @checkbutton_loaned.active?
|
151
|
+
@book.loaned_to = @entry_loaned_to.text
|
152
|
+
loaned_since = @date_loaned_since.text
|
153
|
+
if loaned_since.strip.empty?
|
154
|
+
@book.loaned_since = nil
|
155
|
+
else
|
156
|
+
begin
|
157
|
+
t = parse_date(loaned_since)
|
158
|
+
@book.loaned_since = t
|
159
|
+
rescue
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
@book.redd = @checkbutton_redd.active?
|
164
|
+
if @book.redd
|
165
|
+
redd_date = @redd_date.text
|
166
|
+
if redd_date.strip.empty?
|
167
|
+
@book.redd_when = nil
|
168
|
+
else
|
169
|
+
begin
|
170
|
+
t = parse_date(redd_date)
|
171
|
+
@book.redd_when = t
|
172
|
+
rescue => err
|
173
|
+
puts err
|
174
|
+
puts err.backtrace
|
175
|
+
end
|
176
|
+
end
|
177
|
+
else
|
178
|
+
@book.redd_when = nil
|
179
|
+
end
|
180
|
+
@book.own = @checkbutton_own.active?
|
181
|
+
@book.want = @checkbutton_want.active?
|
182
|
+
@book.tags = @entry_tags.text.split(',') # tags are comma separated
|
183
|
+
|
184
|
+
if @delete_cover_file
|
185
|
+
FileUtils.rm_f(@cover_file)
|
186
|
+
end
|
187
|
+
|
188
|
+
if @original_cover_file
|
189
|
+
FileUtils.rm_f(@original_cover_file)
|
190
|
+
end
|
191
|
+
|
192
|
+
@library.save(@book)
|
193
|
+
# @on_close_cb.call(@book)
|
194
|
+
@book_properties_dialog.destroy
|
195
|
+
end
|
196
|
+
|
197
|
+
def on_cancel
|
198
|
+
if @original_cover_file
|
199
|
+
FileUtils.mv(@original_cover_file, @cover_file)
|
200
|
+
end
|
201
|
+
@book_properties_dialog.destroy
|
202
|
+
end
|
203
|
+
|
204
|
+
def on_help
|
205
|
+
Alexandria::UI.display_help(@preferences_dialog,
|
206
|
+
'editing-book-properties')
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|