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


Python SettingsHandler.create方法代码示例

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


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

示例1: __new__

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import create [as 别名]
    def __new__(mcs, name, bases, kwargs):
        from Orange.canvas.registry.description import (
            input_channel_from_args, output_channel_from_args)

        cls = type.__new__(mcs, name, bases, kwargs)
        if not cls.name: # not a widget
            return cls

        cls.inputs = [input_channel_from_args(inp) for inp in cls.inputs]
        cls.outputs = [output_channel_from_args(outp) for outp in cls.outputs]

        for inp in cls.inputs:
            if not hasattr(cls, inp.handler):
                raise AttributeError("missing input signal handler '{}' in {}".
                                     format(inp.handler, cls.name))

        # TODO Remove this when all widgets are migrated to Orange 3.0
        if (hasattr(cls, "settingsToWidgetCallback") or
                hasattr(cls, "settingsFromWidgetCallback")):
            raise TypeError("Reimplement settingsToWidgetCallback and "
                            "settingsFromWidgetCallback")

        cls.settingsHandler = SettingsHandler.create(cls, template=cls.settingsHandler)

        return cls
开发者ID:Ameobea,项目名称:orange3,代码行数:27,代码来源:widget.py

示例2: __new__

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import create [as 别名]
 def __new__(mcs, name, bases, kwargs):
     cls = super().__new__(mcs, name, bases, kwargs)
     if not cls.name: # not a widget
         return cls
     cls.convert_signals()
     cls.settingsHandler = \
         SettingsHandler.create(cls, template=cls.settingsHandler)
     return cls
开发者ID:benzei,项目名称:orange3,代码行数:10,代码来源:widget.py

示例3: test_initialization_of_not_declared_provider

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import create [as 别名]
    def test_initialization_of_not_declared_provider(self):
        widget = WidgetWithNoProviderDeclared()
        handler = SettingsHandler.create(WidgetWithNoProviderDeclared)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")

            handler.initialize(widget)
            handler.initialize(widget.undeclared_component)

        self.assertIsInstance(widget.undeclared_component.int_setting, int)
开发者ID:jujuefengliu,项目名称:orange3,代码行数:12,代码来源:test_settings.py

示例4: test_create_uses_template_if_provided

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import create [as 别名]
    def test_create_uses_template_if_provided(self):
        template = SettingsHandler()
        template.a = 'a'
        template.b = 'b'
        with self.override_default_settings(SimpleWidget):
            handler = SettingsHandler.create(SimpleWidget, template)
        self.assertEqual(handler.a, 'a')
        self.assertEqual(handler.b, 'b')

        # create should copy the template
        handler.b = 'B'
        self.assertEqual(template.b, 'b')
开发者ID:acopar,项目名称:orange3,代码行数:14,代码来源:test_settings_handler.py

示例5: test_create_uses_template_if_provided

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import create [as 别名]
    def test_create_uses_template_if_provided(self):
        template = SettingsHandler()
        template.read_defaults = lambda: None
        template.a = 'a'
        template.b = 'b'
        handler = SettingsHandler.create(SimpleWidget, template)
        self.assertEqual(handler.a, 'a')
        self.assertEqual(handler.b, 'b')

        # create should copy the template
        handler.b = 'B'
        self.assertEqual(template.b, 'b')
开发者ID:VesnaT,项目名称:orange3,代码行数:14,代码来源:test_settings_handler.py

示例6: test_create

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import create [as 别名]
    def test_create(self, SettingProvider):
        """:type SettingProvider: unittest.mock.Mock"""

        with patch.object(SettingsHandler, 'read_defaults'):
            handler = SettingsHandler.create(SimpleWidget)

            self.assertEqual(handler.widget_class, SimpleWidget)
            # create needs to create a SettingProvider which traverses
            # the widget definition and collects all settings and read
            # all settings and for widget class
            SettingProvider.assert_called_once_with(SimpleWidget)
            SettingsHandler.read_defaults.assert_called_once_with()
开发者ID:VesnaT,项目名称:orange3,代码行数:14,代码来源:test_settings_handler.py

示例7: __new__

# 需要导入模块: from Orange.widgets.settings import SettingsHandler [as 别名]
# 或者: from Orange.widgets.settings.SettingsHandler import create [as 别名]
    def __new__(mcs, name, bases, dict):
        from Orange.canvas.registry.description import input_channel_from_args, output_channel_from_args

        cls = type.__new__(mcs, name, bases, dict)
        if not cls.name:  # not a widget
            return cls

        cls.inputs = list(map(input_channel_from_args, cls.inputs))
        cls.outputs = list(map(output_channel_from_args, cls.outputs))

        # TODO Remove this when all widgets are migrated to Orange 3.0
        if hasattr(cls, "settingsToWidgetCallback") or hasattr(cls, "settingsFromWidgetCallback"):
            raise SystemError("Reimplement settingsToWidgetCallback and " "settingsFromWidgetCallback")

        cls.settingsHandler = SettingsHandler.create(cls, template=cls.settingsHandler)

        return cls
开发者ID:pythoncharmers1,项目名称:orange3,代码行数:19,代码来源:widget.py


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