예제 #1
0
def get_resources_dir():
    rsc = None
    try:
        import gtkosx_application  #@UnresolvedImport
        try:
            rsc = gtkosx_application.gtkosx_application_get_resource_path()
            if rsc:
                RESOURCES = "/Resources/"
                i = rsc.rfind(RESOURCES)
                if i > 0:
                    rsc = rsc[:i + len(RESOURCES)]
        except:
            #maybe we're not running from an app bundle?
            pass
    except:
        print(
            "ERROR: gtkosx_application module is missing - trying to continue anyway"
        )
    if not rsc:
        from xpra.platform import default_get_app_dir
        rsc = default_get_app_dir()
    if rsc:
        #when we run from a jhbuild installation,
        #~/gtk/inst/bin/xpra is the binary
        #so rsc=~/gtk/inst/bin
        #and we want to find ~/gtk/inst/share with get_icon_dir()
        #so let's try to look for that
        #(there is no /bin/ in the regular application bundle path)
        head, tail = os.path.split(rsc)
        if tail == "bin":
            return head
    return rsc
예제 #2
0
파일: paths.py 프로젝트: svn2github/Xpra
def get_resources_dir():
    rsc = None
    RESOURCES = "/Resources/"
    try:
        import gtkosx_application        #@UnresolvedImport
        try:
            rsc = gtkosx_application.gtkosx_application_get_resource_path()
            debug("get_resources_dir() gtkosx_application_get_resource_path=%s", rsc)
            if rsc:
                i = rsc.rfind(RESOURCES)
                if i<=0:
                    rsc = None
        except:
            #maybe we're not running from an app bundle?
            pass
    except:
        print("ERROR: gtkosx_application module is missing - trying to continue anyway")
    if not rsc:
        from xpra.platform.paths import default_get_app_dir
        rsc = default_get_app_dir()
        debug("get_resources_dir() default_get_app_dir()=%s", rsc)
    i = rsc.rfind(RESOURCES)
    if i>0:
        rsc = rsc[:i+len(RESOURCES)]
    else:
        rsc = None
    debug("get_resources_dir()=%s", rsc)
    return rsc
예제 #3
0
파일: paths.py 프로젝트: Brainiarc7/xpra
def get_resources_dir():
    rsc = None
    try:
        import gtkosx_application        #@UnresolvedImport
        try:
            rsc = gtkosx_application.gtkosx_application_get_resource_path()
            if rsc:
                RESOURCES = "/Resources/"
                i = rsc.rfind(RESOURCES)
                if i>0:
                    rsc = rsc[:i+len(RESOURCES)]
        except:
            #maybe we're not running from an app bundle?
            pass
    except:
        print("ERROR: gtkosx_application module is missing - trying to continue anyway")
    if not rsc:
        from xpra.platform.paths import default_get_app_dir
        rsc = default_get_app_dir()
    if rsc:
        #when we run from a jhbuild installation,
        #~/gtk/inst/bin/xpra is the binary
        #so rsc=~/gtk/inst/bin
        #and we want to find ~/gtk/inst/share with get_icon_dir()
        #so let's try to look for that
        #(there is no /bin/ in the regular application bundle path)
        head, tail = os.path.split(rsc)
        if tail=="bin":
            return head
    return rsc
예제 #4
0
파일: paths.py 프로젝트: ljmljz/xpra
def do_get_resources_dir():
    rsc = None
    RESOURCES = "/Resources/"
    #FUGLY warning: importing gtkosx_application causes the dock to appear,
    #and in some cases we don't want that.. so use the env var XPRA_SKIP_UI as workaround for such cases:
    if os.environ.get("XPRA_SKIP_UI", "0")=="0":
        try:
            import gtkosx_application        #@UnresolvedImport
            try:
                rsc = gtkosx_application.gtkosx_application_get_resource_path()
                debug("get_resources_dir() gtkosx_application_get_resource_path=%s", rsc)
            except:
                #maybe we're not running from an app bundle?
                pass
        except:
            #delayed import to prevent cycles:
            from xpra.log import Logger
            log = Logger("util")
            log.error("ERROR: gtkosx_application module is missing - trying to continue anyway")
    else:
        debug("XPRA_SKIP_UI is set, not importing gtkosx_application")
    if rsc is None:
        #try using the path to this file to find the resource path:
        rsc = __file__
    i = rsc.rfind(RESOURCES)
    if i<=0:
        #last fallback: try the default app dir
        from xpra.platform.paths import default_get_app_dir
        rsc = default_get_app_dir()
        debug("get_resources_dir() default_get_app_dir()=%s", rsc)
    i = rsc.rfind(RESOURCES)
    if i>0:
        rsc = rsc[:i+len(RESOURCES)]
    debug("get_resources_dir()=%s", rsc)
    return rsc
