本文整理汇总了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)
示例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)