本文整理汇总了Python中stoqlib.gui.base.dialogs.BasicDialog.close方法的典型用法代码示例。如果您正苦于以下问题:Python BasicDialog.close方法的具体用法?Python BasicDialog.close怎么用?Python BasicDialog.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.gui.base.dialogs.BasicDialog
的用法示例。
在下文中一共展示了BasicDialog.close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BaseEditor
# 需要导入模块: from stoqlib.gui.base.dialogs import BasicDialog [as 别名]
# 或者: from stoqlib.gui.base.dialogs.BasicDialog import close [as 别名]
#.........这里部分代码省略.........
if self._confirm_disabled:
return
self.main_dialog.ok_button.set_sensitive(validation_value)
def add_button(self, label=None, stock=None):
"""
Adds a button to editor. The added button is returned which you
can use to connect signals on.
:param label: label of the button
:param stock: stock label of the button
:param returns: the button added
:rtype: gtk.Button
"""
if label is None and stock is None:
raise TypeError("You need to provide a label or a stock argument")
button = gtk.Button(label=label, stock=stock)
button.props.can_focus = True
self.main_dialog.action_area.pack_start(button, False, False)
self.main_dialog.action_area.reorder_child(button, 0)
button.show()
return button
def cancel(self):
"""
Cancel the dialog.
"""
# set this before runing BaseEditorSlave.cancel so
# 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.
示例2: BaseEditor
# 需要导入模块: from stoqlib.gui.base.dialogs import BasicDialog [as 别名]
# 或者: from stoqlib.gui.base.dialogs.BasicDialog import close [as 别名]
#.........这里部分代码省略.........
Adds a button to editor. The added button is returned which you
can use to connect signals on.
:param label: label of the button
:param stock: stock label of the button
:param returns: the button added
:rtype: gtk.Button
"""
if label is None and stock is None:
raise TypeError("You need to provide a label or a stock argument")
button = gtk.Button(label=label, stock=stock)
button.props.can_focus = True
self.main_dialog.action_area.pack_start(button, False, False)
self.main_dialog.action_area.reorder_child(button, 0)
button.show()
return button
def cancel(self):
"""
Cancel the dialog.
"""
if (self._need_cancel_confirmation() and
not yesno(_("If you cancel this dialog all changes will be lost. "
"Are you sure?"), gtk.RESPONSE_NO,
_("Cancel"), _("Don't cancel"))):
return False
# set this before runing BaseEditorSlave.cancel so
# 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))
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):
"""