From f655adbf9085c5e3796e6ce599590a3bc700339b Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Tue, 24 Jan 2012 16:58:49 -0500 Subject: [PATCH] Partially fixed Unity bug (frames display but menu doesnt) --- misc_funcs.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/misc_funcs.py b/misc_funcs.py index 95f7b9f..0f6f60d 100644 --- a/misc_funcs.py +++ b/misc_funcs.py @@ -6,6 +6,9 @@ import svlgui from threading import Event, Thread import math +import subprocess +import re +import os def select_any(self): svlgui.MODE = " " @@ -66,6 +69,21 @@ def box(x, y, width, height, fill): return box +def process_exists(proc_name): + ps = subprocess.Popen("ps ax -o pid= -o args= ", shell=True, stdout=subprocess.PIPE) + ps_pid = ps.pid + output = ps.stdout.read() + ps.stdout.close() + ps.wait() + + for line in output.split("\n"): + res = re.findall("(\d+) (.*)", line) + if res: + pid = int(res[0][0]) + if proc_name in res[0][1] and pid != os.getpid() and pid != ps_pid: + return True + return False + def lastval(arr,index): for i in reversed(arr[:index]): if i: