コード例 #1
0
def init():
    from maestro import utils
    from maestro.gui import treeactions
    from maestro.widgets import WidgetClass
    from maestro.widgets.browser import delegate
    from maestro.widgets.browser.browser import Browser, BrowserTreeView
    from maestro.widgets.browser.coverbrowser import CoverBrowser
    from maestro.widgets.browser.covertable import CoverTable
    translate = QtCore.QCoreApplication.translate
    delegate.init()
    WidgetClass(id='browser',
                theClass=Browser,
                name=translate('Browser', 'Browser'),
                areas='dock',
                preferredDockArea='left').register()

    WidgetClass(id='coverbrowser',
                theClass=CoverBrowser,
                name=translate('CoverBrowser', 'Cover Browser'),
                icon=utils.images.icon('widgets/coverbrowser.png')).register()

    coverbrowser.addDisplayClass('table', CoverTable)

    import maestro.widgets.browser.actions
    maestro.widgets.browser.actions.init()

    for identifier in ('hideTagValues', 'tagValue', 'editTags', 'changeURLs',
                       'delete', 'merge', 'completeContainer', 'collapseAll',
                       'expandAll', 'appendToPL', 'replacePL'):
        BrowserTreeView.addActionDefinition(identifier)
    treeactions.SetElementTypeAction.addSubmenu(
        BrowserTreeView.actionConf.root)
    treeactions.ChangePositionAction.addSubmenu(
        BrowserTreeView.actionConf.root)
コード例 #2
0
ファイル: __init__.py プロジェクト: maestromusic/maestro
def init():
    from maestro import utils
    from maestro.widgets import WidgetClass
    from maestro.gui import treeactions
    from maestro.widgets.editor.gui import EditorTreeView, EditorWidget
    from maestro.widgets.editor.delegate import EditorDelegate
    for identifier in 'editTags', 'remove', 'merge', 'flatten', 'clearTree', 'commit':
        EditorTreeView.addActionDefinition(identifier)
    treeactions.SetElementTypeAction.addSubmenu(EditorTreeView.actionConf.root)
    treeactions.ChangePositionAction.addSubmenu(EditorTreeView.actionConf.root)
    WidgetClass(id='editor',
                theClass=EditorWidget,
                name=translate('Editor', 'editor'),
                icon=utils.images.icon('accessories-text-editor'),
                preferredDockArea='right').register()
    from maestro.gui.delegates import profiles
    EditorDelegate.profileType = profiles.createProfileType(
        name='editor',
        title=translate('Delegates', 'Editor'),
        leftData=['t:album', 't:composer', 't:artist', 't:performer'],
        rightData=['t:date', 't:genre', 't:conductor'],
        overwrite=dict(showPaths=True,
                       showType=True,
                       appendRemainingTags=True,
                       showAllAncestors=True))
    from maestro.widgets.editor import albumguesser
    albumguesser.init()
コード例 #3
0
def init():
    from maestro.widgets import WidgetClass
    WidgetClass(id='details',
                theClass=DetailsView,
                name=translate('DetailsView', 'Details'),
                icon=utils.images.icon('help-about'),
                preferredDockArea='right').register()
コード例 #4
0
def init():
    from maestro import utils
    from maestro.widgets import WidgetClass
    from maestro.widgets.tageditor.tageditor import TagEditorWidget, TagEditorDialog

    WidgetClass(id='tageditor',
                theClass=TagEditorWidget,
                name=translate('Tageditor', 'Tag Editor'),
                icon=utils.images.icon('tageditor'),
                unique=True,
                areas='dock',
                preferredDockArea='right').register()
コード例 #5
0
def init():
    from maestro.widgets import WidgetClass
    from maestro import utils
    from maestro.filesystem.browser import FilesystemBrowser
    WidgetClass(id='filesystembrowser',
                theClass=FilesystemBrowser,
                name=translate('FilesystemBrowser', 'File System Browser'),
                icon=utils.images.icon('filesystembrowser'),
                areas='dock',
                preferredDockArea='right').register()
    from maestro.filesystem import dialogs
    dialogs.RemoveMissingFilesAction.register('filesystem-removeMissing',
                                              shortcut=translate(
                                                  'QShortcut', 'Del'))
    dialogs.SetPathAction.register('filesystem-setPath')
    dialogs.MissingFilesTreeView.addActionDefinition(
        'filesystem-removeMissing')
    dialogs.MissingFilesTreeView.addActionDefinition('filesystem-setPath')
