diff --git a/coverart_album.py b/coverart_album.py index cd796b6..8353bbb 100644 --- a/coverart_album.py +++ b/coverart_album.py @@ -22,6 +22,12 @@ Structures and managers to work with albums on Rhythmbox. This module provides the base model for the plugin to work on top of. ''' +from datetime import datetime, date +import os +import cgi +import tempfile +import gc + from gi.repository import RB from gi.repository import GObject from gi.repository import Gio @@ -40,13 +46,8 @@ import coverart_rb3compat as rb3compat from coverart_utils import uniquify_and_sort from coverart_utils import dumpstack from coverart_utils import check_lastfm -from datetime import datetime, date - -import os -import cgi -import tempfile import rb -import gc + # default chunk of entries to process when loading albums diff --git a/coverart_artistinfo.py b/coverart_artistinfo.py index 2afbe87..c447ced 100644 --- a/coverart_artistinfo.py +++ b/coverart_artistinfo.py @@ -19,14 +19,12 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. import os -import urllib.request, urllib.parse +import urllib.request +import urllib.parse import json +import gettext from mako.template import Template - -import rb -import rb_lastfm as LastFM # from coverart-search-providers - from gi.repository import WebKit from gi.repository import GObject from gi.repository import Gtk @@ -34,12 +32,13 @@ from gi.repository import Gdk from gi.repository import GLib from gi.repository import RB from gi.repository import Gio + +import rb +import rb_lastfm as LastFM # from coverart-search-providers from coverart_utils import get_stock_size -from coverart_widgets import PixbufButton from coverart_browser_prefs import GSetting from coverart_utils import create_button_image -import gettext gettext.install('rhythmbox', RB.locale_dir()) diff --git a/coverart_artistview.py b/coverart_artistview.py index 40cc1c6..9951430 100644 --- a/coverart_artistview.py +++ b/coverart_artistview.py @@ -17,6 +17,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +import os +import tempfile +import shutil + from gi.repository import Gdk from gi.repository import Gtk from gi.repository import GLib @@ -26,7 +30,6 @@ from gi.repository import GdkPixbuf from gi.repository import RB from coverart_browser_prefs import GSetting -from coverart_album import Cover from coverart_album import Album from coverart_album import AlbumsModel from coverart_album import CoverManager @@ -40,13 +43,7 @@ from coverart_utils import create_pixbuf_from_file_at_size from coverart_extdb import CoverArtExtDB import coverart_rb3compat as rb3compat from coverart_rb3compat import Menu - import rb -import os - -from collections import namedtuple - -import tempfile, shutil def create_temporary_copy(path): diff --git a/coverart_browser.py b/coverart_browser.py index f66af14..0f992fb 100644 --- a/coverart_browser.py +++ b/coverart_browser.py @@ -18,30 +18,21 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # define plugin -import rb -import locale -import gettext - from gi.repository import GObject from gi.repository import Gtk from gi.repository import RB -from gi.repository import GdkPixbuf from gi.repository import Peas from gi.repository import Gio from gi.repository import GLib -from coverart_browser_prefs import Preferences +import rb from coverart_browser_prefs import GSetting from coverart_browser_prefs import CoverLocale from coverart_browser_source import CoverArtBrowserSource -from coverart_utils import Theme from coverart_listview import ListView from coverart_queueview import QueueView from coverart_toolbar import TopToolbar -import coverart_rb3compat as rb3compat - - class CoverArtBrowserEntryType(RB.RhythmDBEntryType): ''' Entry type for our source. diff --git a/coverart_browser_prefs.py b/coverart_browser_prefs.py index bc762d9..e4cc8a6 100644 --- a/coverart_browser_prefs.py +++ b/coverart_browser_prefs.py @@ -16,6 +16,12 @@ # 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 St, Fifth Floor, Boston, MA 02110-1301 USA. +import locale +import gettext +import os +import shutil +import webbrowser + from gi.repository import Gio from gi.repository import GObject from gi.repository import Gtk @@ -24,11 +30,6 @@ from gi.repository import Peas from gi.repository import RB import rb -import locale -import gettext -import os -import shutil -import webbrowser from stars import ReactiveStar from stars import StarSize import coverart_rb3compat as rb3compat @@ -433,7 +434,6 @@ class Preferences(GObject.Object, PeasGtk.Configurable): # now prepare the genre tab from coverart_utils import GenreConfiguredSpriteSheet from coverart_utils import get_stock_size - from coverart_utils import GenreType self._sheet = GenreConfiguredSpriteSheet(plugin, "genre", get_stock_size()) diff --git a/coverart_browser_source.py b/coverart_browser_source.py index 7708690..c852c53 100644 --- a/coverart_browser_source.py +++ b/coverart_browser_source.py @@ -17,7 +17,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -import rb +import random +from collections import OrderedDict +import unicodedata +import re from gi.repository import GObject from gi.repository import GLib @@ -26,8 +29,8 @@ from gi.repository import Gdk from gi.repository import Gtk from gi.repository import RB +import rb from coverart_album import AlbumManager - from coverart_browser_prefs import GSetting from coverart_browser_prefs import CoverLocale from coverart_browser_prefs import Preferences @@ -47,11 +50,7 @@ from coverart_artistinfo import ArtistInfoPane from coverart_external_plugins import CreateExternalPluginMenu from coverart_playlists import EchoNestPlaylist from coverart_entryview import EntryViewPane - import coverart_rb3compat as rb3compat -import random -from collections import OrderedDict -import unicodedata, re class CoverArtBrowserSource(RB.Source): diff --git a/coverart_controllers.py b/coverart_controllers.py index 6ab9942..8e31e4e 100644 --- a/coverart_controllers.py +++ b/coverart_controllers.py @@ -17,6 +17,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +from datetime import date +from collections import OrderedDict +from collections import namedtuple + from gi.repository import GObject from gi.repository import Gdk from gi.repository import RB @@ -31,12 +35,8 @@ from coverart_utils import ConfiguredSpriteSheet from coverart_utils import get_stock_size from coverart_utils import CaseInsensitiveDict from coverart_utils import Theme -from datetime import date -from collections import OrderedDict import rb -import coverart_rb3compat as rb3compat -from collections import namedtuple MenuNodeT = namedtuple('MenuNode', 'label menutype typevalue') diff --git a/coverart_coverflowview.py b/coverart_coverflowview.py index 3574e2d..db8240d 100644 --- a/coverart_coverflowview.py +++ b/coverart_coverflowview.py @@ -17,22 +17,21 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +import json +import os +from xml.sax.saxutils import escape + from gi.repository import Gdk from gi.repository import Gtk from gi.repository import GLib from gi.repository import GObject from gi.repository import Gio + from coverart_browser_prefs import GSetting from coverart_browser_prefs import webkit_support -from coverart_album import AlbumsModel from coverart_widgets import AbstractView from coverart_widgets import PanedCollapsible import rb -import json -import os -from os.path import expanduser -from xml.sax.saxutils import escape -from collections import namedtuple class FlowShowingPolicy(GObject.Object): diff --git a/coverart_covericonview.py b/coverart_covericonview.py index 6b21674..03fc2ad 100644 --- a/coverart_covericonview.py +++ b/coverart_covericonview.py @@ -25,8 +25,7 @@ from gi.repository import Gio from gi.repository import Pango from gi.repository import PangoCairo from gi.repository import GdkPixbuf -from gi.repository import RB -from gi.repository.GdkPixbuf import Pixbuf + from coverart_widgets import EnhancedIconView from coverart_browser_prefs import GSetting from coverart_album import AlbumsModel @@ -35,6 +34,7 @@ from coverart_widgets import PanedCollapsible import coverart_rb3compat as rb3compat import rb + PLAY_SIZE_X = 30 PLAY_SIZE_Y = 30 diff --git a/coverart_entryview.py b/coverart_entryview.py index fc7abdc..b1f782b 100644 --- a/coverart_entryview.py +++ b/coverart_entryview.py @@ -17,6 +17,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +from collections import OrderedDict + from gi.repository import RB from gi.repository import Gtk from gi.repository import GObject @@ -28,7 +30,6 @@ from coverart_rb3compat import ActionGroup from coverart_browser_prefs import GSetting from coverart_browser_prefs import CoverLocale from coverart_external_plugins import CreateExternalPluginMenu -from collections import OrderedDict from coverart_playlists import LastFMTrackPlaylist from coverart_playlists import EchoNestPlaylist from coverart_playlists import EchoNestGenrePlaylist @@ -38,6 +39,7 @@ from stars import ReactiveStar from coverart_search import CoverSearchPane from coverart_widgets import PixbufButton + MIN_IMAGE_SIZE = 100 diff --git a/coverart_export.py b/coverart_export.py index 0f13fc6..23312b4 100644 --- a/coverart_export.py +++ b/coverart_export.py @@ -17,6 +17,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +import shutil +import os +import sys +import subprocess + from gi.repository import GObject from gi.repository import Gtk from gi.repository import GLib @@ -25,15 +30,9 @@ from gi.repository import Gdk from gi.repository import Peas from gi.repository import Gst -from coverart_album import Album from coverart_utils import NaturalString import rb -import shutil import coverart_rb3compat as rb3compat -import os.path -import os -import sys -import subprocess class CoverArtExport(GObject.Object): diff --git a/coverart_external_plugins.py b/coverart_external_plugins.py index 6741537..d5120d4 100644 --- a/coverart_external_plugins.py +++ b/coverart_external_plugins.py @@ -20,8 +20,8 @@ from gi.repository import Peas from gi.repository import GObject import lxml.etree as ET + import rb -import coverart_rb3compat as rb3compat from coverart_rb3compat import ActionGroup from coverart_rb3compat import ApplicationShell from coverart_utils import CaseInsensitiveDict @@ -185,9 +185,7 @@ class CreateExternalPluginMenu(GObject.Object): self._actiongroup = ActionGroup(popup.shell, section_name + '_externalplugins') # all supported plugins will be defined in the following array by parsing - # the plugins XML file for the definition. Supported plugins are split between - # rb2.99 and later and rb2.98 and earlier due to the likelihood that earlier - # plugins may never be updated by their authors + # the plugins XML file for the definition. self.supported_plugins = [] diff --git a/coverart_listview.py b/coverart_listview.py index 1076afe..994a291 100644 --- a/coverart_listview.py +++ b/coverart_listview.py @@ -17,10 +17,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -from coverart_widgets import AbstractView from gi.repository import GObject from gi.repository import GLib +from coverart_widgets import AbstractView + class ListShowingPolicy(GObject.Object): ''' diff --git a/coverart_playlists.py b/coverart_playlists.py index c0266e3..f873283 100644 --- a/coverart_playlists.py +++ b/coverart_playlists.py @@ -17,15 +17,18 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -from gi.repository import RB -from gi.repository import Gtk -from coverart_utils import idle_iterator -import rb import urllib.parse import json import os import random +from gi.repository import RB +from gi.repository import Gtk + +from coverart_utils import idle_iterator +import rb + + LOAD_CHUNK = 50 diff --git a/coverart_queueview.py b/coverart_queueview.py index 8d70ceb..3e0b633 100644 --- a/coverart_queueview.py +++ b/coverart_queueview.py @@ -17,10 +17,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -from coverart_widgets import AbstractView from gi.repository import GObject from gi.repository import GLib +from coverart_widgets import AbstractView + class QueueShowingPolicy(GObject.Object): ''' diff --git a/coverart_rb3compat.py b/coverart_rb3compat.py index 6009327..26d7f2a 100644 --- a/coverart_rb3compat.py +++ b/coverart_rb3compat.py @@ -22,14 +22,16 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +import sys +import xml.etree.ElementTree as ET + from gi.repository import Gtk from gi.repository import Gio from gi.repository import GLib from gi.repository import GObject from gi.repository import RB -import sys + import rb -import xml.etree.ElementTree as ET def pygobject_version(): diff --git a/coverart_search.py b/coverart_search.py index 2b046c5..4e58402 100644 --- a/coverart_search.py +++ b/coverart_search.py @@ -18,9 +18,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -import rb from gi.repository import Gtk from mako.template import Template + +import rb import coverart_rb3compat as rb3compat from coverart_album import Album from coverart_browser_prefs import webkit_support diff --git a/coverart_toolbar.py b/coverart_toolbar.py index 4ff5c44..0ddeb4e 100644 --- a/coverart_toolbar.py +++ b/coverart_toolbar.py @@ -36,7 +36,6 @@ from coverart_controllers import ArtistSortOrderToggleController from coverart_controllers import AlbumSearchEntryController from coverart_widgets import SearchEntry from coverart_browser_prefs import webkit_support - import rb diff --git a/coverart_utils.py b/coverart_utils.py index 0ed042a..2ae42f6 100644 --- a/coverart_utils.py +++ b/coverart_utils.py @@ -15,6 +15,12 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. from bisect import bisect_left, bisect_right +import collections +import re +import logging +import sys +from collections import namedtuple + from gi.repository import GdkPixbuf from gi.repository import Gdk from gi.repository import Gtk @@ -23,17 +29,13 @@ from gi.repository import RB from gi.repository import GObject from gi.repository import Gio import lxml.etree as ET + import rb from coverart_browser_prefs import CoverLocale from coverart_browser_prefs import GSetting -import collections -import re import coverart_rb3compat as rb3compat -import logging -import sys from coverart_search_providers import lastfm_connected from coverart_search_providers import get_search_providers -from collections import namedtuple class FauxTb(object): diff --git a/coverart_widgets.py b/coverart_widgets.py index bc4b637..87e6014 100644 --- a/coverart_widgets.py +++ b/coverart_widgets.py @@ -23,11 +23,9 @@ from gi.repository import Gdk from gi.repository import GLib from gi.repository import GObject from gi.repository import Gio - import cairo from coverart_browser_prefs import GSetting - import rb @@ -548,8 +546,6 @@ class ImageRadioButton(Gtk.RadioButton, OptionsWidget): #self.set_image(self._controller.get_current_image(Gtk.Buildable.get_name(self))) self.set_tooltip_text("") #self._controller.get_current_description()) - from gi.repository import Gdk - if self.controller.current_key == Gtk.Buildable.get_name(self): self.set_active(True) self._set_colour(Gtk.StateFlags.NORMAL) diff --git a/stars.py b/stars.py index 9f20e90..2beb19f 100644 --- a/stars.py +++ b/stars.py @@ -16,12 +16,10 @@ # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -import cairo - import logging import gettext -from gettext import gettext as _ +import cairo from gi.repository import Gtk, Gdk, GObject from em import StockEms, em, small_em, big_em