当前位置: 首页>>代码示例>>Python>>正文


Python SettingsHandler.pack_data方法代码示例

本文整理汇总了Python中Orange.widgets.settings.SettingsHandler.pack_data方法的典型用法代码示例。如果您正苦于以下问题:Python SettingsHandler.pack_data方法的具体用法?Python SettingsHandler.pack_data怎么用?Python SettingsHandler.pack_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Orange.widgets.settings.SettingsHandler的用法示例。


在下文中一共展示了SettingsHandler.pack_data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_about_pack_settings_signal

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import pack_data [as 别名]
 def test_about_pack_settings_signal(self):
     handler = SettingsHandler()
     handler.bind(SimpleWidget)
     widget = SimpleWidget()
     handler.initialize(widget)
     fn = Mock()
     widget.settingsAboutToBePacked.connect(fn)
     handler.pack_data(widget)
     self.assertEqual(1, fn.call_count)
     handler.update_defaults(widget)
     self.assertEqual(2, fn.call_count)
开发者ID:PrimozGodec,项目名称:orange3,代码行数:13,代码来源:test_settings_handler.py

示例2: test_schema_only_settings

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import pack_data [as 别名]
    def test_schema_only_settings(self):
        handler = SettingsHandler()
        with self.override_default_settings(SimpleWidget):
            handler.bind(SimpleWidget)

        # fast_save should not update defaults
        widget = SimpleWidget()
        handler.fast_save(widget, 'schema_only_setting', 5)
        self.assertEqual(
            handler.known_settings['schema_only_setting'].default, None)
        handler.fast_save(widget, 'component.schema_only_setting', 5)
        self.assertEqual(
            handler.known_settings['component.schema_only_setting'].default, "only")

        # update_defaults should not update defaults
        widget.schema_only_setting = 5
        handler.update_defaults(widget)
        self.assertEqual(
            handler.known_settings['schema_only_setting'].default, None)
        widget.component.schema_only_setting = 5
        self.assertEqual(
            handler.known_settings['component.schema_only_setting'].default, "only")

        # pack_data should pack setting
        widget.schema_only_setting = 5
        widget.component.schema_only_setting = 5
        data = handler.pack_data(widget)
        self.assertEqual(data['schema_only_setting'], 5)
        self.assertEqual(data['component']['schema_only_setting'], 5)
开发者ID:acopar,项目名称:orange3,代码行数:31,代码来源:test_settings_handler.py

示例3: test_pack_settings_stores_version

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import pack_data [as 别名]
    def test_pack_settings_stores_version(self):
        handler = SettingsHandler()
        handler.bind(SimpleWidget)

        widget = SimpleWidget()

        settings = handler.pack_data(widget)
        self.assertIn(VERSION_KEY, settings)
开发者ID:acopar,项目名称:orange3,代码行数:10,代码来源:test_settings_handler.py

示例4: test_schema_only_settings

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import pack_data [as 别名]
    def test_schema_only_settings(self):
        handler = SettingsHandler()
        handler.read_defaults = lambda: None
        handler.bind(SimpleWidget)

        # fast_save should not update defaults
        widget = SimpleWidget()
        handler.fast_save(widget, 'schema_only_setting', 5)
        self.assertEqual(
            handler.known_settings['schema_only_setting'].default, None)

        # update_defaults should not update defaults
        widget.schema_only_setting = 5
        handler.update_defaults(widget)
        self.assertEqual(
            handler.known_settings['schema_only_setting'].default, None)

        # pack_data should pack setting
        widget.schema_only_setting = 5
        data = handler.pack_data(widget)
        self.assertEqual(data['schema_only_setting'], 5)
开发者ID:675801717,项目名称:orange3,代码行数:23,代码来源:test_settings_handler.py


注:本文中的Orange.widgets.settings.SettingsHandler.pack_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。