本文整理汇总了Python中stoqlib.gui.base.dialogs.BasicDialog.enable_ok方法的典型用法代码示例。如果您正苦于以下问题:Python BasicDialog.enable_ok方法的具体用法?Python BasicDialog.enable_ok怎么用?Python BasicDialog.enable_ok使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.gui.base.dialogs.BasicDialog
的用法示例。
在下文中一共展示了BasicDialog.enable_ok方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BaseEditor
# 需要导入模块: from stoqlib.gui.base.dialogs import BasicDialog [as 别名]
# 或者: from stoqlib.gui.base.dialogs.BasicDialog import enable_ok [as 别名]
#.........这里部分代码省略.........
# on_cancel can modify self.retval, if needed
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)
示例2: BaseEditor
# 需要导入模块: from stoqlib.gui.base.dialogs import BasicDialog [as 别名]
# 或者: from stoqlib.gui.base.dialogs.BasicDialog import enable_ok [as 别名]
#.........这里部分代码省略.........
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))
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)