"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ffmulticonverter/presets_dlgs.py" between
ffmulticonverter-1.7.2.tar.gz and ffmulticonverter-1.8.0.tar.gz

About: FF Multi Converter is a graphical application which enables you to convert audio, video, image and document files between all popular formats, using and combining other programs.

presets_dlgs.py  (ffmulticonverter-1.7.2):presets_dlgs.py  (ffmulticonverter-1.8.0)
# Copyright (C) 2011-2015 Ilias Stamatis <stamatis.iliass@gmail.com> # Copyright (C) 2011-2016 Ilias Stamatis <stamatis.iliass@gmail.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os import os
import re import re
import time import time
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
from PyQt4.QtCore import Qt, QTimer from PyQt5.QtCore import Qt, QTimer
from PyQt4.QtGui import ( from PyQt5.QtWidgets import (
QDialog, QDialogButtonBox, QFileDialog, QLabel, QLineEdit, QListWidget, QDialog, QDialogButtonBox, QFileDialog, QLabel, QLineEdit, QListWidget,
QMessageBox, QPushButton, QShortcut, QSizePolicy, QSpacerItem QMessageBox, QPushButton, QShortcut, QSizePolicy, QSpacerItem
) )
from ffmulticonverter import utils from ffmulticonverter import utils
from ffmulticonverter import config from ffmulticonverter import config
class ShowPresets(QDialog): class ShowPresets(QDialog):
def __init__(self, parent=None, choose=False): def __init__(self, parent=None, choose=False):
super(ShowPresets, self).__init__(parent) super(ShowPresets, self).__init__(parent)
skipping to change at line 252 skipping to change at line 252
except: except:
pass pass
def import_presets(self): def import_presets(self):
"""Import an xml tree.""" """Import an xml tree."""
title = 'FF Multi Converter - Import' title = 'FF Multi Converter - Import'
reply = QMessageBox.question(self, title, self.tr('All current ' reply = QMessageBox.question(self, title, self.tr('All current '
'presets will be deleted.\nAre you sure that you want to ' 'presets will be deleted.\nAre you sure that you want to '
'continue?'), QMessageBox.Yes|QMessageBox.Cancel) 'continue?'), QMessageBox.Yes|QMessageBox.Cancel)
if reply == QMessageBox.Yes: if reply == QMessageBox.Yes:
fname = QFileDialog.getOpenFileName(self, title) fname = QFileDialog.getOpenFileName(self, title, config.home)[0]
if fname: if fname:
msg = self.tr('Successful import!') msg = self.tr('Successful import!')
try: try:
self.tree = etree.parse(fname) self.tree = etree.parse(fname)
except: except:
msg = self.tr('Import failed!') msg = self.tr('Import failed!')
else: else:
self.root = self.tree.getroot() self.root = self.tree.getroot()
self.save_tree() self.save_tree()
QMessageBox.information(self, title, msg) QMessageBox.information(self, title, msg)
def export_presets(self): def export_presets(self):
"""Export the xml tree.""" """Export the xml tree."""
fname = QFileDialog.getSaveFileName( fname = QFileDialog.getSaveFileName(
self, 'FF Multi Converter - ' + self.tr('Export presets'), self, 'FF Multi Converter - ' + self.tr('Export presets'),
config.home + '/presets-' + time.strftime("%Y-%m-%d") + '.xml') config.home + '/presets-' + time.strftime("%Y-%m-%d") + '.xml'
)[0]
if fname: if fname:
self.load_xml() self.load_xml()
with open(fname, 'wb') as _file: with open(fname, 'wb') as _file:
try: try:
etree.ElementTree(self.root).write(_file) etree.ElementTree(self.root).write(_file)
except: except:
pass pass
def reset(self): def reset(self):
"""Import the default xml tree.""" """Import the default xml tree."""
 End of changes. 4 change blocks. 
5 lines changed or deleted 6 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS