ig3tool 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/ig3tool +1 -15
- data/lib/glade/printing.glade +461 -2
- data/lib/glade/products.glade +8 -4
- data/lib/glade/protjes.glade +2884 -0
- data/lib/glade/sales.glade +85 -83
- data/lib/glade/stock_print.png +0 -0
- data/lib/ui/{printenwindow.rb → OLD_printenwindow.rb} +2 -2
- data/lib/ui/automaatwindow.rb +4 -5
- data/lib/ui/gladehelper.rb +22 -10
- data/lib/ui/peoplewindow.rb +9 -2
- data/lib/ui/printingwindow.rb +197 -22
- data/lib/ui/productswindow.rb +23 -2
- data/lib/ui/protjes.rb +850 -0
- data/lib/ui/saleswindow.rb +15 -0
- metadata +8 -5
data/lib/ui/printingwindow.rb
CHANGED
@@ -8,14 +8,9 @@ module Ig3tool
|
|
8
8
|
|
9
9
|
attr :glade
|
10
10
|
|
11
|
-
#def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)
|
12
11
|
def initialize
|
13
12
|
super("printing.glade")
|
14
13
|
|
15
|
-
#$client = Client.new("infogroep.be")
|
16
|
-
|
17
|
-
#bindtextdomain(domain, localedir, nil, "UTF-8")
|
18
|
-
#@glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}
|
19
14
|
|
20
15
|
@tabs = @glade.get_widget("tabs")
|
21
16
|
|
@@ -25,6 +20,7 @@ module Ig3tool
|
|
25
20
|
@email = @glade.get_widget("email")
|
26
21
|
@saldo = @glade.get_widget("saldo")
|
27
22
|
@notification = @glade.get_widget("notification")
|
23
|
+
@log_notification = @glade.get_widget("log_notification")
|
28
24
|
@apply = @glade.get_widget("apply")
|
29
25
|
@clear = @glade.get_widget("clear")
|
30
26
|
@delta = @glade.get_widget("delta")
|
@@ -35,7 +31,22 @@ module Ig3tool
|
|
35
31
|
r = Gtk::CellRendererText.new
|
36
32
|
@usernames.insert_column(-1, "username", r, :text => 1)
|
37
33
|
@usernames.enable_search = true
|
38
|
-
|
34
|
+
|
35
|
+
|
36
|
+
# ALIASES
|
37
|
+
@alias_debugger = @glade.get_widget("alias_debugger")
|
38
|
+
@alias_notification = @glade.get_widget("alias_notification")
|
39
|
+
@alias_username = @glade.get_widget("alias_username")
|
40
|
+
@alias_alias = @glade.get_widget("alias_alias")
|
41
|
+
@aliases = @glade.get_widget("aliases")
|
42
|
+
@aliases.model = @aliases_store = Gtk::ListStore.new(Object, String)
|
43
|
+
ar = Gtk::CellRendererText.new
|
44
|
+
@aliases.insert_column(-1, "alias", ar, :text => 1)
|
45
|
+
@aliases.enable_search = true
|
46
|
+
|
47
|
+
make_debugger_combo(@alias_debugger)
|
48
|
+
|
49
|
+
# LOG
|
39
50
|
|
40
51
|
@filteredlog = @glade.get_widget("filteredlog")
|
41
52
|
@filteredlog.model = @filteredlog_store = Gtk::ListStore.new(Object, String)
|
@@ -52,7 +63,7 @@ module Ig3tool
|
|
52
63
|
|
53
64
|
|
54
65
|
@log = @glade.get_widget("log")
|
55
|
-
@log.model = @log_store = Gtk::ListStore.new(Object
|
66
|
+
@log.model = @log_store = Gtk::ListStore.new(Object)
|
56
67
|
l = Gtk::CellRendererText.new
|
57
68
|
@log.insert_column(-1, "time", l) do |tvc, cell, m, iter|
|
58
69
|
cell.text = Time.parse(iter[0].time).strftime("%d/%m %H:%M")
|
@@ -80,41 +91,186 @@ module Ig3tool
|
|
80
91
|
cell.text = iter[0].job
|
81
92
|
end
|
82
93
|
|
94
|
+
|
95
|
+
|
83
96
|
_update_usernames
|
84
97
|
_update_log
|
85
98
|
@statussearch.active = 0
|
99
|
+
make_menu
|
100
|
+
make_bigmenu
|
101
|
+
end
|
86
102
|
|
103
|
+
|
104
|
+
def log_click(w, event)
|
105
|
+
if event.kind_of? Gdk::EventButton and event.button == 3
|
106
|
+
@log_menu.popup(nil, nil, event.button, event.time)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
def biglog_click(w, event)
|
110
|
+
if event.kind_of? Gdk::EventButton and event.button == 3
|
111
|
+
@log_big_menu.popup(nil, nil, event.button, event.time)
|
112
|
+
end
|
87
113
|
end
|
88
114
|
|
89
|
-
def
|
90
|
-
|
91
|
-
|
115
|
+
def make_menu
|
116
|
+
@log_menu = Gtk::Menu.new
|
117
|
+
log_menu_refund_item = Gtk::MenuItem.new("refund")
|
118
|
+
log_menu_show_item = Gtk::MenuItem.new("show")
|
119
|
+
# Treeview heeft default Mode Gtk::SELECTION_SINGLE
|
120
|
+
log_menu_show_item.signal_connect("activate") {
|
121
|
+
@filteredlog.selection.selected_each do |model, path, iter|
|
122
|
+
logentry = iter[0]
|
92
123
|
_show(logentry.username)
|
93
|
-
|
124
|
+
end
|
125
|
+
}
|
126
|
+
log_menu_refund_item.signal_connect("activate") {
|
127
|
+
@filteredlog.selection.selected_each do |model, path, iter|
|
128
|
+
logentry = iter[0]
|
94
129
|
begin
|
130
|
+
raise IG3Error, "the imps can only refund printjobs" if logentry.category != "print"
|
95
131
|
$client.print_refund!({"logid" => logentry["id"]})
|
96
132
|
@notification.text = "refunded print of #{logentry["amount"]} to #{logentry["username"]}"
|
97
133
|
_update_log
|
98
134
|
rescue Exception => e
|
99
135
|
#puts "ERR: " + e.message.to_s
|
100
|
-
|
136
|
+
@notification.text = (e.class.to_s + " - " + e.message).smaller
|
101
137
|
end
|
102
|
-
|
103
|
-
|
138
|
+
end
|
139
|
+
#_delete(iter[0],false)
|
140
|
+
#model.remove(iter) # Verwijder uit de lijst
|
141
|
+
}
|
104
142
|
|
105
|
-
|
106
|
-
|
107
|
-
|
143
|
+
@log_menu.append(log_menu_show_item)
|
144
|
+
@log_menu.append(log_menu_refund_item)
|
145
|
+
@log_menu.show_all
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
def make_bigmenu
|
150
|
+
@log_big_menu = Gtk::Menu.new
|
151
|
+
log_menu_refund_item = Gtk::MenuItem.new("refund")
|
152
|
+
log_menu_show_item = Gtk::MenuItem.new("show")
|
153
|
+
# Treeview heeft default Mode Gtk::SELECTION_SINGLE
|
154
|
+
log_menu_show_item.signal_connect("activate") {
|
155
|
+
@log.selection.selected_each do |model, path, iter|
|
156
|
+
logentry = iter[0]
|
108
157
|
_show(logentry.username)
|
109
|
-
|
158
|
+
@tabs.page = 0
|
159
|
+
end
|
160
|
+
}
|
161
|
+
log_menu_refund_item.signal_connect("activate") {
|
162
|
+
@log.selection.selected_each do |model, path, iter|
|
163
|
+
logentry = iter[0]
|
110
164
|
begin
|
165
|
+
raise IG3Error, "the imps can only refund printjobs" if logentry.category != "print"
|
111
166
|
$client.print_refund!({"logid" => logentry["id"]})
|
112
|
-
@
|
167
|
+
@log_notification.text = "refunded print of #{logentry["amount"]} to #{logentry["username"]}"
|
168
|
+
_update_log
|
113
169
|
rescue Exception => e
|
114
170
|
#puts "ERR: " + e.message.to_s
|
115
|
-
|
171
|
+
@log_notification.text = (e.class.to_s + " - " + e.message).smaller
|
116
172
|
end
|
173
|
+
end
|
174
|
+
#_delete(iter[0],false)
|
175
|
+
#model.remove(iter) # Verwijder uit de lijst
|
176
|
+
}
|
177
|
+
|
178
|
+
@log_big_menu.append(log_menu_show_item)
|
179
|
+
@log_big_menu.append(log_menu_refund_item)
|
180
|
+
@log_big_menu.show_all
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
def alias_apply(w)
|
187
|
+
begin
|
188
|
+
username = @alias_debugger.active_iter[0]
|
189
|
+
a = @alias_alias.text.strip
|
190
|
+
$client.print_addalias!("username" => username.username, "alias" => a)
|
191
|
+
@alias_notification.text = "alias #{a} for #{username.username} added!"
|
192
|
+
@alias_alias.text = ""
|
193
|
+
_update_aliases(username.username)
|
194
|
+
rescue Exception => e
|
195
|
+
@alias_notification.text = e.message
|
117
196
|
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
def select_alias(widget, path, col)
|
201
|
+
a = widget.model.get_iter(path)[0]
|
202
|
+
@alias_alias.text = a.alias
|
203
|
+
@alias_username.text = a.username
|
204
|
+
end
|
205
|
+
|
206
|
+
def alias_cancel(w)
|
207
|
+
@alias_username.text = ""
|
208
|
+
@alias_alias.text = ""
|
209
|
+
@alias_notification.text = ""
|
210
|
+
end
|
211
|
+
|
212
|
+
def alias_delete(w)
|
213
|
+
begin
|
214
|
+
username = @alias_debugger.active_iter[0]
|
215
|
+
a = @alias_alias.text.strip
|
216
|
+
$client.print_removealias!("username" => username.username, "alias" => a)
|
217
|
+
@alias_notification.text = "alias #{a} for #{username.username} removed!"
|
218
|
+
@alias_alias.text = ""
|
219
|
+
_update_aliases(username.username)
|
220
|
+
rescue Exception => e
|
221
|
+
@alias_notification.text = e.message
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def alias_delete_all(w)
|
226
|
+
begin
|
227
|
+
username = @alias_debugger.active_iter[0]
|
228
|
+
$client.print_removealiases!("username" => username.username)
|
229
|
+
@alias_notification.text = "all aliases for #{username.username} removed!"
|
230
|
+
@alias_alias.text = ""
|
231
|
+
_update_aliases(username.username)
|
232
|
+
rescue Exception => e
|
233
|
+
@alias_notification.text = e.message
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def alias_changed(widget)
|
238
|
+
alias_cancel(nil)
|
239
|
+
username = @alias_debugger.active_iter[0].username
|
240
|
+
puts username
|
241
|
+
@alias_username.text = username
|
242
|
+
_update_aliases(username)
|
243
|
+
end
|
244
|
+
|
245
|
+
def fl_row_activated(view, path, col)
|
246
|
+
logentry = @filteredlog.model.get_iter(path)[0]
|
247
|
+
#if logentry.category != "print"
|
248
|
+
_show(logentry.username)
|
249
|
+
#else
|
250
|
+
# begin
|
251
|
+
# $client.print_refund!({"logid" => logentry["id"]})
|
252
|
+
# @notification.text = "refunded print of #{logentry["amount"]} to #{logentry["username"]}"
|
253
|
+
# _update_log
|
254
|
+
# rescue Exception => e
|
255
|
+
# #puts "ERR: " + e.message.to_s
|
256
|
+
# @notification.text = (e.class.to_s + " - " + e.message).smaller
|
257
|
+
# end
|
258
|
+
#end
|
259
|
+
end
|
260
|
+
|
261
|
+
def log_row_activated(view, path, col)
|
262
|
+
logentry = @log.model.get_iter(path)[0]
|
263
|
+
#if logentry.category != "print"
|
264
|
+
_show(logentry.username)
|
265
|
+
#else
|
266
|
+
# begin
|
267
|
+
# $client.print_refund!({"logid" => logentry["id"]})
|
268
|
+
# @notification.text = "refunded print of #{logentry["amount"]} to #{logentry["username"]}"
|
269
|
+
# rescue Exception => e
|
270
|
+
# #puts "ERR: " + e.message.to_s
|
271
|
+
# @notification.text = (e.class.to_s + " - " + e.message).smaller
|
272
|
+
# end
|
273
|
+
#end
|
118
274
|
@tabs.page = 0
|
119
275
|
end
|
120
276
|
|
@@ -132,6 +288,7 @@ module Ig3tool
|
|
132
288
|
|
133
289
|
def refreshlog(widget) #refreshes the big log on page 2
|
134
290
|
_update_biglog
|
291
|
+
@log_notification.text = ""
|
135
292
|
end
|
136
293
|
|
137
294
|
def to_apply(widget)
|
@@ -158,10 +315,13 @@ module Ig3tool
|
|
158
315
|
end
|
159
316
|
|
160
317
|
def tabfocus(a,b,c)
|
161
|
-
|
318
|
+
case c
|
319
|
+
when 1
|
162
320
|
_update_biglog
|
163
|
-
|
321
|
+
when 0
|
164
322
|
refresh(nil)
|
323
|
+
when 2
|
324
|
+
_update_aliases(nil)
|
165
325
|
end
|
166
326
|
end
|
167
327
|
|
@@ -349,6 +509,21 @@ module Ig3tool
|
|
349
509
|
@usernames.model = @usernames_store
|
350
510
|
end
|
351
511
|
end
|
512
|
+
|
513
|
+
def _update_aliases(username)
|
514
|
+
@aliases.model = nil
|
515
|
+
@aliases_store.clear
|
516
|
+
Thread.new do
|
517
|
+
users = $client.print_aliases
|
518
|
+
users.delete_if{|u| u.username != username} unless username.nil?
|
519
|
+
users.each do |user|
|
520
|
+
row = @aliases_store.append
|
521
|
+
row[1] = user.alias
|
522
|
+
row[0] = user
|
523
|
+
end
|
524
|
+
@aliases.model = @aliases_store
|
525
|
+
end
|
526
|
+
end
|
352
527
|
|
353
528
|
|
354
529
|
def _update_log(clear=true)
|
data/lib/ui/productswindow.rb
CHANGED
@@ -69,13 +69,22 @@ module Ig3tool
|
|
69
69
|
@glade = nil
|
70
70
|
|
71
71
|
@selected_product = nil
|
72
|
+
@barcode_entry.editable = true
|
72
73
|
|
73
74
|
end
|
74
75
|
|
76
|
+
def barcode_ins(a,b,c,d)
|
77
|
+
_clear_most
|
78
|
+
end
|
79
|
+
|
80
|
+
def barcode_del(a,b,c)
|
81
|
+
_clear_most
|
82
|
+
end
|
83
|
+
|
75
84
|
def product_row_activated (widget, path, column)
|
76
85
|
prod = @product_view.selection.selected[0]
|
77
86
|
@selected_product = prod
|
78
|
-
|
87
|
+
#@barcode_entry.editable = false
|
79
88
|
@name_entry.text = prod.name
|
80
89
|
@barcode_entry.text = prod.barcode
|
81
90
|
@category.child.text = prod.category
|
@@ -122,7 +131,6 @@ module Ig3tool
|
|
122
131
|
private
|
123
132
|
def _clear
|
124
133
|
@selected_product = nil
|
125
|
-
@barcode_entry.editable = true
|
126
134
|
@barcode_entry.text = ""
|
127
135
|
@name_entry.text = ""
|
128
136
|
@category.child.text = ""
|
@@ -134,6 +142,19 @@ module Ig3tool
|
|
134
142
|
@new_stock.text = ""
|
135
143
|
_fill_purchases
|
136
144
|
end
|
145
|
+
|
146
|
+
def _clear_most
|
147
|
+
@selected_product = nil
|
148
|
+
@name_entry.text = ""
|
149
|
+
@category.child.text = ""
|
150
|
+
@dprice_entry.text = ""
|
151
|
+
@lprice_entry.text = ""
|
152
|
+
@nlprice_entry.text = ""
|
153
|
+
@stock_label.text = "0"
|
154
|
+
@new_price.text = ""
|
155
|
+
@new_stock.text = ""
|
156
|
+
_fill_purchases
|
157
|
+
end
|
137
158
|
|
138
159
|
def _fill_products (products)
|
139
160
|
@product_view.model = nil
|