ig3tool 0.2.1 → 0.3.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.
@@ -30,40 +30,51 @@
30
30
  <placeholder/>
31
31
  </child>
32
32
  <child>
33
- <widget class="GtkLabel" id="label6">
33
+ <widget class="GtkComboBox" id="debugger">
34
34
  <property name="visible">True</property>
35
- <property name="xalign">0</property>
36
- <property name="label" translatable="yes">Debugger:</property>
35
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
36
+ <property name="active">0</property>
37
+ <signal name="changed" handler="debugger_changed"/>
37
38
  </widget>
38
39
  <packing>
40
+ <property name="left_attach">1</property>
41
+ <property name="right_attach">2</property>
39
42
  <property name="top_attach">1</property>
40
43
  <property name="bottom_attach">2</property>
41
- <property name="x_options">GTK_FILL</property>
42
- <property name="y_options"></property>
43
44
  </packing>
44
45
  </child>
45
46
  <child>
46
- <widget class="GtkEntry" id="count">
47
+ <widget class="GtkEntry" id="smartzap">
47
48
  <property name="visible">True</property>
48
49
  <property name="can_focus">True</property>
49
- <property name="text" translatable="yes">1</property>
50
- <signal name="activate" handler="count_activate"/>
50
+ <signal name="activate" handler="smartzap_activate"/>
51
51
  </widget>
52
52
  <packing>
53
53
  <property name="left_attach">1</property>
54
54
  <property name="right_attach">2</property>
55
- <property name="top_attach">2</property>
56
- <property name="bottom_attach">3</property>
57
55
  <property name="y_options"></property>
58
56
  </packing>
59
57
  </child>
60
58
  <child>
61
- <widget class="GtkLabel" id="label5">
59
+ <widget class="GtkLabel" id="label1">
62
60
  <property name="visible">True</property>
63
61
  <property name="xalign">0</property>
64
- <property name="label" translatable="yes">Aantal:</property>
62
+ <property name="label" translatable="yes">Smartzap:</property>
65
63
  </widget>
66
64
  <packing>
65
+ <property name="x_options">GTK_FILL</property>
66
+ <property name="y_options"></property>
67
+ </packing>
68
+ </child>
69
+ <child>
70
+ <widget class="GtkLabel" id="label7">
71
+ <property name="visible">True</property>
72
+ <property name="xalign">0</property>
73
+ <property name="label" translatable="yes">Lid:</property>
74
+ </widget>
75
+ <packing>
76
+ <property name="left_attach">2</property>
77
+ <property name="right_attach">3</property>
67
78
  <property name="top_attach">2</property>
68
79
  <property name="bottom_attach">3</property>
69
80
  <property name="x_options">GTK_FILL</property>
@@ -93,14 +104,12 @@ debugger</property>
93
104
  </packing>
94
105
  </child>
95
106
  <child>
96
- <widget class="GtkLabel" id="label7">
107
+ <widget class="GtkLabel" id="label5">
97
108
  <property name="visible">True</property>
98
109
  <property name="xalign">0</property>
99
- <property name="label" translatable="yes">Lid:</property>
110
+ <property name="label" translatable="yes">Aantal:</property>
100
111
  </widget>
101
112
  <packing>
102
- <property name="left_attach">2</property>
103
- <property name="right_attach">3</property>
104
113
  <property name="top_attach">2</property>
105
114
  <property name="bottom_attach">3</property>
106
115
  <property name="x_options">GTK_FILL</property>
@@ -108,40 +117,31 @@ debugger</property>
108
117
  </packing>
109
118
  </child>
110
119
  <child>
111
- <widget class="GtkLabel" id="label1">
112
- <property name="visible">True</property>
113
- <property name="xalign">0</property>
114
- <property name="label" translatable="yes">Smartzap:</property>
115
- </widget>
116
- <packing>
117
- <property name="x_options">GTK_FILL</property>
118
- <property name="y_options"></property>
119
- </packing>
120
- </child>
121
- <child>
122
- <widget class="GtkEntry" id="smartzap">
120
+ <widget class="GtkEntry" id="count">
123
121
  <property name="visible">True</property>
124
122
  <property name="can_focus">True</property>
125
- <signal name="activate" handler="smartzap_activate"/>
123
+ <property name="text" translatable="yes">1</property>
124
+ <signal name="activate" handler="count_activate"/>
126
125
  </widget>
127
126
  <packing>
128
127
  <property name="left_attach">1</property>
129
128
  <property name="right_attach">2</property>
