-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #394 from gaphor/mac-startup-binary
Mac startup binary
- Loading branch information
Showing
9 changed files
with
1,403 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
try: | ||
import gi | ||
|
||
gi.require_version("GtkosxApplication", "1.0") | ||
except ValueError: | ||
macos_init = None | ||
else: | ||
from gi.repository import Gio, GtkosxApplication | ||
|
||
macos_app = GtkosxApplication.Application.get() | ||
|
||
def open_file(macos_app, path, gtk_app): | ||
if path == __file__: | ||
return False | ||
|
||
gtk_app.open([Gio.File.new_for_path(path)], "") | ||
|
||
return True | ||
|
||
def block_termination(macos_app, application): | ||
quit = application.quit() | ||
return not quit | ||
|
||
def macos_init(application, gtk_app): | ||
macos_app.connect("NSApplicationOpenFile", open_file, gtk_app) | ||
macos_app.connect( | ||
"NSApplicationBlockTermination", block_termination, application | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import os | ||
import pathlib | ||
import sys | ||
|
||
PYVER = "3.7" | ||
|
||
resources = os.environ["RESOURCEPATH"] | ||
cache = pathlib.Path.home() / ".cache" / "gaphor" | ||
|
||
print(f"App contents folder is {resources}, cache is {cache}") | ||
|
||
|
||
while sys.path[0] == resources: | ||
del sys.path[0] | ||
|
||
|
||
os.environ["DYLD_LIBRARY_PATH"] = f"{resources}/lib" | ||
os.environ["FONTCONFIG_SYSROOT"] = f"{resources}" | ||
os.environ["GTK_DATA_PREFIX"] = f"{resources}" | ||
os.environ["GI_TYPELIB_PATH"] = f"{resources}/lib/girepository-1.0" | ||
|
||
os.environ["GTK_EXE_PREFIX"] = f"{resources}" | ||
os.environ["GTK_PATH"] = f"{resources}" | ||
os.environ["XDG_DATA_HOME"] = f"{resources}/share" | ||
os.environ["XDG_DATA_DIRS"] = f"{resources}/share" | ||
os.environ["FONTCONFIG_FILE"] = f"{resources}/etc/fonts/fonts.conf" | ||
os.environ["GI_TYPELIB_PATH"] = f"{resources}/lib/girepository-1.0" | ||
|
||
os.environ["GDK_PIXBUF_MODULEDIR"] = f"{resources}/lib/gdk-pixbuf-2.0/2.10.0/loaders" | ||
os.environ["GDK_PIXBUF_MODULE_FILE"] = f"{cache}/gdk-pixbuf-2.0-loaders.cache" | ||
|
||
os.environ["GTK_IM_MODULE_FILE"] = f"{cache}/immodules.cache" | ||
|
||
os.system(f'"{resources}/bin/gdk-pixbuf-query-loaders" --update-cache') | ||
os.system(f'"{resources}/bin/gtk-query-immodules-3.0" --update-cache') | ||
|
||
|
||
from gaphor.ui import main # noqa: E402 | ||
|
||
main(sys.argv) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.