Merge lp:~romaia/stoq/ideale into lp:~stoq-dev/stoq/master-old

Proposed by Ronaldo Maia
Status: Merged
Merged at revision: not available
Proposed branch: lp:~romaia/stoq/ideale
Merge into: lp:~stoq-dev/stoq/master-old
Diff against target: None lines
To merge this branch: bzr merge lp:~romaia/stoq/ideale
Reviewer Review Type Date Requested Status
George Kussumoto (community) code-review Approve
Review via email: mp+11546@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ronaldo Maia (romaia) wrote :
Revision history for this message
George Kussumoto (georgeyk) wrote :

Ficou legal!

=== modified file 'stoq/gui/stock/stock.py'
--- stoq/gui/stock/stock.py 2009-07-27 18:19:18 +0000
+++ stoq/gui/stock/stock.py 2009-09-10 17:00:40 +0000

@@ -131,6 +126,30 @@
         items.insert(0, [_('All branches'), None])
         return items

+ def _setup_widgets(self):
+ space = gtk.EventBox()
+ space.show()
+ self.hbox7.pack_start(space)
+
+ self.image = gtk.Image()
+
+ button = gtk.Button()
+ button.set_size_request(74, 64)
+ button.set_image(self.image)
+ button.set_relief(gtk.RELIEF_NONE)
+ button.show()
+ button.connect('clicked', self._on_image_button__clicked)
+ self.hbox7.pack_start(button, False, False)
+ self.image_button = button
+
+

uma linha sobrando acima.
Atualiza o nome hbox7 para algo melhor, tipo button_box.

review: Approve (code-review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'stoq/gui/stock/stock.py'
--- stoq/gui/stock/stock.py 2009-07-27 18:19:18 +0000
+++ stoq/gui/stock/stock.py 2009-09-10 17:00:40 +0000
@@ -29,6 +29,7 @@
2929
30import pango30import pango
31import gtk31import gtk
32from kiwi.datatypes import converter
32from kiwi.enums import SearchFilterPosition33from kiwi.enums import SearchFilterPosition
33from kiwi.ui.search import ComboSearchFilter34from kiwi.ui.search import ComboSearchFilter
34from kiwi.ui.objectlist import Column, SearchColumn35from kiwi.ui.objectlist import Column, SearchColumn
@@ -42,6 +43,7 @@
42from stoqlib.domain.views import ProductFullStockView43from stoqlib.domain.views import ProductFullStockView
43from stoqlib.lib.defaults import sort_sellable_code44from stoqlib.lib.defaults import sort_sellable_code
44from stoqlib.lib.message import warning45from stoqlib.lib.message import warning
46from stoqlib.gui.editors.producteditor import ProductStockEditor
45from stoqlib.gui.wizards.receivingwizard import ReceivingOrderWizard47from stoqlib.gui.wizards.receivingwizard import ReceivingOrderWizard
46from stoqlib.gui.wizards.stocktransferwizard import StockTransferWizard48from stoqlib.gui.wizards.stocktransferwizard import StockTransferWizard
47from stoqlib.gui.search.receivingsearch import PurchaseReceivingSearch49from stoqlib.gui.search.receivingsearch import PurchaseReceivingSearch
@@ -67,6 +69,7 @@
67 search_table = ProductFullStockView69 search_table = ProductFullStockView
68 search_labels = _('Matching:')70 search_labels = _('Matching:')
69 klist_selection_mode = gtk.SELECTION_MULTIPLE71 klist_selection_mode = gtk.SELECTION_MULTIPLE
72 pixbuf_converter = converter.get_converter(gtk.gdk.Pixbuf)
7073
71 def __init__(self, app):74 def __init__(self, app):
72 SearchableAppWindow.__init__(self, app)75 SearchableAppWindow.__init__(self, app)
@@ -113,14 +116,6 @@
113 # Private API116 # Private API
114 #117 #
115118
116 def _setup_widgets(self):
117 self.search.set_summary_label(column='stock',
118 label=_('<b>Stock Total:</b>'),
119 format='<b>%s</b>')
120
121 if Inventory.has_open(self.conn, get_current_branch(self.conn)):
122 show_inventory_process_message()
123
124 def _get_branches(self):119 def _get_branches(self):
125 items = [(b.person.name, b)120 items = [(b.person.name, b)
126 for b in Person.iselect(IBranch, connection=self.conn)]121 for b in Person.iselect(IBranch, connection=self.conn)]
@@ -131,6 +126,30 @@
131 items.insert(0, [_('All branches'), None])126 items.insert(0, [_('All branches'), None])
132 return items127 return items
133128
129 def _setup_widgets(self):
130 space = gtk.EventBox()
131 space.show()
132 self.hbox7.pack_start(space)
133
134 self.image = gtk.Image()
135
136 button = gtk.Button()
137 button.set_size_request(74, 64)
138 button.set_image(self.image)
139 button.set_relief(gtk.RELIEF_NONE)
140 button.show()
141 button.connect('clicked', self._on_image_button__clicked)
142 self.hbox7.pack_start(button, False, False)
143 self.image_button = button
144
145
146 self.search.set_summary_label(column='stock',
147 label=_('<b>Stock Total:</b>'),
148 format='<b>%s</b>')
149
150 if Inventory.has_open(self.conn, get_current_branch(self.conn)):
151 show_inventory_process_message()
152
134 def _update_widgets(self):153 def _update_widgets(self):
135 branch = get_current_branch(self.conn)154 branch = get_current_branch(self.conn)
136 if Inventory.has_open(self.conn, branch):155 if Inventory.has_open(self.conn, branch):
@@ -142,7 +161,21 @@
142161
143 is_main_branch = self.branch_filter.get_state().value is branch162 is_main_branch = self.branch_filter.get_state().value is branch
144 has_stock = len(self.results) > 0163 has_stock = len(self.results) > 0
145 one_selected = len(self.results.get_selected_rows()) == 1164
165 selected = self.results.get_selected_rows()
166 one_selected = len(selected) == 1
167
168 pixbuf = None
169 if one_selected:
170 item = selected[0]
171 pixbuf = self.pixbuf_converter.from_string(item.product.image)
172
173 if pixbuf:
174 self.image.set_from_pixbuf(pixbuf)
175 else:
176 self.image.set_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_DIALOG)
177
178 self.image_button.set_sensitive(one_selected)
146 self.history_button.set_sensitive(one_selected and is_main_branch)179 self.history_button.set_sensitive(one_selected and is_main_branch)
147 self.retention_button.set_sensitive(one_selected and is_main_branch)180 self.retention_button.set_sensitive(one_selected and is_main_branch)
148 self.print_button.set_sensitive(has_stock)181 self.print_button.set_sensitive(has_stock)
@@ -233,3 +266,17 @@
233 sellable = Sellable.get(selected[0].id, connection=self.conn)266 sellable = Sellable.get(selected[0].id, connection=self.conn)
234 self.run_dialog(ProductStockHistoryDialog, self.conn, sellable,267 self.run_dialog(ProductStockHistoryDialog, self.conn, sellable,
235 branch=self.branch_filter.combo.get_selected())268 branch=self.branch_filter.combo.get_selected())
269
270 def _on_image_button__clicked(self, button):
271 selected = self.results.get_selected_rows()
272 one_selected = len(selected) == 1
273
274 if not one_selected:
275 return
276
277 trans = new_transaction()
278 product = trans.get(selected[0].product)
279
280 model = self.run_dialog(ProductStockEditor, trans, product)
281 finish_transaction(trans, model)
282 trans.close()

Subscribers

People subscribed via source and target branches