Class: Alexandria::UI::BadIsbnsDialog
- Inherits:
-
Object
- Object
- Alexandria::UI::BadIsbnsDialog
- Defined in:
- lib/alexandria/ui/bad_isbns_dialog.rb
Overview
Generalized Dialog for lists of bad isbns. Used for on_import. Can also be used for on_load library conversions.
Instance Method Summary collapse
-
#initialize(parent, message, list) ⇒ BadIsbnsDialog
constructor
A new instance of BadIsbnsDialog.
- #show ⇒ Object
Constructor Details
#initialize(parent, message, list) ⇒ BadIsbnsDialog
Returns a new instance of BadIsbnsDialog.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/alexandria/ui/bad_isbns_dialog.rb', line 12 def initialize(parent, , list) @dialog = Gtk::MessageDialog.new(parent: parent, flags: :modal, type: :warning, buttons: :close, message: ) the_vbox = @dialog.children.first isbn_container = Gtk::Box.new :horizontal the_vbox.pack_start(isbn_container) the_vbox.reorder_child(isbn_container, 3) scrolley = Gtk::ScrolledWindow.new isbn_container.pack_start(scrolley) textview = Gtk::TextView.new(Gtk::TextBuffer.new) textview.editable = false textview.cursor_visible = false scrolley.add(textview) list.each do |li| textview.buffer.insert_at_cursor("#{li}\n") end @dialog.signal_connect("response") { @dialog.destroy } end |
Instance Method Details
#show ⇒ Object
36 37 38 |
# File 'lib/alexandria/ui/bad_isbns_dialog.rb', line 36 def show @dialog.show_all end |