本文整理汇总了Python中GuiBasic.delete_confirmation_dialog方法的典型用法代码示例。如果您正苦于以下问题:Python GuiBasic.delete_confirmation_dialog方法的具体用法?Python GuiBasic.delete_confirmation_dialog怎么用?Python GuiBasic.delete_confirmation_dialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiBasic
的用法示例。
在下文中一共展示了GuiBasic.delete_confirmation_dialog方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_operations
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import delete_confirmation_dialog [as 别名]
def run_operations(self, __widget):
"""Event when the 'delete' toolbar button is clicked."""
# fixme: should present this dialog after finding operations
# Disable delete confirmation message.
# if the option is selected under preference.
self.stop_now = False
print "Cleane clicked" , self.stop_now
if not options.get("no_popup"):
if not GuiBasic.delete_confirmation_dialog(self.window, True):
return
self.preview_or_run_operations(True)
示例2: cb_run_option
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import delete_confirmation_dialog [as 别名]
def cb_run_option(self, widget, really_delete, cleaner_id, option_id):
"""Callback from context menu to delete/preview a single option"""
operations = {cleaner_id: [option_id]}
# preview
if not really_delete:
self.preview_or_run_operations(False, operations)
return
# delete
if GuiBasic.delete_confirmation_dialog(self.window, mention_preview=False):
self.preview_or_run_operations(True, operations)
return
示例3: shred_paths
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import delete_confirmation_dialog [as 别名]
def shred_paths(self, paths):
"""Shred file or folders"""
# create a temporary cleaner object
backends['_gui'] = Cleaner.create_simple_cleaner(paths)
# preview and confirm
operations = {'_gui': ['files']}
self.preview_or_run_operations(False, operations)
if GuiBasic.delete_confirmation_dialog(self.window, mention_preview=False):
# delete
self.preview_or_run_operations(True, operations)
return True
return False
示例4: cleaner_change_dialog
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import delete_confirmation_dialog [as 别名]
def cleaner_change_dialog(changes, parent):
"""Present a dialog regarding the change of cleaner definitions"""
def toggled(cell, path, model):
"""Callback for clicking the checkbox"""
__iter = model.get_iter_from_string(path)
value = not model.get_value(__iter, 0)
model.set(__iter, 0, value)
import pygtk
pygtk.require('2.0')
import gtk
dialog = gtk.Dialog(title=_("Security warning"),
parent=parent,
flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
dialog.set_default_size(600, 500)
# create warning
warnbox = gtk.HBox()
image = gtk.Image()
image.set_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG)
warnbox.pack_start(image, False)
# TRANSLATORS: Cleaner definitions are XML data files that define
# which files will be cleaned.
label = gtk.Label(
_("These cleaner definitions are new or have changed. Malicious definitions can damage your system. If you do not trust these changes, delete the files or quit."))
label.set_line_wrap(True)
warnbox.pack_start(label, True)
dialog.vbox.pack_start(warnbox, False)
# create tree view
liststore = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING)
treeview = gtk.TreeView(model=liststore)
renderer0 = gtk.CellRendererToggle()
renderer0.set_property('activatable', True)
renderer0.connect('toggled', toggled, liststore)
# TRANSLATORS: This is the column label (header) in the tree view for the
# security dialog
treeview.append_column(
gtk.TreeViewColumn(_p('column_label', 'Delete'), renderer0, active=0))
renderer1 = gtk.CellRendererText()
# TRANSLATORS: This is the column label (header) in the tree view for the
# security dialog
treeview.append_column(
gtk.TreeViewColumn(_p('column_label', 'Filename'), renderer1, text=1))
# populate tree view
for change in changes:
liststore.append([False, change[0]])
# populate dialog with widgets
scrolled_window = gtk.ScrolledWindow()
scrolled_window.add_with_viewport(treeview)
dialog.vbox.pack_start(scrolled_window)
dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)
dialog.add_button(gtk.STOCK_QUIT, gtk.RESPONSE_CLOSE)
# run dialog
dialog.show_all()
while True:
if gtk.RESPONSE_ACCEPT != dialog.run():
sys.exit(0)
delete = []
for row in liststore:
b = row[0]
path = row[1]
if b:
delete.append(path)
if 0 == len(delete):
# no files selected to delete
break
import GuiBasic
if not GuiBasic.delete_confirmation_dialog(parent, mention_preview=False):
# confirmation not accepted, so do not delete files
continue
for path in delete:
print "info: deleting unrecognized CleanerML '%s'" % path
os.remove(path)
break
dialog.destroy()
示例5: run_operations
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import delete_confirmation_dialog [as 别名]
def run_operations(self, __widget):
"""Event when the 'delete' toolbar button is clicked."""
# fixme: should present this dialog after finding operations
if not GuiBasic.delete_confirmation_dialog(self.window, True):
return
self.preview_or_run_operations(True)
示例6: cleaner_change_dialog
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import delete_confirmation_dialog [as 别名]
def cleaner_change_dialog(changes, parent):
"""Present a dialog regarding the change of cleaner definitions"""
def toggled(cell, path, model):
"""Callback for clicking the checkbox"""
__iter = model.get_iter_from_string(path)
value = not model.get_value(__iter, 0)
model.set(__iter, 0, value)
# TODO: move to GuiBasic
from bleachbit.GuiBasic import Gtk
from gi.repository import GObject
dialog = Gtk.Dialog(title=_("Security warning"),
transient_for=parent,
modal=True, destroy_with_parent=True)
dialog.set_default_size(600, 500)
# create warning
warnbox = Gtk.Box()
image = Gtk.Image()
image.set_from_icon_name("dialog-warning", Gtk.IconSize.DIALOG)
warnbox.pack_start(image, False, True, 0)
# TRANSLATORS: Cleaner definitions are XML data files that define
# which files will be cleaned.
label = Gtk.Label(
label=_("These cleaner definitions are new or have changed. Malicious definitions can damage your system. If you do not trust these changes, delete the files or quit."))
label.set_line_wrap(True)
warnbox.pack_start(label, True, True, 0)
dialog.vbox.pack_start(warnbox, False, True, 0)
# create tree view
liststore = Gtk.ListStore(GObject.TYPE_BOOLEAN, GObject.TYPE_STRING)
treeview = Gtk.TreeView(model=liststore)
renderer0 = Gtk.CellRendererToggle()
renderer0.set_property('activatable', True)
renderer0.connect('toggled', toggled, liststore)
# TRANSLATORS: This is the column label (header) in the tree view for the
# security dialog
treeview.append_column(
Gtk.TreeViewColumn(_p('column_label', 'Delete'), renderer0, active=0))
renderer1 = Gtk.CellRendererText()
# TRANSLATORS: This is the column label (header) in the tree view for the
# security dialog
treeview.append_column(
Gtk.TreeViewColumn(_p('column_label', 'Filename'), renderer1, text=1))
# populate tree view
for change in changes:
liststore.append([False, change[0]])
# populate dialog with widgets
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add(treeview)
dialog.vbox.pack_start(scrolled_window, True, True, 0)
dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
dialog.add_button(Gtk.STOCK_QUIT, Gtk.ResponseType.CLOSE)
# run dialog
dialog.show_all()
while True:
if Gtk.ResponseType.ACCEPT != dialog.run():
sys.exit(0)
delete = []
for row in liststore:
b = row[0]
path = row[1]
if b:
delete.append(path)
if 0 == len(delete):
# no files selected to delete
break
import GuiBasic
if not GuiBasic.delete_confirmation_dialog(parent, mention_preview=False):
# confirmation not accepted, so do not delete files
continue
for path in delete:
logger.info("deleting unrecognized CleanerML '%s'", path)
os.remove(path)
break
dialog.destroy()