ig3tool 0.4.0 → 0.4.4
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.
- data/lib/glade/printing.glade +519 -2
- data/lib/glade/protjes.glade +54 -7
- data/lib/glade/sales.glade +114 -85
- data/lib/glade/sound/burp.wav +0 -0
- data/lib/glade/sound/cash2.wav +0 -0
- data/lib/glade/sound/cow.wav +0 -0
- data/lib/glade/sound/kaching.wav +0 -0
- data/lib/glade/sound/scribble.wav +0 -0
- data/lib/glade/sound/shaglic1.wav +0 -0
- data/lib/glade/sound/yeahbaby.wav +0 -0
- data/lib/lib/errors.rb +4 -0
- data/lib/ui/automaatwindow.rb +6 -6
- data/lib/ui/bibliotheekwindow.rb +5 -4
- data/lib/ui/gladehelper.rb +30 -0
- data/lib/ui/interne.rb +2 -1
- data/lib/ui/peoplewindow.rb +5 -5
- data/lib/ui/printingwindow.rb +152 -19
- data/lib/ui/protjes.rb +38 -5
- data/lib/ui/saleswindow.rb +74 -21
- metadata +12 -4
- /data/lib/ui/{bibwindow.rb → OLD_bibwindow.rb} +0 -0
data/lib/ui/interne.rb
CHANGED
|
@@ -105,7 +105,8 @@ module Ig3tool
|
|
|
105
105
|
begin
|
|
106
106
|
amount = @amount.text
|
|
107
107
|
raise Ig3tool::IG3Error, "uncorrect format for amount" unless amount =~ /\d+(\.\d{1,2}){0,1}/
|
|
108
|
-
message = @message.text.strip
|
|
108
|
+
message = @message.text.strip
|
|
109
|
+
message = "No message" if message.nil? or message.empty?
|
|
109
110
|
$client.interne_transfer!("from" => fromusername, "to" => tousername, "amount" => @amount.text.strip.to_c, "message" => message)
|
|
110
111
|
_clear
|
|
111
112
|
_update_transactions(fromusername)
|
data/lib/ui/peoplewindow.rb
CHANGED
|
@@ -201,9 +201,9 @@ module Ig3tool
|
|
|
201
201
|
end
|
|
202
202
|
def select (widget, path, column)
|
|
203
203
|
iter = widget.model.get_iter(path)
|
|
204
|
-
puts "SELECT"
|
|
205
204
|
clear_all(nil)
|
|
206
|
-
|
|
205
|
+
u = $client.person_lookup("username", iter[0].username.to_s)[0]
|
|
206
|
+
_show(u)
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
def clear_all(widget, clearnotification=true)
|
|
@@ -249,9 +249,9 @@ module Ig3tool
|
|
|
249
249
|
if people.nil?
|
|
250
250
|
case @statussearch.active
|
|
251
251
|
when -1
|
|
252
|
-
people = $client.
|
|
252
|
+
people = $client.person_people
|
|
253
253
|
when 0
|
|
254
|
-
people = $client.
|
|
254
|
+
people = $client.person_people
|
|
255
255
|
when 1
|
|
256
256
|
people = $client.person_debuggers
|
|
257
257
|
when 2
|
|
@@ -286,7 +286,7 @@ module Ig3tool
|
|
|
286
286
|
|
|
287
287
|
|
|
288
288
|
def _show(person)
|
|
289
|
-
puts "DEBUG: #{person.inspect}"
|
|
289
|
+
#puts "DEBUG: #{person.inspect}"
|
|
290
290
|
begin
|
|
291
291
|
@username.text = person["username"]
|
|
292
292
|
@email.text = person["email"]
|
data/lib/ui/printingwindow.rb
CHANGED
|
@@ -50,6 +50,7 @@ module Ig3tool
|
|
|
50
50
|
|
|
51
51
|
@filteredlog = @glade.get_widget("filteredlog")
|
|
52
52
|
@filteredlog.model = @filteredlog_store = Gtk::ListStore.new(Object, String)
|
|
53
|
+
@last_log_id = 0
|
|
53
54
|
fl = Gtk::CellRendererText.new
|
|
54
55
|
@filteredlog.insert_column(-1, "message", fl) do |tvc, cell, m ,iter|
|
|
55
56
|
if iter[0].category == "print"
|
|
@@ -64,6 +65,7 @@ module Ig3tool
|
|
|
64
65
|
|
|
65
66
|
@log = @glade.get_widget("log")
|
|
66
67
|
@log.model = @log_store = Gtk::ListStore.new(Object)
|
|
68
|
+
@last_big_log_id = 0
|
|
67
69
|
l = Gtk::CellRendererText.new
|
|
68
70
|
@log.insert_column(-1, "time", l) do |tvc, cell, m, iter|
|
|
69
71
|
cell.text = Time.parse(iter[0].time).strftime("%d/%m %H:%M")
|
|
@@ -79,7 +81,7 @@ module Ig3tool
|
|
|
79
81
|
cell.text = iter[0].queue
|
|
80
82
|
end
|
|
81
83
|
@log.insert_column(-1, "amount", l) do |tvc, cell, m, iter|
|
|
82
|
-
cell.text = iter[0].amount
|
|
84
|
+
cell.text = iter[0].amount.from_c.to_s
|
|
83
85
|
end
|
|
84
86
|
@log.insert_column(-1, "host", l) do |tvc, cell, m, iter|
|
|
85
87
|
cell.text = iter[0].host
|
|
@@ -90,11 +92,26 @@ module Ig3tool
|
|
|
90
92
|
@log.insert_column(-1, "job", l) do |tvc, cell, m, iter|
|
|
91
93
|
cell.text = iter[0].job
|
|
92
94
|
end
|
|
95
|
+
@log.insert_column(-1, "message", l) do |tvc, cell, m, iter|
|
|
96
|
+
cell.text = iter[0].message
|
|
97
|
+
end
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
# externals
|
|
100
|
+
@ext_debugger = @glade.get_widget("ext_debugger")
|
|
101
|
+
@ext_notification = @glade.get_widget("ext_notification")
|
|
102
|
+
@ext_name = @glade.get_widget("ext_name")
|
|
103
|
+
@ext_contact = @glade.get_widget("ext_contact")
|
|
104
|
+
@ext_ip = @glade.get_widget("ext_ip")
|
|
105
|
+
@ext_debt = @glade.get_widget("ext_debt")
|
|
106
|
+
@ext_list = @glade.get_widget("ext_list")
|
|
107
|
+
@ext_list.model = @ext_list_store = Gtk::ListStore.new(Object, String)
|
|
108
|
+
err = Gtk::CellRendererText.new
|
|
109
|
+
@ext_list.insert_column(-1, "ext", err, :text => 1)
|
|
110
|
+
@ext_list.enable_search = true
|
|
111
|
+
|
|
112
|
+
make_debugger_combo(@ext_debugger)
|
|
113
|
+
|
|
114
|
+
refresh(nil)
|
|
98
115
|
@statussearch.active = 0
|
|
99
116
|
make_menu
|
|
100
117
|
make_bigmenu
|
|
@@ -182,6 +199,69 @@ module Ig3tool
|
|
|
182
199
|
end
|
|
183
200
|
|
|
184
201
|
|
|
202
|
+
# funtions for extern tab
|
|
203
|
+
|
|
204
|
+
def ext_apply(w)
|
|
205
|
+
begin
|
|
206
|
+
$client.print_update_external!("name" => @ext_name.text.strip, "contact" => @ext_contact.text.strip, "ip" => @ext_ip.text.strip)
|
|
207
|
+
_ext_clear
|
|
208
|
+
_update_ext_list
|
|
209
|
+
@ext_notification.text = "the imps applied your changes!"
|
|
210
|
+
rescue Exception => e
|
|
211
|
+
@ext_notification.text = e.class.to_s + " " + e.message.to_s
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def ext_cancel(w)
|
|
216
|
+
_ext_clear
|
|
217
|
+
_update_ext_list
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
def ext_delete(w)
|
|
221
|
+
begin
|
|
222
|
+
$client.print_remove_external!("name" => @ext_name.text.strip)
|
|
223
|
+
_update_ext_list
|
|
224
|
+
_ext_clear
|
|
225
|
+
@ext_notification.text = "the imps removed this external!"
|
|
226
|
+
rescue Exception => e
|
|
227
|
+
@ext_notification.text = e.class.to_s + " " + e.message.to_s
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def get_debugger(widget)
|
|
232
|
+
widget.active_iter[0]
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def ext_reset(w)
|
|
237
|
+
begin
|
|
238
|
+
if @ext_debugger.active == -1
|
|
239
|
+
@ext_notification.text = "Please select a debugger!"
|
|
240
|
+
else
|
|
241
|
+
$client.print_reset_external!("external" => @ext_name.text.strip, "debugger" => get_debugger(@ext_debugger).username)
|
|
242
|
+
_ext_clear
|
|
243
|
+
@ext_notification.text = "the imps resetted the debt of this external!"
|
|
244
|
+
end
|
|
245
|
+
rescue Exception => e
|
|
246
|
+
@ext_notification.text = e.class.to_s + " " + e.message.to_s
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def ext_smart_update(w)
|
|
251
|
+
name = @ext_name.text.strip
|
|
252
|
+
_ext_show(name)
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
def ext_seleted(w, path, col)
|
|
256
|
+
name = w.model.get_iter(path)[1]
|
|
257
|
+
_ext_show(name)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
# end of extern
|
|
263
|
+
|
|
264
|
+
|
|
185
265
|
|
|
186
266
|
def alias_apply(w)
|
|
187
267
|
begin
|
|
@@ -281,8 +361,12 @@ module Ig3tool
|
|
|
281
361
|
end
|
|
282
362
|
|
|
283
363
|
def refresh(widget) # refreshes the usernames list and the small log
|
|
284
|
-
|
|
285
|
-
|
|
364
|
+
if !@refreshing
|
|
365
|
+
@refreshing = true
|
|
366
|
+
_update_usernames
|
|
367
|
+
_update_log
|
|
368
|
+
@refreshing = false
|
|
369
|
+
end
|
|
286
370
|
end
|
|
287
371
|
|
|
288
372
|
|
|
@@ -322,6 +406,8 @@ module Ig3tool
|
|
|
322
406
|
refresh(nil)
|
|
323
407
|
when 2
|
|
324
408
|
_update_aliases(nil)
|
|
409
|
+
when 3
|
|
410
|
+
_update_ext_list
|
|
325
411
|
end
|
|
326
412
|
end
|
|
327
413
|
|
|
@@ -333,6 +419,8 @@ module Ig3tool
|
|
|
333
419
|
else
|
|
334
420
|
begin
|
|
335
421
|
user = $client.print_user(@username.text)
|
|
422
|
+
_ext_clear
|
|
423
|
+
@ext_contact.text = user.username
|
|
336
424
|
person = $client.person_lookup({"username" => @username.text})
|
|
337
425
|
raise NotFound, "the ig3tool imps found no such user..." if person.nil?
|
|
338
426
|
person = person[0]
|
|
@@ -351,6 +439,8 @@ module Ig3tool
|
|
|
351
439
|
raise NotFound, "the ig3tool imps found no such user..." if person.nil? or person.empty?
|
|
352
440
|
person = person[0]
|
|
353
441
|
@email.text = person["email"]
|
|
442
|
+
_ext_clear
|
|
443
|
+
@ext_contact.text = user.username
|
|
354
444
|
@saldo.text = "0.0"
|
|
355
445
|
@firstname.text = person["first_name"]
|
|
356
446
|
@lastname.text = person["last_name"]
|
|
@@ -457,6 +547,8 @@ module Ig3tool
|
|
|
457
547
|
user = $client.print_user(username)
|
|
458
548
|
person = $client.person_lookup({"username", username})[0]
|
|
459
549
|
@username.text = username
|
|
550
|
+
_ext_clear
|
|
551
|
+
@ext_contact.text = username
|
|
460
552
|
@email.text = person["email"]
|
|
461
553
|
@saldo.text = user["saldo"].from_c.to_s
|
|
462
554
|
@firstname.text = person["first_name"]
|
|
@@ -473,6 +565,8 @@ module Ig3tool
|
|
|
473
565
|
raise NotFound, "the ig3tool imps found no such user..." if person.nil? or person.empty?
|
|
474
566
|
person = person[0]
|
|
475
567
|
@username.text = username
|
|
568
|
+
_ext_clear
|
|
569
|
+
@ext_contact.text = username
|
|
476
570
|
@email.text = person["email"]
|
|
477
571
|
@saldo.text = "0"
|
|
478
572
|
@firstname.text = person["first_name"]
|
|
@@ -493,6 +587,18 @@ module Ig3tool
|
|
|
493
587
|
end
|
|
494
588
|
end
|
|
495
589
|
|
|
590
|
+
def _ext_show(name)
|
|
591
|
+
begin
|
|
592
|
+
e = $client.print_external(name)
|
|
593
|
+
@ext_name.text = e.name
|
|
594
|
+
@ext_contact.text = e.contact
|
|
595
|
+
@ext_ip.text = e.ip
|
|
596
|
+
@ext_debt.text = e.debt.from_c.to_s
|
|
597
|
+
rescue Exception => e
|
|
598
|
+
@notification.text = (e.class.to_s + " - " + e.message)
|
|
599
|
+
end
|
|
600
|
+
end
|
|
601
|
+
|
|
496
602
|
def _update_usernames(clear=true)
|
|
497
603
|
@usernames.model = nil
|
|
498
604
|
@usernames_store.clear if clear
|
|
@@ -524,28 +630,55 @@ module Ig3tool
|
|
|
524
630
|
@aliases.model = @aliases_store
|
|
525
631
|
end
|
|
526
632
|
end
|
|
633
|
+
|
|
634
|
+
def _update_ext_list
|
|
635
|
+
@ext_list.model = nil
|
|
636
|
+
@ext_list_store.clear
|
|
637
|
+
Thread.new do
|
|
638
|
+
exts = $client.print_externals
|
|
639
|
+
exts.each do |e|
|
|
640
|
+
row = @ext_list_store.append
|
|
641
|
+
row[1] = e.name
|
|
642
|
+
row[0] = e
|
|
643
|
+
end
|
|
644
|
+
@ext_list.model = @ext_list_store
|
|
645
|
+
end
|
|
646
|
+
end
|
|
527
647
|
|
|
528
648
|
|
|
529
|
-
def _update_log
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
loglines
|
|
533
|
-
|
|
534
|
-
@filteredlog_store.append[0] = ll
|
|
649
|
+
def _update_log
|
|
650
|
+
Thread.new do
|
|
651
|
+
loglines = $client.print_logs(200, @last_log_id)
|
|
652
|
+
loglines.reverse.each do |ll|
|
|
653
|
+
@filteredlog_store.prepend[0] = ll
|
|
535
654
|
end
|
|
655
|
+
@last_log_id = loglines.first.real_id
|
|
536
656
|
end
|
|
537
657
|
end
|
|
538
658
|
|
|
539
|
-
def _update_biglog
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
659
|
+
def _update_biglog
|
|
660
|
+
if !@updating_biglog # sommige kindjes vinden het leuk om op refresh te klikken
|
|
661
|
+
@updating_biglog = true
|
|
662
|
+
Thread.new do
|
|
663
|
+
loglines = $client.print_logs(200, @last_big_log_id)
|
|
664
|
+
loglines.reverse.each do |ll|
|
|
665
|
+
@log_store.prepend[0] = ll
|
|
666
|
+
end
|
|
667
|
+
@last_big_log_id = loglines.first.real_id
|
|
668
|
+
@updating_biglog = false
|
|
545
669
|
end
|
|
546
670
|
end
|
|
547
671
|
end
|
|
548
672
|
|
|
673
|
+
def _ext_clear
|
|
674
|
+
@ext_name.text = ""
|
|
675
|
+
@ext_contact.text = ""
|
|
676
|
+
@ext_ip.text = ""
|
|
677
|
+
@ext_debt.text = ""
|
|
678
|
+
@ext_notification.text = ""
|
|
679
|
+
@ext_debugger.active = -1
|
|
680
|
+
end
|
|
681
|
+
|
|
549
682
|
def quick_message(message, title="ig3tool message")
|
|
550
683
|
# Create the dialog
|
|
551
684
|
dialog = Gtk::Dialog.new(title,
|
data/lib/ui/protjes.rb
CHANGED
|
@@ -41,6 +41,7 @@ def initialize
|
|
|
41
41
|
@purchase_debuggers_orig = @glade.get_widget("purchase_debuggers_orig")
|
|
42
42
|
@purchase_plebs_orig = @glade.get_widget("purchase_plebs_orig")
|
|
43
43
|
@purchase_members_orig = @glade.get_widget("purchase_members_orig")
|
|
44
|
+
@purchase_last = @glade.get_widget("purchase_last")
|
|
44
45
|
@purchase_debugger = @glade.get_widget("purchase_debugger")
|
|
45
46
|
@purchase_debuggers = @glade.get_widget("purchase_debuggers")
|
|
46
47
|
@purchase_plebs = @glade.get_widget("purchase_plebs")
|
|
@@ -219,7 +220,21 @@ def initialize
|
|
|
219
220
|
@stock_stock_new].each do |w|
|
|
220
221
|
make_eval_widget w
|
|
221
222
|
end
|
|
223
|
+
|
|
224
|
+
@handler69 = @purchase_debugger.signal_connect("changed"){ purchase_debugger_changed }
|
|
225
|
+
@debugger_stamp = nil
|
|
226
|
+
|
|
227
|
+
end
|
|
222
228
|
|
|
229
|
+
def purchase_debugger_changed
|
|
230
|
+
puts "debugger changed"
|
|
231
|
+
@debugger_stamp = Time.now
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def check_purchase_debugger_reset
|
|
235
|
+
if @debugger_stamp.nil? or ((Time.now - @debugger_stamp).to_i > 300)
|
|
236
|
+
@purchase_debugger.active = -1
|
|
237
|
+
end
|
|
223
238
|
end
|
|
224
239
|
|
|
225
240
|
def get_debugger(widget)
|
|
@@ -317,6 +332,7 @@ end
|
|
|
317
332
|
end
|
|
318
333
|
|
|
319
334
|
def toggle_price_fields(from_save, bool=nil)
|
|
335
|
+
# if from_save = true the saving of prices gets skipped
|
|
320
336
|
bool = (not @manage_debuggers.sensitive?) if bool.nil?
|
|
321
337
|
@manage_debuggers.sensitive = bool
|
|
322
338
|
@manage_debuggers.editable = bool
|
|
@@ -395,14 +411,16 @@ end
|
|
|
395
411
|
end
|
|
396
412
|
|
|
397
413
|
def add_cancel(widget)
|
|
398
|
-
toggle_price_fields(
|
|
414
|
+
toggle_price_fields(true, false)
|
|
399
415
|
_add_clear
|
|
400
416
|
end
|
|
401
417
|
def log_cancel(w)
|
|
402
418
|
_log_clear
|
|
419
|
+
_update_log
|
|
403
420
|
end
|
|
404
421
|
def slog_cancel(w)
|
|
405
422
|
_slog_clear
|
|
423
|
+
_update_slog
|
|
406
424
|
end
|
|
407
425
|
def to_purchase(w)
|
|
408
426
|
@tabs.page = 1
|
|
@@ -412,7 +430,7 @@ end
|
|
|
412
430
|
begin
|
|
413
431
|
p = $client.product_lookup(barcode)
|
|
414
432
|
_update_log(barcode)
|
|
415
|
-
rescue
|
|
433
|
+
rescue Needed => e
|
|
416
434
|
_update_log
|
|
417
435
|
end
|
|
418
436
|
end
|
|
@@ -421,7 +439,7 @@ end
|
|
|
421
439
|
begin
|
|
422
440
|
p = $client.product_lookup(barcode)
|
|
423
441
|
_update_slog(barcode)
|
|
424
|
-
rescue
|
|
442
|
+
rescue Needed => e
|
|
425
443
|
_update_slog
|
|
426
444
|
end
|
|
427
445
|
end
|
|
@@ -453,8 +471,9 @@ end
|
|
|
453
471
|
def add_delete(w)
|
|
454
472
|
begin
|
|
455
473
|
barcode = @add_barcode.text.strip
|
|
456
|
-
$client.product_remove!(barcode)
|
|
474
|
+
$client.product_remove!("barcode" => barcode)
|
|
457
475
|
_add_clear
|
|
476
|
+
_update_add_products(false)
|
|
458
477
|
rescue Exception => e
|
|
459
478
|
@add_notification.text = e.message
|
|
460
479
|
end
|
|
@@ -483,6 +502,7 @@ end
|
|
|
483
502
|
|
|
484
503
|
def purchase_cancel(widget)
|
|
485
504
|
_purchase_clear
|
|
505
|
+
check_purchase_debugger_reset
|
|
486
506
|
end
|
|
487
507
|
|
|
488
508
|
def price_ins(widget, arg0, arg1, arg2)
|
|
@@ -494,6 +514,7 @@ end
|
|
|
494
514
|
_update_add_products
|
|
495
515
|
when 1
|
|
496
516
|
_update_purchase_products
|
|
517
|
+
check_purchase_debugger_reset
|
|
497
518
|
when 2
|
|
498
519
|
_update_stock_products
|
|
499
520
|
when 3
|
|
@@ -516,6 +537,7 @@ end
|
|
|
516
537
|
begin
|
|
517
538
|
@add_notification.text = "saving product..."
|
|
518
539
|
toggle_price_fields(true, false)
|
|
540
|
+
barcode = @add_barcode.text.strip
|
|
519
541
|
raise Needed, "please scan a barcode" if @add_barcode.text.strip.empty?
|
|
520
542
|
raise Needed, "please enter a descriptive name" if @add_name.text.strip.empty?
|
|
521
543
|
raise Needed, "please select a category" if @add_prodcat.active == -1
|
|
@@ -523,6 +545,8 @@ end
|
|
|
523
545
|
_update_add_products(false)
|
|
524
546
|
@add_notification.text = "the imps saved the product!"
|
|
525
547
|
_add_clear(false)
|
|
548
|
+
_add_show(barcode)
|
|
549
|
+
_purchase_show(barcode)
|
|
526
550
|
rescue Exception => e
|
|
527
551
|
@add_notification.text = e.message
|
|
528
552
|
end
|
|
@@ -603,6 +627,12 @@ end
|
|
|
603
627
|
@purchase_category.text = prod.category
|
|
604
628
|
price_amount_changed
|
|
605
629
|
toggle_purchase_fields(true)
|
|
630
|
+
Thread.new do
|
|
631
|
+
ps = $client.product_purchases(barcode)
|
|
632
|
+
last_purchase = ps.first
|
|
633
|
+
date = Time.parse(last_purchase.time).strftime("%d/%m/%y")
|
|
634
|
+
@purchase_last.text = date
|
|
635
|
+
end
|
|
606
636
|
rescue Exception => e
|
|
607
637
|
@purchase_notification.text = e.message
|
|
608
638
|
ensure
|
|
@@ -773,16 +803,19 @@ end
|
|
|
773
803
|
@add_prodcat.active = -1
|
|
774
804
|
@add_notification.text = "" if all
|
|
775
805
|
end
|
|
806
|
+
|
|
776
807
|
def _purchase_clear(all=true)
|
|
777
808
|
@purchase_members_orig.text = "0.0"
|
|
778
809
|
@purchase_debuggers_orig.text = "0.0"
|
|
779
810
|
@purchase_plebs_orig.text = "0.0"
|
|
780
811
|
@purchase_members.text = ""
|
|
781
812
|
@purchase_debuggers.text = ""
|
|
782
|
-
|
|
813
|
+
#@purchase_debugger.active = -1
|
|
814
|
+
check_purchase_debugger_reset
|
|
783
815
|
@purchase_plebs.text = ""
|
|
784
816
|
@purchase_barcode.text = "" if all
|
|
785
817
|
@purchase_stock.text = ""
|
|
818
|
+
@purchase_last.text = ""
|
|
786
819
|
@purchase_amount.text = ""
|
|
787
820
|
@purchase_price.text = ""
|
|
788
821
|
@purchase_date.text = Time.now.strftime("%Y-%m-%d")
|
data/lib/ui/saleswindow.rb
CHANGED
|
@@ -13,6 +13,9 @@ module Ig3tool
|
|
|
13
13
|
@statushashi = @statushash.invert
|
|
14
14
|
|
|
15
15
|
# init items
|
|
16
|
+
@saldo_label = _get_widget("saldo_label")
|
|
17
|
+
@saldo = _get_widget("saldo")
|
|
18
|
+
|
|
16
19
|
@items = _get_widget("list")
|
|
17
20
|
@items.model = Gtk::ListStore.new(Integer, String, Float, Object, String)
|
|
18
21
|
r = Gtk::CellRendererText.new
|
|
@@ -25,8 +28,37 @@ module Ig3tool
|
|
|
25
28
|
|
|
26
29
|
make_debugger_combo(_get_widget("debugger"), @window)
|
|
27
30
|
make_eval_widget @glade.get_widget("count"), 1
|
|
31
|
+
|
|
32
|
+
toggle_saldo_label(false)
|
|
28
33
|
end
|
|
29
34
|
|
|
35
|
+
def set_saldo(username)
|
|
36
|
+
begin
|
|
37
|
+
i = $client.interne(username)
|
|
38
|
+
@saldo.text = i.saldo.from_c.to_s
|
|
39
|
+
rescue Exception => e
|
|
40
|
+
@saldo.text = e.message
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def toggle_saldo_label(bool=nil)
|
|
45
|
+
if bool.nil?
|
|
46
|
+
if @saldo_label.text.empty?
|
|
47
|
+
@saldo_label.text = "Saldo:"
|
|
48
|
+
else
|
|
49
|
+
@saldo_label.text = ""
|
|
50
|
+
@saldo.text = ""
|
|
51
|
+
end
|
|
52
|
+
else
|
|
53
|
+
if bool
|
|
54
|
+
@saldo_label.text = "Saldo:"
|
|
55
|
+
else
|
|
56
|
+
@saldo_label.text = ""
|
|
57
|
+
@saldo.text = ""
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
30
62
|
def smartzap_activate
|
|
31
63
|
value = _get_widget("smartzap").text
|
|
32
64
|
value.strip!
|
|
@@ -36,6 +68,7 @@ module Ig3tool
|
|
|
36
68
|
when "non member"
|
|
37
69
|
@target = nil
|
|
38
70
|
@status = "non member"
|
|
71
|
+
toggle_saldo_label(false)
|
|
39
72
|
@member_id.active = @statushashi[@status]
|
|
40
73
|
return
|
|
41
74
|
|
|
@@ -51,29 +84,39 @@ module Ig3tool
|
|
|
51
84
|
|
|
52
85
|
# is het een debugger?
|
|
53
86
|
when /^[a-z-]/i
|
|
87
|
+
|
|
88
|
+
play("tetten") if value == "tetten"
|
|
89
|
+
|
|
54
90
|
wanted = {"username", value, "status", "debugger"}
|
|
55
91
|
pers = $client.person_lookup(wanted)
|
|
56
92
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
93
|
+
unless pers.empty?
|
|
94
|
+
pers = pers.first
|
|
95
|
+
|
|
96
|
+
@status = "debugger"
|
|
97
|
+
@target = @debugger = pers.username
|
|
98
|
+
toggle_saldo_label(true)
|
|
99
|
+
set_saldo(@debugger)
|
|
100
|
+
|
|
101
|
+
_get_widget("debugger").model.each do |m, p, i|
|
|
102
|
+
if i[1] == @target
|
|
103
|
+
_get_widget("debugger").active_iter = i
|
|
104
|
+
@member_id.active = @statushashi[@status]
|
|
105
|
+
return
|
|
106
|
+
end
|
|
107
|
+
end if _get_widget("debugger").model # Can be nil if editted too fast
|
|
108
|
+
end
|
|
109
|
+
#return
|
|
110
|
+
end
|
|
61
111
|
|
|
62
|
-
unless pers.empty?
|
|
63
|
-
pers = pers.first
|
|
64
112
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@member_id.active = @statushashi[@status]
|
|
72
|
-
break
|
|
73
|
-
end
|
|
74
|
-
end
|
|
113
|
+
# lidkaart magic: eg scan 000708XXXXX -> lidkaart
|
|
114
|
+
begin
|
|
115
|
+
jaar = Time.werkjaar % 100
|
|
116
|
+
lidkaartx = sprintf("^00%02d%02d", jaar, jaar+1).to_re
|
|
117
|
+
if value =~ lidkaartx # yay! fascets! (fascisme?)
|
|
118
|
+
value = "lidkaart"
|
|
75
119
|
end
|
|
76
|
-
return
|
|
77
120
|
end
|
|
78
121
|
|
|
79
122
|
# is het een member?
|
|
@@ -93,6 +136,9 @@ module Ig3tool
|
|
|
93
136
|
qty = _get_widget("count").text.to_i
|
|
94
137
|
_add_product(prod, qty)
|
|
95
138
|
return
|
|
139
|
+
rescue Exception => e
|
|
140
|
+
warn "Look mom, it's an airplane!"
|
|
141
|
+
warn "#{e.class} - #{e.message}"
|
|
96
142
|
end
|
|
97
143
|
# het is een vliegtuig!
|
|
98
144
|
end
|
|
@@ -104,6 +150,8 @@ module Ig3tool
|
|
|
104
150
|
@target = @debugger = iter[1]
|
|
105
151
|
@member_id.active = @statushashi[@status]
|
|
106
152
|
end
|
|
153
|
+
toggle_saldo_label(true)
|
|
154
|
+
set_saldo(@debugger)
|
|
107
155
|
end
|
|
108
156
|
|
|
109
157
|
def member_changed
|
|
@@ -113,12 +161,16 @@ module Ig3tool
|
|
|
113
161
|
case chosen
|
|
114
162
|
when "non member"
|
|
115
163
|
@status = "non member"
|
|
164
|
+
toggle_saldo_label(false)
|
|
116
165
|
|
|
117
166
|
when "debugger"
|
|
118
167
|
@target = @debugger = _get_widget("debugger").active_iter[1]
|
|
119
168
|
@status = "debugger"
|
|
169
|
+
toggle_saldo_label(true)
|
|
170
|
+
set_saldo(@debugger)
|
|
120
171
|
|
|
121
172
|
else # member
|
|
173
|
+
toggle_saldo_label(false)
|
|
122
174
|
begin
|
|
123
175
|
memb = $client.person_member(chosen)
|
|
124
176
|
|
|
@@ -163,10 +215,11 @@ module Ig3tool
|
|
|
163
215
|
end
|
|
164
216
|
|
|
165
217
|
def clear_clicked
|
|
218
|
+
play("clear")
|
|
166
219
|
@items.model.clear
|
|
167
|
-
@status = "non member"
|
|
168
|
-
@member_id.active = @statushashi[@status]
|
|
169
220
|
_update_total
|
|
221
|
+
toggle_saldo_label(false)
|
|
222
|
+
@member_id.active = 0
|
|
170
223
|
end
|
|
171
224
|
|
|
172
225
|
alias_method :count_activate, :smartzap_activate
|
|
@@ -204,7 +257,7 @@ module Ig3tool
|
|
|
204
257
|
begin
|
|
205
258
|
$client.scribble! params
|
|
206
259
|
clear_clicked
|
|
207
|
-
|
|
260
|
+
play("scribble")
|
|
208
261
|
rescue Exception => e
|
|
209
262
|
puts "Error: #{$!}"
|
|
210
263
|
end
|
|
@@ -222,7 +275,7 @@ module Ig3tool
|
|
|
222
275
|
begin
|
|
223
276
|
$client.kaching! params
|
|
224
277
|
clear_clicked
|
|
225
|
-
|
|
278
|
+
play("kaching")
|
|
226
279
|
rescue Exception => e
|
|
227
280
|
puts "Error: #{$!}"
|
|
228
281
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ig3tool
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kevin Pinte
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2008-04-
|
|
12
|
+
date: 2008-04-25 00:00:00 +02:00
|
|
13
13
|
default_executable: ig3tool
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
requirements:
|
|
20
20
|
- - ">="
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.
|
|
22
|
+
version: 0.4.0
|
|
23
23
|
version:
|
|
24
24
|
description:
|
|
25
25
|
email: igtool@infogroep.be
|
|
@@ -36,7 +36,6 @@ files:
|
|
|
36
36
|
- bin/ig3tool
|
|
37
37
|
- lib/ui/OLD_internewindow.rb
|
|
38
38
|
- lib/ui/OLD_memberswindow.rb
|
|
39
|
-
- lib/ui/bibwindow.rb
|
|
40
39
|
- lib/ui/loginwindow.rb
|
|
41
40
|
- lib/ui/toolwindow.rb
|
|
42
41
|
- lib/ui/saleswindow.rb
|
|
@@ -50,6 +49,7 @@ files:
|
|
|
50
49
|
- lib/ui/bibliotheekwindow.rb
|
|
51
50
|
- lib/ui/OLD_printenwindow.rb
|
|
52
51
|
- lib/ui/interne.rb
|
|
52
|
+
- lib/ui/OLD_bibwindow.rb
|
|
53
53
|
- lib/lib/errors.rb
|
|
54
54
|
- lib/lib/util.rb
|
|
55
55
|
- lib/glade/stock_bookmark_klein.png
|
|
@@ -100,6 +100,14 @@ files:
|
|
|
100
100
|
- lib/glade/money_xsmall.png
|
|
101
101
|
- lib/glade/members.glade
|
|
102
102
|
- lib/glade/printerlog_xklein.png
|
|
103
|
+
- lib/glade/sound
|
|
104
|
+
- lib/glade/sound/burp.wav
|
|
105
|
+
- lib/glade/sound/kaching.wav
|
|
106
|
+
- lib/glade/sound/cash2.wav
|
|
107
|
+
- lib/glade/sound/scribble.wav
|
|
108
|
+
- lib/glade/sound/cow.wav
|
|
109
|
+
- lib/glade/sound/shaglic1.wav
|
|
110
|
+
- lib/glade/sound/yeahbaby.wav
|
|
103
111
|
- lib/glade/stock_book_xklein.png
|
|
104
112
|
- lib/glade/cola_xsmall.png
|
|
105
113
|
- lib/glade/piggy_small.png
|
|
File without changes
|