Class: Alexandria::UI::BookPropertiesDialog
- Inherits:
-
BookPropertiesDialogBase
- Object
- BuilderBase
- BookPropertiesDialogBase
- Alexandria::UI::BookPropertiesDialog
- Extended by:
- GetText
- Includes:
- GetText
- Defined in:
- lib/alexandria/ui/book_properties_dialog.rb
Constant Summary
Constants inherited from BookPropertiesDialogBase
Alexandria::UI::BookPropertiesDialogBase::COVER_ABSOLUTE_MAXHEIGHT, Alexandria::UI::BookPropertiesDialogBase::COVER_MAXWIDTH
Instance Method Summary collapse
-
#initialize(parent, library, book) ⇒ BookPropertiesDialog
constructor
A new instance of BookPropertiesDialog.
Methods inherited from BookPropertiesDialogBase
#on_add_author, #on_change_cover, #on_destroy, #on_image_no_rating_press, #on_image_rating1_press, #on_image_rating2_press, #on_image_rating3_press, #on_image_rating4_press, #on_image_rating5_press, #on_loaned, #on_loaned_date_changed, #on_remove_author, #on_title_changed, #own_toggled, #redd_toggled, #setup_date_widgets, #show, #want_toggled, #widget_names
Methods included from Logging
Methods included from CalendarPopup
#assign_selected_date, #clear_date_entry, #display_calendar_popup, #setup_calendar_widgets
Constructor Details
#initialize(parent, library, book) ⇒ BookPropertiesDialog
Returns a new instance of BookPropertiesDialog.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/alexandria/ui/book_properties_dialog.rb', line 16 def initialize(parent, library, book) super(parent, library.cover(book)) log.debug { "Initializing Book Properties Dialog" } = Gtk::Button.new(stock_id: Gtk::Stock::CANCEL) .signal_connect("clicked") { on_cancel } .show @button_box << = Gtk::Button.new(stock_id: Gtk::Stock::SAVE) .signal_connect("clicked") { on_close } .show @button_box << = Gtk::Button.new(stock_id: Gtk::Stock::HELP) .signal_connect("clicked") { on_help } .show @button_box << @button_box.set_child_secondary(, true) @entry_title.text = @book_properties_dialog.title = book.title @entry_isbn.text = (book.isbn || "") @entry_publisher.text = book.publisher @entry_publish_date.text = book.publishing_year.to_s @entry_publish_date.signal_connect("focus-out-event") do text = @entry_publish_date.text if text.empty? false else year = text.to_i if year.zero? || year > (Time.now.year + 10) || year < 10 @entry_publish_date.text = "" @entry_publish_date.grab_focus true elsif year < 100 @entry_publish_date.text = "19" + year.to_s false end end end @entry_edition.text = book.edition if book. @entry_tags.text = book..join(",") # tags are comma-separated end book..each do || iter = @treeview_authors.model.append iter[0] = iter[1] = true end buffer = Gtk::TextBuffer.new buffer.text = (book.notes || "") @textview_notes.buffer = buffer @library = library @book = book self.cover = Icons.cover(library, book) self. = (book. || Book::DEFAULT_RATING) if (@checkbutton_loaned.active = book.loaned?) @entry_loaned_to.text = (book.loaned_to || "") self.loaned_since = book.loaned_since @date_loaned_since.sensitive = true else @date_loaned_since.sensitive = false end @checkbutton_own.active = book.own? if (@checkbutton_redd.active = book.redd?) @redd_date.sensitive = true if book.redd_when.nil? log.debug { "no redd_when" } else @redd_date.text = format_date(book.redd_when) end # self.redd_when = (book.redd_when or Time.now) else @redd_date.sensitive = false end @checkbutton_want.active = book.want? @checkbutton_want.inconsistent = true if (@checkbutton_own.active = book.own?) end |