Class: Ig3tool::ProtjesGlade
- Inherits:
-
GladeHelper
- Object
- GladeHelper
- Ig3tool::ProtjesGlade
- Defined in:
- lib/ui/protjes.rb
Constant Summary collapse
- MENU_PATH =
["Producten", "Producten"]
- ICON =
"doos_xsmall.png"
Constants inherited from GladeHelper
Instance Attribute Summary collapse
-
#glade ⇒ Object
readonly
Returns the value of attribute glade.
Instance Method Summary collapse
- #accept_toogled(widget) ⇒ Object
- #add_apply(widget) ⇒ Object
- #add_cancel(widget) ⇒ Object
- #add_delete(w) ⇒ Object
- #add_edit(widget) ⇒ Object
- #afronden(i) ⇒ Object
- #barcode_changed ⇒ Object
- #barcode_del(widget, arg0, arg1) ⇒ Object
- #barcode_ins(widget, arg0, arg1, arg2) ⇒ Object
- #changed(widget) ⇒ Object
- #check_purchase_debugger_reset ⇒ Object
- #debuggers_act(widget) ⇒ Object
- #get_debugger(widget) ⇒ Object
-
#initialize ⇒ ProtjesGlade
constructor
A new instance of ProtjesGlade.
- #log_cancel(w) ⇒ Object
- #log_select(widget, path, column) ⇒ Object
- #members_act(widget) ⇒ Object
- #notification_focus_in_event_cb(widget, arg0) ⇒ Object
- #plebs_act(widget) ⇒ Object
- #price_amount_changed ⇒ Object
- #price_del(widget, arg0, arg1) ⇒ Object
- #price_ins(widget, arg0, arg1, arg2) ⇒ Object
- #purchase ⇒ Object
- #purchase_cancel(widget) ⇒ Object
- #purchase_debugger_changed ⇒ Object
- #purchase_select(widget, path, column) ⇒ Object
- #refresh(widget = nil) ⇒ Object
- #refresh_slog(w) ⇒ Object
- #refreshlog(w) ⇒ Object
- #select(widget, path, column) ⇒ Object
- #select_from_log(widget, path, column) ⇒ Object
- #select_from_slog(widget, path, column) ⇒ Object
- #slog_cancel(w) ⇒ Object
- #slog_select(widget, path, column) ⇒ Object
- #smart_search(widget) ⇒ Object
- #stock_apply(widget) ⇒ Object
- #stock_cancel(widget) ⇒ Object
- #stock_select(widget, path, column) ⇒ Object
- #stock_to_apply(widget) ⇒ Object
- #tabfocus(widget, a, b) ⇒ Object
- #to_purchase(w) ⇒ Object
- #toggle_price_fields(from_save, bool = nil) ⇒ Object
- #toggle_purchase_fields(bool) ⇒ Object
- #toggle_stock_field(bool) ⇒ Object
Methods inherited from GladeHelper
#_get_widget, #add_window_colorer, #load_sounds, #make_debugger_combo, #make_eval_widget, #make_status_combo, #number_eval_widget, #play, #present, #show, #speak
Constructor Details
#initialize ⇒ ProtjesGlade
Returns a new instance of ProtjesGlade.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/ui/protjes.rb', line 21 def initialize super("protjes.glade") @tabs = @glade.("tabs") # MANAGE TAB @manage_debuggers = @glade.("add_debuggers") @manage_plebs = @glade.("add_plebs") @manage_members = @glade.("add_members") @manage_edit = @glade.("add_edit") @add_notification = @glade.("add_notification") @add_barcode = @glade.("add_barcode") @add_name = @glade.("add_name") @add_stock = @glade.("add_stock") @add_prodcat = @glade.("add_prodcat") @add_categories = @glade.("add_categories") @continuous_stock = @glade.("continuous_stock_check") @categories = $client.product_categories.collect {|x| x.name}.sort @add_products = @glade.("add_products") @add_products.model = @add_products_store = Gtk::ListStore.new(Object, String) l = Gtk::CellRendererText.new @add_products.insert_column(-1, "product", l, :text => 1) @add_products.enable_search = true # PURCHASE TAB @purchase_debuggers_orig = @glade.("purchase_debuggers_orig") @purchase_plebs_orig = @glade.("purchase_plebs_orig") @purchase_members_orig = @glade.("purchase_members_orig") @purchase_last = @glade.("purchase_last") @purchase_debugger = @glade.("purchase_debugger") @purchase_debuggers = @glade.("purchase_debuggers") @purchase_plebs = @glade.("purchase_plebs") @purchase_members = @glade.("purchase_members") @purchase_barcode = @glade.("purchase_barcode") @purchase_name = @glade.("purchase_name") @purchase_stock = @glade.("purchase_stock") @purchase_category = @glade.("purchase_category") @purchase_categories = @glade.("purchase_categories") @purchase_notification = @glade.("purchase_notification") @purchase_amount = @glade.("purchase_amount") @purchase_price = @glade.("purchase_price") @purchase_date = @glade.("purchase_date") @purchase_accept = @glade.("purchase_accept") @purchase_products = @glade.("purchase_products") @purchase_products.model = @purchase_products_store = Gtk::ListStore.new(Object, String) l = Gtk::CellRendererText.new @purchase_products.insert_column(-1, "product", l, :text => 1) @purchase_products.enable_search = true # STOCK TAB @stock_notification = @glade.("stock_notification") @stock_categories = @glade.("stock_categories") @stock_barcode = @glade.("stock_barcode") @stock_stock = @glade.("stock_stock") @stock_category = @glade.("stock_category") @stock_name = @glade.("stock_name") @stock_debugger = @glade.("stock_debugger") @stock_stock_new = @glade.("stock_stock_new") @stock_apply = @glade.("stock_apply") @stock_products = @glade.("stock_products") @stock_products.model = @stock_products_store = Gtk::ListStore.new(Object, String) l = Gtk::CellRendererText.new @stock_products.insert_column(-1, "product", l, :text => 1) @stock_products.enable_search = true # LOG TAB @log_notification = @glade.("log_notification") @log_categories = @glade.("log_categories") @log_barcode = @glade.("log_barcode") @log_name = @glade.("log_name") @log_products = @glade.("log_products") @log_products.model = @log_products_store = Gtk::ListStore.new(Object, String) l = Gtk::CellRendererText.new @log_products.insert_column(-1, "product", l, :text => 1) @log_products.enable_search = true @purchase_log = @glade.("purchase_log") @purchase_log.model = @purchase_log_store = Gtk::ListStore.new(Object, String, String, String, String, String) l = Gtk::CellRendererText.new @purchase_log.insert_column(-1, "time", l) do |tvc, cell, m, iter| cell.text = Time.parse(iter[0].time).strftime("%d/%m/%y") end @purchase_log.insert_column(-1, "barcode", l) do |tvc, cell, m, iter| cell.text = iter[0].product end @purchase_log.insert_column(-1, "debugger", l) do |tvc, cell, m, iter| cell.text = iter[0].debugger end @purchase_log.insert_column(-1, "amount", l) do |tvc, cell, m, iter| cell.text = iter[0].count end @purchase_log.insert_column(-1, "price", l) do |tvc, cell, m, iter| cell.text = iter[0].cost end # sales LOG TAB @slog_notification = @glade.("slog_notification") @slog_categories = @glade.("slog_categories") @slog_barcode = @glade.("slog_barcode") @slog_name = @glade.("slog_name") @slog_products = @glade.("slog_products") @slog_products.model = @slog_products_store = Gtk::ListStore.new(Object, String) l = Gtk::CellRendererText.new @slog_products.insert_column(-1, "product", l, :text => 1) @slog_products.enable_search = true @spurchase_log = @glade.("spurchase_log") @spurchase_log.model = @spurchase_log_store = Gtk::ListStore.new(Object, String, String, String, String, String, String) l = Gtk::CellRendererText.new @spurchase_log.insert_column(-1, "time", l) do |tvc, cell, m, iter| cell.text = Time.parse(iter[0].time).strftime("%d/%m/%y") end @spurchase_log.insert_column(-1, "barcode", l) do |tvc, cell, m, iter| cell.text = iter[0].product end @spurchase_log.insert_column(-1, "debugger", l) do |tvc, cell, m, iter| cell.text = iter[0].debugger end @spurchase_log.insert_column(-1, "status", l) do |tvc, cell, m, iter| cell.text = iter[0].status end @spurchase_log.insert_column(-1, "amount", l) do |tvc, cell, m, iter| cell.text = iter[0].count end @spurchase_log.insert_column(-1, "price", l) do |tvc, cell, m, iter| cell.text = iter[0].price end # ALL cat_model = Gtk::ListStore.new(String) cat2_model = Gtk::ListStore.new(String) cat3_model = Gtk::ListStore.new(String) cat4_model = Gtk::ListStore.new(String) cat5_model = Gtk::ListStore.new(String) cat6_model = Gtk::ListStore.new(String) cat_model.prepend[0] = "all products" cat3_model.prepend[0] = "all products" cat4_model.prepend[0] = "all products" cat5_model.prepend[0] = "all products" cat6_model.prepend[0] = "all products" @categories.each do |cat| r = cat_model.append r[0] = cat r2 = cat2_model.append r2[0] = cat r3 = cat3_model.append r3[0] = cat r4 = cat4_model.append r4[0] = cat r5 = cat5_model.append r5[0] = cat r6 = cat6_model.append r6[0] = cat end @add_categories.model = cat_model @add_categories.active = 0 @add_prodcat.model = cat2_model @add_prodcat.active = -1 @purchase_categories.model = cat3_model @purchase_categories.active = 0 @stock_categories.model = cat4_model @stock_categories.active = 0 @log_categories.model = cat5_model @log_categories.active = 0 @slog_categories.model = cat6_model @slog_categories.active = 0 @continuous_stock.active = false toggle_purchase_fields(false) _add_clear _purchase_clear #signal handlers @handler1 = @add_barcode.signal_connect("changed"){ } @handler2 = @purchase_barcode.signal_connect("changed"){ } @handler3 = @stock_barcode.signal_connect("changed"){ } @handler6 = @log_barcode.signal_connect("changed"){ } @handler7 = @log_barcode.signal_connect("activate"){ _log_show(@log_barcode.text.strip) ; _update_log(@log_barcode.text.strip) } @handler4 = @purchase_price.signal_connect("changed"){ price_amount_changed } @handler5 = @purchase_amount.signal_connect("changed"){ price_amount_changed } %w(focus-out-event activate).each do |s| @purchase_amount.signal_connect s do (@purchase_amount, "0.0") if @purchase_price.text.strip.to_c == 0 @purchase_price.text = (@purchase_amount.text.strip.to_i * @purchase_debuggers_orig.text.to_f).to_s end false end end #@handler8 = @add_categories.signal_connect("changed"){ refresh } @handler9 = @purchase_categories.signal_connect("changed"){ refresh } @handler10 = @stock_categories.signal_connect("changed"){ refresh } @handler11 = @log_categories.signal_connect("changed"){ refresh } @handler12 = @slog_categories.signal_connect("changed"){ refresh } @handler15 = @slog_barcode.signal_connect("changed"){ } @handler16 = @slog_barcode.signal_connect("activate"){ _slog_show(@log_barcode.text.strip) ; _update_slog(@log_barcode.text.strip) } make_debugger_combo(@purchase_debugger) make_debugger_combo(@stock_debugger) [@purchase_amount, @purchase_price, @purchase_plebs, @purchase_debuggers, @purchase_members, @manage_debuggers, @manage_plebs, @manage_members, @stock_stock_new].each do |w| w end @handler69 = @purchase_debugger.signal_connect("changed"){ purchase_debugger_changed } @debugger_stamp = nil end |
Instance Attribute Details
#glade ⇒ Object (readonly)
Returns the value of attribute glade.
19 20 21 |
# File 'lib/ui/protjes.rb', line 19 def glade @glade end |
Instance Method Details
#accept_toogled(widget) ⇒ Object
521 522 |
# File 'lib/ui/protjes.rb', line 521 def accept_toogled() end |
#add_apply(widget) ⇒ Object
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
# File 'lib/ui/protjes.rb', line 557 def add_apply() begin @add_notification.text = "saving product..." toggle_price_fields(true, false) = @add_barcode.text.strip raise Needed, "please scan a barcode" if @add_barcode.text.strip.empty? raise Needed, "please enter a descriptive name" if @add_name.text.strip.empty? raise Needed, "please select a category" if @add_prodcat.active == -1 if @continuous_stock.active? cs = 1 else cs = 0 end $client.product_save!("barcode" => @add_barcode.text.strip, "name" => @add_name.text.strip, "continuous_stock" => cs, "dprice" => @manage_debuggers.text.strip.to_c, "mprice" => @manage_members.text.strip.to_c, "nmprice" => @manage_plebs.text.strip.to_c, "category" => @categories[@add_prodcat.active]) _update_add_products(false) @add_notification.text = "the imps saved the product!" _add_clear(false) _add_show() _purchase_show() rescue Exception => e @add_notification.text = e. end end |
#add_cancel(widget) ⇒ Object
434 435 436 437 |
# File 'lib/ui/protjes.rb', line 434 def add_cancel() toggle_price_fields(true, false) _add_clear end |
#add_delete(w) ⇒ Object
492 493 494 495 496 497 498 499 500 501 |
# File 'lib/ui/protjes.rb', line 492 def add_delete(w) begin = @add_barcode.text.strip $client.product_remove!("barcode" => ) _add_clear _update_add_products(false) rescue Exception => e @add_notification.text = e. end end |
#add_edit(widget) ⇒ Object
405 406 407 |
# File 'lib/ui/protjes.rb', line 405 def add_edit() toggle_price_fields(false) end |
#afronden(i) ⇒ Object
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/ui/protjes.rb', line 294 def afronden(i) m = i % 5 case m when 0 i when 1 i - 1 when 2 i - 2 when 3 i + 2 when 4 i + 1 end end |
#barcode_changed ⇒ Object
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/ui/protjes.rb', line 337 def () case @tabs.page when 0 _purchase_clear(false) toggle_purchase_fields(false) when 1 _purchase_clear(false) toggle_purchase_fields(false) when 2 _stock_clear(false) toggle_stock_field(false) when 3 _log_clear(false) when 4 _slog_clear(false) end end |
#barcode_del(widget, arg0, arg1) ⇒ Object
334 335 |
# File 'lib/ui/protjes.rb', line 334 def (, arg0, arg1) end |
#barcode_ins(widget, arg0, arg1, arg2) ⇒ Object
331 332 |
# File 'lib/ui/protjes.rb', line 331 def (, arg0, arg1, arg2) end |
#changed(widget) ⇒ Object
468 469 470 |
# File 'lib/ui/protjes.rb', line 468 def changed() #puts "changed() is not implemented yet." end |
#check_purchase_debugger_reset ⇒ Object
254 255 256 257 258 |
# File 'lib/ui/protjes.rb', line 254 def check_purchase_debugger_reset if @debugger_stamp.nil? or ((Time.now - @debugger_stamp).to_i > 300) @purchase_debugger.active = -1 end end |
#debuggers_act(widget) ⇒ Object
518 519 |
# File 'lib/ui/protjes.rb', line 518 def debuggers_act() end |
#get_debugger(widget) ⇒ Object
260 261 262 |
# File 'lib/ui/protjes.rb', line 260 def get_debugger() .active_iter[0] end |
#log_cancel(w) ⇒ Object
438 439 440 441 |
# File 'lib/ui/protjes.rb', line 438 def log_cancel(w) _log_clear _update_log end |
#log_select(widget, path, column) ⇒ Object
595 596 597 598 599 600 |
# File 'lib/ui/protjes.rb', line 595 def log_select(, path, column) prodentry = .model.get_iter(path) = prodentry[0]. _log_show() _update_log() end |
#members_act(widget) ⇒ Object
328 329 |
# File 'lib/ui/protjes.rb', line 328 def members_act() end |
#notification_focus_in_event_cb(widget, arg0) ⇒ Object
550 551 |
# File 'lib/ui/protjes.rb', line 550 def notification_focus_in_event_cb(, arg0) end |
#plebs_act(widget) ⇒ Object
431 432 |
# File 'lib/ui/protjes.rb', line 431 def plebs_act() end |
#price_amount_changed ⇒ Object
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/ui/protjes.rb', line 264 def price_amount_changed amount = @purchase_amount.text.strip.to_i price = @purchase_price.text.strip.to_c amount = @purchase_amount.text.strip.to_i @purchase_notification.text = "please enter a valid amount" if amount == 0 @purchase_notification.text = "please enter a valid price (in euro's)" if price == 0 if amount != 0 and price != 0 begin @purchase_notification.text = "" old = @purchase_debuggers_orig.text oldm = @purchase_members_orig.text oldp = @purchase_plebs_orig.text new = price.to_f / amount.to_f memb_ratio = (oldm.to_f / old.to_f) plebs_ratio = (oldp.to_f / old.to_f) newp = (new.to_f * plebs_ratio).to_i newm = (new.to_f * memb_ratio).to_i @purchase_debuggers.text = new.to_i.from_c.to_s @purchase_members.text = afronden(newm).from_c.to_s @purchase_plebs.text = afronden(newp).from_c.to_s #@purchase_accept.active = true rescue Exception => e @purchase_debuggers.text = new.to_i.from_c.to_s @purchase_members.text = afronden(new.to_i).from_c.to_s @purchase_plebs.text = afronden(new.to_i).from_c.to_s @purchase_notification.text = "no (smart) price suggestions could be made" end end end |
#price_del(widget, arg0, arg1) ⇒ Object
476 477 |
# File 'lib/ui/protjes.rb', line 476 def price_del(, arg0, arg1) end |
#price_ins(widget, arg0, arg1, arg2) ⇒ Object
529 530 |
# File 'lib/ui/protjes.rb', line 529 def price_ins(, arg0, arg1, arg2) end |
#purchase ⇒ Object
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/ui/protjes.rb', line 312 def purchase begin if @purchase_accept.active? = @purchase_barcode.text.strip $client.product_save!("barcode" => , "dprice" => @purchase_debuggers.text.strip.to_c, "mprice" => @purchase_members.text.strip.to_c, "nmprice" => @purchase_plebs.text.strip.to_c) end raise "Refusing to update stock: price == 0 !" if @purchase_price.text.strip.to_c == 0 $client.product_purchase!("debugger" => get_debugger(@purchase_debugger).username, "date" => @purchase_date.text.strip, "barcode" => @purchase_barcode.text.strip, "amount" => @purchase_amount.text.strip.to_i, "price" => @purchase_price.text.strip.to_c) _purchase_clear @purchase_notification.text = "the imps noted this purchase..." rescue Exception => e @purchase_notification.text = e. end end |
#purchase_cancel(widget) ⇒ Object
524 525 526 527 |
# File 'lib/ui/protjes.rb', line 524 def purchase_cancel() _purchase_clear check_purchase_debugger_reset end |
#purchase_debugger_changed ⇒ Object
249 250 251 252 |
# File 'lib/ui/protjes.rb', line 249 def purchase_debugger_changed puts "debugger changed" @debugger_stamp = Time.now end |
#purchase_select(widget, path, column) ⇒ Object
586 587 588 589 590 |
# File 'lib/ui/protjes.rb', line 586 def purchase_select(, path, column) prodentry = .model.get_iter(path) _add_show(prodentry[0].) _purchase_show(prodentry[0].) end |
#refresh(widget = nil) ⇒ Object
503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/ui/protjes.rb', line 503 def refresh(=nil) case @tabs.page when 0 _update_add_products(false) when 1 _update_purchase_products(false) when 2 _update_stock_products(false) when 3 _update_log_products(false) when 4 _update_slog_products(false) end end |
#refresh_slog(w) ⇒ Object
458 459 460 461 462 463 464 465 466 |
# File 'lib/ui/protjes.rb', line 458 def refresh_slog(w) = @slog_barcode.text.strip begin p = $client.product_lookup() _update_slog() rescue Needed => e _update_slog end end |
#refreshlog(w) ⇒ Object
449 450 451 452 453 454 455 456 457 |
# File 'lib/ui/protjes.rb', line 449 def refreshlog(w) = @log_barcode.text.strip begin p = $client.product_lookup() _update_log() rescue Needed => e _update_log end end |
#select(widget, path, column) ⇒ Object
581 582 583 584 585 |
# File 'lib/ui/protjes.rb', line 581 def select(, path, column) prodentry = .model.get_iter(path) _add_show(prodentry[0].) _purchase_show(prodentry[0].) end |
#select_from_log(widget, path, column) ⇒ Object
601 602 603 604 605 606 |
# File 'lib/ui/protjes.rb', line 601 def select_from_log(, path, column) prodentry = .model.get_iter(path) = prodentry[0].product _log_show() _update_log() end |
#select_from_slog(widget, path, column) ⇒ Object
613 614 615 616 617 618 |
# File 'lib/ui/protjes.rb', line 613 def select_from_slog(, path, column) prodentry = .model.get_iter(path) = prodentry[0].product _slog_show() _update_slog() end |
#slog_cancel(w) ⇒ Object
442 443 444 445 |
# File 'lib/ui/protjes.rb', line 442 def slog_cancel(w) _slog_clear _update_slog end |
#slog_select(widget, path, column) ⇒ Object
607 608 609 610 611 612 |
# File 'lib/ui/protjes.rb', line 607 def slog_select(, path, column) prodentry = .model.get_iter(path) = prodentry[0]. _slog_show() _update_slog() end |
#smart_search(widget) ⇒ Object
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/ui/protjes.rb', line 409 def smart_search() case @tabs.page when 0 = @add_barcode.text.strip _add_show() _purchase_show() when 1 = @purchase_barcode.text.strip _add_show() _purchase_show() when 2 = @stock_barcode.text.strip _stock_show() when 3 = @stock_barcode.text.strip _log_show() when 4 = @stock_barcode.text.strip _slog_show() end end |
#stock_apply(widget) ⇒ Object
479 480 481 482 483 484 485 486 487 488 489 490 |
# File 'lib/ui/protjes.rb', line 479 def stock_apply() begin raise IG3Error, "select a debugger please!" if @stock_debugger.active == -1 = @stock_barcode.text.strip $client.product_adjust_stock!("barcode" => , "stock" => @stock_stock_new.text.strip.to_i, "debugger" => get_debugger(@stock_debugger).username) _stock_clear @stock_notification.text = "stock update saved!" _stock_show() rescue Exception => e @stock_notification.text = e. end end |
#stock_cancel(widget) ⇒ Object
472 473 474 |
# File 'lib/ui/protjes.rb', line 472 def stock_cancel() _stock_clear end |
#stock_select(widget, path, column) ⇒ Object
591 592 593 594 |
# File 'lib/ui/protjes.rb', line 591 def stock_select(, path, column) prodentry = .model.get_iter(path) _stock_show(prodentry[0].) end |
#stock_to_apply(widget) ⇒ Object
553 554 555 |
# File 'lib/ui/protjes.rb', line 553 def stock_to_apply() @stock_apply.grab_focus end |
#tabfocus(widget, a, b) ⇒ Object
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
# File 'lib/ui/protjes.rb', line 532 def tabfocus(, a, b) case b when 0 _update_add_products when 1 _update_purchase_products check_purchase_debugger_reset when 2 _update_stock_products when 3 _update_log_products _update_log when 4 _update_slog_products _update_slog end end |
#to_purchase(w) ⇒ Object
446 447 448 |
# File 'lib/ui/protjes.rb', line 446 def to_purchase(w) @tabs.page = 1 end |
#toggle_price_fields(from_save, bool = nil) ⇒ Object
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/ui/protjes.rb', line 355 def toggle_price_fields(from_save, bool=nil) # if from_save = true the saving of prices gets skipped bool = (not @manage_debuggers.sensitive?) if bool.nil? @manage_debuggers.sensitive = bool @manage_debuggers.editable = bool @manage_plebs.sensitive = bool @manage_plebs.editable = bool @manage_members.sensitive = bool @manage_members.editable = bool if bool @manage_edit.image = Gtk::Image.new(Gtk::Stock::SAVE, Gtk::IconSize::BUTTON) @manage_edit.label = Gtk::Stock::SAVE else unless from_save begin = @add_barcode.text.strip $client.product_save!("barcode" => , "dprice" => @manage_debuggers.text.strip.to_c, "mprice" => @manage_members.text.strip.to_c, "nmprice" => @manage_plebs.text.strip.to_c) @add_notification.text = "prices saved!" _add_show() rescue Exception => e puts e.backtrace @add_notification.text = e. end end @manage_edit.image = Gtk::Image.new(Gtk::Stock::EDIT, Gtk::IconSize::BUTTON) @manage_edit.label = Gtk::Stock::EDIT end end |
#toggle_purchase_fields(bool) ⇒ Object
385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/ui/protjes.rb', line 385 def toggle_purchase_fields(bool) @purchase_debuggers.sensitive = bool @purchase_debuggers.editable = bool @purchase_plebs.sensitive = bool @purchase_plebs.editable = bool @purchase_members.sensitive = bool @purchase_members.editable = bool #@purchase_date.sensitive = bool #@purchase_date.editable = bool @purchase_amount.sensitive = bool @purchase_amount.editable = bool @purchase_price.sensitive = bool @purchase_price.editable = bool end |
#toggle_stock_field(bool) ⇒ Object
400 401 402 403 |
# File 'lib/ui/protjes.rb', line 400 def toggle_stock_field(bool) @stock_stock_new.sensitive = bool @stock_stock_new.editable = bool end |