ig3tool 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. data/bin/ig3tool +114 -0
  2. data/lib/glade/bib.glade +539 -0
  3. data/lib/glade/bibliotheek.glade +994 -0
  4. data/lib/glade/icons/cola.png +0 -0
  5. data/lib/glade/icons/emblem-money.png +0 -0
  6. data/lib/glade/icons/emblem-package.png +0 -0
  7. data/lib/glade/icons/emblem-penning.xpm +98 -0
  8. data/lib/glade/icons/emblem-people.png +0 -0
  9. data/lib/glade/icons/emblem-sales.png +0 -0
  10. data/lib/glade/icons/gdict.png +0 -0
  11. data/lib/glade/icons/members_klein.png +0 -0
  12. data/lib/glade/icons/members_xklein.png +0 -0
  13. data/lib/glade/icons/no.xpm +34 -0
  14. data/lib/glade/icons/stock_book.svg +338 -0
  15. data/lib/glade/icons/stock_book_klein.png +0 -0
  16. data/lib/glade/icons/stock_book_xklein.png +0 -0
  17. data/lib/glade/icons/stock_bookmark.svg +327 -0
  18. data/lib/glade/icons/stock_bookmark_klein.png +0 -0
  19. data/lib/glade/icons/stock_bookmark_xklein.png +0 -0
  20. data/lib/glade/icons/stock_print.png +0 -0
  21. data/lib/glade/interne.glade +228 -0
  22. data/lib/glade/loginwindow.glade +255 -0
  23. data/lib/glade/memberinfo.svg +411 -0
  24. data/lib/glade/memberinfo_klein.png +0 -0
  25. data/lib/glade/memberinfo_xklein.png +0 -0
  26. data/lib/glade/members.glade +596 -0
  27. data/lib/glade/members.svg +559 -0
  28. data/lib/glade/members_klein.png +0 -0
  29. data/lib/glade/members_xklein.png +0 -0
  30. data/lib/glade/penningtool.glade +731 -0
  31. data/lib/glade/people.glade +947 -0
  32. data/lib/glade/printen.glade +358 -0
  33. data/lib/glade/printer.png +0 -0
  34. data/lib/glade/printer_klein.png +0 -0
  35. data/lib/glade/printer_xklein.png +0 -0
  36. data/lib/glade/printerlog_klein.png +0 -0
  37. data/lib/glade/printerlog_xklein.png +0 -0
  38. data/lib/glade/printing.glade +841 -0
  39. data/lib/glade/products.glade +404 -0
  40. data/lib/glade/sales.glade +426 -0
  41. data/lib/glade/stock_book.svg +338 -0
  42. data/lib/glade/stock_book_klein.png +0 -0
  43. data/lib/glade/stock_book_xklein.png +0 -0
  44. data/lib/glade/stock_bookmark_klein.png +0 -0
  45. data/lib/glade/stock_bookmark_xklein.png +0 -0
  46. data/lib/glade/vendingmachine.glade +207 -0
  47. data/lib/lib/errors.rb +90 -0
  48. data/lib/lib/util.rb +89 -0
  49. data/lib/ui/automaatwindow.rb +107 -0
  50. data/lib/ui/bibliotheekwindow.rb +453 -0
  51. data/lib/ui/bibwindow.rb +537 -0
  52. data/lib/ui/gladehelper.rb +110 -0
  53. data/lib/ui/internewindow.rb +126 -0
  54. data/lib/ui/loginwindow.rb +60 -0
  55. data/lib/ui/memberswindow.rb +327 -0
  56. data/lib/ui/messagebox.rb +23 -0
  57. data/lib/ui/peoplewindow.rb +333 -0
  58. data/lib/ui/printenwindow.rb +329 -0
  59. data/lib/ui/printingwindow.rb +395 -0
  60. data/lib/ui/productswindow.rb +160 -0
  61. data/lib/ui/saleswindow.rb +207 -0
  62. data/lib/ui/toolwindow.rb +97 -0
  63. metadata +128 -0