예제 #5
0
파일: paths.py 프로젝트: rudresh2319/Xpra
def get_resources_dir():
    rsc = None
    RESOURCES = "/Resources/"
    try:
        import gtkosx_application  #@UnresolvedImport
        try:
            rsc = gtkosx_application.gtkosx_application_get_resource_path()
            debug(
                "get_resources_dir() gtkosx_application_get_resource_path=%s",
                rsc)
            if rsc:
                i = rsc.rfind(RESOURCES)
                if i <= 0:
                    rsc = None
        except:
            #maybe we're not running from an app bundle?
            pass
    except:
        print(
            "ERROR: gtkosx_application module is missing - trying to continue anyway"
        )
    if not rsc:
        from xpra.platform.paths import default_get_app_dir
        rsc = default_get_app_dir()
        debug("get_resources_dir() default_get_app_dir()=%s", rsc)
    i = rsc.rfind(RESOURCES)
    if i > 0:
        rsc = rsc[:i + len(RESOURCES)]
    else:
        rsc = None
    debug("get_resources_dir()=%s", rsc)
    return rsc
예제 #6
0
파일: paths.py 프로젝트: rudresh2319/Xpra
def do_get_resources_dir():
    rsc = None
    RESOURCES = "/Resources/"
    #FUGLY warning: importing gtkosx_application causes the dock to appear,
    #and in some cases we don't want that.. so use the env var XPRA_SKIP_UI as workaround for such cases:
    if not envbool("XPRA_SKIP_UI", False):
        try:
            import gtkosx_application  #@UnresolvedImport
            try:
                rsc = gtkosx_application.gtkosx_application_get_resource_path()
                debug(
                    "get_resources_dir() gtkosx_application_get_resource_path=%s",
                    rsc)
            except:
                #maybe we're not running from an app bundle?
                pass
        except:
            global _gtkosx_warning_
            if _gtkosx_warning_ is False:
                _gtkosx_warning_ = True
                #delayed import to prevent cycles:
                from xpra.log import Logger
                log = Logger("util")
                log.error(
                    "ERROR: gtkosx_application module is missing - trying to continue anyway"
                )
    else:
        debug("XPRA_SKIP_UI is set, not importing gtkosx_application")
    if rsc is None:
        #try using the path to this file to find the resource path:
        rsc = __file__
    i = rsc.rfind(RESOURCES)
    if i <= 0:
        #last fallback: try the default app dir
        from xpra.platform.paths import default_get_app_dir
        rsc = default_get_app_dir()
        debug("get_resources_dir() default_get_app_dir()=%s", rsc)
    i = rsc.rfind(RESOURCES)
    if i > 0:
        rsc = rsc[:i + len(RESOURCES)]
    debug("get_resources_dir()=%s", rsc)
    return rsc
예제 #7
0
            os.mkdir(appdata)
        log_path = os.path.join(appdata, "Xpra")
        if not os.path.exists(log_path):
            os.mkdir(log_path)
        log_file = os.path.join(log_path, "Xpra.log")
        sys.stdout = open(log_file, "a")
        sys.stderr = sys.stdout
        APP_DIR = os.path.dirname(sys.executable)
        ICONS_DIR = os.path.join(APP_DIR, "icons")
        gpl2_file = os.path.join(APP_DIR, "COPYING")
        load_license(gpl2_file)
elif sys.platform.startswith("darwin"):
    rsc = None
    try:
        import gtkosx_application  #@UnresolvedImport
        rsc = gtkosx_application.gtkosx_application_get_resource_path()
        if rsc:
            RESOURCES = "/Resources/"
            CONTENTS = "/Contents/"
            i = rsc.rfind(RESOURCES)
            if i > 0:
                rsc = rsc[:i + len(RESOURCES)]
            i = rsc.rfind(CONTENTS)
            if i > 0:
                APP_DIR = rsc[:i + len(CONTENTS)]
            ICONS_DIR = os.path.join(rsc, "share", "xpra", "icons")
            gpl2_file = os.path.join(rsc, "share", "xpra", "COPYING")
            load_license(gpl2_file)

        def prepare_window_osx(window):
            def quit_launcher(*args):
예제 #8
0
			os.mkdir(appdata)
		log_path = os.path.join(appdata, "Xpra")
		if not os.path.exists(log_path):
			os.mkdir(log_path)
		log_file = os.path.join(log_path, "Xpra.log")
		sys.stdout = open(log_file, "a")
		sys.stderr = sys.stdout
		APP_DIR = os.path.dirname(sys.executable)
		ICONS_DIR = os.path.join(APP_DIR, "icons")
		gpl2_file = os.path.join(APP_DIR, "COPYING")
		load_license(gpl2_file)
elif sys.platform.startswith("darwin"):
	rsc = None
	try:
		import gtkosx_application		#@UnresolvedImport
		rsc = gtkosx_application.gtkosx_application_get_resource_path()
		if rsc:
			RESOURCES = "/Resources/"
			CONTENTS = "/Contents/"
			i = rsc.rfind(RESOURCES)
			if i>0:
				rsc = rsc[:i+len(RESOURCES)]
			i = rsc.rfind(CONTENTS)
			if i>0:
				APP_DIR = rsc[:i+len(CONTENTS)]
			ICONS_DIR = os.path.join(rsc, "share", "xpra", "icons")
			gpl2_file = os.path.join(rsc, "share", "xpra", "COPYING")
			load_license(gpl2_file)

		def prepare_window_osx(window):
			def quit_launcher(*args):