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


Python Fysom.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from fysom import Fysom [as 别名]
# 或者: from fysom.Fysom import __init__ [as 别名]
    def __init__(self, callbacks_dict=None, interactive_callbacks=None):
        self.__NOT_IMPLEMENTED_ERROR = "Classes that inherit from KnittingPlugin should implment {0}"
        self.interactive_callbacks = {}

        if interactive_callbacks is None:
            self.register_interactive_callbacks({
                "info": BaseKnittingPlugin.__interactive_info,
                "user_action": BaseKnittingPlugin.__interactive_info,
                "warning": BaseKnittingPlugin.__interactive_warn,
                "error": BaseKnittingPlugin.__interactive_error,
                "progress": BaseKnittingPlugin.__log_progress
            })
        else:
            self.register_interactive_callbacks(interactive_callbacks)

        if callbacks_dict is None:
            callbacks_dict = {
                'onknit': self.onknit,
                'onconfigure': self.onconfigure,
                'onfinish': self.onfinish,
            }
        Fysom.__init__(self, {
            'initial': 'activated',
            'events': [  # TODO: add more states for handling error management.
                         {'name': 'configure', 'src': 'activated', 'dst': 'configured'},
                         {'name': 'configure', 'src': 'configured', 'dst': 'configured'},
                         {'name': 'configure', 'src': 'finished', 'dst': 'configured'},
                         {'name': 'configure', 'src': 'error', 'dst': 'configured'},
                         {'name': 'knit', 'src': 'configured', 'dst': 'knitting'},
                         {'name': 'finish', 'src': 'knitting', 'dst': 'finished'},
                         {'name': 'fail', 'src': 'knitting', 'dst': 'error'}],
            'callbacks': callbacks_dict
        })
开发者ID:tian2992,项目名称:knitlib,代码行数:35,代码来源:knitting_plugin.py

示例2: __init__

# 需要导入模块: from fysom import Fysom [as 别名]
# 或者: from fysom.Fysom import __init__ [as 别名]
 def __init__(self, name, runner, references, config, **kwargs):
     """ Create a PrePostTask.
       @param str name: unique name of the task
       @param object runner: TaskRunner that manages this task
       @param dict references: contains references to all required modules
       @param dict config: configuration parameter dictionary
     """
     _default_callbacks = {'onprerun': self._pre, 'onpostrun': self._post}
     _stateList = {
         'initial': 'stopped',
         'events': [
             {'name': 'prerun', 'src': 'stopped', 'dst': 'paused'},
             {'name': 'postrun', 'src': 'paused', 'dst': 'stopped'}
         ],
         'callbacks': _default_callbacks
     }
     if 'PyQt5' in sys.modules:
         super().__init__(cfg=_stateList, **kwargs)
     else:
         QtCore.QObject.__init__(self)
         Fysom.__init__(self, _stateList)
     self.lock = Mutex()
     self.name = name
     self.runner = runner
     self.ref = references
     self.config = config
开发者ID:Ulm-IQO,项目名称:qudi,代码行数:28,代码来源:generic_task.py

示例3: __init__

# 需要导入模块: from fysom import Fysom [as 别名]
# 或者: from fysom.Fysom import __init__ [as 别名]
    def __init__(self, plugin_id, current_state):
        Fysom.__init__(self, {
            'initial': current_state,
            'events': events,
            'callbacks': {
                'oninstall': self.install,
                'oninitialize': self.initialize
            }
        })

        self.plugin_id = plugin_id
        self.current_state = current_state
        self.onchangestate = self._onchangestate
开发者ID:AlexeyKasatkin,项目名称:fuel-web,代码行数:15,代码来源:fsm.py

示例4: __init__

# 需要导入模块: from fysom import Fysom [as 别名]
# 或者: from fysom.Fysom import __init__ [as 别名]
  def __init__(self, callbacks_dict):
    self.__NOT_IMPLEMENTED_ERROR = "Classes that inherit from KnittingPlugin should implment {0}"

    callbacks_dict = {
        'onknit': self.onknit,
        #'onknitting': self.onknitting,
        'onconfigure': self.onconfigure,
        'onfinish': self.onfinish,
        }
    Fysom.__init__(self,
        {'initial': 'activated',
         'events': [
             ## TODO: add more states for handling error management.
             {'name': 'configure', 'src': 'activated', 'dst': 'configured'},
             {'name': 'configure', 'src': 'configured', 'dst': 'configured'},
             {'name': 'configure', 'src': 'finished', 'dst': 'configured'},
             {'name': 'configure', 'src': 'error', 'dst': 'configured'},
             {'name': 'knit', 'src': 'configured', 'dst': 'knitting'},
             {'name': 'finish', 'src': 'knitting', 'dst': 'finished'},
             {'name': 'fail', 'src': 'knittng', 'dst': 'error'}
         ],
         'callbacks':  callbacks_dict
         })
开发者ID:AllYarnsAreBeautiful,项目名称:ayab-desktop,代码行数:25,代码来源:knitting_plugin.py

示例5: __init__

# 需要导入模块: from fysom import Fysom [as 别名]
# 或者: from fysom.Fysom import __init__ [as 别名]
    def __init__(self, callbacks_dict=None, interactive_callbacks=None):
        self.__NOT_IMPLEMENTED_ERROR = "Classes that inherit from KnittingPlugin should implement {0}"
        """Interactive callbacks handle Plugin-Frontend interaction hooks."""
        self.interactive_callbacks = {}

        # Are we running on CLI or knitlib web?
        # If no callbacks are registered, we set a CLI set as default.
        if interactive_callbacks is None:
            self.register_interactive_callbacks({
                "blocking_user_action": BaseKnittingPlugin.__cli_blocking_action,
                "message": BaseKnittingPlugin.__cli_emit_message,
                "progress": BaseKnittingPlugin.__cli_log_progress
            })
        else:
            self.register_interactive_callbacks(interactive_callbacks)

        # Fysom allows to set hooks before changing states, we set them here.
        if callbacks_dict is None:
            callbacks_dict = {
                'onknit': self.onknit,
                'onconfigure': self.onconfigure,
                'onfinish': self.onfinish,
            }
        Fysom.__init__(self, {
            'initial': 'activated',
            'events': [  # TODO: add more states for handling error management.
                         {'name': 'configure', 'src': 'activated', 'dst': 'configured'},
                         {'name': 'configure', 'src': 'configured', 'dst': 'configured'},
                         {'name': 'configure', 'src': 'finished', 'dst': 'configured'},
                         {'name': 'configure', 'src': 'error', 'dst': 'configured'},
                         {'name': 'knit', 'src': 'configured', 'dst': 'knitting'},
                         {'name': 'finish', 'src': 'knitting', 'dst': 'finished'},
                         {'name': 'finish', 'src': 'finished', 'dst': 'finished'},
                         {'name': 'fail', 'src': 'knitting', 'dst': 'error'}],
            'callbacks': callbacks_dict
        })
开发者ID:shiluka,项目名称:knitlib,代码行数:38,代码来源:knitting_plugin.py


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