本文整理汇总了Python中safe.gui.tools.minimum_needs.needs_profile.NeedsProfile.load_profile方法的典型用法代码示例。如果您正苦于以下问题:Python NeedsProfile.load_profile方法的具体用法?Python NeedsProfile.load_profile怎么用?Python NeedsProfile.load_profile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类safe.gui.tools.minimum_needs.needs_profile.NeedsProfile
的用法示例。
在下文中一共展示了NeedsProfile.load_profile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NeedsManagerDialog
# 需要导入模块: from safe.gui.tools.minimum_needs.needs_profile import NeedsProfile [as 别名]
# 或者: from safe.gui.tools.minimum_needs.needs_profile.NeedsProfile import load_profile [as 别名]
#.........这里部分代码省略.........
self.main_stacked_widget.setCurrentIndex(1)
self.minimum_needs = NeedsProfile()
self.edit_item = None
# Remove profile button
# noinspection PyUnresolvedReferences
self.remove_profile_button.clicked.connect(self.remove_profile)
# These are all buttons that will get hidden on context change
# to the profile editing view
self.profile_editing_buttons = list()
self.profile_editing_buttons.append(self.remove_resource_button)
self.profile_editing_buttons.append(self.add_resource_button)
self.profile_editing_buttons.append(self.edit_resource_button)
self.profile_editing_buttons.append(self.export_profile_button)
self.profile_editing_buttons.append(self.import_profile_button)
self.profile_editing_buttons.append(self.new_profile_button)
self.profile_editing_buttons.append(self.save_profile_button)
self.profile_editing_buttons.append(self.save_profile_as_button)
# We also keep a list of all widgets to disable in context of resource
# editing (not hidden, just disabled)
self.profile_editing_widgets = self.profile_editing_buttons
self.profile_editing_widgets.append(self.remove_profile_button)
self.profile_editing_widgets.append(self.profile_combo)
# These are all buttons that will get hidden on context change
# to the resource editing view
self.resource_editing_buttons = list()
self.resource_editing_buttons.append(self.discard_changes_button)
self.resource_editing_buttons.append(self.save_resource_button)
for item in self.resource_editing_buttons:
item.hide()
self.load_profiles()
# Next 2 lines fixes issues #1388 #1389 #1390 #1391
if self.profile_combo.count() > 0:
self.select_profile(0)
# initial sync profile_combo and resource list
self.clear_resource_list()
self.populate_resource_list()
self.set_up_resource_parameters()
# Only do this afterward load_profiles to avoid the resource list
# being updated
# noinspection PyUnresolvedReferences
self.profile_combo.activated.connect(self.select_profile)
# noinspection PyUnresolvedReferences
self.stacked_widget.currentChanged.connect(self.page_changed)
self.select_profile(self.profile_combo.currentIndex())
def reject(self):
"""Overload the base dialog reject event so we can handle state change.
If the user is in resource editing mode, clicking close button,
window [x] or pressing escape should switch context back to the
profile view, not close the whole window.
See https://github.com/AIFDR/inasafe/issues/1387
"""
if self.stacked_widget.currentWidget() == self.resource_edit_page:
self.edit_item = None
self.switch_context(self.profile_edit_page)
else:
super(NeedsManagerDialog, self).reject()
def populate_resource_list(self):
示例2: NeedsManagerDialog
# 需要导入模块: from safe.gui.tools.minimum_needs.needs_profile import NeedsProfile [as 别名]
# 或者: from safe.gui.tools.minimum_needs.needs_profile.NeedsProfile import load_profile [as 别名]
#.........这里部分代码省略.........
self.main_stacked_widget.setCurrentIndex(1)
self.minimum_needs = NeedsProfile()
self.edit_item = None
# Remove profile button
# noinspection PyUnresolvedReferences
self.remove_profile_button.clicked.connect(self.remove_profile)
# These are all buttons that will get hidden on context change
# to the profile editing view
self.profile_editing_buttons = list()
self.profile_editing_buttons.append(self.remove_resource_button)
self.profile_editing_buttons.append(self.add_resource_button)
self.profile_editing_buttons.append(self.edit_resource_button)
self.profile_editing_buttons.append(self.export_profile_button)
self.profile_editing_buttons.append(self.import_profile_button)
self.profile_editing_buttons.append(self.new_profile_button)
self.profile_editing_buttons.append(self.save_profile_button)
self.profile_editing_buttons.append(self.save_profile_as_button)
# We also keep a list of all widgets to disable in context of resource
# editing (not hidden, just disabled)
self.profile_editing_widgets = self.profile_editing_buttons
self.profile_editing_widgets.append(self.remove_profile_button)
self.profile_editing_widgets.append(self.profile_combo)
# These are all buttons that will get hidden on context change
# to the resource editing view
self.resource_editing_buttons = list()
self.resource_editing_buttons.append(self.discard_changes_button)
self.resource_editing_buttons.append(self.save_resource_button)
for item in self.resource_editing_buttons:
item.hide()
self.load_profiles()
# Next 2 lines fixes issues #1388 #1389 #1390 #1391
if self.profile_combo.count() > 0:
self.select_profile(0)
# initial sync profile_combo and resource list
self.clear_resource_list()
self.populate_resource_list()
self.set_up_resource_parameters()
# Only do this afterward load_profiles to avoid the resource list
# being updated
# noinspection PyUnresolvedReferences
self.profile_combo.activated.connect(self.select_profile)
# noinspection PyUnresolvedReferences
self.stacked_widget.currentChanged.connect(self.page_changed)
self.select_profile(self.profile_combo.currentIndex())
def reject(self):
"""Overload the base dialog reject event so we can handle state change.
If the user is in resource editing mode, clicking close button,
window [x] or pressing escape should switch context back to the
profile view, not close the whole window.
See https://github.com/AIFDR/inasafe/issues/1387
"""
if self.stacked_widget.currentWidget() == self.resource_edit_page:
self.edit_item = None
self.switch_context(self.profile_edit_page)
else:
super(NeedsManagerDialog, self).reject()
def populate_resource_list(self):