Skip to content

Commit

Permalink
[python] settings: get PAPARAZZI_SRC
Browse files Browse the repository at this point in the history
still needs to be cleaned up and converted to proper modules..
  • Loading branch information
flixr committed Feb 18, 2015
1 parent 6706fac commit c24177f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion sw/ground_segment/python/settings_app/settingsapp.py
Expand Up @@ -7,7 +7,9 @@
import getopt
import sys

sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python")
PPRZ_SRC = os.getenv("PAPARAZZI_SRC", os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
'../../../..')))
sys.path.append(PPRZ_SRC + "/sw/lib/python")
import settings_xml_parse

def Usage(scmd):
Expand Down
4 changes: 3 additions & 1 deletion sw/ground_segment/python/settings_app/settingsframe.py
Expand Up @@ -6,7 +6,9 @@
import sys
import os

sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python")
PPRZ_SRC = os.getenv("PAPARAZZI_SRC", os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
'../../../..')))
sys.path.append(PPRZ_SRC + "/sw/lib/python")

from settings_tool import IvySettingsInterface

Expand Down
4 changes: 3 additions & 1 deletion sw/lib/python/settings_tool.py
Expand Up @@ -7,7 +7,9 @@
import logging
import sys

sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python")
PPRZ_SRC = os.getenv("PAPARAZZI_SRC", os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
'../../..')))
sys.path.append(PPRZ_SRC + "/sw/lib/python")
from settings_xml_parse import PaparazziACSettings

_SHOW_IVY_MSGS_ = False
Expand Down
6 changes: 5 additions & 1 deletion sw/lib/python/settings_xml_parse.py
Expand Up @@ -6,6 +6,10 @@
import sys
from lxml import etree

# if PAPARAZZI_HOME not set, then assume the tree containing this
# file is a reasonable substitute
PPRZ_HOME = os.getenv("PAPARAZZI_HOME", os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
'../../..')))
# Class for all settings
class PaparazziACSettings:
"Paparazzi Settings Class"
Expand All @@ -18,7 +22,7 @@ class PaparazziACSettings:

def __init__(self, ac_id):
self.ac_id = ac_id
paparazzi_home = os.getenv("PAPARAZZI_HOME")
paparazzi_home = PPRZ_HOME
paparazzi_conf = os.path.join(paparazzi_home, 'conf')
conf_xml_path = os.path.join(paparazzi_conf, 'conf.xml')
conf_tree = etree.parse(conf_xml_path)
Expand Down

0 comments on commit c24177f

Please sign in to comment.