diff --git a/app/eparser/satxml.py b/app/eparser/satxml.py
index 38e42e32..71e03206 100644
--- a/app/eparser/satxml.py
+++ b/app/eparser/satxml.py
@@ -7,8 +7,6 @@ from xml.dom.minidom import parse, Document
from app.eparser.__constants import POLARIZATION, FEC, SYSTEM, MODULATION, PLS_MODE
-__FILE_NAME = "satellites.xml"
-
Satellite = namedtuple("Satellite", ["name", "flags", "position", "transponders"])
Transponder = namedtuple("Transponder", ["frequency", "symbol_rate", "polarization", "fec_inner",
@@ -37,7 +35,7 @@ __COMMENT = (" File was created in DemonEditor\n\n"
def get_satellites(path):
- return parse_satellites(path + "satellites.xml")
+ return parse_satellites(path)
def write_satellites(satellites, data_path):
@@ -71,7 +69,7 @@ def write_satellites(satellites, data_path):
transponder_child.setAttribute("is_id", tr.is_id)
sat_child.appendChild(transponder_child)
root.appendChild(sat_child)
- doc.writexml(open(data_path + __FILE_NAME, "w"),
+ doc.writexml(open(data_path, "w"),
# indent="",
addindent=" ",
newl='\n',
diff --git a/app/ui/satellites_dialog.glade b/app/ui/satellites_dialog.glade
index c4cfb61c..64d1ab5c 100644
--- a/app/ui/satellites_dialog.glade
+++ b/app/ui/satellites_dialog.glade
@@ -285,7 +285,7 @@
False
True
True
-
+
diff --git a/app/ui/satellites_dialog.py b/app/ui/satellites_dialog.py
index 65fdc02c..e3245483 100644
--- a/app/ui/satellites_dialog.py
+++ b/app/ui/satellites_dialog.py
@@ -19,7 +19,7 @@ class SatellitesDialog:
_aggr = [None for x in range(9)] # aggregate
def __init__(self, transient, options):
- self._data_path = options["data_dir_path"]
+ self._data_path = options["data_dir_path"] + "satellites.xml"
self._options = options
handlers = {"on_open": self.on_open,
@@ -73,10 +73,22 @@ class SatellitesDialog:
self.destroy()
def on_open(self, model):
- response = show_dialog(dialog_type=DialogType.CHOOSER, transient=self._dialog, options=self._options)
- if response != Gtk.ResponseType.CANCEL:
- self._data_path = response
- self.on_satellites_list_load(model)
+ file_filter = Gtk.FileFilter()
+ file_filter.add_pattern("satellites.xml")
+ file_filter.set_name("satellites.xml")
+ response = show_dialog(dialog_type=DialogType.CHOOSER,
+ transient=self._dialog,
+ options=self._options,
+ action_type=Gtk.FileChooserAction.OPEN,
+ file_filter=file_filter)
+ if response == Gtk.ResponseType.CANCEL:
+ return
+
+ if not str(response).endswith("satellites.xml"):
+ show_dialog(DialogType.ERROR, self._dialog, text="No satellites.xml file is selected!")
+ return
+ self._data_path = response
+ self.on_satellites_list_load(model)
@staticmethod
def on_row_activated(view, path, column):