129
+ <property name="top_attach">2</property>
130
+ <property name="bottom_attach">3</property>
130
131
  <property name="y_options"></property>
131
132
  </packing>
132
133
  </child>
133
134
  <child>
134
- <widget class="GtkComboBox" id="debugger">
135
+ <widget class="GtkLabel" id="label6">
135
136
  <property name="visible">True</property>
136
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
137
- <property name="active">0</property>
138
- <signal name="changed" handler="debugger_changed"/>
137
+ <property name="xalign">0</property>
138
+ <property name="label" translatable="yes">Debugger:</property>
139
139
  </widget>
140
140
  <packing>
141
- <property name="left_attach">1</property>
142
- <property name="right_attach">2</property>
143
141
  <property name="top_attach">1</property>
144
142
  <property name="bottom_attach">2</property>
143
+ <property name="x_options">GTK_FILL</property>
144
+ <property name="y_options"></property>
145
145
  </packing>
146
146
  </child>
147
147
  </widget>
@@ -222,33 +222,27 @@ debugger</property>
222
222
  <property name="column_spacing">6</property>
223
223
  <property name="row_spacing">3</property>
224
224
  <child>
225
- <widget class="GtkEntry" id="change">
225
+ <widget class="GtkLabel" id="label9">
226
226
  <property name="visible">True</property>
227
- <property name="can_focus">True</property>
228
- <property name="editable">False</property>
229
- <property name="has_frame">False</property>
230
- <property name="width_chars">9</property>
227
+ <property name="xalign">0</property>
228
+ <property name="label" translatable="yes">€</property>
231
229
  </widget>
232
230
  <packing>
233
- <property name="left_attach">1</property>
234
- <property name="right_attach">2</property>
235
- <property name="top_attach">2</property>
236
- <property name="bottom_attach">3</property>
231
+ <property name="left_attach">2</property>
232
+ <property name="right_attach">3</property>
237
233
  <property name="x_options">GTK_FILL</property>
238
234
  <property name="y_options"></property>
239
235
  </packing>
240
236
  </child>
241
237
  <child>
242
- <widget class="GtkEntry" id="paid">
238
+ <widget class="GtkLabel" id="label10">
243
239
  <property name="visible">True</property>
244
- <property name="can_focus">True</property>
245
- <property name="has_frame">False</property>
246
- <property name="width_chars">9</property>
247
- <signal name="changed" handler="price_entries_changed"/>
240
+ <property name="xalign">0</property>
241
+ <property name="label" translatable="yes">€</property>
248
242
  </widget>
249
243
  <packing>
250
- <property name="left_attach">1</property>
251
- <property name="right_attach">2</property>
244
+ <property name="left_attach">2</property>
245
+ <property name="right_attach">3</property>
252
246
  <property name="top_attach">1</property>
253
247
  <property name="bottom_attach">2</property>
254
248
  <property name="x_options">GTK_FILL</property>
@@ -256,31 +250,27 @@ debugger</property>
256
250
  </packing>
257
251
  </child>
258
252
  <child>
259
- <widget class="GtkEntry" id="total">
253
+ <widget class="GtkLabel" id="label11">
260
254
  <property name="visible">True</property>
261
- <property name="can_focus">True</property>
262
- <property name="editable">False</property>
263
- <property name="has_frame">False</property>
264
- <property name="width_chars">9</property>
265
- <property name="text" translatable="yes">0.00</property>
266
- <signal name="changed" handler="price_entries_changed"/>
255
+ <property name="xalign">0</property>
256
+ <property name="label" translatable="yes">€</property>
267
257
  </widget>
268
258
  <packing>
269
- <property name="left_attach">1</property>
270
- <property name="right_attach">2</property>
259
+ <property name="left_attach">2</property>
260
+ <property name="right_attach">3</property>
261
+ <property name="top_attach">2</property>
262
+ <property name="bottom_attach">3</property>
271
263
  <property name="x_options">GTK_FILL</property>
272
264
  <property name="y_options"></property>
273
265
  </packing>
274
266
  </child>
275
267
  <child>
276
- <widget class="GtkLabel" id="label14">
268
+ <widget class="GtkLabel" id="label12">
277
269
  <property name="visible">True</property>
278
270
  <property name="xalign">0</property>
279
- <property name="label" translatable="yes">Terug:</property>
271
+ <property name="label" translatable="yes">Totaal:</property>
280
272
  </widget>
281
273
  <packing>
282
- <property name="top_attach">2</property>
283
- <property name="bottom_attach">3</property>
284
274
  <property name="x_options">GTK_FILL</property>
