-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac compability #8
Open
mouuff
wants to merge
37
commits into
master
Choose a base branch
from
mac_compability
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
2aa53f6
It starts on macos, need to work on the desktop entries
peauc 87682be
added app bundle
lokoum d6ebc8c
The solution is now launched via iQuail on OSX
lokoum d35f3db
OSX - Started to work on a proper xml way of writing plist files
peauc ebcbfcd
Merge branch 'master' into mac_compability
lokoum 1af7eb6
Fixed some variables names
lokoum 8d491ee
Merge branch 'mac_compability' of https://github.com/QuailTeam/iQuail…
lokoum 67f9841
Fixed code from the feedback review
lokoum b563fd6
Removed a syntax error
peauc 206afa3
Fix bundle path
lokoum 95c6e94
Merge branch 'mac_compability' of https://github.com/QuailTeam/iQuail…
lokoum 6154eae
Adding a new feature to parse and write xml files for our OSX install.
peauc a19b6c8
Added new tests for our xml feature
peauc 310fe69
Hey we have icons on osx now -> Extra s in resource folder
peauc 7706633
Forgot to commit the file (Couldn't ammend don't know why)
peauc d4c9dae
fixed wrong syntax on class declaration
peauc 2050428
Merging master from mac_compatibility
peauc fee4133
Auto stash before merge of "mac_compability" and "origin/master"
peauc 7d06807
Missing an S to the application's folder
peauc fae2ecc
Fixing some variable name and removing old comments
peauc 0ce224c
Added key/value adding in plcreator
peauc aea3b82
We are now creating valid .plist files
peauc 8532d48
Skipping IOS test on different platforms
peauc aed062d
removed an old file.
peauc 850ec11
Refactored the plist_creator.py file
peauc 96f2edf
Changed the error message when tkinter is not found
peauc b3c39e3
Added a todo
peauc 23e6dfe
Merge branch 'master' into mac_compability
lokoum 73f5bd9
Cleaned the installer OSX file and added local installation
peauc 8c9dd30
Cleaned the installer OSX file and added local installation
peauc 3239bcd
Refactoring
peauc 252a4b0
Made the ios import exclusive to ios
peauc f9a0ebc
Added support for user designed icon on the OSx installation
peauc fc6cae9
Merge branch 'mac_compability' of https://github.com/QuailTeam/iQuail…
lokoum 3332f31
added github full solution handling
peauc 83bd11d
fix bugs about PATH for local binaries, added eexample for PKG with GUI
lokoum 977c7ce
ready for merging with master
lokoum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"maccalc": "bdee4331072ce68954b7aa6d090165bc638474bf9515114a72d5baf86fa415af"} |
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,2 @@ | ||
#!/usr/bin/env bash | ||
open -a calculator && cat |
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,20 @@ | ||
#!/usr/bin/python3 | ||
|
||
import os | ||
import os.path | ||
import iquail | ||
import platform | ||
|
||
if iquail.helper.OS_OSX: | ||
solution_path = ['MacCalc'] | ||
iquail.run( | ||
iquail.SolutionLocal(['MacCalc']), | ||
iquail.Installer( | ||
name='MacCalc', | ||
publisher='test', | ||
icon='icon.jpeg', | ||
binary='maccalc', | ||
console=True, | ||
), | ||
iquail.builder.Builder(iquail.builder.CmdIntegrity(solution_path)) | ||
) |
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
from .controller_base import ControllerBase | ||
from .controller_tkinter import ControllerTkinter | ||
try: | ||
from .controller_tkinter import ControllerTkinter | ||
except: | ||
print("No display found or tkinter missing, console mode enabled !") | ||
from .controller_console import ControllerConsole |
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,2 @@ | ||
from .bundle_template import BundleTemplate | ||
from .plist_template import PlistTemplate |
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,14 @@ | ||
import os | ||
|
||
class BundleTemplate(): | ||
|
||
def __init__(self, CFBundleName): | ||
self.bundle_name = CFBundleName | ||
#TODO refactor name | ||
self.base_dir = "/Applications/" | ||
self.full_path = self.base_dir + self.bundle_name + ".app" | ||
self.names = [self.full_path, self.full_path + "/Contents", self.full_path + "/Contents/MacOS"] | ||
|
||
def make(self): | ||
for path in self.names: | ||
os.mkdir(path) |
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,33 @@ | ||
import xml.etree.ElementTree as ET | ||
|
||
class PlistCreator: | ||
def __init__(self, bundle_name: str, plistDict: dict): | ||
self.__file = open("/applications/" + bundle_name + ".app/contents/info.plist", "a+") | ||
self.__ | ||
peauc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.__plist_dict = { | ||
"CFBundleGetInfoString": bundle_name, | ||
"CFBundleExecutable": 'launcher', | ||
"CFBundleIdentifier": bundle_name, | ||
"CFBundleName": bundle_name | ||
} | ||
self.__plist_header = """ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
""" | ||
self.__plist_dict.update(plistDict) | ||
|
||
def __del__(self): | ||
self.__file.close() | ||
|
||
@property | ||
def plist_dict(self): | ||
return self.__plist_dict | ||
|
||
def write_file(self): | ||
self.__create_header() | ||
|
||
def __create_header(self): | ||
self.__file.write(self.__plist_header) | ||
|
||
|
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,42 @@ | ||
import os | ||
|
||
#TODO : add full PATH to spotlight env to access python3 | ||
class PlistTemplate(): | ||
def __init__(self, CFBundleName, plistDict): | ||
self.file = open("/Applications/" + CFBundleName + ".app/Contents/Info.plist", "a+") | ||
self.plist_dict = dict( | ||
CFBundleGetInfoString=CFBundleName, | ||
CFBundleExecutable='launcher', | ||
CFBundleIdentifier=CFBundleName, | ||
CFBundleName=CFBundleName | ||
) | ||
self.plist_dict.update(plistDict) | ||
|
||
def make(self): | ||
self._createHeader() | ||
for key, value in self.plist_dict.items(): | ||
self._writeProperty(key, value, "string") | ||
self._createFooter() | ||
|
||
def getInfoPlist(self): | ||
return self.plist_dict | ||
|
||
def _createHeader(self): | ||
self.plist_header = """ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
""" | ||
self.file.write(self.plist_header) | ||
|
||
def _createFooter(self): | ||
self.plist_footer = """ | ||
</dict> | ||
</plist> | ||
""" | ||
self.file.write(self.plist_footer) | ||
|
||
def _writeProperty(self, key, value, typeValue): | ||
self.file.write(" <key>" + key + "</key>\n") | ||
self.file.write(" <" + typeValue + ">" + value + "</" + typeValue + ">\n") |
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,52 @@ | ||
from .installer_base import InstallerBase | ||
import os | ||
import stat | ||
import shutil | ||
import pathlib | ||
from ..helper import BundleTemplate, PlistTemplate | ||
|
||
class InstallerOsx(InstallerBase): | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self._bundle_install_path = '/Applications/' + self.name + '.app' | ||
|
||
""" We need to put a syslink into /usr/local/bin or into a local folder inside the user's home directory""" | ||
def _register(self): | ||
bundle = BundleTemplate(self._name) | ||
bundle.make() | ||
plist = PlistTemplate(self._binary_name, {}) | ||
peauc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
plist.make() | ||
self._build_launcher() | ||
#self.__add_to_path(self.binary, self._binary_name) | ||
|
||
def _unregister(self): | ||
self.__remove_from_path(self.binary) | ||
|
||
def _registered(self): | ||
if not os.path.exists(self.build_symlink_path(self.binary)): | ||
return False | ||
|
||
def __add_to_path(self, binary, name): | ||
os.symlink(binary, self.build_symlink_path(name)) | ||
peauc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def __remove_from_path(self, name): | ||
peauc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
shutil.rmtree(self._bundle_install_path) | ||
|
||
def build_symlink_path(self, name): | ||
if self.install_systemwide: | ||
#TODO setup local installation | ||
#final_folder = '/Applications' | ||
final_folder = os.path.join(str(pathlib.Path.home()), '/Applications/' + self._name + '.app/Contents/MacOS/') | ||
peauc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else: | ||
final_folder = os.path.join(str(pathlib.Path.home()), '/Applications/' + self._name + '.app/Contents/MacOS/') | ||
return os.path.join(final_folder, name) | ||
|
||
def _build_launcher(self): | ||
with open(self._bundle_install_path + '/Contents/MacOS/launcher', 'w') as f: | ||
content = '/usr/local/bin/python3 ~/.iquail/' + self.uid + '/iquail_launcher.py' | ||
peauc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
shebang = '#!/bin/bash\n' | ||
f.write(shebang) | ||
f.write(content) | ||
st = os.stat(self._bundle_install_path + '/Contents/MacOS/launcher') | ||
os.chmod(self._bundle_install_path + '/Contents/MacOS/launcher', st.st_mode | stat.S_IEXEC) | ||
peauc marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Le problème c'est que si on importe pas, plus pas il y aura une ref non trouvé, et aussi les args de controller_tkinter sont pas les mêmes que controller console, donc c'est pas vraiment interchangeable pour le moment