本文整理汇总了Python中GuiBasic.message_dialog方法的典型用法代码示例。如果您正苦于以下问题:Python GuiBasic.message_dialog方法的具体用法?Python GuiBasic.message_dialog怎么用?Python GuiBasic.message_dialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiBasic
的用法示例。
在下文中一共展示了GuiBasic.message_dialog方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: preview_or_run_operations
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import message_dialog [as 别名]
def preview_or_run_operations(self, really_delete, operations=None):
"""Preview operations or run operations (delete files)"""
assert(isinstance(really_delete, bool))
import Worker
self.start_time = None
if None == operations:
operations = {}
for operation in self.get_selected_operations():
operations[operation] = self.get_operation_options(operation)
assert(isinstance(operations, dict))
if 0 == len(operations):
GuiBasic.message_dialog(self.window,
_("You must select an operation"),
gtk.MESSAGE_WARNING, gtk.BUTTONS_OK)
return
try:
self.set_sensitive(True)
self.textbuffer.set_text("")
self.progressbar.show()
print "STOP NOW"
print self,stop_now
self.worker = Worker.Worker(self, really_delete, operations, self.stop_now)
except:
traceback.print_exc()
err = str(sys.exc_info()[1])
self.append_text(err + "\n", 'error')
else:
self.start_time = time.time()
worker = self.worker.run()
gobject.idle_add(worker.next)
示例2: environ
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import message_dialog [as 别名]
def environ(varname, csidl):
try:
os.environ[varname] = shell.SHGetSpecialFolderPath(None, csidl)
except:
traceback.print_exc()
msg = 'Error setting environemnt variable "%s": %s ' % (varname, str(sys.exc_info()[1]))
import GuiBasic
GuiBasic.message_dialog(None, msg)
示例3: set_cleaner
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import message_dialog [as 别名]
def set_cleaner(self, path, model, parent_window, value=None):
"""Activate or deactive option of cleaner."""
if None == value:
# if not value given, toggle current value
value = not model[path][1]
assert(type(value) is types.BooleanType)
assert(type(model) is gtk.TreeStore)
cleaner_id = None
i = path
if type(i) is str:
# type is either str or gtk.TreeIter
i = model.get_iter(path)
parent = model.iter_parent(i)
if None != parent:
# this is an option (child), not a cleaner (parent)
cleaner_id = model[parent][2]
option_id = model[path][2]
if cleaner_id and value:
# when toggling an option, present any warnings
warning = backends[cleaner_id].get_warning(option_id)
# TRANSLATORS: %(cleaner) may be Firefox, System, etc.
# %(option) may be cache, logs, cookies, etc.
# %(warning) may be 'This option is really slow'
msg = _("Warning regarding %(cleaner)s - %(option)s:\n\n%(warning)s") % \
{'cleaner': model[parent][0],
'option': model[path][0],
'warning': warning}
if warning:
resp = GuiBasic.message_dialog(parent_window,
msg,
gtk.MESSAGE_WARNING, gtk.BUTTONS_OK_CANCEL)
if gtk.RESPONSE_OK != resp:
# user cancelled, so don't toggle option
return
model[path][1] = value
示例4: get_autostart_path
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import message_dialog [as 别名]
def get_autostart_path():
"""Return the path of the BleachBit shortcut in the user's startup folder"""
try:
startupdir = shell.SHGetSpecialFolderPath(None, shellcon.CSIDL_STARTUP)
except:
# example of failure http://bleachbit.sourceforge.net/forum/error-windows-7-x64-bleachbit-091
traceback.print_exc()
msg = 'Error finding user startup folder: %s ' % (str(sys.exc_info()[1]))
import GuiBasic
GuiBasic.message_dialog(None, msg)
# as a fallback, guess
# Windows XP: C:\Documents and Settings\(username)\Start Menu\Programs\Startup
# Windows 7: C:\Users\(username)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
startupdir = os.path.expandvars('$USERPROFILE\\Start Menu\\Programs\\Startup')
if not os.path.exists(startupdir):
startupdir = os.path.expandvars('$APPDATA\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup')
return os.path.join(startupdir, 'bleachbit.lnk')