本文整理汇总了Python中yali.gui.YaliDialog.Dialog.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python Dialog.destroy方法的具体用法?Python Dialog.destroy怎么用?Python Dialog.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yali.gui.YaliDialog.Dialog
的用法示例。
在下文中一共展示了Dialog.destroy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from yali.gui.YaliDialog import Dialog [as 别名]
# 或者: from yali.gui.YaliDialog.Dialog import destroy [as 别名]
class ShrinkEditor:
def __init__(self, parent, storage):
self.storage = storage
self.intf = parent.intf
self.parent = parent
self.dialog = Dialog(_("Partitions to Shrink"), closeButton=False)
self.dialog.addWidget(ShrinkWidget(self))
self.dialog.resize(QSize(0,0))
def run(self):
if self.dialog is None:
return []
while 1:
rc = self.dialog.exec_()
operations = []
if not rc:
self.destroy()
return (rc, operations)
widget = self.dialog.content
request = widget.partitions.itemData(widget.partitions.currentIndex()).toPyObject()
newsize = widget.sizeSpin.value()
try:
operations.append(OperationResizeFormat(request, newsize))
except ValueError as e:
self.intf.messageWindow(_("Resize FileSystem Error"),
_("%(device)s: %(msg)s") %
{'device': request.format.device, 'msg': e.message},
type="error")
continue
try:
operations.append(OperationResizeDevice(request, newsize))
except ValueError as e:
self.intf.messageWindow(_("Resize Device Error"),
_("%(name)s: %(msg)s") %
{'name': request.name, 'msg': e.message},
type="warning")
continue
# everything ok, fall out of loop
break
self.dialog.destroy()
return (rc, operations)
def destroy(self):
if self.dialog:
self.dialog = None