Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit 4c966e1c authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[gui] Ability to install a desktop file shortcut

parent a7bc33df
......@@ -30,12 +30,53 @@ Created on Nov 2016
..sectionauthor:: Pierre Vignet <pierre.vignet@irisa.fr>
"""
import sys
import os
import pkg_resources
import gtk
from cadbiom_gui.gt_gui.charter import Charter
from cadbiom import commons as cm
def main():
LOGGER = cm.logger()
def build_desktop_shortcut(executable_path):
"""Install a .desktop launcher file in ~/.local/share/applications"""
if sys.platform != "linux2":
LOGGER.error("This option is only supported on GNU/Linux platforms.")
exit(1)
favicon_path = pkg_resources.resource_filename(
__name__, "gt_gui/images/favicon.ico"
)
desktop_content = """[Desktop Entry]
Comment=Cadbiom GUI launcher
Encoding=UTF-8
Exec={}
Icon={}
Categories=Science;
Name=Cadbiom
Type=Application
Terminal=false
""".format(
executable_path, favicon_path
)
desktop_path = "%s/.local/share/applications/" % os.path.expanduser("~")
with open(desktop_path + "Cadbiom.desktop", "w") as f_d:
f_d.write(desktop_content)
LOGGER.info("Desktop file created in <%s>", desktop_path)
exit(0)
def main():
"""Launch Cadbiom gui"""
import gtk
from cadbiom_gui.gt_gui.charter import Charter
if "--install_desktop_shortcut" in sys.argv:
build_desktop_shortcut(sys.argv[0])
charter = Charter(None)
charter.show()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment