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


Python Terminal.blink方法代码示例

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


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

示例1: start

# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import blink [as 别名]
    def start(self):
        path = self.generate()
        web.path = path
        if web.payloads is not None:
            if self.dbms:
                if self.dbms == 'Mongo':
                    cmd = "run -id -p {0}:80 -v {1}:{2}:rw -v {3}:/etc/php5/fpm/php.ini:ro -v {4}:/usr/lib/php5/modules/mongodb.so:ro --link {5}:{6} --name VW --workdir {2} {7} ".format(
                        self.expose, web.path, self.mount_point, os.path.join(web.path, 'php.ini'), os.path.join(web.path, 'mongodb.so'), web.container_name, self.dbms.lower(), self.image)
                else:
                    cmd = "run -id -p {0}:80 -v {1}:{2} -v {3}:/etc/php5/fpm/php.ini --link {4}:{5} --name VW --workdir {2} {6} ".format(
                        self.expose, web.path, self.mount_point, os.path.join(web.path, 'php.ini'), web.container_name, self.dbms.lower(), self.image)
                if self.command:
                    cmd = cmd + self.command
                web.dAgent.send(cmd)
            else:
                cmd = "run -id -p {0}:80 -v {1}:{2}:rw -v {3}:/etc/php5/fpm/php.ini:ro --name VW --workdir {2} {4} ".format(
                    self.expose, web.path, self.mount_point, os.path.join(web.path, 'php.ini'), self.image)
                if self.command:
                    cmd = cmd + self.command
                web.dAgent.send(cmd)
            web.ctr = web.dAgent.recv()

            if "cmd" in web.payloads:
                Logger.logInfo(
                    "[INFO] " + "CMD: {0}".format(web.payloads['cmd']))
                web.dAgent.send(
                    "exec {0} -- {1}".format(web.ctr, web.payloads['cmd']))
            if "warning" in web.payloads:
                for warning in web.payloads['warning']:
                    Logger.logWarning("[WARNING] " + warning)
            if "error" in web.payloads:
                for error in web.payloads['error']:
                    Logger.logError("[ERROR] " + error)

            url = ['http', '127.0.0.1:{0}'.format(
                self.expose), '/', '', '', '']
            params = {}

            if web.payloads['key'] is not None:
                for index, _ in enumerate(web.payloads['key']):
                    if re.search("page", web.payloads['key'][index], flags=re.IGNORECASE):
                        web.payloads['value'][index] = "index"
                    params.update({'{0}'.format(web.payloads['key'][index]): '{0}'.format(
                        web.payloads['value'][index])})

            query = params

            url[4] = urlencode(query)

            t = Terminal()
            with t.location(0, t.height - 1):
                Logger.logSuccess(
                    t.center(t.blink("Browse: {0}".format(urlparse.urlunparse(url)))))

            web.dAgent.send("logs {0} -f".format(web.ctr))
开发者ID:qazbnm456,项目名称:VWGen,代码行数:57,代码来源:VWGen.py

示例2: start

# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import blink [as 别名]
    def start(self):
        path = self.generate()
        web.path = path
        if web.payloads is not None:
            web.ctr = web.dAgent.startContainer(image='{0}'.format(self.image), ports=[80], volumes=['{0}'.format(self.mount_point), '/etc/php5/fpm/php.ini'],
                                                      host_config=web.dAgent.createHostConfig(
                port_bindings={
                    80: self.expose
                },
                binds=self.bindsOperation(),
                links={'{0}'.format(web.container_name): '{0}'.format(
                    self.dbms.lower())} if self.dbms is not None else None
            ), name='VW')

            if "cmd" in web.payloads:
                Logger.logInfo(
                    "[INFO] " + "CMD: cd {0} && {1}".format(self.mount_point, web.payloads['cmd']))
                web.dAgent.execute(web.ctr, web.payloads[
                                   'cmd'], self.mount_point)

            if "warning" in web.payloads:
                for warning in web.payloads['warning']:
                    Logger.logWarning("[WARNING] " + warning)
            if "error" in web.payloads:
                for error in web.payloads['error']:
                    Logger.logError("[ERROR] " + error)

            url = ['http', '{0}:{1}'.format(
                web.dAgent.host, self.expose), '/', '', '', '']
            params = {}

            if web.payloads['key'] is not None:
                for index, _ in enumerate(web.payloads['key']):
                    if re.search("page", web.payloads['key'][index], flags=re.IGNORECASE):
                        web.payloads['value'][index] = "index"
                    params.update({'{0}'.format(web.payloads['key'][index]): '{0}'.format(
                        web.payloads['value'][index])})

            query = params

            url[4] = urlencode(query)

            t = Terminal()
            with t.location(0, t.height - 1):
                Logger.logSuccess(
                    t.center(t.blink("Browse: {0}".format(urlparse.urlunparse(url)))))

            web.dAgent.logs(web.ctr)
开发者ID:MahaKoala,项目名称:VWGen,代码行数:50,代码来源:VWGen.py


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