Commit 01aa1332 authored by Daniel Garcia Moreno's avatar Daniel Garcia Moreno

Use FileChooserNative instead of FileChooserDialog

Fix #11
parent 815dea75
Pipeline #70390 passed with stage
in 47 seconds
......@@ -30,10 +30,9 @@ class ExportDialog(Gtk.Dialog):
detailed = False
patterns = {
'TXT': '.txt',
'CSV': '.csv',
}
'TXT': '.txt',
'CSV': '.csv',
}
def __init__(self, db, main_window, *args, **kwargs):
self.db = db
......@@ -131,14 +130,12 @@ class ExportDialog(Gtk.Dialog):
self.run()
self.close()
def open_file_dialog(self, _):
save_dialog = Gtk.FileChooserDialog(title="Export To",
parent=self,
action=Gtk.FileChooserAction.SAVE,
buttons=(Gtk.STOCK_CANCEL,
Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE,
Gtk.ResponseType.ACCEPT))
def open_file_dialog(self, _button):
save_dialog = Gtk.FileChooserNative.new(_("Export To"),
self,
Gtk.FileChooserAction.SAVE,
_("_Save"),
_("_Cancel"))
save_dialog.set_do_overwrite_confirmation(True)
save_dialog.set_modal(True)
......@@ -148,10 +145,11 @@ class ExportDialog(Gtk.Dialog):
self.detailed = self.detailed_switch.get_state()
file_types = Gtk.FileFilter()
file_types.set_name(self.file_type)
file_types.add_pattern('*' + self.patterns[self.file_type])
save_dialog.add_filter(file_types)
save_dialog.show()
save_dialog.run()
def file_dialog_callback(self, save_dialog, response_id):
if response_id == Gtk.ResponseType.ACCEPT:
......@@ -163,8 +161,6 @@ class ExportDialog(Gtk.Dialog):
self.write_file(write_fns[self.file_type])
save_dialog.destroy()
def seconds_to_time(self, seconds):
m = seconds // 60
s = seconds % 60
......
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