mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-01-21 15:03:37 +01:00
added filter for open in satellites dialog
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -285,7 +285,7 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="activate" handler="on_open" object="satellites_editor_tree_view" swapped="no"/>
|
||||
<signal name="activate" handler="on_open" object="satellites_tree_store" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user