[Stoq-devel] Tratamento de sensibilidade do botão OK em DeviceSettingsEditor
Henrique Romano
henrique at async.com.br
Fri Jun 2 10:30:45 BRT 2006
O patch em anexo trata adequadamente a sensibilidade do botão OK no
editor de dispositivos, evitando que um objeto sem as informacoes
necessarias seja criado.
--
Henrique Romano <henrique at async.com.br>
--
-------------- next part --------------
Index: stoqlib/gui/editors/devices.py
===================================================================
--- stoqlib/gui/editors/devices.py (revisão 3602)
+++ stoqlib/gui/editors/devices.py (cópia de trabalho)
@@ -164,10 +164,16 @@
def __init__(self, conn, model=None, station=None):
self.printers_dict = get_supported_printers()
self._branch_station = station
+ # This attribute is set to True when setup_proxies is finished
+ self._is_initialized = False
BaseEditor.__init__(self, conn, model)
self._original_brand = self.model.brand
self._original_model = self.model.model
+ def refresh_ok(self, *args):
+ if self._is_initialized:
+ BaseEditor.refresh_ok(self, self.model.is_valid())
+
def setup_station_combo(self):
if self._branch_station:
self.station.prefill([(self._branch_station.name,
@@ -269,6 +275,7 @@
self.setup_widgets()
self.proxy = self.add_proxy(self.model,
DeviceSettingsEditor.proxy_widgets)
+ self._is_initialized = True
def create_model(self, conn):
return DeviceSettings(device=DeviceSettings.DEVICE_SERIAL1,
@@ -336,20 +343,25 @@
def on_brand_combo__changed(self, *args):
self.update_model_combo()
self._update_constants_button()
+ self.refresh_ok()
def on_type_combo__changed(self, *args):
self.update_brand_combo()
self._update_constants_button()
+ self.refresh_ok()
def on_brand_combo__state_changed(self, *args):
self.update_model_combo()
self._update_constants_button()
+ self.refresh_ok()
def on_model_combo__changed(self, *args):
self._update_constants_button()
+ self.refresh_ok()
def on_device_combo__changed(self, *args):
self._update_constants_button()
+ self.refresh_ok()
def on_constants_button__clicked(self, *args):
self._edit_driver_constants()
More information about the Stoq-devel
mailing list