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


Python Common.get_pid方法代码示例

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


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

示例1: main

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import get_pid [as 别名]
def main():
    with open(os.path.join(SHARE, 'version')) as buf:
        tor_browser_launcher_version = buf.read().strip()

    print _('Tor Browser Launcher')
    print _('By Micah Lee, licensed under MIT')
    print _('version {0}').format(tor_browser_launcher_version)
    print 'https://github.com/micahflee/torbrowser-launcher'

    common = Common(tor_browser_launcher_version)

    # is torbrowser-launcher already running?
    tbl_pid = common.get_pid(common.paths['tbl_bin'], True)
    if tbl_pid:
        print _('Tor Browser Launcher is already running (pid {0}), bringing to front').format(tbl_pid)
        common.bring_window_to_front(tbl_pid)
        sys.exit()

    if '-settings' in sys.argv:
        # settings mode
        app = Settings(common)

    else:
        # launcher mode
        app = Launcher(common)
开发者ID:isislovecruft,项目名称:torbrowser-launcher,代码行数:27,代码来源:__init__.py

示例2: main

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import get_pid [as 别名]
def main():
    # parse arguments
    parser = argparse.ArgumentParser()
    parser.add_argument('--settings', action='store_true', dest='settings', help='Open Tor Browser Launcher settings')
    parser.add_argument('url', nargs='*', help='URL to load')
    args = parser.parse_args()

    settings = bool(args.settings)
    url_list = args.url

    # load the version and print the banner
    with open(os.path.join(SHARE, 'version')) as buf:
        tor_browser_launcher_version = buf.read().strip()

    print _('Tor Browser Launcher')
    print _('By Micah Lee, licensed under MIT')
    print _('version {0}').format(tor_browser_launcher_version)
    print 'https://github.com/micahflee/torbrowser-launcher'

    common = Common(tor_browser_launcher_version)

    # is torbrowser-launcher already running?
    tbl_pid = common.get_pid(common.paths['tbl_bin'], True)
    if tbl_pid:
        print _('Tor Browser Launcher is already running (pid {0}), bringing to front').format(tbl_pid)
        common.bring_window_to_front(tbl_pid)
        sys.exit()

    if settings:
        # settings mode
        app = Settings(common)

    else:
        # launcher mode
        app = Launcher(common, url_list)
开发者ID:boklm,项目名称:torbrowser-launcher,代码行数:37,代码来源:__init__.py


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