data/lib/lib/util.rb ADDED
@@ -0,0 +1,89 @@
1
+ module Gtk
2
+ class TextView
3
+ def text
4
+ buffer.text
5
+ end
6
+
7
+ def text=(str)
8
+ buffer.text = str
9
+ end
10
+ end
11
+ end
12
+
13
+ class String
14
+
15
+ def starts_with?(str)
16
+ self.index( str ) == 0
17
+ end
18
+
19
+ def ends_with?(str)
20
+ self.rindex( str ) == self.length - str.length
21
+ end
22
+
23
+ def to_c
24
+ self.to_f.to_c
25
+ end
26
+
27
+ def from_c
28
+ self.to_f.from_c
29
+ end
30
+
31
+ def smaller(l=75)
32
+ if self.size > l
33
+ self[0..l] + "..."
34
+ else
35
+ self
36
+ end
37
+ end
38
+ end
39
+
40
+ class Numeric
41
+ def to_c
42
+ (self.to_f * 100).round.to_i
43
+ end
44
+
45
+ def from_c
46
+ (self.to_f / 100)
47
+ end
48
+
49
+ def to_b
50
+ return (not (self.zero?))
51
+ end
52
+ end
53
+
54
+ class Hash
55
+ # File facets/hash/new.rb, line 44
56
+ def self.zipnew(keys,values) # or some better name
57
+ h = {}
58
+ keys.size.times{ |i| h[ keys[i] ] = values[i] }
59
+ h
60
+ end
61
+ # File facets/hash/keyize.rb, line 49
62
+ def normalize_keys!( &block )
63
+ keys.each{ |k|
64
+ nk = block[k]
65
+ self[nk]=delete(k) if nk
66
+ }
67
+ self
68
+ end
69
+ end
70
+
71
+ class Time
72
+ # bepaling van de week van het academiejaar
73
+ def week
74
+ t = start_werkjaar(Time.werkjaar)
75
+ return 1 + ((self - t) / (86400*7)).to_int
76
+ end
77
+
78
+ # we bepalen de start van het werkjaar (laatste ma van sept)
79
+ def self.start_werkjaar(jaar)
80
+ t = Time.mktime(jaar, 9, 30)
81
+ t = t - 86400 until t.wday == 1
82
+ t
83
+ end
84
+
85
+ def self.werkjaar
86
+ t = Time.now()
87
+ t > start_werkjaar(t.year) ? t.year : t.year - 1
88
+ end
89
+ end
@@ -0,0 +1,107 @@
1
+ module Ig3tool
2
+
3
+ class VendingMachineWindow < GladeHelper
4
+ MENU_PATH = ["Automaat"]
5
+ ICON = "cola.png"
6
+
7
+ BLIKJES = [
8
+ [ "Coca Cola", "5449000000996" ],
9
+ [ "Coca Cola Light", "5449000050205" ],
10
+ [ "Fanta Orange", "5449000011527" ],
11
+ [ "Fanta Lemon", "5449000006004" ],
12
+ [ "Minute Maid", "90494024" ],
13
+ [ "Minute Maid Tropical", "5449000018243" ],
14
+ [ "Nestea", "5449000027382" ],
15
+ [ "Coca Light Lemon", "5449000089229" ],
16
+ ]
17
+
18
+ FLESJES = [
19
+ [ "Coca Cola", "54491472" ],
20
+ [ "Coca Cola Light", "54492387" ],
21
+ [ "Fanta Orange", "40822938" ],
22
+ [ "Fanta Lemon", "54492493" ],
23
+ [ "Sprite", "54491069" ],
24
+ [ "Fanta Pomelo", "42115731" ],
25
+ ]
26
+
27
+ def initialize
28
+ super("vendingmachine.glade")
29
+
30
+ @notification = @glade.get_widget("notification")
31
+
32
+ @entries = [ ]
33
+
34
+ [[BLIKJES, @glade.get_widget("blikjes_table")],
35
+ [FLESJES, @glade.get_widget("flesjes_table")]].
36
+ each do |list, table|
37
+ table.resize(list.length, 2)
38
+ list.each_with_index do |(name, barcode), i|
39
+ label = Gtk::Label.new(name + ":")
40
+ label.set_alignment(0, 0.5)
41
+ table.attach(label, 0, 1, i, i + 1)
42
+ entry = Gtk::Entry.new
43
+ entry.name = barcode
44
+ entry.signal_connect("focus-out-event") { entry_focus_out(entry) }
45
+ table.attach(entry, 1, 2, i, i + 1)
46
+ @entries <<= entry
47
+ end
48
+ end
49
+
50
+ @debuggers = @glade.get_widget("debuggers")
51
+ make_debugger_combo(@debuggers)
52
+
53
+ @window.show_all
54
+ end
55
+
56
+ def entry_focus_out(entry)
57
+ # Clear notification
58
+ @notification.text = ""
59
+ # Controleer of het een nummer is
60
+ Ig3tool::number_eval_widget(entry)
61
+ false # Return false voor de event
62
+ end
63
+
64
+ def sell_clicked
65
+ if @debuggers.active_iter.nil?
66
+ _print_msg("Selecteer eerst uw naam uit de debugger-lijst!")
67
+ return
68
+ end
69
+
70
+ debugger = @debuggers.active_iter[0]
71
+ aantal = 0
72
+ items = {}
73
+
74
+ filled_entries = @entries.select {|x| !x.text.nil? and x.text.to_i > 0}
75
+ filled_entries.each do |entry|
76
+ items[entry.name] = entry.text.to_i
77
+ aantal += entry.text.to_i
78
+ end
79
+
80
+ if items.empty?
81
+ _print_msg("Minstens een element nodig om te verkopen!")
82
+ return
83
+ end
84
+
85
+ begin
86
+ total = $global['client'].product_restock!( :debugger => debugger.username,
87
+ :items => items)
88
+ rescue Exception => e
89
+ _print_msg "Fout: Verkopen: #{$!}"
90
+ else
91
+ _print_msg "#{aantal} items verkocht, voor EUR #{total.from_c}!"
92
+ end
93
+
94
+ # Maak alle velden leeg
95
+ @entries.each { |entry| entry.text = "" }
96
+ end
97
+
98
+ def _print_msg(msg)
99
+ @notification.text = msg
100
+ puts msg
101
+ end
102
+
103
+ end
104
+
105
+ register_window(VendingMachineWindow)
106
+
107
+ end
@@ -0,0 +1,453 @@
1
+ require 'time'
2
+
3
+ begin
4
+ require "amazon/search"
5
+ $global['amazon_loaded'] = true
6
+ rescue Exception => e
7
+ STDERR.puts "Ruby/Amazon kon niet geladen worden: " + e.to_s
8
+ end
9
+
10
+
11
+
12
+ module Ig3tool
13
+
14
+ class BibliotheekWindow < GladeHelper
15
+ include GetText
16
+
17
+ MENU_PATH = ["Bibliotheek", "Bibliotheek"]
18
+ ICON = "stock_book_xklein.png"
19
+
20
+ attr :glade
21
+
22
+ # def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)
23
+ # bindtextdomain(domain, localedir, nil, "UTF-8")
24
+ # @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}
25
+ #
26
+ def initialize
27
+
28
+ super("bibliotheek.glade")
29
+
30
+ # @c = Client.new("infogroep.be")
31
+ @c = $global["client"]
32
+
33
+ @tabs = @glade.get_widget("tabs")
34
+
35
+ @books_isbn = @glade.get_widget("books_isbn")
36
+ @books_title = @glade.get_widget("books_title")
37
+ @books_author = @glade.get_widget("books_author")
38
+ @books_publisher = @glade.get_widget("books_publisher")
39
+ @books_year = @glade.get_widget("books_year")
40
+ @books_section = @glade.get_widget("books_section")
41
+ @books_copies = @glade.get_widget("books_copies")
42
+
43
+ @books_fields = {
44
+ "isbn" => @books_isbn,
45
+ "title" => @books_title,
46
+ "author" => @books_author,
47
+ "publisher" => @books_publisher,
48
+ "year" => @books_year,
49
+ "copies" => @books_copies
50
+ }
51
+
52
+
53
+ @books_notification = @glade.get_widget("books_notification")
54
+
55
+ @loan_memberid = @glade.get_widget("loan_memberid")
56
+ @loan_isbn = @glade.get_widget("loan_isbn")
57
+ @loan_title = @glade.get_widget("loan_title")
58
+ @loan_warranty = @glade.get_widget("loan_warranty")
59
+ @loan_notification = @glade.get_widget("loan_notification")
60
+
61
+ @loan_fields = {
62
+ "isbn" => @loan_isbn,
63
+ "warranty" => @loan_warranty,
64
+ "member" => @loan_memberid
65
+ }
66
+
67
+ @books_list = @glade.get_widget("books_list")
68
+ @loan_list = @glade.get_widget("loan_list")
69
+ @loan_list.model = @loan_list_store = Gtk::ListStore.new(Object, String, String, String, String, String)
70
+ ll = Gtk::CellRendererText.new
71
+ @loan_list.insert_column(-1, "loan date", ll) do |tvc, cell, m ,iter|
72
+ cell.text = Time.parse(iter[0].loan_date).strftime("%d/%m/%y")
73
+ end
74
+ @loan_list.insert_column(-1, "return on", ll) do |tvc, cell, m ,iter|
75
+ date = Time.parse(iter[0].return_date)
76
+ ll.foreground = "red" if date > Time.now
77
+ cell.text = date.strftime("%d/%m/%y")
78
+ ll.foreground = "black"
79
+ end
80
+ @loan_list.insert_column(-1, "memberid", ll) do |tvc, cell, m ,iter|
81
+ cell.text = iter[0].member_id
82
+ end
83
+ @loan_list.insert_column(-1, "isbn", ll) do |tvc, cell, m ,iter|
84
+ cell.text = iter[0].isbn
85
+ end
86
+ @loan_list.insert_column(-1, "warranty", ll) do |tvc, cell, m ,iter|
87
+ cell.text = iter[0].warranty
88
+ end
89
+
90
+ @books_list = @glade.get_widget("books_list")
91
+ @books_list.model = @books_list_store = Gtk::ListStore.new(Object, String)
92
+ bl = Gtk::CellRendererText.new
93
+ @books_list.insert_column(-1, "title", bl) do |tvc, cell, m ,iter|
94
+ cell.text = (iter[0].title.smaller(50) + " (#{iter[0].author})").smaller(62)
95
+ end
96
+
97
+
98
+ _update_sections
99
+ _update_books_list
100
+ _update_loan_list
101
+
102
+
103
+ end
104
+
105
+ def select_book(widget, path, column)
106
+ puts "-> select_book"
107
+ iter = widget.model.get_iter(path)
108
+ _show iter[0]
109
+ end
110
+
111
+ def select_loan(widget, path, column)
112
+ puts "-> select_loan"
113
+ iter = widget.model.get_iter(path)
114
+ @loan_isbn.text = iter[0].isbn
115
+ loan_isbn_set(nil)
116
+ @loan_memberid.text = iter[0].member_id
117
+ @loan_warranty.text = iter[0].warranty
118
+ end
119
+
120
+
121
+ def select_section()
122
+ puts "-> select_section"
123
+ #Thread.new do
124
+ # if @books_section.active_iter[0].nil?
125
+ # books = nil
126
+ # else
127
+ # books = @c.bib_lookup({"section" => @books_section.active_iter[0].name})
128
+ # end
129
+ # _update_books_list(books)
130
+ #end
131
+ end
132
+
133
+ def get_fields
134
+ puts "-> get_fields"
135
+ fields = {}
136
+ @books_fields.each do |k, f|
137
+ fields[k] = f.text unless f.text.strip.empty?
138
+ end
139
+ fields["section"] = @books_section.active_iter[0].name unless @books_section.active_iter[0].nil?
140
+ fields
141
+ end
142
+
143
+ def get_loan_fields
144
+ puts "-> get_loan_fields"
145
+ fields = {}
146
+ @loan_fields.each do |k, f|
147
+ fields[k] = f.text unless f.text.strip.empty?
148
+ end
149
+ fields
150
+ end
151
+
152
+ def books_save(widget)
153
+ puts "-> books_save"
154
+ begin
155
+ @c.bib_add!(get_fields)
156
+ _update_books_list
157
+ #books_clear
158
+ @books_notification.text = "changes saved to book!"
159
+ rescue Exception => e
160
+ puts e.backtrace
161
+ @books_notification.text = e.message.smaller
162
+ end
163
+
164
+ end
165
+ def loan_extend(widget)
166
+ puts "-> loan_extend"
167
+ begin
168
+ @c.bib_extend!(get_loan_fields)
169
+ _update_loan_list
170
+ loan_clear(nil)
171
+ @loan_notification.text = "the ig3tool imps extend the book for 3 weeks..."
172
+ rescue Exception => e
173
+ puts e.backtrace
174
+ @loan_notification.text = e.message.smaller
175
+ end
176
+ end
177
+
178
+ def hl_loan(a)
179
+ puts "hl_loan: NYI"
180
+ end
181
+
182
+ def loan_return(widget)
183
+ puts "-> loan_return"
184
+ begin
185
+ @c.bib_return!(get_loan_fields)
186
+ _update_loan_list
187
+ loan_clear(nil)
188
+ @loan_notification.text = "book returned to the ig3tool imps..."
189
+ rescue Exception => e
190
+ puts e.backtrace
191
+ @loan_notification.text = e.message.smaller
192
+ end
193
+ end
194
+
195
+ def books_delete(widget)
196
+ puts "-> books_delete"
197
+ begin
198
+ @c.bib_remove!(get_fields)
199
+ _update_books_list
200
+ reset_books_fields
201
+ @books_notification.text = "the ig3tool imps trashed the book..."
202
+ rescue Exception => e
203
+ puts e.backtrace
204
+ @loan_notification.text = e.message.smaller
205
+ end
206
+ end
207
+
208
+ def loan_refresh(widget)
209
+ puts "-> loan_refresh"
210
+ _update_loan_list
211
+ end
212
+
213
+ def books_refresh(widget)
214
+ puts "-> books_refresh"
215
+ _update_books_list
216
+ end
217
+
218
+ def tabfocus(widget, arg0, arg1)
219
+ puts "-> tabfocus"
220
+ if arg1 == 1
221
+ _update_loan_list
222
+ else
223
+ _update_books_list
224
+ end
225
+ end
226
+
227
+ def isbn_ins(a,b,c)
228
+ puts "-> isbn_ins"
229
+ reset_books_fields(false)
230
+ end
231
+ def isbn_del(a,b,c,d)
232
+ puts "-> isbn_del"
233
+ reset_books_fields(false)
234
+ end
235
+ def loan_isbn_ins(a,b,c,d)
236
+ puts "-> loan_isbn_ins"
237
+ @loan_title.text = ""
238
+ end
239
+ def loan_isbn_del(a,b,c)
240
+ puts "-> loan_isbn_del"
241
+ @loan_title.text = ""
242
+ end
243
+
244
+ def loan_isbn_set(widget)
245
+ puts "-> loan_isbn_set"
246
+ begin
247
+ book = @c.bib_info(@loan_isbn.text)
248
+ raise Exception, "the ig3tool imps found no such book..." if book.nil?
249
+ _show(book)
250
+ #@loan_title.text = book.title
251
+ rescue Exception => e
252
+ puts e.backtrace
253
+ @loan_notification.text = e.message.smaller
254
+ end
255
+ end
256
+
257
+
258
+ def books_find(widget)
259
+ puts "-> books_find"
260
+ puts "start find"
261
+ Thread.new do
262
+ begin
263
+ books = @c.bib_lookup(get_fields)
264
+ if books.size == 1
265
+ puts "find 1"
266
+ _show(books.first)
267
+ else
268
+ puts "find 2"
269
+ _update_books_list(books)
270
+ end
271
+ rescue Exception => e
272
+ puts e.backtrace
273
+ @books_notification.text = e.message.smaller
274
+ end
275
+ end
276
+ puts "end find"
277
+ end
278
+
279
+ def reset_books_fields(all=true)
280
+ puts "-> reset_books_fields"
281
+ @books_isbn.text = "" if all
282
+ @loan_isbn.text = ""
283
+ @books_title.text = ""
284
+ @loan_title.text = ""
285
+ @loan_memberid.text = ""
286
+ @books_author.text = ""
287
+ @books_publisher.text = ""
288
+ @books_year.text = ""
289
+ @books_copies.text = ""
290
+ @books_section.active = 0
291
+ @books_notification.text = ""
292
+ end
293
+
294
+ def books_clear(widget, all=true)
295
+ puts "-> books_clear"
296
+ reset_books_fields(all)
297
+ #_update_books_list
298
+ end
299
+
300
+
301
+ def loan_clear(widget, all=true)
302
+ puts "-> loan_clear"
303
+ @loan_isbn.text = ""
304
+ @loan_memberid.text = ""
305
+ @loan_warranty.text = "5"
306
+ @loan_notification.text = "" if all
307
+ @loan_title.text = ""
308
+ reset_books_fields
309
+ end
310
+
311
+ def loan_loan(widget)
312
+ puts "-> loan_loan"
313
+ @loan_notification.text = ""
314
+ begin
315
+ @c.bib_loan!(get_loan_fields)
316
+ _update_loan_list
317
+ loan_clear(nil)
318
+ rescue Exception => e
319
+ puts e.backtrace
320
+ @loan_notification.text = e.message.smaller(65)
321
+ end
322
+ end
323
+
324
+ def books_loan(widget)
325
+ @tabs.page = 1
326
+ end
327
+
328
+
329
+
330
+
331
+
332
+ private
333
+
334
+
335
+
336
+ def _lookup_amazon_isbn (isbn)
337
+ return false unless $global['amazon_loaded'] # Indien de amazon gem niet geladen is, return
338
+ return false unless _isbn?(true,isbn) # Indien strenge test faalt
339
+
340
+ if isbn.length == 13 # indien in de nieuwe vorm, maak er een oude van
341
+ isbn = isbn[3..11]
342
+ sum = 0
343
+ 9.times {|i| sum += isbn[i].chr.to_i * (10 - i) }
344
+ controlecijfer = 11 - (sum % 11)
345
+ if controlecijfer != 10
346
+ isbn = isbn + controlecijfer.to_s
347
+ else
348
+ isbn = isbn + "X"
349
+ end
350
+ end
351
+
352
+ # You need a amazon-dev-token in client.rb
353
+ token = CONFIG['amazon-dev-token']
354
+ return unless $global['amazon_loaded'] and token.instance_of?(String) and not token.empty?
355
+
356
+ begin
357
+ req = Amazon::Search::Request.new(CONFIG["amazon-dev-token"],CONFIG["amazon-associates-id"])
358
+ res = req.asin_search(isbn)
359
+ prod = res.products
360
+ return if prod.length == 0
361
+ book = prod[0]
362
+
363
+ @books_title.text = book['product_name'].to_s.strip
364
+ @books_author.text = book['authors'].join(', ').strip if !book['authors'] and book['authors'].class == "Array" # opgelet, niets wegdoen!
365
+ @books_publisher.text = book['manufacturer'].to_s.strip
366
+ @books_year.text = book['release_date'].to_s.strip
367
+ rescue
368
+ puts e.backtrace
369
+ _print_msg "Fout: Lookup Amazon: #{$!}", "ISBN: #{isbn}"
370
+ end
371
+ end
372
+
373
+ def _show(book)
374
+ puts "-> _show"
375
+ @books_isbn.text = book["isbn"]
376
+ @loan_isbn.text = book["isbn"]
377
+ @books_title.text = book["title"]
378
+ @loan_title.text = book["title"]
379
+ @loan_notification.text = ""
380
+ @books_author.text = book["author"]
381
+ @books_publisher.text = book["publisher"]
382
+ @books_year.text = book["year"]
383
+ @books_copies.text = book["copies"]
384
+ _update_sections
385
+ sections = @c.bib_sections.collect{|b| b.name}
386
+ index = sections.index book.section
387
+ @books_section.active = index+1
388
+ end
389
+
390
+ def _update_books_list(books=nil, clear=true)
391
+ puts "-> _update_books_list"
392
+ @books_notification.text = "loading books..."
393
+ @books_list_store.clear if clear
394
+ Thread.new do
395
+ books = @c.bib_books if books.nil?
396
+ unless books.empty?
397
+ books.each do |b|
398
+ @books_list_store.append[0] = b
399
+ end
400
+ end
401
+ if books.empty?
402
+ @books_notification.text = "the ig3tool imps found no books..."
403
+ else
404
+ @books_notification.text = ""
405
+ end
406
+ end
407
+
408
+ end
409
+
410
+ def _update_loan_list(clear=true)
411
+ puts "-> _update_loan_list"
412
+ @loan_list_store.clear if clear
413
+ Thread.new do
414
+ loans = @c.bib_loans
415
+ loans.each do |b|
416
+ @loan_list_store.append[0] = b
417
+ end
418
+ end
419
+
420
+ end
421
+
422
+
423
+ def _update_sections
424
+ puts "-> _update_sections"
425
+ sections = @c.bib_sections
426
+ sections_model = Gtk::ListStore.new(Object, String)
427
+
428
+ empty = sections_model.append
429
+ empty[0] = nil
430
+ empty[1] = "ANY: Any section"
431
+
432
+ sections.each do |s|
433
+ row = sections_model.append
434
+ row[0] = s
435
+ row[1] = s.name + ": " + s.full_name
436
+ end
437
+
438
+ @books_section.model = sections_model
439
+ @books_section.active = 0
440
+ @books_section.clear
441
+ renderer = Gtk::CellRendererText.new
442
+ @books_section.pack_start(renderer, true)
443
+ @books_section.set_attributes(renderer, :text => 1)
444
+ end
445
+
446
+
447
+
448
+ end
449
+
450
+ register_window(BibliotheekWindow)
451
+
452
+
453
+ end