ig3tool 0.5.3 → 0.6.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.
@@ -29,22 +29,23 @@ module Ig3tool
29
29
  port = ENV['IG3TOOL_PORT'] || 2007
30
30
  $client = Ig3tool::Client.new(host, port)
31
31
  Gtk::init
32
+ $toolwindow = nil
32
33
 
33
34
  begin
34
35
  if $client.validate
35
- ToolWindow.new(@klasses)
36
+ $toolwindow = ToolWindow.new(@klasses)
36
37
  else
37
38
  LoginWindow.new($client) do
38
- ToolWindow.new(@klasses)
39
+ $toolwindow = ToolWindow.new(@klasses)
39
40
  end
40
41
  end
41
42
  rescue Exception => e
42
43
  LoginWindow.new($client) do
43
- ToolWindow.new(@klasses)
44
+ $toolwindow = ToolWindow.new(@klasses)
44
45
  end
45
46
  end
46
47
  begin
47
- Gtk::main
48
+ Gtk::main
48
49
  rescue Interrupt
49
50
  # Ctrl-C
50
51
  rescue Exception => e
@@ -93,4 +94,3 @@ require "ui/loginwindow.rb"
93
94
 
94
95
  # Start de grafische interface
95
96
  Ig3tool::start()
96
-
Binary file
Binary file
@@ -55,7 +55,6 @@
55
55
  <widget class="GtkLabel" id="label19">
56
56
  <property name="visible">True</property>
57
57
  <property name="xalign">0</property>
58
- <property name="label" translatable="yes">&lt;b&gt;Blikjes&lt;/b&gt;</property>
59
58
  <property name="use_markup">True</property>
60
59
  </widget>
61
60
  <packing>
@@ -70,8 +69,6 @@
70
69
  <child>
71
70
  <widget class="GtkTable" id="blikjes_table">
72
71
  <property name="visible">True</property>
73
- <property name="n_rows">1</property>
74
- <property name="n_columns">1</property>
75
72
  <property name="column_spacing">12</property>
76
73
  <property name="row_spacing">6</property>
77
74
  <child>
@@ -95,7 +92,6 @@
95
92
  <widget class="GtkLabel" id="label20">
96
93
  <property name="visible">True</property>
97
94
  <property name="xalign">0</property>
98
- <property name="label" translatable="yes">&lt;b&gt;Flesjes&lt;/b&gt;</property>
99
95
  <property name="use_markup">True</property>
100
96
  </widget>
101
97
  <packing>
@@ -110,8 +106,6 @@
110
106
  <child>
111
107
  <widget class="GtkTable" id="flesjes_table">
112
108
  <property name="visible">True</property>
113
- <property name="n_rows">1</property>
114
- <property name="n_columns">1</property>
115
109
  <property name="column_spacing">12</property>
116
110
  <property name="row_spacing">6</property>
117
111
  <child>
@@ -4,24 +4,22 @@ module Ig3tool
4
4
  MENU_PATH = ["Automaat"]
5
5
  ICON = "cola_xsmall.png"
6
6
 