285
275
  <property name="y_options"></property>
286
276
  </packing>
@@ -299,40 +289,46 @@ debugger</property>
299
289
  </packing>
300
290
  </child>
301
291
  <child>
302
- <widget class="GtkLabel" id="label12">
292
+ <widget class="GtkLabel" id="label14">
303
293
  <property name="visible">True</property>
304
294
  <property name="xalign">0</property>
305
- <property name="label" translatable="yes">Totaal:</property>
295
+ <property name="label" translatable="yes">Terug:</property>
306
296
  </widget>
307
297
  <packing>
298
+ <property name="top_attach">2</property>
299
+ <property name="bottom_attach">3</property>
308
300
  <property name="x_options">GTK_FILL</property>
309
301
  <property name="y_options"></property>
310
302
  </packing>
311
303
  </child>
312
304
  <child>
313
- <widget class="GtkLabel" id="label11">
305
+ <widget class="GtkEntry" id="total">
314
306
  <property name="visible">True</property>
315
- <property name="xalign">0</property>
316
- <property name="label" translatable="yes">€</property>
307
+ <property name="can_focus">True</property>
308
+ <property name="editable">False</property>
309
+ <property name="has_frame">False</property>
310
+ <property name="width_chars">9</property>
311
+ <property name="text" translatable="yes">0.00</property>
312
+ <signal name="changed" handler="price_entries_changed"/>
317
313
  </widget>
318
314
  <packing>
319
- <property name="left_attach">2</property>
320
- <property name="right_attach">3</property>
321
- <property name="top_attach">2</property>
322
- <property name="bottom_attach">3</property>
315
+ <property name="left_attach">1</property>
316
+ <property name="right_attach">2</property>
323
317
  <property name="x_options">GTK_FILL</property>
324
318
  <property name="y_options"></property>
325
319
  </packing>
326
320
  </child>
327
321
  <child>
328
- <widget class="GtkLabel" id="label10">
322
+ <widget class="GtkEntry" id="paid">
329
323
  <property name="visible">True</property>
330
- <property name="xalign">0</property>
331
- <property name="label" translatable="yes">€</property>
324
+ <property name="can_focus">True</property>
325
+ <property name="has_frame">False</property>
326
+ <property name="width_chars">9</property>
327
+ <signal name="changed" handler="price_entries_changed"/>
332
328
  </widget>
333
329
  <packing>
334
- <property name="left_attach">2</property>
335
- <property name="right_attach">3</property>
330
+ <property name="left_attach">1</property>
331
+ <property name="right_attach">2</property>
336
332
  <property name="top_attach">1</property>
337
333
  <property name="bottom_attach">2</property>
338
334
  <property name="x_options">GTK_FILL</property>
@@ -340,14 +336,18 @@ debugger</property>
340
336
  </packing>
341
337
  </child>
342
338
  <child>
343
- <widget class="GtkLabel" id="label9">
339
+ <widget class="GtkEntry" id="change">
344
340
  <property name="visible">True</property>
345
- <property name="xalign">0</property>
346
- <property name="label" translatable="yes">€</property>
341
+ <property name="can_focus">True</property>
342
+ <property name="editable">False</property>
343
+ <property name="has_frame">False</property>
344
+ <property name="width_chars">9</property>
347
345
  </widget>
348
346
  <packing>
349
- <property name="left_attach">2</property>
350
- <property name="right_attach">3</property>
347
+ <property name="left_attach">1</property>
348
+ <property name="right_attach">2</property>
349
+ <property name="top_attach">2</property>
350
+ <property name="bottom_attach">3</property>
351
351
  <property name="x_options">GTK_FILL</property>
352
352
  <property name="y_options"></property>
353
353
  </packing>
@@ -382,6 +382,7 @@ debugger</property>
382
382
  <property name="use_underline">True</property>
383
383
  <property name="focus_on_click">False</property>
384
384
  <property name="response_id">0</property>
385
+ <signal name="clicked" handler="kaching_clicked"/>
385
386
  </widget>
386
387
  </child>
387
388
  <child>
@@ -411,6 +412,7 @@ debugger</property>
411
412
  <property name="use_underline">True</property>
412
413
  <property name="focus_on_click">False</property>
413
414
  <property name="response_id">0</property>
415
+ <signal name="clicked" handler="bewijs"/>
414
416
  </widget>
415
417
  <packing>
416
418
  <property name="position">3</property>
Binary file
@@ -142,7 +142,7 @@ module Ig3tool
142
142
  end
143
143
 
144
144
  def delta_focus_out