コード例 #6
0
def init():
    from maestro.widgets import WidgetClass
    WidgetClass(
        id='playback', theClass=PlaybackWidget, name=translate('Playback', 'playback'),
        icon=utils.images.icon('media-playback-start'),
        areas='dock', preferredDockArea='left'
    ).register()

    for command in PlayCommand:
        PlayControlAction.register(
            context='playback', identifier=command.value, label=command.label(),
            shortcut=Qt.Key_Space if command is PlayCommand.PlayPause else None
        )

    global renderer, playIcon, pauseIcon
    renderer = QtSvg.QSvgRenderer(':maestro/playback.svg')
    playIcon = QtGui.QIcon(utils.images.renderSvg(
        renderer, "media_playback_start", ICON_SIZE, ICON_SIZE))
    pauseIcon = QtGui.QIcon(utils.images.renderSvg(
        renderer, "media_playback_pause", ICON_SIZE, ICON_SIZE))
コード例 #7
0
def appendToDefaultPlaylist(wrappers, replace=False):
    """Append the given wrappers to the default playlist. Just do nothing if there is no default playlist.
    If `replace` is true, clear the playlist. If the playlist is currently stopped, start it with the new
    wrappers.
    """
    currentPlaylist = WidgetClass.currentWidget('playlist')
    if currentPlaylist is None:
        return
    model = currentPlaylist.treeview.model()
    if model.backend.connectionState != player.ConnectionState.Connected:
        return
    if replace:
        model.stack.beginMacro(translate("PlaylistWidget", "Replace Playlist"))
        model.clear()
    insertOffset = model.root.fileCount()
    model.insert(model.root, len(model.root.contents), wrappers)
    if replace:
        model.backend.play()
        model.stack.endMacro()
    elif model.backend.state() is player.PlayState.Stop:
        model.backend.setCurrent(insertOffset)
        model.backend.play()
コード例 #8
0
ファイル: __init__.py プロジェクト: maestromusic/maestro
def init():
    from maestro.widgets.playlist import gui as pgui, delegate
    from maestro.widgets import WidgetClass
    from maestro import utils
    delegate.init()
    WidgetClass(
        id='playlist',
        theClass=pgui.PlaylistWidget,
        name=translate('Playlist', 'Playlist'),
        icon=utils.images.icon('view-media-playlist'),
    ).register()
    pgui.RemoveFromPlaylistAction.register('removeFromPL',
                                           context='playback',
                                           shortcut=translate(
                                               'RemoveFromPlaylistAction',
                                               'Del'))
    pgui.ClearPlaylistAction.register('clearPL',
                                      context='playback',
                                      shortcut=translate(
                                          'ClearPlaylistAction', 'Shift+Del'))
    for definition in 'editTags', 'removeFromPL', 'clearPL':
        pgui.PlaylistTreeView.addActionDefinition(definition)
コード例 #9
0
ファイル: gui.py プロジェクト: maestromusic/maestro
def appendToDefaultPlaylist(wrappers, replace=False):
    """Append the given wrappers to the default playlist. Just do nothing if there is no default playlist.
    If `replace` is true, clear the playlist. If the playlist is currently stopped, start it with the new
    wrappers.
    """
    currentPlaylist = WidgetClass.currentWidget('playlist')
    if currentPlaylist is None:
        return
    model = currentPlaylist.treeview.model()
    if model.backend.connectionState != player.ConnectionState.Connected:
        return
    if replace:
        model.stack.beginMacro(translate("PlaylistWidget", "Replace Playlist"))
        model.clear()
    insertOffset = model.root.fileCount()
    model.insert(model.root, len(model.root.contents), wrappers)
    if replace:
        model.backend.play()            
        model.stack.endMacro()
    elif model.backend.state() is player.PlayState.Stop:
        model.backend.setCurrent(insertOffset)
        model.backend.play()