Esempio n. 1
0
def save_tlp_config(self, filenamepointer, tlpconfig, window):
    changedproperties = get_changed_properties(tlpconfig)

    dialog = Gtk.MessageDialog()
    dialog.set_default_size(150, 100)
    dialog.connect('key-press-event', close_window)

    if len(changedproperties) == 0:
        dialog.format_secondary_markup('<b>' + T_('No changes') + '</b>')
    else:
        infotext = '<b>' + T_('Changed values') + ':</b>\n'
        for property in changedproperties:
            infotext += '<small>' + property[0] + ' -> ' + property[
                2] + '</small>\n'

        dialog.format_secondary_markup(infotext.rstrip())
        filename = filenamepointer()
        try:
            write_tlp_file_config(changedproperties, filename)
            # reload config after file save
            load_tlp_config(self, filenamepointer, window)
        except PermissionError as error:
            dialog.format_secondary_markup(repr(error))

    dialog.run()
    dialog.destroy()
Esempio n. 2
0
def save_tlp_config(self, filenamepointer, tlpconfig, window):
    changedproperties = get_changed_properties(tlpconfig)

    dialog = Gtk.MessageDialog()
    dialog.set_default_size(150, 100)
    dialog.connect('key-press-event', close_window)

    if len(changedproperties) == 0:
        dialog.format_secondary_markup('<b>' + T_('No changes') + '</b>')
    else:
        infotext = '<b>' + T_('Changed values') + ':</b>\n'
        for property in changedproperties:
            infotext += '<small>' + property[0] + ' -> ' + property[2] + '</small>\n'

        dialog.format_secondary_markup(infotext.rstrip())
        filename = filenamepointer()
        try:
            write_tlp_file_config(changedproperties, filename)
            # reload config after file save
            load_tlp_config(self, filenamepointer, window)
        except PermissionError as error:
            dialog.format_secondary_markup(repr(error))

    dialog.run()
    dialog.destroy()
Esempio n. 3
0
def save_tlp_config(self, window):
    changedproperties = get_changed_properties(settings.tlpconfig,
                                               settings.tlpconfig_original)

    dialog = Gtk.MessageDialog(window)
    dialog.set_default_size(150, 100)

    if len(changedproperties) == 0:
        dialog.format_secondary_markup('<b>' + language.MT_('No changes') +
                                       '</b>')
    else:
        infotext = '<b>' + language.MT_('Changed values') + ':</b>\n'
        for property in changedproperties:
            infotext += '<small>' + property[0] + ' -> ' + property[
                2] + '</small>\n'

        dialog.format_secondary_markup(infotext.rstrip())
        try:
            write_tlp_file_config(changedproperties, settings.tlpconfigfile)
            # reload config after file save
            load_tlp_config(self, window, True)
        except PermissionError as error:
            dialog.format_secondary_markup(repr(error))

    dialog.run()
    dialog.destroy()