From 49d9041bf76b4cde97e5ec2ae5f1fb1c614d83ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Sat, 20 Jan 2007 17:59:45 +0100 Subject: [PATCH] New tagger script parser, new plugin system, options page with plugin list. --- picard/plugin.py | 96 ++++++ picard/script.py | 415 +++++++++++++++++++++++++ picard/tagger.py | 52 +--- picard/tagz.py | 353 --------------------- picard/ui/options/__init__.py | 1 + picard/ui/options/plugins.py | 67 ++++ picard/ui/ui_options_about.py | 74 ++--- picard/ui/ui_options_cdlookup.py | 100 +++--- picard/ui/ui_options_cdlookup_win32.py | 118 +++---- picard/ui/ui_options_cover.py | 4 +- picard/ui/ui_options_general.py | 204 ++++++------ picard/ui/ui_options_matching.py | 5 +- picard/ui/ui_options_naming.py | 8 +- picard/ui/ui_options_plugins.py | 63 ++++ picard/ui/ui_options_proxy.py | 174 +++++------ picard/ui/ui_options_script.py | 106 +++---- picard/ui/ui_options_tags.py | 218 ++++++------- test/test_asf.py | 52 ---- test/test_compatid3.py | 2 +- test/{test_tagz.py => test_script.py} | 0 ui/options_about.ui | 4 +- ui/options_cdlookup.ui | 8 +- ui/options_cdlookup_win32.ui | 8 +- ui/options_general.ui | 4 +- ui/options_matching.ui | 2 +- ui/options_naming.ui | 8 +- ui/options_plugins.ui | 86 +++++ ui/options_proxy.ui | 6 +- ui/options_script.ui | 4 +- ui/options_tags.ui | 4 +- 30 files changed, 1261 insertions(+), 985 deletions(-) create mode 100644 picard/plugin.py create mode 100644 picard/script.py delete mode 100644 picard/tagz.py create mode 100644 picard/ui/options/plugins.py create mode 100644 picard/ui/ui_options_plugins.py delete mode 100644 test/test_asf.py rename test/{test_tagz.py => test_script.py} (100%) create mode 100644 ui/options_plugins.ui diff --git a/picard/plugin.py b/picard/plugin.py new file mode 100644 index 000000000..a3740b312 --- /dev/null +++ b/picard/plugin.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# Copyright (C) 2007 Lukáš Lalinský +# +# 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 the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +from PyQt4 import QtCore +import imp +import os.path +import picard.plugins + +class PluginWrapper(object): + + def __init__(self, module): + self.module = module + + def __get_name(self): + try: + return self.module.PLUGIN_NAME + except AttributeError: + return self.module.name + name = property(__get_name) + + def __get_author(self): + try: + return self.module.PLUGIN_AUTHOR + except AttributeError: + return "" + author = property(__get_author) + + def __get_description(self): + try: + return self.module.PLUGIN_DESCRIPTION + except AttributeError: + return "" + description = property(__get_description) + + def __get_file(self): + return self.module.__file__ + file = property(__get_file) + + +class PluginManager(QtCore.QObject): + + def __init__(self): + self.plugins = [] + + def load(self, plugindir): + if not os.path.isdir(plugindir): + self.log.info("Plugin directory '%s' doesn't exist", plugindir) + return + + names = set() + suffixes = [s[0] for s in imp.get_suffixes()] + package_entries = ["__init__.py", "__init__.pyc", "__init__.pyo"] + for name in os.listdir(plugindir): + path = os.path.join(plugindir, name) + if os.path.isdir(path): + for entry in package_entries: + if os.path.isfile(os.path.join(path, entry)): + break + else: + continue + else: + name, suffix = os.path.splitext(name) + if suffix not in suffixes: + continue + if hasattr(picard.plugins, name): + self.log.info("Plugin %s already loaded!", name) + else: + names.add(name) + + for name in names: + self.log.debug("Loading plugin %s", name) + info = imp.find_module(name, [plugindir]) + try: + plugin = imp.load_module('picard.plugins.' + name, *info) + setattr(picard.plugins, name, plugin) + self.plugins.append(PluginWrapper(plugin)) + finally: + if info[0] is not None: + info[0].close() + diff --git a/picard/script.py b/picard/script.py new file mode 100644 index 000000000..e80efb8cf --- /dev/null +++ b/picard/script.py @@ -0,0 +1,415 @@ +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# Copyright (C) 2006-2007 Lukáš Lalinský +# +# 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 the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class ScriptError(Exception): pass +class ParseError(ScriptError): pass +class EndOfFile(ParseError): pass +class SyntaxError(ParseError): pass +class UnknownFunction(ScriptError): pass + +class ScriptText(unicode): + + def eval(self, state): + return self + + +class ScriptVariable(object): + + def __init__(self, name): + self.name = name + + def __repr__(self): + return '' % self.name + + def eval(self, state): + return state.context.get(self.name, u"") + + +class ScriptFunction(object): + + def __init__(self, name, args): + self.name = name + self.args = args + + def __repr__(self): + return "" % (self.name, self.args) + + def eval(self, state): + try: + return state.functions[self.name](state, *self.args) + except KeyError: + raise UnknownFunction("Unknown function '%s'" % self.name) + + +class ScriptExpression(list): + + def eval(self, state): + result = [] + for item in self: + result.append(item.eval(state)) + return "".join(result) + + +def isidentif(ch): + return ch.isalnum() or ch == '_' + + +class ExtensionPoint(object): + + def __init__(self): + self.__items = [] + + def register(self, item): + self.__items.append(item) + + def __iter__(self): + for item in self.__items: + yield item + + +class ScriptParser(object): + """Tagger script parser. + +Grammar: + text ::= [^$%] | '\$' | '\%' | '\(' | '\)' | '\,' + argtext ::= [^$%(),] | '\$' | '\%' | '\(' | '\)' | '\,' + identifier ::= [a-zA-Z0-9_] + variable ::= '%' identifier '%' + function ::= '$' identifier '(' (argument (',' argument)*)? ')' + expression ::= (variable | function | text)* + argument ::= (variable | function | argtext)* +""" + + _function_registry = ExtensionPoint() + _cache = {} + + def __raise_eof(self): + raise EndOfFile("Unexpected end of file at position %d, line %d" % (self._x, self._y)) + + def __raise_char(self, ch): + raise SyntaxError("Unexpected character %r at position %d, line %d" % (ch, self._x, self._y)) + + def read(self): + try: + ch = self._text[self._pos] + except IndexError: + return None + else: + self._pos += 1 + self._px = self._x + self._py = self._y + if ch == '\n': + self._x = 1 + self._y += 1 + else: + self._x += 1 + return ch + + def unread(self): + self._pos -= 1 + self._x = self._px + self._y = self._py + + def parse_arguments(self): + results = [] + while True: + result, ch = self.parse_expression(False) + results.append(result) + if ch == ')': + return results + + def parse_function(self): + start = self._pos + while True: + ch = self.read() + if ch == '(': + name = self._text[start:self._pos-1] + return ScriptFunction(name, self.parse_arguments()) + elif ch is None: + self.__raise_eof() + elif not isidentif(ch): + self.__raise_char(ch) + + def parse_variable(self): + begin = self._pos + while True: + ch = self.read() + if ch == '%': + return ScriptVariable(self._text[begin:self._pos-1]) + elif ch is None: + self.__raise_eof() + elif not isidentif(ch): + self.__raise_char(ch) + + def parse_text(self, top): + begin = self._pos - 1 + while True: + ch = self.read() + if ch == '\\': + ch = self.read() + if ch not in '$%(),\\': + self.__raise_char(ch) + elif ch is None: + return ScriptText(self._text[begin:self._pos]) + elif ch in '$%' or (not top and ch in ',()'): + self.unread() + return ScriptText(self._text[begin:self._pos]) + + def parse_expression(self, top): + tokens = ScriptExpression() + while True: + ch = self.read() + if ch is None: + if top: + break + else: + self.__raise_eof() + elif not top and ch in ',)': + break + elif ch == '$': + tokens.append(self.parse_function()) + elif ch == '%': + tokens.append(self.parse_variable()) + else: + tokens.append(self.parse_text(top)) + return (tokens, ch) + + def parse(self, script): + """Parse the script.""" + self._text = script + self._pos = 0 + self._px = self._x = 1 + self._py = self._y = 1 + return self.parse_expression(True)[0] + + def eval(self, script, context): + """Parse and evaluate the script.""" + self.context = context + for name, function in ScriptParser._function_registry: + self.functions[name] = function + key = hash(script) + if key not in ScriptParser.__cache: + ScriptParser.__cache[key] = self.parse(script) + return ScriptParser.__cache[key].eval(self) + + +def register_script_function(function, name=None): + if name is None: + name = function.__name__ + ScriptParser._function_registry.register((name, function)) + + +def func_if(parser, *args): + """If ``if`` is not empty, it returns ``then``, otherwise it returns + ``else``.""" + if args[0]: + return args[1] + if len(args) == 3: + return args[2] + return '' + +def func_if2(parser, *args): + """Returns first non empty argument.""" + for arg in args: + if arg: + return arg + return args[-1] + +def func_noop(parser, *args): + """Does nothing :)""" + return "".join(args) + +def func_left(parser, text, length): + """Returns first ``num`` characters from ``text``.""" + return text[:int(length)] + +def func_right(parser, text, length): + """Returns last ``num`` characters from ``text``.""" + return text[-int(length):] + +def func_lower(parser, text): + """Returns ``text`` in lower case.""" + return text.lower() + +def func_upper(parser, text): + """Returns ``text`` in upper case.""" + return text.upper() + +def func_pad(parser, text, length, char): + return char * (int(length) - len(text)) + text + +def func_strip(parser, text): + return re.sub("\s+", " ", text).strip() + +def func_replace(parser, text, old, new): + return text.replace(old, new) + +def func_rreplace(parser, text, old, new): + return re.sub(old, new, text) + +def func_rsearch(parser, text, pattern): + match = re.search(pattern, text) + if match: + return match.group(1) + return u"" + +def func_num(parser, text, length): + format = "%%0%dd" % int(length) + try: + value = int(text) + except ValueError: + value = 0 + return format % value + +def func_unset(parser, name): + """Unsets the variable ``name``.""" + del parser.context[name] + return "" + +def func_set(parser, name, value): + """Sets the variable ``name`` to ``value``.""" + parser.context[name] = value + return "" + +def func_get(parser, name): + """Returns the variable ``name`` (equivalent to ``%name%``).""" + return parser.context.get(name, "") + +def func_trim(parser, text, char=None): + """Trims all leading and trailing whitespaces from ``text``. The optional + second parameter specifies the character to trim.""" + if char: + return text.strip(char) + else: + return text.strip() + +def func_add(parser, x, y): + """Add ``y`` to ``x``.""" + return str(int(x) + int(y)) + +def func_sub(parser, x, y): + """Substracts ``y`` from ``x``.""" + return str(int(x) - int(y)) + +def func_div(parser, x, y): + """Divides ``x`` by ``y``.""" + return str(int(x) / int(y)) + +def func_mod(parser, x, y): + """Returns the remainder of ``x`` divided by ``y``.""" + return str(int(x) % int(y)) + +def func_mul(parser, x, y): + """Multiplies ``x`` by ``y``.""" + return str(int(x) * int(y)) + +def func_or(parser, x, y): + """Returns true, if either ``x`` or ``y`` not empty.""" + if x or y: + return "1" + else: + return "" + +def func_and(parser, x, y): + """Returns true, if both ``x`` and ``y`` are not empty.""" + if x and y: + return "1" + else: + return "" + +def func_not(parser, x): + """Returns true, if ``x`` is empty.""" + if not x: + return "1" + else: + return "" + +def func_eq(parser, x, y): + """Returns true, if ``x`` equals ``y``.""" + if x == y: + return "1" + else: + return "" + +def func_ne(parser, x, y): + """Returns true, if ``x`` not equals ``y``.""" + if x != y: + return "1" + else: + return "" + +def func_lt(parser, x, y): + """Returns true, if ``x`` is lower than ``y``.""" + if x < y: + return "1" + else: + return "" + +def func_lte(parser, x, y): + """Returns true, if ``x`` is lower than or equals ``y``.""" + if x <= y: + return "1" + else: + return "" + +def func_gt(parser, x, y): + """Returns true, if ``x`` is greater than ``y``.""" + if x > y: + return "1" + else: + return "" + +def func_gte(parser, x, y): + """Returns true, if ``x`` is greater than or equals ``y``.""" + if x >= y: + return "1" + else: + return "" + +register_script_function(func_if, "if") +register_script_function(func_if2, "if2") +register_script_function(func_noop, "noop") +register_script_function(func_left, "left") +register_script_function(func_right, "right") +register_script_function(func_lower, "lower") +register_script_function(func_upper, "upper") +register_script_function(func_pad, "pad") +register_script_function(func_strip, "strip") +register_script_function(func_replace, "replace") +register_script_function(func_rreplace, "rreplace") +register_script_function(func_rsearch, "rsearch") +register_script_function(func_num, "num") +register_script_function(func_unset, "unset") +register_script_function(func_set, "set") +register_script_function(func_get, "get") +register_script_function(func_trim, "trim") +register_script_function(func_add, "add") +register_script_function(func_sub, "sub") +register_script_function(func_div, "div") +register_script_function(func_mod, "mod") +register_script_function(func_mul, "mul") +register_script_function(func_or, "or") +register_script_function(func_and, "and") +register_script_function(func_not, "not") +register_script_function(func_eq, "eq") +register_script_function(func_ne, "ne") +register_script_function(func_lt, "lt") +register_script_function(func_lte, "lte") +register_script_function(func_gt, "gt") +register_script_function(func_gte, "gte") diff --git a/picard/tagger.py b/picard/tagger.py index f9bdc18b2..7e243e8c8 100644 --- a/picard/tagger.py +++ b/picard/tagger.py @@ -37,9 +37,8 @@ __builtin__.__dict__['N_'] = lambda a: a import picard.resources import picard.plugins -import picard.formats -import picard.tagz +import picard.formats from picard import musicdns from picard.album import Album from picard.api import IFileOpener, ITaggerScript @@ -51,7 +50,9 @@ from picard.config import Config from picard.file import File from picard.metadata import Metadata from picard.track import Track +from picard.script import ScriptParser from picard.ui.mainwindow import MainWindow +from picard.plugin import PluginManager from picard.puidmanager import PUIDManager from picard.util import ( decode_filename, @@ -123,10 +124,12 @@ class Tagger(QtGui.QApplication, ComponentManager, Component): self._analyze_thread = self.thread_assist.allocate() self.thread_assist.spawn(self._ofa.init, thread=self._analyze_thread) - self.__load_plugins(os.path.join(os.path.dirname(sys.argv[0]), "plugins")) - self.__load_plugins(self.plugins_dir) + self.pluginmanager = PluginManager() + self.pluginmanager.load(os.path.join(os.path.dirname(sys.argv[0]), "plugins")) + self.pluginmanager.load(self.plugins_dir) self.puidmanager = PUIDManager() + self.scriptparser = ScriptParser() self.__files_to_be_moved = [] @@ -223,42 +226,6 @@ class Tagger(QtGui.QApplication, ComponentManager, Component): def __clear_status_bar_message(self): self.window.clear_status_bar_message() - def __load_plugins(self, plugin_dir): - """Load plugins from the specified directory.""" - if not os.path.isdir(plugin_dir): - self.log.info("Plugin directory '%s' doesn't exist", plugin_dir) - return - - plugin_names = set() - suffixes = [s[0] for s in imp.get_suffixes()] - package_entries = ["__init__.py", "__init__.pyc", "__init__.pyo"] - for name in os.listdir(plugin_dir): - path = os.path.join(plugin_dir, name) - if os.path.isdir(path): - for entry in package_entries: - if os.path.isfile(os.path.join(path, entry)): - break - else: - continue - else: - name, suffix = os.path.splitext(name) - if suffix not in suffixes: - continue - if hasattr(picard.plugins, name): - self.log.info("Plugin %s already loaded!", name) - else: - plugin_names.add(name) - - for name in plugin_names: - self.log.debug("Loading plugin %s", name) - info = imp.find_module(name, [plugin_dir]) - try: - plugin = imp.load_module('picard.plugins.' + name, *info) - setattr(picard.plugins, name, plugin) - finally: - if info[0] is not None: - info[0].close() - def get_supported_formats(self): """Returns list of supported formats. @@ -715,10 +682,7 @@ class Tagger(QtGui.QApplication, ComponentManager, Component): def evaluate_script(self, script, context={}): """Evaluate the script and return the result.""" - if not self.scripting: - raise Exception, "No tagger script interpreter." - - return self.scripting[0].evaluate_script(script, context) + return self.scriptparser.eval(script, context) def get_web_service(self, cached=True, **kwargs): if "host" not in kwargs: diff --git a/picard/tagz.py b/picard/tagz.py deleted file mode 100644 index c1bf406fd..000000000 --- a/picard/tagz.py +++ /dev/null @@ -1,353 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Picard, the next-generation MusicBrainz tagger -# Copyright (C) 2006 Lukáš Lalinský -# -# 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 the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -"""Tagger script parser and evaluator.""" - -import re -try: - from re import Scanner -except ImportError: - from sre import Scanner -from picard.component import Component, ExtensionPoint, Interface, implements -from picard.api import ITaggerScript - - -_re_text = r"(?:\\.|[^%$])+" -_re_text2 = r"(?:\\.|[^%$,])+" -_re_args_sep = "," -_re_name = "\w+" -_re_var = r"%" + _re_name + r"%" -_re_func_args = no_parens = r"(?:\\.|[^()])*" -for i in range(10): # 10 levels must be enough for everybody ;) - _re_func_args = r"(\(" + _re_func_args + r"\)|" + no_parens + r")*" -_re_func = r"\$" + _re_name + r"\(" + _re_func_args + r"\)" - - -def func_if(context, *args): - """If ``if`` is not empty, it returns ``then``, otherwise it returns - ``else``.""" - if args[0]: - return args[1] - if len(args) == 3: - return args[2] - return '' - -def func_if2(context, *args): - """Returns first non empty argument.""" - for arg in args: - if arg: - return arg - return args[-1] - -def func_noop(context, *args): - """Does nothing :)""" - return "".join(args) - -def func_left(context, text, length): - """Returns first ``num`` characters from ``text``.""" - return text[:int(length)] - -def func_right(context, text, length): - """Returns last ``num`` characters from ``text``.""" - return text[-int(length):] - -def func_lower(context, text): - """Returns ``text`` in lower case.""" - return text.lower() - -def func_upper(context, text): - """Returns ``text`` in upper case.""" - return text.upper() - -def func_pad(context, text, length, char): - return char * (int(length) - len(text)) + text - -def func_strip(context, text): - return re.sub("\s+", " ", text).strip() - -def func_replace(context, text, old, new): - return text.replace(old, new) - -def func_rreplace(context, text, old, new): - return re.sub(old, new, text) - -def func_rsearch(context, text, pattern): - match = re.search(pattern, text) - if match: - return match.group(1) - return u"" - -def func_num(context, text, length): - format = "%%0%dd" % int(length) - try: - value = int(text) - except ValueError: - value = 0 - return format % value - -def func_unset(context, name): - """Unsets the variable ``name``.""" - del context[name] - return "" - -def func_set(context, name, value): - """Sets the variable ``name`` to ``value``.""" - context[name] = value - return "" - -def func_get(context, name): - """Returns the variable ``name`` (equivalent to ``%name%``).""" - return context.get(name, "") - -def func_trim(context, text, char=None): - """Trims all leading and trailing whitespaces from ``text``. The optional - second parameter specifies the character to trim.""" - if char: - return text.strip(char) - else: - return text.strip() - -def func_add(context, x, y): - """Add ``y`` to ``x``.""" - return str(int(x) + int(y)) - -def func_sub(context, x, y): - """Substracts ``y`` from ``x``.""" - return str(int(x) - int(y)) - -def func_div(context, x, y): - """Divides ``x`` by ``y``.""" - return str(int(x) / int(y)) - -def func_mod(context, x, y): - """Returns the remainder of ``x`` divided by ``y``.""" - return str(int(x) % int(y)) - -def func_mul(context, x, y): - """Multiplies ``x`` by ``y``.""" - return str(int(x) * int(y)) - -def func_or(context, x, y): - """Returns true, if either ``x`` or ``y`` not empty.""" - if x or y: - return "1" - else: - return "" - -def func_and(context, x, y): - """Returns true, if both ``x`` and ``y`` are not empty.""" - if x and y: - return "1" - else: - return "" - -def func_not(context, x): - """Returns true, if ``x`` is empty.""" - if not x: - return "1" - else: - return "" - -def func_eq(context, x, y): - """Returns true, if ``x`` equals ``y``.""" - if x == y: - return "1" - else: - return "" - -def func_ne(context, x, y): - """Returns true, if ``x`` not equals ``y``.""" - if x != y: - return "1" - else: - return "" - -def func_lt(context, x, y): - """Returns true, if ``x`` is lower than ``y``.""" - if x < y: - return "1" - else: - return "" - -def func_lte(context, x, y): - """Returns true, if ``x`` is lower than or equals ``y``.""" - if x <= y: - return "1" - else: - return "" - -def func_gt(context, x, y): - """Returns true, if ``x`` is greater than ``y``.""" - if x > y: - return "1" - else: - return "" - -def func_gte(context, x, y): - """Returns true, if ``x`` is greater than or equals ``y``.""" - if x >= y: - return "1" - else: - return "" - -class TagzError(Exception): - pass - - -class TagzParseError(TagzError): - pass - - -class TagzUnknownFunction(TagzError): - pass - - -class ITagzFunctionProvider(Interface): - pass - - -class TagzBuiltins(Component): - - implements(ITagzFunctionProvider) - - _functions = { - "noop": func_noop, - "if": func_if, - "if2": func_if2, - "eq": func_eq, - "ne": func_ne, - "lt": func_lt, - "lte": func_lte, - "gt": func_gt, - "gte": func_gte, - - "left": func_left, - "right": func_right, - "lower": func_lower, - "upper": func_upper, - "pad": func_pad, - "strip": func_strip, - "replace": func_replace, - "rreplace": func_rreplace, - "rsearch": func_rsearch, - "num": func_num, - - "unset": func_unset, - "set": func_set, - "get": func_get, - - "add": func_add, - "sub": func_sub, - "div": func_div, - "mod": func_mod, - "mul": func_mul, - - "or": func_or, - "and": func_and, - "not": func_not, - } - - def get_functions(self): - return self._functions - - -class TagzParser(object): - """Tagger script implementation similar to Foobar2000's titleformat.""" - - def __init__(self, context, functions): - self.context = context - self.functions = functions - - def evaluate(self, text): - """Parse and evaluate the script from ``text``.""" - scanner = Scanner([(_re_text, self.s_text), - (_re_var, self.s_variable), - (_re_func, self.s_func)]) - res = scanner.scan(text) - if res[1]: - raise TagzParseError() - return "".join(res[0]) - - def s_text(self, scanner, string): - string = string.replace("\\(", "(") - string = string.replace("\\)", ")") - string = string.replace("\\\\", "\\") - string = string.replace("\\,", ",") - return string - - def s_variable(self, scanner, string): - try: - return self.context[string[1:-1].lower()] - except KeyError: - return "" - - def s_args_sep(self, scanner, string): - return "\0" - - def s_func(self, scanner, string): - args_begin = string.find("(") - name = string[1:args_begin] - args = string[args_begin+1:-1] - - scanner = Scanner([(_re_args_sep, self.s_args_sep), - (_re_text2, self.s_text), - (_re_var, self.s_variable), - (_re_func, self.s_func)]) - results, error = scanner.scan(args) - if error: - raise TagzParseError(string.rfind(error)) - - args = [] - if results: - if results[0] == "\0": - results.insert(0, "") - if results[-1] == "\0": - results.append("") - while results: - j = 1 - for res in results: - if res == "\0": - break - j += 1 - args.append("".join(results[:j-1])) - results = results[j:] - - try: - return self.functions[name](self.context, *args) - except KeyError: - raise TagzUnknownFunction, "Unknown function $%s" % name - - -class Tagz(Component): - - implements(ITaggerScript) - - function_providers = ExtensionPoint(ITagzFunctionProvider) - - def __init__(self): - self.functions = {} - for prov in self.function_providers: - self.functions.update(prov.get_functions()) - - def evaluate_script(self, text, context={}): - """Parse and evaluate the script from ``text``.""" - parser = TagzParser(context, self.functions) - return parser.evaluate(text) - - diff --git a/picard/ui/options/__init__.py b/picard/ui/options/__init__.py index ab620eafe..cd6f06964 100644 --- a/picard/ui/options/__init__.py +++ b/picard/ui/options/__init__.py @@ -32,6 +32,7 @@ from picard.ui.options import ( matching, metadata, naming, + plugins, proxy, scripting, tags, diff --git a/picard/ui/options/plugins.py b/picard/ui/options/plugins.py new file mode 100644 index 000000000..a1de632a9 --- /dev/null +++ b/picard/ui/options/plugins.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# Copyright (C) 2007 Lukáš Lalinský +# +# 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 the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +from PyQt4 import QtCore, QtGui +from picard.api import IOptionsPage +from picard.component import Component, implements +from picard.ui.ui_options_plugins import Ui_PluginsPage + +class PluginsOptionsPage(Component): + + implements(IOptionsPage) + + def get_page_info(self): + return _(u"Plugins"), "plugins", None, 50 + + def get_page_widget(self, parent=None): + self.widget = QtGui.QWidget(parent) + self.ui = Ui_PluginsPage() + self.ui.setupUi(self.widget) + self.connect(self.ui.plugins, QtCore.SIGNAL("itemSelectionChanged()"), self.change_details) + return self.widget + + def load_options(self): + self.items = {} + firstitem = None + for plugin in self.tagger.pluginmanager.plugins: + item = QtGui.QTreeWidgetItem(self.ui.plugins) + item.setText(0, plugin.name) + item.setText(1, plugin.author) + if not firstitem: + firstitem = item + self.items[item] = plugin + self.ui.plugins.setCurrentItem(firstitem) + + def save_options(self): + pass + + def change_details(self): + plugin = self.items[self.ui.plugins.selectedItems()[0]] + text = [] + name = plugin.name + if name: + text.append("" + _("Name") + ": " + name) + author = plugin.author + if author: + text.append("" + _("Author") + ": " + author) + text.append("" + _("File") + ": " + plugin.file) + descr = plugin.description + if descr: + text.append(descr) + self.ui.details.setText("
\n".join(text)) diff --git a/picard/ui/ui_options_about.py b/picard/ui/ui_options_about.py index 05d9cd22c..25b0c3eba 100644 --- a/picard/ui/ui_options_about.py +++ b/picard/ui/ui_options_about.py @@ -1,37 +1,37 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'ui\options_about.ui' -# -# Created: Sat Oct 21 15:40:37 2006 -# by: PyQt4 UI code generator 4-snapshot-20061015 -# -# WARNING! All changes made in this file will be lost! - -import sys -from PyQt4 import QtCore, QtGui - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(QtCore.QSize(QtCore.QRect(0,0,427,426).size()).expandedTo(Form.minimumSizeHint())) - - self.vboxlayout = QtGui.QVBoxLayout(Form) - self.vboxlayout.setMargin(9) - self.vboxlayout.setSpacing(6) - self.vboxlayout.setObjectName("vboxlayout") - - self.label = QtGui.QLabel(Form) - self.label.setAlignment(QtCore.Qt.AlignCenter) - self.label.setWordWrap(True) - self.label.setObjectName("label") - self.vboxlayout.addWidget(self.label) - - spacerItem = QtGui.QSpacerItem(20,51,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) - self.vboxlayout.addItem(spacerItem) - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - - def retranslateUi(self, Form): - pass - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'ui/options_about.ui' +# +# Created: Sat Jan 20 17:45:24 2007 +# by: PyQt4 UI code generator 4.1 +# +# WARNING! All changes made in this file will be lost! + +import sys +from PyQt4 import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(QtCore.QSize(QtCore.QRect(0,0,171,137).size()).expandedTo(Form.minimumSizeHint())) + + self.vboxlayout = QtGui.QVBoxLayout(Form) + self.vboxlayout.setMargin(9) + self.vboxlayout.setSpacing(6) + self.vboxlayout.setObjectName("vboxlayout") + + self.label = QtGui.QLabel(Form) + self.label.setAlignment(QtCore.Qt.AlignCenter) + self.label.setWordWrap(True) + self.label.setObjectName("label") + self.vboxlayout.addWidget(self.label) + + spacerItem = QtGui.QSpacerItem(20,51,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) + self.vboxlayout.addItem(spacerItem) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + pass + diff --git a/picard/ui/ui_options_cdlookup.py b/picard/ui/ui_options_cdlookup.py index bf3727437..a5a866728 100644 --- a/picard/ui/ui_options_cdlookup.py +++ b/picard/ui/ui_options_cdlookup.py @@ -1,50 +1,50 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'ui\options_cdlookup.ui' -# -# Created: Sat Sep 30 21:29:55 2006 -# by: PyQt4 UI code generator 4.0 -# E:\projects\picard-qt\setup.py build_ui -# -# WARNING! All changes made in this file will be lost! - -import sys -from PyQt4 import QtCore, QtGui - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(QtCore.QSize(QtCore.QRect(0,0,285,211).size()).expandedTo(Form.minimumSizeHint())) - - self.vboxlayout = QtGui.QVBoxLayout(Form) - self.vboxlayout.setMargin(9) - self.vboxlayout.setSpacing(6) - self.vboxlayout.setObjectName("vboxlayout") - - self.rename_files = QtGui.QGroupBox(Form) - self.rename_files.setObjectName("rename_files") - - self.gridlayout = QtGui.QGridLayout(self.rename_files) - self.gridlayout.setMargin(9) - self.gridlayout.setSpacing(2) - self.gridlayout.setObjectName("gridlayout") - - self.cd_lookup_device = QtGui.QLineEdit(self.rename_files) - self.cd_lookup_device.setObjectName("cd_lookup_device") - self.gridlayout.addWidget(self.cd_lookup_device,1,0,1,1) - - self.label_3 = QtGui.QLabel(self.rename_files) - self.label_3.setObjectName("label_3") - self.gridlayout.addWidget(self.label_3,0,0,1,1) - self.vboxlayout.addWidget(self.rename_files) - - spacerItem = QtGui.QSpacerItem(161,81,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) - self.vboxlayout.addItem(spacerItem) - self.label_3.setBuddy(self.cd_lookup_device) - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - - def retranslateUi(self, Form): - self.rename_files.setTitle(_("CD Lookup")) - self.label_3.setText(_("CD-ROM device to use for lookups:")) +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'ui/options_cdlookup.ui' +# +# Created: Sat Jan 20 17:45:24 2007 +# by: PyQt4 UI code generator 4.1 +# +# WARNING! All changes made in this file will be lost! + +import sys +from PyQt4 import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(QtCore.QSize(QtCore.QRect(0,0,224,176).size()).expandedTo(Form.minimumSizeHint())) + + self.vboxlayout = QtGui.QVBoxLayout(Form) + self.vboxlayout.setMargin(9) + self.vboxlayout.setSpacing(6) + self.vboxlayout.setObjectName("vboxlayout") + + self.rename_files = QtGui.QGroupBox(Form) + self.rename_files.setObjectName("rename_files") + + self.gridlayout = QtGui.QGridLayout(self.rename_files) + self.gridlayout.setMargin(9) + self.gridlayout.setSpacing(2) + self.gridlayout.setObjectName("gridlayout") + + self.cd_lookup_device = QtGui.QLineEdit(self.rename_files) + self.cd_lookup_device.setObjectName("cd_lookup_device") + self.gridlayout.addWidget(self.cd_lookup_device,1,0,1,1) + + self.label_3 = QtGui.QLabel(self.rename_files) + self.label_3.setObjectName("label_3") + self.gridlayout.addWidget(self.label_3,0,0,1,1) + self.vboxlayout.addWidget(self.rename_files) + + spacerItem = QtGui.QSpacerItem(161,81,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) + self.vboxlayout.addItem(spacerItem) + self.label_3.setBuddy(self.cd_lookup_device) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + self.rename_files.setTitle(_(u"CD Lookup")) + self.label_3.setText(_(u"CD-ROM device to use for lookups:")) + diff --git a/picard/ui/ui_options_cdlookup_win32.py b/picard/ui/ui_options_cdlookup_win32.py index 3ed93acf0..5ab8eef77 100644 --- a/picard/ui/ui_options_cdlookup_win32.py +++ b/picard/ui/ui_options_cdlookup_win32.py @@ -1,59 +1,59 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'ui\options_cdlookup_win32.ui' -# -# Created: Sat Sep 30 21:29:55 2006 -# by: PyQt4 UI code generator 4.0 -# E:\projects\picard-qt\setup.py build_ui -# -# WARNING! All changes made in this file will be lost! - -import sys -from PyQt4 import QtCore, QtGui - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(QtCore.QSize(QtCore.QRect(0,0,324,217).size()).expandedTo(Form.minimumSizeHint())) - - self.vboxlayout = QtGui.QVBoxLayout(Form) - self.vboxlayout.setMargin(9) - self.vboxlayout.setSpacing(6) - self.vboxlayout.setObjectName("vboxlayout") - - self.rename_files = QtGui.QGroupBox(Form) - self.rename_files.setObjectName("rename_files") - - self.gridlayout = QtGui.QGridLayout(self.rename_files) - self.gridlayout.setMargin(9) - self.gridlayout.setSpacing(2) - self.gridlayout.setObjectName("gridlayout") - - self.cd_lookup_ = QtGui.QLabel(self.rename_files) - self.cd_lookup_.setObjectName("cd_lookup_") - self.gridlayout.addWidget(self.cd_lookup_,0,0,1,1) - - self.hboxlayout = QtGui.QHBoxLayout() - self.hboxlayout.setMargin(0) - self.hboxlayout.setSpacing(6) - self.hboxlayout.setObjectName("hboxlayout") - - self.cd_lookup_device = QtGui.QComboBox(self.rename_files) - self.cd_lookup_device.setObjectName("cd_lookup_device") - self.hboxlayout.addWidget(self.cd_lookup_device) - - spacerItem = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.hboxlayout.addItem(spacerItem) - self.gridlayout.addLayout(self.hboxlayout,1,0,1,1) - self.vboxlayout.addWidget(self.rename_files) - - spacerItem1 = QtGui.QSpacerItem(161,81,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) - self.vboxlayout.addItem(spacerItem1) - self.cd_lookup_.setBuddy(self.cd_lookup_device) - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - - def retranslateUi(self, Form): - self.rename_files.setTitle(_("CD Lookup")) - self.cd_lookup_.setText(_("CD-ROM drive to use for lookups:")) +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'ui/options_cdlookup_win32.ui' +# +# Created: Sat Jan 20 17:45:24 2007 +# by: PyQt4 UI code generator 4.1 +# +# WARNING! All changes made in this file will be lost! + +import sys +from PyQt4 import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(QtCore.QSize(QtCore.QRect(0,0,217,155).size()).expandedTo(Form.minimumSizeHint())) + + self.vboxlayout = QtGui.QVBoxLayout(Form) + self.vboxlayout.setMargin(9) + self.vboxlayout.setSpacing(6) + self.vboxlayout.setObjectName("vboxlayout") + + self.rename_files = QtGui.QGroupBox(Form) + self.rename_files.setObjectName("rename_files") + + self.gridlayout = QtGui.QGridLayout(self.rename_files) + self.gridlayout.setMargin(9) + self.gridlayout.setSpacing(2) + self.gridlayout.setObjectName("gridlayout") + + self.cd_lookup_ = QtGui.QLabel(self.rename_files) + self.cd_lookup_.setObjectName("cd_lookup_") + self.gridlayout.addWidget(self.cd_lookup_,0,0,1,1) + + self.hboxlayout = QtGui.QHBoxLayout() + self.hboxlayout.setMargin(0) + self.hboxlayout.setSpacing(6) + self.hboxlayout.setObjectName("hboxlayout") + + self.cd_lookup_device = QtGui.QComboBox(self.rename_files) + self.cd_lookup_device.setObjectName("cd_lookup_device") + self.hboxlayout.addWidget(self.cd_lookup_device) + + spacerItem = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout.addItem(spacerItem) + self.gridlayout.addLayout(self.hboxlayout,1,0,1,1) + self.vboxlayout.addWidget(self.rename_files) + + spacerItem1 = QtGui.QSpacerItem(161,81,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) + self.vboxlayout.addItem(spacerItem1) + self.cd_lookup_.setBuddy(self.cd_lookup_device) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + self.rename_files.setTitle(_(u"CD Lookup")) + self.cd_lookup_.setText(_(u"CD-ROM drive to use for lookups:")) + diff --git a/picard/ui/ui_options_cover.py b/picard/ui/ui_options_cover.py index 31908637c..d8762407b 100644 --- a/picard/ui/ui_options_cover.py +++ b/picard/ui/ui_options_cover.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'ui/options_cover.ui' # -# Created: Sat Nov 11 12:48:02 2006 -# by: PyQt4 UI code generator 4.0.1 +# Created: Sat Jan 20 17:45:24 2007 +# by: PyQt4 UI code generator 4.1 # # WARNING! All changes made in this file will be lost! diff --git a/picard/ui/ui_options_general.py b/picard/ui/ui_options_general.py index 11ba00723..7612420b3 100644 --- a/picard/ui/ui_options_general.py +++ b/picard/ui/ui_options_general.py @@ -1,102 +1,102 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'ui\options_general.ui' -# -# Created: Mon Oct 23 14:07:34 2006 -# by: PyQt4 UI code generator 4-snapshot-20061015 -# -# WARNING! All changes made in this file will be lost! - -import sys -from PyQt4 import QtCore, QtGui - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(QtCore.QSize(QtCore.QRect(0,0,400,300).size()).expandedTo(Form.minimumSizeHint())) - - self.vboxlayout = QtGui.QVBoxLayout(Form) - self.vboxlayout.setMargin(9) - self.vboxlayout.setSpacing(6) - self.vboxlayout.setObjectName("vboxlayout") - - self.groupBox = QtGui.QGroupBox(Form) - self.groupBox.setObjectName("groupBox") - - self.gridlayout = QtGui.QGridLayout(self.groupBox) - self.gridlayout.setMargin(9) - self.gridlayout.setSpacing(2) - self.gridlayout.setObjectName("gridlayout") - - self.server_host = QtGui.QComboBox(self.groupBox) - - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(7),QtGui.QSizePolicy.Policy(0)) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.server_host.sizePolicy().hasHeightForWidth()) - self.server_host.setSizePolicy(sizePolicy) - self.server_host.setEditable(True) - self.server_host.setObjectName("server_host") - self.gridlayout.addWidget(self.server_host,1,0,1,1) - - self.label_7 = QtGui.QLabel(self.groupBox) - self.label_7.setObjectName("label_7") - self.gridlayout.addWidget(self.label_7,0,1,1,1) - - self.server_port = QtGui.QSpinBox(self.groupBox) - self.server_port.setMaximum(65535) - self.server_port.setMinimum(1) - self.server_port.setProperty("value",QtCore.QVariant(80)) - self.server_port.setObjectName("server_port") - self.gridlayout.addWidget(self.server_port,1,1,1,1) - - self.label = QtGui.QLabel(self.groupBox) - self.label.setObjectName("label") - self.gridlayout.addWidget(self.label,0,0,1,1) - self.vboxlayout.addWidget(self.groupBox) - - self.rename_files_2 = QtGui.QGroupBox(Form) - self.rename_files_2.setObjectName("rename_files_2") - - self.gridlayout1 = QtGui.QGridLayout(self.rename_files_2) - self.gridlayout1.setMargin(9) - self.gridlayout1.setSpacing(2) - self.gridlayout1.setObjectName("gridlayout1") - - self.username = QtGui.QLineEdit(self.rename_files_2) - self.username.setObjectName("username") - self.gridlayout1.addWidget(self.username,1,0,1,1) - - self.label_5 = QtGui.QLabel(self.rename_files_2) - self.label_5.setObjectName("label_5") - self.gridlayout1.addWidget(self.label_5,2,0,1,1) - - self.password = QtGui.QLineEdit(self.rename_files_2) - self.password.setEchoMode(QtGui.QLineEdit.Password) - self.password.setObjectName("password") - self.gridlayout1.addWidget(self.password,3,0,1,1) - - self.label_6 = QtGui.QLabel(self.rename_files_2) - self.label_6.setObjectName("label_6") - self.gridlayout1.addWidget(self.label_6,0,0,1,1) - self.vboxlayout.addWidget(self.rename_files_2) - - spacerItem = QtGui.QSpacerItem(201,92,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) - self.vboxlayout.addItem(spacerItem) - self.label_5.setBuddy(self.password) - self.label_6.setBuddy(self.username) - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - Form.setTabOrder(self.server_host,self.server_port) - Form.setTabOrder(self.server_port,self.username) - Form.setTabOrder(self.username,self.password) - - def retranslateUi(self, Form): - self.groupBox.setTitle(_(u"MusicBrainz Server")) - self.label_7.setText(_(u"Port:")) - self.label.setText(_(u"Server address:")) - self.rename_files_2.setTitle(_(u"Account Information")) - self.label_5.setText(_(u"Password:")) - self.label_6.setText(_(u"Username:")) - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'ui/options_general.ui' +# +# Created: Sat Jan 20 17:45:24 2007 +# by: PyQt4 UI code generator 4.1 +# +# WARNING! All changes made in this file will be lost! + +import sys +from PyQt4 import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(QtCore.QSize(QtCore.QRect(0,0,232,275).size()).expandedTo(Form.minimumSizeHint())) + + self.vboxlayout = QtGui.QVBoxLayout(Form) + self.vboxlayout.setMargin(9) + self.vboxlayout.setSpacing(6) + self.vboxlayout.setObjectName("vboxlayout") + + self.groupBox = QtGui.QGroupBox(Form) + self.groupBox.setObjectName("groupBox") + + self.gridlayout = QtGui.QGridLayout(self.groupBox) + self.gridlayout.setMargin(9) + self.gridlayout.setSpacing(2) + self.gridlayout.setObjectName("gridlayout") + + self.server_host = QtGui.QComboBox(self.groupBox) + + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(7),QtGui.QSizePolicy.Policy(0)) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.server_host.sizePolicy().hasHeightForWidth()) + self.server_host.setSizePolicy(sizePolicy) + self.server_host.setEditable(True) + self.server_host.setObjectName("server_host") + self.gridlayout.addWidget(self.server_host,1,0,1,1) + + self.label_7 = QtGui.QLabel(self.groupBox) + self.label_7.setObjectName("label_7") + self.gridlayout.addWidget(self.label_7,0,1,1,1) + + self.server_port = QtGui.QSpinBox(self.groupBox) + self.server_port.setMaximum(65535) + self.server_port.setMinimum(1) + self.server_port.setProperty("value",QtCore.QVariant(80)) + self.server_port.setObjectName("server_port") + self.gridlayout.addWidget(self.server_port,1,1,1,1) + + self.label = QtGui.QLabel(self.groupBox) + self.label.setObjectName("label") + self.gridlayout.addWidget(self.label,0,0,1,1) + self.vboxlayout.addWidget(self.groupBox) + + self.rename_files_2 = QtGui.QGroupBox(Form) + self.rename_files_2.setObjectName("rename_files_2") + + self.gridlayout1 = QtGui.QGridLayout(self.rename_files_2) + self.gridlayout1.setMargin(9) + self.gridlayout1.setSpacing(2) + self.gridlayout1.setObjectName("gridlayout1") + + self.username = QtGui.QLineEdit(self.rename_files_2) + self.username.setObjectName("username") + self.gridlayout1.addWidget(self.username,1,0,1,1) + + self.label_5 = QtGui.QLabel(self.rename_files_2) + self.label_5.setObjectName("label_5") + self.gridlayout1.addWidget(self.label_5,2,0,1,1) + + self.password = QtGui.QLineEdit(self.rename_files_2) + self.password.setEchoMode(QtGui.QLineEdit.Password) + self.password.setObjectName("password") + self.gridlayout1.addWidget(self.password,3,0,1,1) + + self.label_6 = QtGui.QLabel(self.rename_files_2) + self.label_6.setObjectName("label_6") + self.gridlayout1.addWidget(self.label_6,0,0,1,1) + self.vboxlayout.addWidget(self.rename_files_2) + + spacerItem = QtGui.QSpacerItem(201,92,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) + self.vboxlayout.addItem(spacerItem) + self.label_5.setBuddy(self.password) + self.label_6.setBuddy(self.username) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + Form.setTabOrder(self.server_host,self.server_port) + Form.setTabOrder(self.server_port,self.username) + Form.setTabOrder(self.username,self.password) + + def retranslateUi(self, Form): + self.groupBox.setTitle(_(u"MusicBrainz Server")) + self.label_7.setText(_(u"Port:")) + self.label.setText(_(u"Server address:")) + self.rename_files_2.setTitle(_(u"Account Information")) + self.label_5.setText(_(u"Password:")) + self.label_6.setText(_(u"Username:")) + diff --git a/picard/ui/ui_options_matching.py b/picard/ui/ui_options_matching.py index 2d180e074..7e266f959 100644 --- a/picard/ui/ui_options_matching.py +++ b/picard/ui/ui_options_matching.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'ui/options_matching.ui' # -# Created: Sat Dec 16 23:40:23 2006 +# Created: Sat Jan 20 17:45:24 2007 # by: PyQt4 UI code generator 4.1 # # WARNING! All changes made in this file will be lost! @@ -13,7 +13,7 @@ from PyQt4 import QtCore, QtGui class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") - Form.resize(QtCore.QSize(QtCore.QRect(0,0,340,313).size()).expandedTo(Form.minimumSizeHint())) + Form.resize(QtCore.QSize(QtCore.QRect(0,0,328,313).size()).expandedTo(Form.minimumSizeHint())) self.vboxlayout = QtGui.QVBoxLayout(Form) self.vboxlayout.setMargin(9) @@ -112,3 +112,4 @@ class Ui_Form(object): self.label_5.setText(_(u"Minimal similarity for cluster lookups:")) self.label_3.setText(_(u"Minimal similarity for PUID lookups:")) self.puid_lookup_threshold.setSuffix(_(u" %")) + diff --git a/picard/ui/ui_options_naming.py b/picard/ui/ui_options_naming.py index b270e46ab..bc2b7254b 100644 --- a/picard/ui/ui_options_naming.py +++ b/picard/ui/ui_options_naming.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'ui/options_naming.ui' # -# Created: Sat Nov 11 15:24:58 2006 -# by: PyQt4 UI code generator 4.0.1 +# Created: Sat Jan 20 17:45:24 2007 +# by: PyQt4 UI code generator 4.1 # # WARNING! All changes made in this file will be lost! @@ -13,7 +13,7 @@ from PyQt4 import QtCore, QtGui class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") - Form.resize(QtCore.QSize(QtCore.QRect(0,0,401,426).size()).expandedTo(Form.minimumSizeHint())) + Form.resize(QtCore.QSize(QtCore.QRect(0,0,284,388).size()).expandedTo(Form.minimumSizeHint())) self.vboxlayout = QtGui.QVBoxLayout(Form) self.vboxlayout.setMargin(9) @@ -92,7 +92,7 @@ class Ui_Form(object): self.gridlayout1.addWidget(self.label_2,0,0,1,3) self.vboxlayout.addWidget(self.move_files) - spacerItem = QtGui.QSpacerItem(383,51,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) + spacerItem = QtGui.QSpacerItem(111,76,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout.addItem(spacerItem) self.label_4.setBuddy(self.va_file_naming_format) self.label_3.setBuddy(self.file_naming_format) diff --git a/picard/ui/ui_options_plugins.py b/picard/ui/ui_options_plugins.py new file mode 100644 index 000000000..01f652bd6 --- /dev/null +++ b/picard/ui/ui_options_plugins.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'ui/options_plugins.ui' +# +# Created: Sat Jan 20 17:45:24 2007 +# by: PyQt4 UI code generator 4.1 +# +# WARNING! All changes made in this file will be lost! + +import sys +from PyQt4 import QtCore, QtGui + +class Ui_PluginsPage(object): + def setupUi(self, PluginsPage): + PluginsPage.setObjectName("PluginsPage") + PluginsPage.resize(QtCore.QSize(QtCore.QRect(0,0,265,297).size()).expandedTo(PluginsPage.minimumSizeHint())) + + self.vboxlayout = QtGui.QVBoxLayout(PluginsPage) + self.vboxlayout.setMargin(9) + self.vboxlayout.setSpacing(6) + self.vboxlayout.setObjectName("vboxlayout") + + self.splitter = QtGui.QSplitter(PluginsPage) + self.splitter.setOrientation(QtCore.Qt.Vertical) + self.splitter.setObjectName("splitter") + + self.groupBox_2 = QtGui.QGroupBox(self.splitter) + self.groupBox_2.setObjectName("groupBox_2") + + self.vboxlayout1 = QtGui.QVBoxLayout(self.groupBox_2) + self.vboxlayout1.setMargin(9) + self.vboxlayout1.setSpacing(6) + self.vboxlayout1.setObjectName("vboxlayout1") + + self.plugins = QtGui.QTreeWidget(self.groupBox_2) + self.plugins.setRootIsDecorated(False) + self.plugins.setObjectName("plugins") + self.vboxlayout1.addWidget(self.plugins) + + self.groupBox = QtGui.QGroupBox(self.splitter) + self.groupBox.setObjectName("groupBox") + + self.vboxlayout2 = QtGui.QVBoxLayout(self.groupBox) + self.vboxlayout2.setMargin(9) + self.vboxlayout2.setSpacing(6) + self.vboxlayout2.setObjectName("vboxlayout2") + + self.details = QtGui.QLabel(self.groupBox) + self.details.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.details.setWordWrap(True) + self.details.setObjectName("details") + self.vboxlayout2.addWidget(self.details) + self.vboxlayout.addWidget(self.splitter) + + self.retranslateUi(PluginsPage) + QtCore.QMetaObject.connectSlotsByName(PluginsPage) + + def retranslateUi(self, PluginsPage): + self.groupBox_2.setTitle(_(u"Plugins")) + self.plugins.headerItem().setText(0,_(u"Name")) + self.plugins.headerItem().setText(1,_(u"Author")) + self.groupBox.setTitle(_(u"Details")) + diff --git a/picard/ui/ui_options_proxy.py b/picard/ui/ui_options_proxy.py index 139160710..c85d07825 100644 --- a/picard/ui/ui_options_proxy.py +++ b/picard/ui/ui_options_proxy.py @@ -1,87 +1,87 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'ui\options_proxy.ui' -# -# Created: Sun Oct 08 11:21:09 2006 -# by: PyQt4 UI code generator 4.0 -# E:\projects\picard-qt\setup.py build_ui -# -# WARNING! All changes made in this file will be lost! - -import sys -from PyQt4 import QtCore, QtGui - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(QtCore.QSize(QtCore.QRect(0,0,339,252).size()).expandedTo(Form.minimumSizeHint())) - - self.vboxlayout = QtGui.QVBoxLayout(Form) - self.vboxlayout.setMargin(9) - self.vboxlayout.setSpacing(6) - self.vboxlayout.setObjectName("vboxlayout") - - self.web_proxy = QtGui.QGroupBox(Form) - self.web_proxy.setCheckable(True) - self.web_proxy.setObjectName("web_proxy") - - self.gridlayout = QtGui.QGridLayout(self.web_proxy) - self.gridlayout.setMargin(9) - self.gridlayout.setSpacing(2) - self.gridlayout.setObjectName("gridlayout") - - self.password = QtGui.QLineEdit(self.web_proxy) - self.password.setEchoMode(QtGui.QLineEdit.Password) - self.password.setObjectName("password") - self.gridlayout.addWidget(self.password,5,0,1,2) - - self.username = QtGui.QLineEdit(self.web_proxy) - self.username.setObjectName("username") - self.gridlayout.addWidget(self.username,3,0,1,2) - - self.label_5 = QtGui.QLabel(self.web_proxy) - self.label_5.setObjectName("label_5") - self.gridlayout.addWidget(self.label_5,4,0,1,2) - - self.label_6 = QtGui.QLabel(self.web_proxy) - self.label_6.setObjectName("label_6") - self.gridlayout.addWidget(self.label_6,2,0,1,2) - - self.server_host = QtGui.QLineEdit(self.web_proxy) - self.server_host.setObjectName("server_host") - self.gridlayout.addWidget(self.server_host,1,0,1,1) - - self.label_7 = QtGui.QLabel(self.web_proxy) - self.label_7.setObjectName("label_7") - self.gridlayout.addWidget(self.label_7,0,1,1,1) - - self.server_port = QtGui.QSpinBox(self.web_proxy) - self.server_port.setMaximum(65535) - self.server_port.setMinimum(1) - self.server_port.setProperty("value",QtCore.QVariant(80)) - self.server_port.setObjectName("server_port") - self.gridlayout.addWidget(self.server_port,1,1,1,1) - - self.label = QtGui.QLabel(self.web_proxy) - self.label.setObjectName("label") - self.gridlayout.addWidget(self.label,0,0,1,1) - self.vboxlayout.addWidget(self.web_proxy) - - spacerItem = QtGui.QSpacerItem(101,31,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) - self.vboxlayout.addItem(spacerItem) - self.label_5.setBuddy(self.password) - self.label_6.setBuddy(self.username) - self.label.setBuddy(self.server_host) - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - Form.setTabOrder(self.server_host,self.server_port) - Form.setTabOrder(self.server_port,self.username) - Form.setTabOrder(self.username,self.password) - - def retranslateUi(self, Form): - self.web_proxy.setTitle(_("Web Proxy")) - self.label_5.setText(_("Password:")) - self.label_6.setText(_("Username:")) - self.label_7.setText(_("Port:")) - self.label.setText(_("Server address:")) +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'ui/options_proxy.ui' +# +# Created: Sat Jan 20 17:45:24 2007 +# by: PyQt4 UI code generator 4.1 +# +# WARNING! All changes made in this file will be lost! + +import sys +from PyQt4 import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(QtCore.QSize(QtCore.QRect(0,0,233,252).size()).expandedTo(Form.minimumSizeHint())) + + self.vboxlayout = QtGui.QVBoxLayout(Form) + self.vboxlayout.setMargin(9) + self.vboxlayout.setSpacing(6) + self.vboxlayout.setObjectName("vboxlayout") + + self.web_proxy = QtGui.QGroupBox(Form) + self.web_proxy.setCheckable(True) + self.web_proxy.setObjectName("web_proxy") + + self.gridlayout = QtGui.QGridLayout(self.web_proxy) + self.gridlayout.setMargin(9) + self.gridlayout.setSpacing(2) + self.gridlayout.setObjectName("gridlayout") + + self.password = QtGui.QLineEdit(self.web_proxy) + self.password.setEchoMode(QtGui.QLineEdit.Password) + self.password.setObjectName("password") + self.gridlayout.addWidget(self.password,5,0,1,2) + + self.username = QtGui.QLineEdit(self.web_proxy) + self.username.setObjectName("username") + self.gridlayout.addWidget(self.username,3,0,1,2) + + self.label_5 = QtGui.QLabel(self.web_proxy) + self.label_5.setObjectName("label_5") + self.gridlayout.addWidget(self.label_5,4,0,1,2) + + self.label_6 = QtGui.QLabel(self.web_proxy) + self.label_6.setObjectName("label_6") + self.gridlayout.addWidget(self.label_6,2,0,1,2) + + self.server_host = QtGui.QLineEdit(self.web_proxy) + self.server_host.setObjectName("server_host") + self.gridlayout.addWidget(self.server_host,1,0,1,1) + + self.label_7 = QtGui.QLabel(self.web_proxy) + self.label_7.setObjectName("label_7") + self.gridlayout.addWidget(self.label_7,0,1,1,1) + + self.server_port = QtGui.QSpinBox(self.web_proxy) + self.server_port.setMaximum(65535) + self.server_port.setMinimum(1) + self.server_port.setProperty("value",QtCore.QVariant(80)) + self.server_port.setObjectName("server_port") + self.gridlayout.addWidget(self.server_port,1,1,1,1) + + self.label = QtGui.QLabel(self.web_proxy) + self.label.setObjectName("label") + self.gridlayout.addWidget(self.label,0,0,1,1) + self.vboxlayout.addWidget(self.web_proxy) + + spacerItem = QtGui.QSpacerItem(101,31,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) + self.vboxlayout.addItem(spacerItem) + self.label_5.setBuddy(self.password) + self.label_6.setBuddy(self.username) + self.label.setBuddy(self.server_host) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + Form.setTabOrder(self.server_host,self.server_port) + Form.setTabOrder(self.server_port,self.username) + Form.setTabOrder(self.username,self.password) + + def retranslateUi(self, Form): + self.web_proxy.setTitle(_(u"Web Proxy")) + self.label_5.setText(_(u"Password:")) + self.label_6.setText(_(u"Username:")) + self.label_7.setText(_(u"Port:")) + self.label.setText(_(u"Server address:")) + diff --git a/picard/ui/ui_options_script.py b/picard/ui/ui_options_script.py index ef2749790..c9d6db860 100644 --- a/picard/ui/ui_options_script.py +++ b/picard/ui/ui_options_script.py @@ -1,53 +1,53 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'ui\options_script.ui' -# -# Created: Tue Oct 24 15:01:06 2006 -# by: PyQt4 UI code generator 4-snapshot-20061015 -# -# WARNING! All changes made in this file will be lost! - -import sys -from PyQt4 import QtCore, QtGui - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(QtCore.QSize(QtCore.QRect(0,0,273,238).size()).expandedTo(Form.minimumSizeHint())) - - self.vboxlayout = QtGui.QVBoxLayout(Form) - self.vboxlayout.setMargin(9) - self.vboxlayout.setSpacing(6) - self.vboxlayout.setObjectName("vboxlayout") - - self.enable_tagger_script = QtGui.QGroupBox(Form) - self.enable_tagger_script.setCheckable(True) - self.enable_tagger_script.setObjectName("enable_tagger_script") - - self.vboxlayout1 = QtGui.QVBoxLayout(self.enable_tagger_script) - self.vboxlayout1.setMargin(9) - self.vboxlayout1.setSpacing(6) - self.vboxlayout1.setObjectName("vboxlayout1") - - self.tagger_script = QtGui.QTextEdit(self.enable_tagger_script) - - font = QtGui.QFont(self.tagger_script.font()) - font.setFamily("Courier") - font.setPointSize(8) - font.setWeight(50) - font.setItalic(False) - font.setUnderline(False) - font.setStrikeOut(False) - font.setBold(False) - self.tagger_script.setFont(font) - self.tagger_script.setLineWrapMode(QtGui.QTextEdit.NoWrap) - self.tagger_script.setObjectName("tagger_script") - self.vboxlayout1.addWidget(self.tagger_script) - self.vboxlayout.addWidget(self.enable_tagger_script) - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - - def retranslateUi(self, Form): - self.enable_tagger_script.setTitle(_(u"Tagger Script")) - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'ui/options_script.ui' +# +# Created: Sat Jan 20 17:45:24 2007 +# by: PyQt4 UI code generator 4.1 +# +# WARNING! All changes made in this file will be lost! + +import sys +from PyQt4 import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(QtCore.QSize(QtCore.QRect(0,0,222,228).size()).expandedTo(Form.minimumSizeHint())) + + self.vboxlayout = QtGui.QVBoxLayout(Form) + self.vboxlayout.setMargin(9) + self.vboxlayout.setSpacing(6) + self.vboxlayout.setObjectName("vboxlayout") + + self.enable_tagger_script = QtGui.QGroupBox(Form) + self.enable_tagger_script.setCheckable(True) + self.enable_tagger_script.setObjectName("enable_tagger_script") + + self.vboxlayout1 = QtGui.QVBoxLayout(self.enable_tagger_script) + self.vboxlayout1.setMargin(9) + self.vboxlayout1.setSpacing(6) + self.vboxlayout1.setObjectName("vboxlayout1") + + self.tagger_script = QtGui.QTextEdit(self.enable_tagger_script) + + font = QtGui.QFont(self.tagger_script.font()) + font.setFamily("Courier") + font.setPointSize(8) + font.setWeight(50) + font.setItalic(False) + font.setUnderline(False) + font.setStrikeOut(False) + font.setBold(False) + self.tagger_script.setFont(font) + self.tagger_script.setLineWrapMode(QtGui.QTextEdit.NoWrap) + self.tagger_script.setObjectName("tagger_script") + self.vboxlayout1.addWidget(self.tagger_script) + self.vboxlayout.addWidget(self.enable_tagger_script) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + self.enable_tagger_script.setTitle(_(u"Tagger Script")) + diff --git a/picard/ui/ui_options_tags.py b/picard/ui/ui_options_tags.py index 42624fffa..5ffa7989c 100644 --- a/picard/ui/ui_options_tags.py +++ b/picard/ui/ui_options_tags.py @@ -1,109 +1,109 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'ui\options_tags.ui' -# -# Created: Fri Oct 20 21:31:20 2006 -# by: PyQt4 UI code generator 4-snapshot-20061015 -# -# WARNING! All changes made in this file will be lost! - -import sys -from PyQt4 import QtCore, QtGui - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(QtCore.QSize(QtCore.QRect(0,0,293,300).size()).expandedTo(Form.minimumSizeHint())) - - self.vboxlayout = QtGui.QVBoxLayout(Form) - self.vboxlayout.setMargin(9) - self.vboxlayout.setSpacing(6) - self.vboxlayout.setObjectName("vboxlayout") - - self.rename_files = QtGui.QGroupBox(Form) - self.rename_files.setObjectName("rename_files") - - self.vboxlayout1 = QtGui.QVBoxLayout(self.rename_files) - self.vboxlayout1.setMargin(9) - self.vboxlayout1.setSpacing(2) - self.vboxlayout1.setObjectName("vboxlayout1") - - self.clear_existing_tags = QtGui.QCheckBox(self.rename_files) - self.clear_existing_tags.setObjectName("clear_existing_tags") - self.vboxlayout1.addWidget(self.clear_existing_tags) - self.vboxlayout.addWidget(self.rename_files) - - self.rename_files_2 = QtGui.QGroupBox(Form) - self.rename_files_2.setObjectName("rename_files_2") - - self.vboxlayout2 = QtGui.QVBoxLayout(self.rename_files_2) - self.vboxlayout2.setMargin(9) - self.vboxlayout2.setSpacing(2) - self.vboxlayout2.setObjectName("vboxlayout2") - - self.write_id3v1 = QtGui.QCheckBox(self.rename_files_2) - self.write_id3v1.setObjectName("write_id3v1") - self.vboxlayout2.addWidget(self.write_id3v1) - - self.write_id3v23 = QtGui.QCheckBox(self.rename_files_2) - self.write_id3v23.setObjectName("write_id3v23") - self.vboxlayout2.addWidget(self.write_id3v23) - - self.label_2 = QtGui.QLabel(self.rename_files_2) - self.label_2.setObjectName("label_2") - self.vboxlayout2.addWidget(self.label_2) - - self.hboxlayout = QtGui.QHBoxLayout() - self.hboxlayout.setMargin(0) - self.hboxlayout.setSpacing(6) - self.hboxlayout.setObjectName("hboxlayout") - - self.enc_iso88591 = QtGui.QRadioButton(self.rename_files_2) - self.enc_iso88591.setObjectName("enc_iso88591") - self.hboxlayout.addWidget(self.enc_iso88591) - - self.enc_utf16 = QtGui.QRadioButton(self.rename_files_2) - self.enc_utf16.setObjectName("enc_utf16") - self.hboxlayout.addWidget(self.enc_utf16) - - self.enc_utf8 = QtGui.QRadioButton(self.rename_files_2) - self.enc_utf8.setObjectName("enc_utf8") - self.hboxlayout.addWidget(self.enc_utf8) - - spacerItem = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.hboxlayout.addItem(spacerItem) - self.vboxlayout2.addLayout(self.hboxlayout) - self.vboxlayout.addWidget(self.rename_files_2) - - self.rename_files_3 = QtGui.QGroupBox(Form) - self.rename_files_3.setObjectName("rename_files_3") - - self.vboxlayout3 = QtGui.QVBoxLayout(self.rename_files_3) - self.vboxlayout3.setMargin(9) - self.vboxlayout3.setSpacing(2) - self.vboxlayout3.setObjectName("vboxlayout3") - - self.strip_ape_tags = QtGui.QCheckBox(self.rename_files_3) - self.strip_ape_tags.setObjectName("strip_ape_tags") - self.vboxlayout3.addWidget(self.strip_ape_tags) - self.vboxlayout.addWidget(self.rename_files_3) - - spacerItem1 = QtGui.QSpacerItem(81,21,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) - self.vboxlayout.addItem(spacerItem1) - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - - def retranslateUi(self, Form): - self.rename_files.setTitle(_(u"Common")) - self.clear_existing_tags.setText(_(u"Clear existing tags before writing new tags")) - self.rename_files_2.setTitle(_(u"ID3")) - self.write_id3v1.setText(_(u"Write ID3v1 tags to the files")) - self.write_id3v23.setText(_(u"Write ID3v2 version 2.3 tags (2.4 is default)")) - self.label_2.setText(_(u"Text encoding to use while writing ID3v2 tags:")) - self.enc_iso88591.setText(_(u"ISO-8859-1")) - self.enc_utf16.setText(_(u"UTF-16")) - self.enc_utf8.setText(_(u"UTF-8")) - self.rename_files_3.setTitle(_(u"APE")) - self.strip_ape_tags.setText(_(u"Strip APE tags from MP3 files")) - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'ui/options_tags.ui' +# +# Created: Sat Jan 20 17:45:24 2007 +# by: PyQt4 UI code generator 4.1 +# +# WARNING! All changes made in this file will be lost! + +import sys +from PyQt4 import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(QtCore.QSize(QtCore.QRect(0,0,292,295).size()).expandedTo(Form.minimumSizeHint())) + + self.vboxlayout = QtGui.QVBoxLayout(Form) + self.vboxlayout.setMargin(9) + self.vboxlayout.setSpacing(6) + self.vboxlayout.setObjectName("vboxlayout") + + self.rename_files = QtGui.QGroupBox(Form) + self.rename_files.setObjectName("rename_files") + + self.vboxlayout1 = QtGui.QVBoxLayout(self.rename_files) + self.vboxlayout1.setMargin(9) + self.vboxlayout1.setSpacing(2) + self.vboxlayout1.setObjectName("vboxlayout1") + + self.clear_existing_tags = QtGui.QCheckBox(self.rename_files) + self.clear_existing_tags.setObjectName("clear_existing_tags") + self.vboxlayout1.addWidget(self.clear_existing_tags) + self.vboxlayout.addWidget(self.rename_files) + + self.rename_files_2 = QtGui.QGroupBox(Form) + self.rename_files_2.setObjectName("rename_files_2") + + self.vboxlayout2 = QtGui.QVBoxLayout(self.rename_files_2) + self.vboxlayout2.setMargin(9) + self.vboxlayout2.setSpacing(2) + self.vboxlayout2.setObjectName("vboxlayout2") + + self.write_id3v1 = QtGui.QCheckBox(self.rename_files_2) + self.write_id3v1.setObjectName("write_id3v1") + self.vboxlayout2.addWidget(self.write_id3v1) + + self.write_id3v23 = QtGui.QCheckBox(self.rename_files_2) + self.write_id3v23.setObjectName("write_id3v23") + self.vboxlayout2.addWidget(self.write_id3v23) + + self.label_2 = QtGui.QLabel(self.rename_files_2) + self.label_2.setObjectName("label_2") + self.vboxlayout2.addWidget(self.label_2) + + self.hboxlayout = QtGui.QHBoxLayout() + self.hboxlayout.setMargin(0) + self.hboxlayout.setSpacing(6) + self.hboxlayout.setObjectName("hboxlayout") + + self.enc_iso88591 = QtGui.QRadioButton(self.rename_files_2) + self.enc_iso88591.setObjectName("enc_iso88591") + self.hboxlayout.addWidget(self.enc_iso88591) + + self.enc_utf16 = QtGui.QRadioButton(self.rename_files_2) + self.enc_utf16.setObjectName("enc_utf16") + self.hboxlayout.addWidget(self.enc_utf16) + + self.enc_utf8 = QtGui.QRadioButton(self.rename_files_2) + self.enc_utf8.setObjectName("enc_utf8") + self.hboxlayout.addWidget(self.enc_utf8) + + spacerItem = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout.addItem(spacerItem) + self.vboxlayout2.addLayout(self.hboxlayout) + self.vboxlayout.addWidget(self.rename_files_2) + + self.rename_files_3 = QtGui.QGroupBox(Form) + self.rename_files_3.setObjectName("rename_files_3") + + self.vboxlayout3 = QtGui.QVBoxLayout(self.rename_files_3) + self.vboxlayout3.setMargin(9) + self.vboxlayout3.setSpacing(2) + self.vboxlayout3.setObjectName("vboxlayout3") + + self.strip_ape_tags = QtGui.QCheckBox(self.rename_files_3) + self.strip_ape_tags.setObjectName("strip_ape_tags") + self.vboxlayout3.addWidget(self.strip_ape_tags) + self.vboxlayout.addWidget(self.rename_files_3) + + spacerItem1 = QtGui.QSpacerItem(81,21,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) + self.vboxlayout.addItem(spacerItem1) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + self.rename_files.setTitle(_(u"Common")) + self.clear_existing_tags.setText(_(u"Clear existing tags before writing new tags")) + self.rename_files_2.setTitle(_(u"ID3")) + self.write_id3v1.setText(_(u"Write ID3v1 tags to the files")) + self.write_id3v23.setText(_(u"Write ID3v2 version 2.3 tags (2.4 is default)")) + self.label_2.setText(_(u"Text encoding to use while writing ID3v2 tags:")) + self.enc_iso88591.setText(_(u"ISO-8859-1")) + self.enc_utf16.setText(_(u"UTF-16")) + self.enc_utf8.setText(_(u"UTF-8")) + self.rename_files_3.setTitle(_(u"APE")) + self.strip_ape_tags.setText(_(u"Strip APE tags from MP3 files")) + diff --git a/test/test_asf.py b/test/test_asf.py deleted file mode 100644 index 7b3210fd3..000000000 --- a/test/test_asf.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- - -import os -import shutil -import unittest -from picard.plugins.picardmutagen.mutagenext.asf import ASF, UnicodeAttribute -from tempfile import mkstemp - - -class ASFTest(unittest.TestCase): - - def setUp(self): - self.filename = os.path.join("test", "data", "silence.wma") - self.asf = ASF(self.filename) - - def test_write(self): - fd, filename = mkstemp(suffix='.wma') - os.close(fd) - try: - shutil.copy(self.filename, filename) - wma = ASF(filename) - wma.tags["WM/Composer"] = UnicodeAttribute("Test!") - wma.save() - wma = ASF(filename) - self.failUnlessEqual(unicode(wma["WM/Composer"][0]), "Test!") - finally: - os.unlink(filename) - - def test_is_vbr(self): - self.failUnlessEqual(bool(self.asf["IsVBR"][0]), True) - - def test_title(self): - self.failUnlessEqual(unicode(self.asf["Title"][0]), "Enjoy the Silence!") - - -class TASFInfo(unittest.TestCase): - - def setUp(self): - self.file = ASF(os.path.join("test", "data", "silence.wma")) - -# def test_length(self): -# self.failUnlessAlmostEqual(self.file.info.length, 0.03, 2) - - def test_bitrate(self): - self.failUnlessEqual(self.file.info.bitrate, 64) - - def test_sample_rate(self): - self.failUnlessEqual(self.file.info.sample_rate, 44100) - - def test_channels(self): - self.failUnlessEqual(self.file.info.channels, 2) - diff --git a/test/test_compatid3.py b/test/test_compatid3.py index 1ca4fd914..d65dce994 100644 --- a/test/test_compatid3.py +++ b/test/test_compatid3.py @@ -2,7 +2,7 @@ import unittest from mutagen import id3 -from picard.plugins.picardmutagen.mutagenext import compatid3 +from picard.formats.mutagenext import compatid3 class UpdateToV23Test(unittest.TestCase): diff --git a/test/test_tagz.py b/test/test_script.py similarity index 100% rename from test/test_tagz.py rename to test/test_script.py diff --git a/ui/options_about.ui b/ui/options_about.ui index b5570a669..e70a63726 100644 --- a/ui/options_about.ui +++ b/ui/options_about.ui @@ -5,8 +5,8 @@ 0 0 - 427 - 426 + 171 + 137 diff --git a/ui/options_cdlookup.ui b/ui/options_cdlookup.ui index 2ee01055d..0d1076e43 100644 --- a/ui/options_cdlookup.ui +++ b/ui/options_cdlookup.ui @@ -1,15 +1,12 @@ - - - Form 0 0 - 285 - 211 + 224 + 176 @@ -62,7 +59,6 @@ - cd_lookup_device diff --git a/ui/options_cdlookup_win32.ui b/ui/options_cdlookup_win32.ui index 77ea4df8b..5f928b924 100644 --- a/ui/options_cdlookup_win32.ui +++ b/ui/options_cdlookup_win32.ui @@ -1,15 +1,12 @@ - - - Form 0 0 - 324 - 217 + 217 + 155 @@ -85,7 +82,6 @@ - diff --git a/ui/options_general.ui b/ui/options_general.ui index e2a4ebc8b..02f4ed1ef 100644 --- a/ui/options_general.ui +++ b/ui/options_general.ui @@ -5,8 +5,8 @@ 0 0 - 400 - 300 + 232 + 275 diff --git a/ui/options_matching.ui b/ui/options_matching.ui index 744f1f15c..2e2ee2fe2 100644 --- a/ui/options_matching.ui +++ b/ui/options_matching.ui @@ -5,7 +5,7 @@ 0 0 - 340 + 328 313 diff --git a/ui/options_naming.ui b/ui/options_naming.ui index eb8491b42..3f0df62fe 100644 --- a/ui/options_naming.ui +++ b/ui/options_naming.ui @@ -5,8 +5,8 @@ 0 0 - 401 - 426 + 284 + 388 @@ -143,8 +143,8 @@ - 383 - 51 + 111 + 76 diff --git a/ui/options_plugins.ui b/ui/options_plugins.ui new file mode 100644 index 000000000..b523ffa08 --- /dev/null +++ b/ui/options_plugins.ui @@ -0,0 +1,86 @@ + + PluginsPage + + + + 0 + 0 + 265 + 297 + + + + + 9 + + + 6 + + + + + Qt::Vertical + + + + Plugins + + + + 9 + + + 6 + + + + + false + + + + Name + + + + + Author + + + + + + + + + Details + + + + 9 + + + 6 + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + + + + + diff --git a/ui/options_proxy.ui b/ui/options_proxy.ui index 1e6e3cfac..a1475bc7a 100644 --- a/ui/options_proxy.ui +++ b/ui/options_proxy.ui @@ -1,14 +1,11 @@ - - - Form 0 0 - 339 + 233 252 @@ -115,7 +112,6 @@ - server_host server_port diff --git a/ui/options_script.ui b/ui/options_script.ui index f0b8f1e65..853f67584 100644 --- a/ui/options_script.ui +++ b/ui/options_script.ui @@ -5,8 +5,8 @@ 0 0 - 273 - 238 + 222 + 228 diff --git a/ui/options_tags.ui b/ui/options_tags.ui index b5314268d..10984e09d 100644 --- a/ui/options_tags.ui +++ b/ui/options_tags.ui @@ -5,8 +5,8 @@ 0 0 - 293 - 300 + 292 + 295