7
- BLIKJES = [
7
+ LEFTCOL = [
8
8
  [ "Coca Cola", "5449000000996" ],
9
9
  [ "Coca Cola Light", "5449000050205" ],
10
+ [ "Coca Cola Zero", "5449000131805" ],
11
+ [ "Coca Light Lemon", "5449000089229" ],
10
12
  [ "Fanta Orange", "5449000011527" ],
11
13
  [ "Fanta Lemon", "5449000006004" ],
14
+ ]
15
+
16
+ RIGHTCOL = [
12
17
  [ "Minute Maid", "90494024" ],
13
18
  [ "Minute Maid Tropical", "5449000100573" ],
19
+ [ "Minute Maid Appelsap", "90494031" ],
14
20
  [ "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
- [ "Aquarius Orange", "54490802" ],
24
- [ "Water", "5449000111678" ],
21
+ [ "Aquarius Orange", "5449000033819" ],
22
+ [ "Nalu", "5449000067456" ],
25
23
  ]
26
24
 
27
25
  def initialize
@@ -31,8 +29,8 @@ module Ig3tool
31
29
 
32
30
  @entries = [ ]
33
31
 
34
- [[BLIKJES, @glade.get_widget("blikjes_table")],
35
- [FLESJES, @glade.get_widget("flesjes_table")]].
32
+ [[LEFTCOL, @glade.get_widget("blikjes_table")],
33
+ [RIGHTCOL, @glade.get_widget("flesjes_table")]].
36
34
  each do |list, table|
37
35
  table.resize(list.length, 2)
38
36
  list.each_with_index do |(name, barcode), i|
@@ -35,22 +35,51 @@ module Ig3tool
35
35
  end
36
36
  @sounds["cash"] = "cash2.wav"
37
37
  @sounds["tetten"] = "shaglic1.wav"
38
+ @sounds["yeahbaby"] = "yeahbaby.wav"
39
+ @sounds["ltunes"] = "ltunes.wav"
40
+ @sounds["tahdah"] = "tahdah.wav"
41
+ @sounds["wall-e"] = "walle01.wav"
42
+ @sounds["buttscratcher"] = "buttscratcher.wav"
43
+ @sounds["tea"] = "wohlen_sie.wav"
44
+ @sounds["burp"] = "burp.wav"
45
+ @sounds["cow"] = "cow.wav"
46
+ @sounds["jaaa"] = "jaaaaaa.wav"
47
+ @sounds["kaching"] = "kaching.wav"
48
+ @sounds["pika"] = "pikachu1.wav"
49
+ @sounds["scribble"] = "scribble.wav"
50
+ @sounds["sheep"] = "sheep.wav"
51
+ @sounds["fart"] = "fart.wav"
52
+ @sounds["ohyeah"] = "ohyeah.wav"
53
+ @sounds["canttouch"] = "cant_touch_this.wav"
54
+ @sounds["hammertime"] = "stop_hammertime.wav"
55
+ @sounds["gone1"] = "gonept1.mp3"
56
+ @sounds["gone2"] = "gonept2.mp3"
38
57
  end
39
58
 
40
59
  def play(key)
41
- filename = @sounds[key]
42
- unless filename.nil?
43
- filename = File.join(GLADE_DIR, "sound", filename)
44
- Thread.new do
45
- begin
46
- `aplay #{filename}`
47
- rescue Exception => e
48
- warn "sound error: #{e.message}"
49
- end
50
- end
51
- end
60
+ Thread.new do
61
+ filename = @sounds[key]
62
+ unless filename.nil?
63
+ filename = File.join(GLADE_DIR, "sound", filename)
64
+ begin
65
+ `aplay #{filename}`
66
+ rescue Exception => e
67
+ warn "sound error: #{e.message}"
68
+ end
69
+ end
70
+ end
52
71
  end
53
72
 
73
+ def speak(str)
74
+ Thread.new do
75
+ begin
76
+ `echo \"#{str}\" | festival --tts`
77
+ rescue
78
+ warn "speech error: #{e.message}"
79
+ end
80
+ end
81
+ end
82
+
54
83
  def present
55
84
  @window.present
56
85
  end
@@ -110,6 +110,26 @@ module Ig3tool
110
110
  @ext_list.enable_search = true
111
111
 
112
112
  make_debugger_combo(@ext_debugger)
113
+
114
+ begin
115
+ GLib::Timeout.add_seconds(30) {
116
+ begin
117
+ _update_log
118
+ _update_biglog
119
+ rescue Exception => e
120
+ end
121
+ true
122
+ }
123
+ rescue
124
+ GLib::Timeout.add(30*1000) {
125
+ begin
126
+ _update_log
127
+ _update_biglog
128
+ rescue Exception => e
129
+ end
130
+ true
131
+ }
132
+ end
113
133
 
114
134
  refresh(nil)
115
135
  @statussearch.active = 0
@@ -669,35 +689,64 @@ module Ig3tool
669
689
  end
670
690
 
671
691
 
672
- def _update_log
673
- Thread.new do
692
+ def _update_log
693
+ _update_log_bypassed
694
+ @filteredlog.scroll_to_point(0,0)
695
+ begin
696
+ GLib::Timeout.add_seconds(1) {
697
+ @filteredlog.scroll_to_point(0,0)
698
+ false
699
+ }
700
+ rescue
701
+ GLib::Timeout.add(1*1000) {
702
+ @filteredlog.scroll_to_point(0,0)
703
+ false
704
+ }
705
+ end
706
+ end
707
+
708
+ def _update_log_bypassed
674
709
  begin
675
710
  loglines = $client.print_logs(200, @last_log_id)
676
711
  loglines.reverse.each do |ll|
677
712
  @filteredlog_store.prepend[0] = ll
678
713
  end
679
- @last_log_id = loglines.first.real_id
714
+ @last_log_id = loglines.first["id"]
680
715
  rescue Exception => e
681
716
  warn "error updating log: " + e.message
682
717
  end
683
- end
684
718
  end
685
-
719
+
686
720
  def _update_biglog
721
+ _update_biglog_bypassed
722
+ @log.scroll_to_point(0,0)
723
+ begin
724
+ GLib::Timeout.add_seconds(1) {
725
+ @log.scroll_to_point(0,0)
726
+ false
727
+ }
728
+ rescue
729
+ GLib::Timeout.add(1*1000) {
730
+ @log.scroll_to_point(0,0)
731
+ false
732
+ }
733
+ end
734
+ end
735
+
736
+ def _update_biglog_bypassed
687
737
  if !@updating_biglog # sommige kindjes vinden het leuk om op refresh te klikken
688
738
  @updating_biglog = true
689
- Thread.new do
690
739
  begin
691
740
  loglines = $client.print_logs(200, @last_big_log_id)
692
741
  loglines.reverse.each do |ll|
693
742
  @log_store.prepend[0] = ll
694
743
  end
695
- @last_big_log_id = loglines.first.real_id
744
+ @last_big_log_id = loglines.first["id"]
696
745
  @updating_biglog = false
697
746
  rescue Exception => e
698
747
  warn "error updating biglog: " + e.message
748
+ @updating_biglog = false
699
749
  end
700
- end
701
750
  end
702
751
  end
703
752
 
@@ -32,6 +32,10 @@ module Ig3tool
32
32
  toggle_saldo_label(false)
33
33
  end
34
34
 
35
+ def focus_smartzap
36
+ _get_widget("smartzap").grab_focus
37
+ end
38
+
35
39
  def set_saldo(username)
36
40
  begin
37
41
  i = $client.interne(username)
@@ -92,7 +96,19 @@ module Ig3tool
92
96
  # is het een debugger?
93
97
  when /^[a-z-]/i
94
98
 
95
- play("tetten") if value == "tetten"
99
+ Thread.new do
100
+ case value
101
+ when "tetten": play("tetten")
102
+ when "rdewaele": play("yeahbaby")
103
+ when "resteven": play("tea")
104
+ when "rroels": play("sheep")
105
+ when "hdebondt": play("pika")
106
+ #when "kpinte": speak("hello kevin")
107
+ when "bcorne": play("gonept2")
108
+ when "jeuk": play("buttscratcher")
109
+ #when "dharnie": say("hey, sweetheart")
110
+ end
111
+ end
96
112
 
97
113
  wanted = {"username", value, "status", "debugger"}
98
114
  pers = $client.person_lookup(wanted)
@@ -141,6 +157,7 @@ module Ig3tool
141
157
  # is het een product?
142
158
  begin
143
159
  prod = $client.product_lookup(value)
160
+ # speak(prod.name) # SPEAK OR DIE!
144
161
  qty = _get_widget("count").text.to_i
145
162
  _add_product(prod, qty)
146
163
  return
@@ -267,7 +284,14 @@ module Ig3tool
267
284
  begin
268
285
  $client.scribble! params
269
286
  clear_clicked
270
- play("scribble")
287
+ case params["debugger"]
288
+ when "resteven": play("jaaa")
289
+ when "rroels": play("ohyeah")
290
+ when "bcorne": play("gonept2")
291
+ when "kpinte": play("burp")
292
+ when "rdewaele": play("fart")
293
+ else play("scribble")
294
+ end
271
295
  rescue Exception => e
272
296
  puts "Error: #{$!}"
273
297
  end
@@ -1,10 +1,40 @@
1
1
  module Ig3tool
2
2
 
3
- require 'pathname'
3
+ begin
4
+ require 'pathname'
5
+ require 'inline'
6
+ class XScreenSaver
7
+ class << self
8
+ inline do |builder|
9
+ builder.add_link_flags '-lXss'
10
+ builder.include '<X11/extensions/scrnsaver.h>'
11
+ builder.c %{
12
+ double idle_time() {
13
+ static Display *display;
14
+ XScreenSaverInfo *info = XScreenSaverAllocInfo();
15
+ if (!display) display = XOpenDisplay(0);
16
+ if (!display) return -1;
17
+ XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
18
+ return info->idle / 1000;
19
+ }
20
+ }
21
+ end
22
+ end
23
+ end
24
+ rescue Exception => e
25
+ class XScreenSaver
26
+ def self.timeout
27
+ 0
28
+ end
29
+ end
30
+ puts "XTimeout extension not enabled: #{e.message}"
31
+ end
4
32
 
5
33
  # Hoofdmenu (altijd on top)
6
34
  # Zorgt voor dynamische uitbreidingsmogelijkheden van de ig3tool
7
35
 
36
+ SALES_WINDOW_TIMEOUT = 60 # 1 Minuut
37
+
8
38
  class ToolWindow
9
39
 
10
40
  @@windows = {}
@@ -45,6 +75,21 @@ module Ig3tool
45
75
  Gtk::main_quit
46
76
  end
47
77
 
78
+ GLib::Timeout.add_seconds(30) {
79
+ begin
80
+ if XScreenSaver.idle_time >= SALES_WINDOW_TIMEOUT
81
+ klass = SalesWindow
82
+ @@windows[klass] ||= klass.new
83
+ @@windows[klass].show
84
+ @@windows[klass].present
85
+ @@windows[klass].focus_smartzap
86
+ end
87
+ rescue Exception => e
88
+ puts "No XTimeout"
89
+ end
90
+ true
91
+ }
92
+
48
93
  bigbox.show_all
49
94
  size = window.size_request
50
95
  size[0] += 24
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ig3tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
- - Kevin Pinte
7
+ - Kevin Pinte, Dries Harnie, Lode Hoste, Reinout Stevens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-21 00:00:00 +01:00
12
+ date: 2009-10-05 00:00:00 +02:00
13
13
  default_executable: ig3tool
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -31,98 +31,110 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
 
33
33
  files:
34
- - lib/ui
35
- - lib/lib
36
34
  - lib/glade
35
+ - lib/lib
36
+ - lib/ui
37
37
  - bin/ig3tool
38
- - lib/ui/loginwindow.rb
39
- - lib/ui/toolwindow.rb
40
- - lib/ui/saleswindow.rb
41
- - lib/ui/printingwindow.rb
42
- - lib/ui/automaatwindow.rb
43
- - lib/ui/peoplewindow.rb
44
- - lib/ui/protjes.rb
45
- - lib/ui/messagebox.rb
46
- - lib/ui/gladehelper.rb
47
- - lib/ui/bibliotheekwindow.rb
48
- - lib/ui/interne.rb
49
- - lib/lib/errors.rb
50
- - lib/lib/util.rb
51
- - lib/glade/stock_bookmark_klein.png
52
- - lib/glade/protjes.glade
53
- - lib/glade/printing.glade
54
- - lib/glade/penningtool.glade
55
- - lib/glade/bibliotheek.glade
56
- - lib/glade/products.glade
57
- - lib/glade/vendingmachine.glade
58
- - lib/glade/stock_print.png
59
- - lib/glade/members.svg
60
- - lib/glade/printerlog_klein.png
61
- - lib/glade/bib.glade
38
+ - lib/glade/piggy_small.png
39
+ - lib/glade/stock_bookmark_xklein.png
40
+ - lib/glade/members.glade
41
+ - lib/glade/memberinfo_xklein.png
42
+ - lib/glade/printer.png
62
43
  - lib/glade/memberinfo.svg
63
- - lib/glade/cola_small.png
44
+ - lib/glade/doos_xsmall.png
45
+ - lib/glade/cola_light_small.png
46
+ - lib/glade/bib.glade
64
47
  - lib/glade/members_xklein.png
48
+ - lib/glade/cola_light_xsmall.png
49
+ - lib/glade/memberinfo_klein.png
50
+ - lib/glade/money_small.png
51
+ - lib/glade/stock_book_klein.png
52
+ - lib/glade/printerlog_xklein.png
53
+ - lib/glade/newinterne.glade
54
+ - lib/glade/protjes.glade
55
+ - lib/glade/vendingmachine.glade
56
+ - lib/glade/stock_book_xklein.png
57
+ - lib/glade/interne.glade
58
+ - lib/glade/sound
59
+ - lib/glade/sound/buttscratcher.wav
60
+ - lib/glade/sound/scribble.wav
61
+ - lib/glade/sound/cant_touch_this.wav
62
+ - lib/glade/sound/shaglic1.wav
63
+ - lib/glade/sound/fart.wav
64
+ - lib/glade/sound/tahdah.wav
65
+ - lib/glade/sound/ohyeah.wav
66
+ - lib/glade/sound/wohlen_sie.wav
67
+ - lib/glade/sound/stop_hammertime.wav
68
+ - lib/glade/sound/kaching.wav
69
+ - lib/glade/sound/cash2.wav
70
+ - lib/glade/sound/ltunes.wav
71
+ - lib/glade/sound/pikachu1.wav
72
+ - lib/glade/sound/burp.wav
73
+ - lib/glade/sound/jaaaaaa.wav
74
+ - lib/glade/sound/yeahbaby.wav
75
+ - lib/glade/sound/walle01.wav
76
+ - lib/glade/sound/cow.wav
77
+ - lib/glade/sound/sheep.wav
78
+ - lib/glade/cola_xsmall.png
65
79
  - lib/glade/printer_klein.png
66
- - lib/glade/printer.png
67
- - lib/glade/loginwindow.glade
68
- - lib/glade/printen.glade
80
+ - lib/glade/printer_xklein.png
69
81
  - lib/glade/icons
70
- - lib/glade/icons/stock_bookmark_klein.png
71
- - lib/glade/icons/emblem-penning.xpm
72
- - lib/glade/icons/stock_print.png
73
- - lib/glade/icons/emblem-money.png
82
+ - lib/glade/icons/piggy_small.png
83
+ - lib/glade/icons/stock_bookmark_xklein.png
84
+ - lib/glade/icons/emblem-people.png
85
+ - lib/glade/icons/stock_bookmark.svg
86
+ - lib/glade/icons/doos_xsmall.png
74
87
  - lib/glade/icons/no.xpm
75
- - lib/glade/icons/cola_small.png
88
+ - lib/glade/icons/cola_light_small.png
76
89
  - lib/glade/icons/members_xklein.png
77
- - lib/glade/icons/cola.png
90
+ - lib/glade/icons/cola_light_xsmall.png
91
+ - lib/glade/icons/stock_book_klein.png
92
+ - lib/glade/icons/emblem-package.png
78
93
  - lib/glade/icons/stock_book_xklein.png
79
- - lib/glade/icons/stock_bookmark.svg
80
94
  - lib/glade/icons/cola_xsmall.png
81
- - lib/glade/icons/piggy_small.png
82
- - lib/glade/icons/doos_xsmall.png
83
- - lib/glade/icons/cola_light_xsmall.png
84
95
  - lib/glade/icons/stock_book.svg
96
+ - lib/glade/icons/members_klein.png
97
+ - lib/glade/icons/stock_bookmark_klein.png
98
+ - lib/glade/icons/emblem-penning.xpm
85
99
  - lib/glade/icons/gdict.png
86
- - lib/glade/icons/emblem-package.png
87
- - lib/glade/icons/stock_book_klein.png
88
- - lib/glade/icons/emblem-people.png
89
- - lib/glade/icons/stock_bookmark_xklein.png
100
+ - lib/glade/icons/stock_print.png
90
101
  - lib/glade/icons/doos_small.png
91
- - lib/glade/icons/emblem-sales.png
92
- - lib/glade/icons/members_klein.png
102
+ - lib/glade/icons/emblem-money.png
103
+ - lib/glade/icons/cola_small.png
93
104
  - lib/glade/icons/piggy_xsmall.png
94
- - lib/glade/icons/cola_light_small.png
95
- - lib/glade/interne.glade
96
- - lib/glade/money_xsmall.png
97
- - lib/glade/members.glade
98
- - lib/glade/printerlog_xklein.png
99
- - lib/glade/sound
100
- - lib/glade/sound/burp.wav
101
- - lib/glade/sound/kaching.wav
102
- - lib/glade/sound/cash2.wav
103
- - lib/glade/sound/scribble.wav
104
- - lib/glade/sound/cow.wav
105
- - lib/glade/sound/shaglic1.wav
106
- - lib/glade/sound/yeahbaby.wav
107
- - lib/glade/stock_book_xklein.png
108
- - lib/glade/cola_xsmall.png
109
- - lib/glade/piggy_small.png
110
- - lib/glade/money_small.png
111
- - lib/glade/newinterne.glade
112
- - lib/glade/doos_xsmall.png
113
- - lib/glade/sales.glade
114
- - lib/glade/cola_light_xsmall.png
105
+ - lib/glade/icons/cola.png
106
+ - lib/glade/icons/emblem-sales.png
107
+ - lib/glade/penningtool.glade
108
+ - lib/glade/printerlog_klein.png
115
109
  - lib/glade/stock_book.svg
116
- - lib/glade/memberinfo_xklein.png
117
- - lib/glade/people.glade
118
- - lib/glade/stock_book_klein.png
119
- - lib/glade/stock_bookmark_xklein.png
120
- - lib/glade/memberinfo_klein.png
121
- - lib/glade/doos_small.png
110
+ - lib/glade/loginwindow.glade
111
+ - lib/glade/sales.glade
122
112
  - lib/glade/members_klein.png
113
+ - lib/glade/stock_bookmark_klein.png
114
+ - lib/glade/members.svg
115
+ - lib/glade/products.glade
116
+ - lib/glade/stock_print.png
117
+ - lib/glade/doos_small.png
118
+ - lib/glade/bibliotheek.glade
119
+ - lib/glade/cola_small.png
120
+ - lib/glade/printing.glade
123
121
  - lib/glade/piggy_xsmall.png
124
- - lib/glade/cola_light_small.png
125
- - lib/glade/printer_xklein.png
122
+ - lib/glade/printen.glade
123
+ - lib/glade/money_xsmall.png
124
+ - lib/glade/people.glade
125
+ - lib/lib/util.rb
126
+ - lib/lib/errors.rb
127
+ - lib/ui/saleswindow.rb
128
+ - lib/ui/loginwindow.rb
129
+ - lib/ui/messagebox.rb
130
+ - lib/ui/bibliotheekwindow.rb
131
+ - lib/ui/toolwindow.rb
132
+ - lib/ui/protjes.rb
133
+ - lib/ui/printingwindow.rb
134
+ - lib/ui/interne.rb
135
+ - lib/ui/peoplewindow.rb
136
+ - lib/ui/gladehelper.rb
137
+ - lib/ui/automaatwindow.rb
126
138
  has_rdoc: false
127
139
  homepage: http://infogroep.be
128
140
  post_install_message:
@@ -147,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
159
  requirements: []
148
160
 
149
161
  rubyforge_project: ig3tool
150
- rubygems_version: 1.3.1
162
+ rubygems_version: 1.2.0
151
163
  signing_key:
152
164
  specification_version: 2
153
165
  summary: gtk ig3tool client