本文整理汇总了Python中gtk.MESSAGE_WARNING属性的典型用法代码示例。如果您正苦于以下问题:Python gtk.MESSAGE_WARNING属性的具体用法?Python gtk.MESSAGE_WARNING怎么用?Python gtk.MESSAGE_WARNING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gtk
的用法示例。
在下文中一共展示了gtk.MESSAGE_WARNING属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: display_export_failure_invalid_image_message
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_WARNING [as 别名]
def display_export_failure_invalid_image_message(details, parent=None):
pg.gui.display_error_message(
title=pg.config.PLUGIN_TITLE,
app_name=pg.config.PLUGIN_TITLE,
parent=parent,
message_type=gtk.MESSAGE_WARNING,
message_markup=_(
"Sorry, but the export was unsuccessful. "
"Do not close the image when exporting, "
"keep it open until the export finishes successfully."),
message_secondary_markup=_(
"If you believe this is a different error, "
"you can help fix it by sending a report with the text "
"in the details to one of the sites below."),
details=details,
display_details_initially=False,
report_uri_list=pg.config.BUG_REPORT_URL_LIST,
report_description="",
focus_on_button=True)
示例2: display_image_preview_failure_message
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_WARNING [as 别名]
def display_image_preview_failure_message(details, parent=None):
pg.gui.display_error_message(
title=pg.config.PLUGIN_TITLE,
app_name=pg.config.PLUGIN_TITLE,
parent=parent,
message_type=gtk.MESSAGE_WARNING,
message_markup=_(
"There was a problem with updating the image preview."),
message_secondary_markup=_(
"If you believe this is an error in the plug-in, you can help fix it "
"by sending a report with the text in the details to one of the sites below."),
details=details,
display_details_initially=False,
report_uri_list=pg.config.BUG_REPORT_URL_LIST,
report_description="",
focus_on_button=True)
示例3: update_view_timeout
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_WARNING [as 别名]
def update_view_timeout(self):
#print "view: update_view_timeout called at real time ", time.time()
# while the simulator is busy, run the gtk event loop
while not self.simulation.lock.acquire(False):
while gtk.events_pending():
gtk.main_iteration()
pause_messages = self.simulation.pause_messages
self.simulation.pause_messages = []
try:
self.update_view()
self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
#print "view: target time set to %f" % self.simulation.target_time
finally:
self.simulation.lock.release()
if pause_messages:
#print pause_messages
dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
message_format='\n'.join(pause_messages))
dialog.connect("response", lambda d, r: d.destroy())
dialog.show()
self.play_button.set_active(False)
# if we're paused, stop the update timer
if not self.play_button.get_active():
self._update_timeout_id = None
return False
#print "view: self.simulation.go.set()"
self.simulation.go.set()
#print "view: done."
return True
示例4: display_export_failure_message
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_WARNING [as 别名]
def display_export_failure_message(exception, parent=None):
error_message = _(
"Sorry, but the export was unsuccessful. "
"You can try exporting again if you fix the issue described below.")
error_message += "\n" + str(exception)
messages_.display_message(
error_message,
message_type=gtk.MESSAGE_WARNING,
parent=parent,
message_in_text_view=True)
示例5: display_reset_prompt
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_WARNING [as 别名]
def display_reset_prompt(parent=None, more_settings_shown=False):
dialog = gtk.MessageDialog(
parent=parent,
type=gtk.MESSAGE_WARNING,
flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
buttons=gtk.BUTTONS_YES_NO)
dialog.set_transient_for(parent)
dialog.set_title(pg.config.PLUGIN_TITLE)
dialog.set_markup(
gobject.markup_escape_text(_("Are you sure you want to reset settings?")))
if more_settings_shown:
checkbutton_reset_operations = gtk.CheckButton(
label=_("Remove procedures and constraints"), use_underline=False)
dialog.vbox.pack_start(checkbutton_reset_operations, expand=False, fill=False)
dialog.set_focus(dialog.get_widget_for_response(gtk.RESPONSE_NO))
dialog.show_all()
response_id = dialog.run()
dialog.destroy()
clear_operations = (
checkbutton_reset_operations.get_active() if more_settings_shown else False)
return response_id, clear_operations
示例6: _init_settings
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_WARNING [as 别名]
def _init_settings(self):
settings_plugin.setup_image_ids_and_filepaths_settings(
self._settings["gui_session/name_preview_layers_collapsed_state"],
self._settings["gui_persistent/name_preview_layers_collapsed_state"],
settings_plugin.convert_set_of_layer_ids_to_names,
[self._layer_exporter_for_previews.layer_tree],
settings_plugin.convert_set_of_layer_names_to_ids,
[self._layer_exporter_for_previews.layer_tree])
settings_plugin.setup_image_ids_and_filepaths_settings(
self._settings["gui_session/image_preview_displayed_layers"],
self._settings["gui_persistent/image_preview_displayed_layers"],
settings_plugin.convert_layer_id_to_name,
[self._layer_exporter_for_previews.layer_tree],
settings_plugin.convert_layer_name_to_id,
[self._layer_exporter_for_previews.layer_tree])
self._settings["main/procedures"].tags.add("ignore_load")
self._settings["main/constraints"].tags.add("ignore_load")
status, status_message = self._settings.load()
if status == pg.setting.Persistor.READ_FAIL:
messages_.display_message(status_message, gtk.MESSAGE_WARNING)
# Needs to be string to avoid strict directory validation
self._settings["gui_session"].add([
pg.setting.StringSetting(
"current_directory",
default_value=self._settings["main/output_directory"].default_value,
gui_type=None)])
_setup_image_ids_and_directories_and_initial_directory(
self._settings, self._settings["gui_session/current_directory"], self._image)
_setup_output_directory_changed(self._settings, self._image)
示例7: update
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_WARNING [as 别名]
def update(settings, prompt_on_clear=False):
"""
Update to the latest version of the plug-in. This includes renaming settings
or replacing obsolete procedures.
Return one of the following values:
* `FRESH_START` - The plug-in was never used before or has no settings stored.
* `UPDATE` - The plug-in was successfully updated to the latest version.
* `CLEAR_SETTINGS` - An old version of the plug-in (incompatible with the
changes in later versions) was used that required clearing stored settings.
* `ABORT` - No update was performed. This value is returned if the user
cancelled clearing settings interactively.
If `prompt_on_clear` is `True` and the plug-in requires clearing settings,
display a message dialog to prompt the user to proceed with clearing. If "No"
is chosen, do not clear settings and return `ABORT`.
"""
if _is_fresh_start():
_save_plugin_version(settings)
return FRESH_START
status, unused_ = pg.setting.Persistor.load(
[settings["main/plugin_version"]], [pg.config.PERSISTENT_SOURCE])
previous_version = pg.version.Version.parse(settings["main/plugin_version"].value)
if (status == pg.setting.Persistor.SUCCESS
and previous_version >= MIN_VERSION_WITHOUT_CLEAN_REINSTALL):
_save_plugin_version(settings)
current_version = pg.version.Version.parse(pg.config.PLUGIN_VERSION)
handle_update(settings, _UPDATE_HANDLERS, previous_version, current_version)
return UPDATE
if prompt_on_clear:
response = messages.display_message(
_("Due to significant changes in the plug-in, settings need to be reset. Proceed?"),
gtk.MESSAGE_WARNING,
buttons=gtk.BUTTONS_YES_NO,
button_response_id_to_focus=gtk.RESPONSE_NO)
if response == gtk.RESPONSE_YES:
clear_setting_sources(settings)
return CLEAR_SETTINGS
else:
return ABORT
else:
clear_setting_sources(settings)
return CLEAR_SETTINGS
示例8: _on_pdb_procedure_browser_dialog_response
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_WARNING [as 别名]
def _on_pdb_procedure_browser_dialog_response(self, dialog, response_id):
if response_id == gtk.RESPONSE_OK:
procedure_name = dialog.get_selected()
if procedure_name:
pdb_procedure = pdb[procedure_name.encode(pg.GIMP_CHARACTER_ENCODING)]
try:
pdb_proc_operation_dict = operations.get_operation_dict_for_pdb_procedure(
pdb_procedure)
except operations.UnsupportedPdbProcedureError as e:
pg.gui.display_error_message(
title=pg.config.PLUGIN_TITLE,
app_name="",
parent=pg.gui.get_toplevel_window(self),
message_type=gtk.MESSAGE_WARNING,
message_markup=(
_("Could not add procedure '{}' because the parameter type '{}' "
"is not supported.").format(e.procedure_name, e.unsupported_param_type)),
message_secondary_markup="",
report_uri_list=pg.config.BUG_REPORT_URL_LIST,
report_description=_(
"You can help fix this issue by sending a report with the text above "
"to one of the sites below"),
focus_on_button=True)
dialog.hide()
return
pdb_proc_operation_dict["enabled"] = False
item = self.add_item(pdb_proc_operation_dict)
operation_edit_dialog = _OperationEditDialog(
item.operation,
pdb_procedure,
title=self._get_operation_edit_dialog_title(item),
role=pg.config.PLUGIN_NAME)
operation_edit_dialog.connect(
"response",
self._on_operation_edit_dialog_for_new_operation_response,
item)
operation_edit_dialog.show_all()
dialog.hide()