145
- Ig3tool::number_eval_widget(@glade.get_widget("delta"))
145
+ number_eval_widget(@glade.get_widget("delta"))
146
146
  false
147
147
  end
148
148
 
@@ -203,7 +203,7 @@ module Ig3tool
203
203
 
204
204
  def toepassen_activate_cb
205
205
  delta = @glade.get_widget("delta")
206
- Ig3tool::number_eval_widget(delta)
206
+ number_eval_widget(delta)
207
207
  amount = delta.text.to_i
208
208
  username = @glade.get_widget('user').text
209
209
  email = @glade.get_widget('email').text
@@ -41,7 +41,7 @@ module Ig3tool
41
41
  table.attach(label, 0, 1, i, i + 1)
42
42
  entry = Gtk::Entry.new
43
43
  entry.name = barcode
44
- entry.signal_connect("focus-out-event") { entry_focus_out(entry) }
44
+ make_eval_widget entry
45
45
  table.attach(entry, 1, 2, i, i + 1)
46
46
  @entries <<= entry
47
47
  end
@@ -53,12 +53,11 @@ module Ig3tool
53
53
  @window.show_all
54
54
  end
55
55
 
56
- def entry_focus_out(entry)
56
+ def number_eval_widget(widget)
57
+ # Controleer of het een nummer is
58
+ super(entry)
57
59
  # Clear notification
58
60
  @notification.text = ""
59
- # Controleer of het een nummer is
60
- Ig3tool::number_eval_widget(entry)
61
- false # Return false voor de event
62
61
  end
63
62
 
64
63
  def sell_clicked
@@ -31,21 +31,20 @@ module Ig3tool
31
31
 
32
32
  # Debugger combobox invullen
33
33
  def make_debugger_combo (combo, window = nil)
34
- debuggers = $client.person_debuggers
35
- debuggers.sort! {|a,b| a.username <=> b.username }
34
+ @@debuggers ||= $client.person_debuggers.sort {|a,b| a.username <=> b.username }
36
35
 
37
36
  debugger_model = Gtk::ListStore.new(Object, String)
38
- debuggers.each do |d|
37
+ @@debuggers.each do |d|
39
38
  row = debugger_model.append
40
39
  row[0] = d
41
40
  row[1] = d.username
42
41
  end
43
42
 
44
- combo.model = debugger_model
45
43
  combo.clear
44
+ combo.model = debugger_model
46
45
  renderer = Gtk::CellRendererText.new
47
46
  combo.pack_start(renderer, true)
48
- combo.set_attributes(renderer, :text => 1)
47
+ combo.add_attribute(renderer, :text, 1)
49
48
 
50
49
  # Indien het window gekleurd moet worden adhv zijn 'interne' status
51
50
  add_window_colorer(combo, window) if window
@@ -112,13 +111,26 @@ module Ig3tool
112
111
  end
113
112
  end
114
113
 
115
- def make_eval_widget(widget)
116
- widget.signal_connect "focus-out-event" do
117
- Ig3tool::number_eval_widget widget
118
- false
114
+ def make_eval_widget(widget, fallback="")
115
+ %w(focus-out-event activate).each do |s|
116
+ widget.signal_connect s do
117
+ number_eval_widget widget, fallback
118
+ false
119
+ end
119
120
  end
120
121
  end
121
122
 
122
- end
123
+ def number_eval_widget(widget, fallback="")
124
+ text = widget.text
125
+ text.strip!
126
+ text.gsub! /[^\d+\/*()-]/, ""
127
+ if text =~ /[+\/*()-]/
128
+ text = begin eval(text).to_s rescue fallback.to_s end
129
+ else
130
+ text = text.to_i.to_s
131
+ end
132
+ widget.text = text
133
+ end
123
134
 
135
+ end
124
136
  end
@@ -1,4 +1,4 @@
1
- require 'facets/string/partitions.rb'
1
+ require 'facets'
2
2
 
3
3
  module Ig3tool
4
4
 
@@ -68,7 +68,14 @@ module Ig3tool
68
68
  end
69
69
 
70
70
  def delete(widget)
71
- puts "delete() is not implemented yet."
71
+ username = @username.text.strip
72
+ begin
73
+ raise Needed, "please fill in a username..." if username.empty?
74
+ $client.person_remove!("username" => username)
75
+ @notification.text = "the imps killed username, they left no traces..."
76
+ rescue Exception => e
77
+ @notification.text = e.message
78
+ end
72
79
  end
73
80
  def refreshhist(widget)
74
81
  puts "refreshhist() is not implemented yet."