本文整理汇总了Python中stoqlib.gui.base.dialogs.BasicDialog.disable_ok方法的典型用法代码示例。如果您正苦于以下问题:Python BasicDialog.disable_ok方法的具体用法?Python BasicDialog.disable_ok怎么用?Python BasicDialog.disable_ok使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.gui.base.dialogs.BasicDialog
的用法示例。
在下文中一共展示了BasicDialog.disable_ok方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BaseEditor
# 需要导入模块: from stoqlib.gui.base.dialogs import BasicDialog [as 别名]
# 或者: from stoqlib.gui.base.dialogs.BasicDialog import disable_ok [as 别名]
#.........这里部分代码省略.........
self.retval = False
BaseEditorSlave.cancel(self)
self.main_dialog.close()
if isinstance(self.store, StoqlibStore):
self.store.retval = self.retval
log.info("%s: Closed (cancelled), retval=%r" % (
self.__class__.__name__, self.retval))
def confirm(self):
"""
Confirm the dialog.
"""
# set this before runing BaseEditorSlave.confirm so
# on_confirm can modify self.retval, if needed
self.retval = self.model
if self._confirm_disabled:
return False
if not BaseEditorSlave.confirm(self):
return False
self.main_dialog.close()
if isinstance(self.store, StoqlibStore):
self.store.retval = self.retval
log.info("%s: Closed (confirmed), retval=%r" % (
self.__class__.__name__, self.retval))
return True
def enable_ok(self):
"""
Enable the ok button of the dialog, eg makes it possible
to close/confirm the dialog.
"""
self.main_dialog.enable_ok()
self._confirm_disabled = False
def disable_ok(self):
"""
Enable the ok button of the dialog, eg makes it possible
to close/confirm the dialog.
"""
self.main_dialog.disable_ok()
self._confirm_disabled = True
def enable_normal_window(self):
"""
Enable the dialog as a normal window.
This tells the window manager that the window
should behave as a normal window instead of a dialog.
"""
toplevel = self.main_dialog.get_toplevel()
toplevel.set_type_hint(gdk.WINDOW_TYPE_HINT_NORMAL)
def set_confirm_widget(self, widget_name):
"""
Make a widget confirmable, eg activating that widget would
close the dialog.
:param widget_name: name of the widget to be confirmable
"""
self.main_dialog.set_confirm_widget(widget_name)
def set_message(self, message, message_type=gtk.MESSAGE_INFO):
"""Sets a message for this editor
:param message: message to add
:param message_type: type of message to add
"""
self.main_dialog.set_message(message, message_type)
# RunnableView
# This delegate everything to self.main_dialog
def close(self):
self.main_dialog.close()
def run(self):
self.main_dialog.run()
def get_current_toplevel(self):
return self.main_dialog.get_current_toplevel()
def destroy(self):
self.main_dialog.destroy()
def set_transient_for(self, window):
self.main_dialog.set_transient_for(window)
# Callbacks
def _on_main_dialog__cancel(self, dialog, retval):
self.cancel()
def _on_main_dialog__confirm(self, dialog, retval):
return self.confirm()
def _validation_function(self, is_valid):
self.refresh_ok(is_valid)
示例2: BaseEditor
# 需要导入模块: from stoqlib.gui.base.dialogs import BasicDialog [as 别名]
# 或者: from stoqlib.gui.base.dialogs.BasicDialog import disable_ok [as 别名]
#.........这里部分代码省略.........
return True
def confirm(self):
"""
Confirm the dialog.
"""
# set this before runing BaseEditorSlave.confirm so
# on_confirm can modify self.retval, if needed
self.retval = self.model
if self._confirm_disabled:
return False
if not BaseEditorSlave.confirm(self):
return False
self.main_dialog.close()
if isinstance(self.store, StoqlibStore):
self.store.retval = self.retval
log.info("%s: Closed (confirmed), retval=%r" % (
self.__class__.__name__, self.retval))
return True
def enable_ok(self):
"""
Enable the ok button of the dialog, eg makes it possible
to close/confirm the dialog.
"""
self.main_dialog.enable_ok()
self._confirm_disabled = False
def disable_ok(self):
"""
Enable the ok button of the dialog, eg makes it possible
to close/confirm the dialog.
"""
self.main_dialog.disable_ok()
self._confirm_disabled = True
def enable_normal_window(self):
"""
Enable the dialog as a normal window.
This tells the window manager that the window
should behave as a normal window instead of a dialog.
"""
toplevel = self.main_dialog.get_toplevel()
toplevel.set_type_hint(gdk.WINDOW_TYPE_HINT_NORMAL)
def set_confirm_widget(self, widget_name):
"""
Make a widget confirmable, eg activating that widget would
close the dialog.
:param widget_name: name of the widget to be confirmable
"""
self.main_dialog.set_confirm_widget(widget_name)
def set_message(self, message, message_type=None):
"""Sets a message for this editor
:param message: message to add
:param message_type: type of message to add
"""
if message_type is None:
message_type = gtk.MESSAGE_INFO
self.main_dialog.set_message(message, message_type)