當前位置: 首頁>>代碼示例>>Python>>正文


Python DaemonThread.__init__方法代碼示例

本文整理匯總了Python中util.DaemonThread.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python DaemonThread.__init__方法的具體用法?Python DaemonThread.__init__怎麽用?Python DaemonThread.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在util.DaemonThread的用法示例。


在下文中一共展示了DaemonThread.__init__方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from util import DaemonThread [as 別名]
# 或者: from util.DaemonThread import __init__ [as 別名]
 def __init__(self, config, is_local, gui_name):
     DaemonThread.__init__(self)
     if is_local:
         find = imp.find_module('plugins')
         plugins = imp.load_module('electrum_plugins', *find)
     else:
         plugins = __import__('electrum_plugins')
     self.pkgpath = os.path.dirname(plugins.__file__)
     self.config = config
     self.hw_wallets = {}
     self.plugins = {}
     self.gui_name = gui_name
     self.descriptions = []
     for loader, name, ispkg in pkgutil.iter_modules([self.pkgpath]):
         m = loader.find_module(name).load_module(name)
         d = m.__dict__
         gui_good = gui_name in d.get('available_for', [])
         details = d.get('registers_wallet_type')
         if details:
             self.register_plugin_wallet(name, gui_good, details)
         if not gui_good:
             continue
         self.descriptions.append(d)
         if not d.get('requires_wallet_type') and config.get('use_' + name):
             self.load_plugin(config, name)
開發者ID:Emzy,項目名稱:electrum,代碼行數:27,代碼來源:plugins.py

示例2: __init__

# 需要導入模塊: from util import DaemonThread [as 別名]
# 或者: from util.DaemonThread import __init__ [as 別名]
    def __init__(self, config, fd):

        DaemonThread.__init__(self)
        self.config = config
        if config.get('offline'):
            self.network = None
        else:
            self.network = Network(config)
            self.network.start()
        self.gui = None
        self.wallets = {}
        # Setup server
        cmd_runner = Commands(self.config, None, self.network)
        host = config.get('rpchost', 'localhost')
        port = config.get('rpcport', 0)
        server = SimpleJSONRPCServer((host, port), logRequests=False,
                                     requestHandler=RequestHandler)
        os.write(fd, repr((server.socket.getsockname(), time.time())))
        os.close(fd)
        server.timeout = 0.1
        for cmdname in known_commands:
            server.register_function(getattr(cmd_runner, cmdname), cmdname)
        server.register_function(self.run_cmdline, 'run_cmdline')
        server.register_function(self.ping, 'ping')
        server.register_function(self.run_daemon, 'daemon')
        server.register_function(self.run_gui, 'gui')
        self.server = server
開發者ID:ChainEXS,項目名稱:electrum,代碼行數:29,代碼來源:daemon.py

示例3: __init__

# 需要導入模塊: from util import DaemonThread [as 別名]
# 或者: from util.DaemonThread import __init__ [as 別名]
 def __init__(self, config, is_local, gui_name):
     DaemonThread.__init__(self)
     if is_local:
         find = imp.find_module('plugins')
         plugins = imp.load_module('electrum_plugins', *find)
     else:
         plugins = __import__('electrum_plugins')
     self.pkgpath = os.path.dirname(plugins.__file__)
     self.config = config
     self.hw_wallets = {}
     self.plugins = {}
     self.gui_name = gui_name
     self.descriptions = {}
     self.device_manager = DeviceMgr()
     self.load_plugins()
     self.start()
開發者ID:prusso,項目名稱:electrum,代碼行數:18,代碼來源:plugins.py

示例4: __init__

# 需要導入模塊: from util import DaemonThread [as 別名]
# 或者: from util.DaemonThread import __init__ [as 別名]
    def __init__(self, config, fd):
        DaemonThread.__init__(self)
        self.config = config
        if config.get('offline'):
            self.network = None
            self.fx = None
        else:
            self.network = Network(config)
            self.network.start()
            self.fx = FxThread(config, self.network)
            self.network.add_jobs([self.fx])

        self.gui = None
        self.wallets = {}
        # Setup JSONRPC server
        self.cmd_runner = Commands(self.config, None, self.network)
        self.init_server(config, fd)
開發者ID:Matoking,項目名稱:electrum,代碼行數:19,代碼來源:daemon.py

示例5: __init__

# 需要導入模塊: from util import DaemonThread [as 別名]
# 或者: from util.DaemonThread import __init__ [as 別名]
 def __init__(self, config, network):
     DaemonThread.__init__(self)
     self.config = config
     self.network = network
     self.gui = None
     self.wallets = {}
     self.wallet = None
     self.cmd_runner = Commands(self.config, self.wallet, self.network)
     host = config.get('rpchost', 'localhost')
     port = config.get('rpcport', 0)
     self.server = SimpleJSONRPCServer((host, port), requestHandler=RequestHandler, logRequests=False)
     with open(lockfile(config), 'w') as f:
         f.write(repr(self.server.socket.getsockname()))
     self.server.timeout = 0.1
     for cmdname in known_commands:
         self.server.register_function(getattr(self.cmd_runner, cmdname), cmdname)
     self.server.register_function(self.run_cmdline, 'run_cmdline')
     self.server.register_function(self.ping, 'ping')
     self.server.register_function(self.run_daemon, 'daemon')
     self.server.register_function(self.run_gui, 'gui')
開發者ID:bontaq,項目名稱:electrum,代碼行數:22,代碼來源:daemon.py


注:本文中的util.DaemonThread.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。