[POS-commit] r8189 - in stoq/trunk: data/glade stoq/gui/production
george at async.com.br
george at async.com.br
Fri Jul 31 11:02:18 BRT 2009
Author: george
Date: Fri Jul 31 11:02:18 2009
New Revision: 8189
Log:
#4037: Wizard de abertura de producao (stoq). r=romaia
Modified:
stoq/trunk/data/glade/production.glade
stoq/trunk/stoq/gui/production/production.py
Modified: stoq/trunk/data/glade/production.glade
==============================================================================
--- stoq/trunk/data/glade/production.glade Fri Jul 31 11:01:36 2009 (r8188)
+++ stoq/trunk/data/glade/production.glade Fri Jul 31 11:02:18 2009 (r8189)
@@ -118,6 +118,13 @@
</widget>
</child>
<child>
+ <widget class="GtkAction" id="Services">
+ <property name="name">Services</property>
+ <property name="label" translatable="yes">Services...</property>
+ <property name="accelerator"><Control>s</property>
+ </widget>
+ </child>
+ <child>
<widget class="GtkAction" id="about_menu">
<property name="name">about_menu</property>
<property name="label" translatable="yes">About</property>
@@ -158,6 +165,7 @@
</menu>
<menu action="SearchMenu">
<menuitem action="Products"/>
+ <menuitem action="Services"/>
</menu>
<menu action="help_menu">
<menuitem action="about_menu"/>
@@ -268,7 +276,7 @@
<child>
<widget class="GtkButton" id="edit_button">
<property name="is_focus">True</property>
- <property name="visible">False</property>
+ <property name="visible">True</property>
<child>
<widget class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
Modified: stoq/trunk/stoq/gui/production/production.py
==============================================================================
--- stoq/trunk/stoq/gui/production/production.py Fri Jul 31 11:01:36 2009 (r8188)
+++ stoq/trunk/stoq/gui/production/production.py Fri Jul 31 11:02:18 2009 (r8189)
@@ -31,8 +31,11 @@
from kiwi.ui.objectlist import SearchColumn, Column
from kiwi.ui.search import ComboSearchFilter, SearchFilterPosition
+from stoqlib.database.runtime import new_transaction, finish_transaction
from stoqlib.domain.production import ProductionOrder
from stoqlib.gui.search.productionsearch import ProductionProductSearch
+from stoqlib.gui.search.servicesearch import ServiceSearch
+from stoqlib.gui.wizards.productionwizard import ProductionWizard
from stoq.gui.application import SearchableAppWindow
@@ -47,12 +50,32 @@
search_label = _(u'matching:')
klist_selection_mode = gtk.SELECTION_MULTIPLE
+ def __init__(self, app):
+ SearchableAppWindow.__init__(self, app)
+ self._update_widgets()
+
+ def _update_widgets(self):
+ selection = self.results.get_selected_rows()
+ can_edit = False
+ if len(selection) == 1:
+ selected = selection[0]
+ can_edit = (selected.status == ProductionOrder.ORDER_OPENED or
+ selected.status == ProductionOrder.ORDER_WAITING)
+ self.edit_button.set_sensitive(can_edit)
+
def _get_status_values(self):
items = [(text, value)
for value, text in ProductionOrder.statuses.items()]
items.insert(0, (_(u'Any'), None))
return items
+ def _open_production_order(self, order=None):
+ trans = new_transaction()
+ order = trans.get(order)
+ retval = self.run_dialog(ProductionWizard, trans, order)
+ finish_transaction(trans, retval)
+ trans.close()
+
#
# SearchableAppWindow
#
@@ -82,8 +105,19 @@
def on_Products__activate(self, action):
self.run_dialog(ProductionProductSearch, self.conn)
+ def on_Services__activate(self, action):
+ self.run_dialog(ServiceSearch, self.conn, hide_price_column=True)
+
def on_MenuNewProduction__activate(self, action):
- pass
+ self._open_production_order()
def on_ToolbarNewProduction__activate(self, action):
- pass
+ self._open_production_order()
+
+ def on_edit_button__clicked(self, widget):
+ order = self.results.get_selected_rows()[0]
+ assert order is not None
+ self._open_production_order(order)
+
+ def on_results__selection_changed(self, results, selected):
+ self._update_widgets()
More information about the POS-commit
mailing list