forked from openlp/openlp
Refactor and rename listviews for DnD
Wizard refactors Cleanups bzr-revno: 1290
This commit is contained in:
commit
695cf68bf2
@ -6,18 +6,18 @@ Object Library
|
|||||||
.. automodule:: openlp.core.lib
|
.. automodule:: openlp.core.lib
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
:mod:`BaseListWithDnD`
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
.. autoclass:: openlp.core.lib.baselistwithdnd.BaseListWithDnD
|
|
||||||
:members:
|
|
||||||
|
|
||||||
:mod:`EventReceiver`
|
:mod:`EventReceiver`
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
.. autoclass:: openlp.core.lib.eventreceiver.EventReceiver
|
.. autoclass:: openlp.core.lib.eventreceiver.EventReceiver
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
:mod:`ListWidgetWithDnD`
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. autoclass:: openlp.core.lib.listwidgetwithdnd.ListWidgetWithDnD
|
||||||
|
:members:
|
||||||
|
|
||||||
:mod:`MediaManagerItem`
|
:mod:`MediaManagerItem`
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
@ -319,6 +319,7 @@ def check_directory_exists(dir):
|
|||||||
if not os.path.exists(dir):
|
if not os.path.exists(dir):
|
||||||
os.makedirs(dir)
|
os.makedirs(dir)
|
||||||
|
|
||||||
|
from listwidgetwithdnd import ListWidgetWithDnD
|
||||||
from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \
|
from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \
|
||||||
BackgroundType, HorizontalType, VerticalType
|
BackgroundType, HorizontalType, VerticalType
|
||||||
from displaytags import DisplayTags
|
from displaytags import DisplayTags
|
||||||
@ -339,4 +340,3 @@ from dockwidget import OpenLPDockWidget
|
|||||||
from renderer import Renderer
|
from renderer import Renderer
|
||||||
from rendermanager import RenderManager
|
from rendermanager import RenderManager
|
||||||
from mediamanageritem import MediaManagerItem
|
from mediamanageritem import MediaManagerItem
|
||||||
from baselistwithdnd import BaseListWithDnD
|
|
||||||
|
@ -28,17 +28,17 @@ Extend QListWidget to handle drag and drop functionality
|
|||||||
"""
|
"""
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
class BaseListWithDnD(QtGui.QListWidget):
|
class ListWidgetWithDnD(QtGui.QListWidget):
|
||||||
"""
|
"""
|
||||||
Provide a list widget to store objects and handle drag and drop events
|
Provide a list widget to store objects and handle drag and drop events
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None, name=u''):
|
||||||
"""
|
"""
|
||||||
Initialise the list widget
|
Initialise the list widget
|
||||||
"""
|
"""
|
||||||
QtGui.QListWidget.__init__(self, parent)
|
QtGui.QListWidget.__init__(self, parent)
|
||||||
# this must be set by the class which is inheriting
|
self.mimeDataText = name
|
||||||
assert(self.PluginName)
|
assert(self.mimeDataText)
|
||||||
|
|
||||||
def mouseMoveEvent(self, event):
|
def mouseMoveEvent(self, event):
|
||||||
"""
|
"""
|
||||||
@ -47,9 +47,10 @@ class BaseListWithDnD(QtGui.QListWidget):
|
|||||||
just tell it what plugin to call
|
just tell it what plugin to call
|
||||||
"""
|
"""
|
||||||
if event.buttons() != QtCore.Qt.LeftButton:
|
if event.buttons() != QtCore.Qt.LeftButton:
|
||||||
|
event.ignore()
|
||||||
return
|
return
|
||||||
drag = QtGui.QDrag(self)
|
drag = QtGui.QDrag(self)
|
||||||
mimeData = QtCore.QMimeData()
|
mimeData = QtCore.QMimeData()
|
||||||
drag.setMimeData(mimeData)
|
drag.setMimeData(mimeData)
|
||||||
mimeData.setText(self.PluginName)
|
mimeData.setText(self.mimeDataText)
|
||||||
drag.start(QtCore.Qt.CopyAction)
|
drag.start(QtCore.Qt.CopyAction)
|
@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import context_menu_action, context_menu_separator, \
|
from openlp.core.lib import context_menu_action, context_menu_separator, \
|
||||||
SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, \
|
SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, \
|
||||||
translate, Receiver
|
translate, Receiver, ListWidgetWithDnD
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -73,11 +73,6 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
assumes that the new action is to load a file. If not, you
|
assumes that the new action is to load a file. If not, you
|
||||||
need to override the ``OnNew`` method.
|
need to override the ``OnNew`` method.
|
||||||
|
|
||||||
``self.ListViewWithDnD_class``
|
|
||||||
This must be a **class**, not an object, descended from
|
|
||||||
``openlp.core.lib.BaseListWithDnD`` that is not used in any
|
|
||||||
other part of OpenLP.
|
|
||||||
|
|
||||||
``self.PreviewFunction``
|
``self.PreviewFunction``
|
||||||
This must be a method which returns a QImage to represent the
|
This must be a method which returns a QImage to represent the
|
||||||
item (usually a preview). No scaling is required, that is
|
item (usually a preview). No scaling is required, that is
|
||||||
@ -263,7 +258,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
Creates the main widget for listing items the media item is tracking
|
Creates the main widget for listing items the media item is tracking
|
||||||
"""
|
"""
|
||||||
# Add the List widget
|
# Add the List widget
|
||||||
self.listView = self.ListViewWithDnD_class(self)
|
self.listView = ListWidgetWithDnD(self, self.title)
|
||||||
self.listView.uniformItemSizes = True
|
self.listView.uniformItemSizes = True
|
||||||
self.listView.setSpacing(1)
|
self.listView.setSpacing(1)
|
||||||
self.listView.setSelectionMode(
|
self.listView.setSelectionMode(
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from filerenamedialog import Ui_FileRenameDialog
|
from filerenamedialog import Ui_FileRenameDialog
|
||||||
|
|
||||||
|
@ -216,8 +216,8 @@ class Ui_MainWindow(object):
|
|||||||
self.ToolsAddToolItem = icon_action(mainWindow, u'ToolsAddToolItem',
|
self.ToolsAddToolItem = icon_action(mainWindow, u'ToolsAddToolItem',
|
||||||
u':/tools/tools_add.png')
|
u':/tools/tools_add.png')
|
||||||
mainWindow.actionList.add_action(self.ToolsAddToolItem, u'Tools')
|
mainWindow.actionList.add_action(self.ToolsAddToolItem, u'Tools')
|
||||||
self.ToolsOpenDataFolder = icon_action(mainWindow, u'ToolsOpenDataFolder',
|
self.ToolsOpenDataFolder = icon_action(mainWindow,
|
||||||
u':/general/general_open.png')
|
u'ToolsOpenDataFolder', u':/general/general_open.png')
|
||||||
mainWindow.actionList.add_action(self.ToolsOpenDataFolder, u'Tools')
|
mainWindow.actionList.add_action(self.ToolsOpenDataFolder, u'Tools')
|
||||||
self.settingsPluginListItem = icon_action(mainWindow,
|
self.settingsPluginListItem = icon_action(mainWindow,
|
||||||
u'settingsPluginListItem', u':/system/settings_plugin_list.png')
|
u'settingsPluginListItem', u':/system/settings_plugin_list.png')
|
||||||
|
@ -70,6 +70,12 @@ class OpenLPWizard(QtGui.QWizard):
|
|||||||
self.retranslateUi()
|
self.retranslateUi()
|
||||||
QtCore.QMetaObject.connectSlotsByName(self)
|
QtCore.QMetaObject.connectSlotsByName(self)
|
||||||
|
|
||||||
|
def registerFields(self):
|
||||||
|
"""
|
||||||
|
Hook method for wizards to register any fields they need.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def addProgressPage(self):
|
def addProgressPage(self):
|
||||||
"""
|
"""
|
||||||
Add the progress page for the wizard. This page informs the user how
|
Add the progress page for the wizard. This page informs the user how
|
||||||
@ -146,3 +152,30 @@ class OpenLPWizard(QtGui.QWizard):
|
|||||||
self.finishButton.setVisible(True)
|
self.finishButton.setVisible(True)
|
||||||
self.cancelButton.setVisible(False)
|
self.cancelButton.setVisible(False)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
|
||||||
|
def getFileName(self, title, editbox, filters=u''):
|
||||||
|
"""
|
||||||
|
Opens a QFileDialog and saves the filename to the given editbox.
|
||||||
|
|
||||||
|
``title``
|
||||||
|
The title of the dialog (unicode).
|
||||||
|
|
||||||
|
``editbox``
|
||||||
|
A editbox (QLineEdit).
|
||||||
|
|
||||||
|
``filters``
|
||||||
|
The file extension filters. It should contain the file description
|
||||||
|
as well as the file extension. For example::
|
||||||
|
|
||||||
|
u'OpenLP 2.0 Databases (*.sqlite)'
|
||||||
|
"""
|
||||||
|
if filters:
|
||||||
|
filters += u';;'
|
||||||
|
filters += u'%s (*)' % UiStrings.AllFiles
|
||||||
|
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
||||||
|
os.path.dirname(SettingsManager.get_last_dir(
|
||||||
|
self.plugin.settingsSection, 1)), filters)
|
||||||
|
if filename:
|
||||||
|
editbox.setText(filename)
|
||||||
|
SettingsManager.set_last_dir(self.plugin.settingsSection,
|
||||||
|
filename, 1)
|
||||||
|
@ -727,33 +727,6 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
if books_file:
|
if books_file:
|
||||||
books_file.close()
|
books_file.close()
|
||||||
|
|
||||||
def getFileName(self, title, editbox, filters=u''):
|
|
||||||
"""
|
|
||||||
Opens a QFileDialog and saves the filename to the given editbox.
|
|
||||||
|
|
||||||
``title``
|
|
||||||
The title of the dialog (unicode).
|
|
||||||
|
|
||||||
``editbox``
|
|
||||||
A editbox (QLineEdit).
|
|
||||||
|
|
||||||
``filters``
|
|
||||||
The file extension filters. It should contain the file description
|
|
||||||
as well as the file extension. For example::
|
|
||||||
|
|
||||||
u'openlp.org 1.x bible (*.bible)'
|
|
||||||
"""
|
|
||||||
if filters:
|
|
||||||
filters += u';;'
|
|
||||||
filters += u'%s (*)' % UiStrings.AllFiles
|
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
|
||||||
os.path.dirname(SettingsManager.get_last_dir(
|
|
||||||
self.plugin.settingsSection, 1)), filters)
|
|
||||||
if filename:
|
|
||||||
editbox.setText(filename)
|
|
||||||
SettingsManager.set_last_dir(
|
|
||||||
self.plugin.settingsSection, filename, 1)
|
|
||||||
|
|
||||||
def preWizard(self):
|
def preWizard(self):
|
||||||
"""
|
"""
|
||||||
Prepare the UI for the import.
|
Prepare the UI for the import.
|
||||||
|
@ -28,8 +28,8 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, BaseListWithDnD, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||||
ItemCapabilities, translate
|
translate
|
||||||
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
|
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
|
||||||
media_item_combo_box, critical_error_message_box
|
media_item_combo_box, critical_error_message_box
|
||||||
from openlp.plugins.bibles.forms import BibleImportForm
|
from openlp.plugins.bibles.forms import BibleImportForm
|
||||||
@ -37,15 +37,6 @@ from openlp.plugins.bibles.lib import get_reference_match
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class BibleListView(BaseListWithDnD):
|
|
||||||
"""
|
|
||||||
Custom list view descendant, required for drag and drop.
|
|
||||||
"""
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
self.PluginName = u'Bibles'
|
|
||||||
BaseListWithDnD.__init__(self, parent)
|
|
||||||
|
|
||||||
|
|
||||||
class BibleMediaItem(MediaManagerItem):
|
class BibleMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
This is the custom media manager item for Bibles.
|
This is the custom media manager item for Bibles.
|
||||||
@ -54,7 +45,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def __init__(self, parent, plugin, icon):
|
def __init__(self, parent, plugin, icon):
|
||||||
self.IconPath = u'songs/song'
|
self.IconPath = u'songs/song'
|
||||||
self.ListViewWithDnD_class = BibleListView
|
|
||||||
MediaManagerItem.__init__(self, parent, plugin, icon)
|
MediaManagerItem.__init__(self, parent, plugin, icon)
|
||||||
# Place to store the search results for both bibles.
|
# Place to store the search results for both bibles.
|
||||||
self.search_results = {}
|
self.search_results = {}
|
||||||
|
@ -28,18 +28,13 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||||
Receiver, ItemCapabilities, translate, check_item_selected
|
translate, check_item_selected
|
||||||
from openlp.plugins.custom.lib import CustomXMLParser
|
from openlp.plugins.custom.lib import CustomXMLParser
|
||||||
from openlp.plugins.custom.lib.db import CustomSlide
|
from openlp.plugins.custom.lib.db import CustomSlide
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class CustomListView(BaseListWithDnD):
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
self.PluginName = u'Custom'
|
|
||||||
BaseListWithDnD.__init__(self, parent)
|
|
||||||
|
|
||||||
class CustomMediaItem(MediaManagerItem):
|
class CustomMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
This is the custom media manager item for Custom Slides.
|
This is the custom media manager item for Custom Slides.
|
||||||
@ -48,9 +43,6 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def __init__(self, parent, plugin, icon):
|
def __init__(self, parent, plugin, icon):
|
||||||
self.IconPath = u'custom/custom'
|
self.IconPath = u'custom/custom'
|
||||||
# this next is a class, not an instance of a class - it will
|
|
||||||
# be instanced by the base MediaManagerItem
|
|
||||||
self.ListViewWithDnD_class = CustomListView
|
|
||||||
MediaManagerItem.__init__(self, parent, self, icon)
|
MediaManagerItem.__init__(self, parent, self, icon)
|
||||||
self.singleServiceItem = False
|
self.singleServiceItem = False
|
||||||
# Holds information about whether the edit is remotly triggered and
|
# Holds information about whether the edit is remotly triggered and
|
||||||
|
@ -29,21 +29,14 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
|
||||||
ItemCapabilities, SettingsManager, translate, check_item_selected, \
|
SettingsManager, translate, check_item_selected, check_directory_exists, \
|
||||||
check_directory_exists, Receiver
|
Receiver
|
||||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.core.utils import AppLocation, delete_file, get_images_filter
|
from openlp.core.utils import AppLocation, delete_file, get_images_filter
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
# We have to explicitly create separate classes for each plugin
|
|
||||||
# in order for DnD to the Service manager to work correctly.
|
|
||||||
class ImageListView(BaseListWithDnD):
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
self.PluginName = u'Images'
|
|
||||||
BaseListWithDnD.__init__(self, parent)
|
|
||||||
|
|
||||||
class ImageMediaItem(MediaManagerItem):
|
class ImageMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
This is the custom media manager item for images.
|
This is the custom media manager item for images.
|
||||||
@ -52,9 +45,6 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def __init__(self, parent, plugin, icon):
|
def __init__(self, parent, plugin, icon):
|
||||||
self.IconPath = u'images/image'
|
self.IconPath = u'images/image'
|
||||||
# This next is a class, not an instance of a class - it will
|
|
||||||
# be instanced by the base MediaManagerItem.
|
|
||||||
self.ListViewWithDnD_class = ImageListView
|
|
||||||
MediaManagerItem.__init__(self, parent, self, icon)
|
MediaManagerItem.__init__(self, parent, self, icon)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
|
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
|
||||||
|
@ -29,18 +29,12 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
|
||||||
ItemCapabilities, SettingsManager, translate, check_item_selected, Receiver
|
SettingsManager, translate, check_item_selected, Receiver
|
||||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class MediaListView(BaseListWithDnD):
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
self.PluginName = u'Media'
|
|
||||||
BaseListWithDnD.__init__(self, parent)
|
|
||||||
|
|
||||||
|
|
||||||
class MediaMediaItem(MediaManagerItem):
|
class MediaMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
This is the custom media manager item for Media Slides.
|
This is the custom media manager item for Media Slides.
|
||||||
@ -50,9 +44,6 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
def __init__(self, parent, plugin, icon):
|
def __init__(self, parent, plugin, icon):
|
||||||
self.IconPath = u'images/image'
|
self.IconPath = u'images/image'
|
||||||
self.background = False
|
self.background = False
|
||||||
# this next is a class, not an instance of a class - it will
|
|
||||||
# be instanced by the base MediaManagerItem
|
|
||||||
self.ListViewWithDnD_class = MediaListView
|
|
||||||
self.PreviewFunction = QtGui.QPixmap(
|
self.PreviewFunction = QtGui.QPixmap(
|
||||||
u':/media/media_video.png').toImage()
|
u':/media/media_video.png').toImage()
|
||||||
MediaManagerItem.__init__(self, parent, self, icon)
|
MediaManagerItem.__init__(self, parent, self, icon)
|
||||||
|
@ -179,7 +179,6 @@ class ImpressController(PresentationController):
|
|||||||
desktop = self.get_com_desktop()
|
desktop = self.get_com_desktop()
|
||||||
except:
|
except:
|
||||||
log.exception(u'Failed to find an OpenOffice desktop to terminate')
|
log.exception(u'Failed to find an OpenOffice desktop to terminate')
|
||||||
finally:
|
|
||||||
if not desktop:
|
if not desktop:
|
||||||
return
|
return
|
||||||
docs = desktop.getComponents()
|
docs = desktop.getComponents()
|
||||||
|
@ -29,24 +29,13 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \
|
||||||
SettingsManager, translate, check_item_selected, Receiver, ItemCapabilities
|
translate, check_item_selected, Receiver, ItemCapabilities
|
||||||
from openlp.core.lib.ui import critical_error_message_box, media_item_combo_box
|
from openlp.core.lib.ui import critical_error_message_box, media_item_combo_box
|
||||||
from openlp.plugins.presentations.lib import MessageListener
|
from openlp.plugins.presentations.lib import MessageListener
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class PresentationListView(BaseListWithDnD):
|
|
||||||
"""
|
|
||||||
Class for the list of Presentations
|
|
||||||
|
|
||||||
We have to explicitly create separate classes for each plugin
|
|
||||||
in order for DnD to the Service manager to work correctly.
|
|
||||||
"""
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
self.PluginName = u'Presentations'
|
|
||||||
BaseListWithDnD.__init__(self, parent)
|
|
||||||
|
|
||||||
class PresentationMediaItem(MediaManagerItem):
|
class PresentationMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
This is the Presentation media manager item for Presentation Items.
|
This is the Presentation media manager item for Presentation Items.
|
||||||
@ -61,9 +50,6 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
self.controllers = controllers
|
self.controllers = controllers
|
||||||
self.IconPath = u'presentations/presentation'
|
self.IconPath = u'presentations/presentation'
|
||||||
self.Automatic = u''
|
self.Automatic = u''
|
||||||
# this next is a class, not an instance of a class - it will
|
|
||||||
# be instanced by the base MediaManagerItem
|
|
||||||
self.ListViewWithDnD_class = PresentationListView
|
|
||||||
MediaManagerItem.__init__(self, parent, self, icon)
|
MediaManagerItem.__init__(self, parent, self, icon)
|
||||||
self.message_listener = MessageListener(self)
|
self.message_listener = MessageListener(self)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
@ -87,7 +87,8 @@ class SongExportForm(OpenLPWizard):
|
|||||||
Song wizard specific signals.
|
Song wizard specific signals.
|
||||||
"""
|
"""
|
||||||
QtCore.QObject.connect(self.availableListWidget,
|
QtCore.QObject.connect(self.availableListWidget,
|
||||||
QtCore.SIGNAL(u'itemActivated(QListWidgetItem*)'), self.onItemPressed)
|
QtCore.SIGNAL(u'itemActivated(QListWidgetItem*)'),
|
||||||
|
self.onItemPressed)
|
||||||
QtCore.QObject.connect(self.searchLineEdit,
|
QtCore.QObject.connect(self.searchLineEdit,
|
||||||
QtCore.SIGNAL(u'textEdited(const QString&)'),
|
QtCore.SIGNAL(u'textEdited(const QString&)'),
|
||||||
self.onSearchLineEditChanged)
|
self.onSearchLineEditChanged)
|
||||||
@ -241,12 +242,6 @@ class SongExportForm(OpenLPWizard):
|
|||||||
self.selectedListWidget.clear()
|
self.selectedListWidget.clear()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def registerFields(self):
|
|
||||||
"""
|
|
||||||
Register song export wizard fields.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def setDefaults(self):
|
def setDefaults(self):
|
||||||
"""
|
"""
|
||||||
Set default form values for the song export wizard.
|
Set default form values for the song export wizard.
|
||||||
|
@ -442,33 +442,6 @@ class SongImportForm(OpenLPWizard):
|
|||||||
elif self.currentPage() == self.progressPage:
|
elif self.currentPage() == self.progressPage:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def getFileName(self, title, editbox, filters=u''):
|
|
||||||
"""
|
|
||||||
Opens a QFileDialog and writes the filename to the given editbox.
|
|
||||||
|
|
||||||
``title``
|
|
||||||
The title of the dialog (unicode).
|
|
||||||
|
|
||||||
``editbox``
|
|
||||||
A editbox (QLineEdit).
|
|
||||||
|
|
||||||
``filters``
|
|
||||||
The file extension filters. It should contain the file descriptions
|
|
||||||
as well as the file extensions. For example::
|
|
||||||
|
|
||||||
u'OpenLP 2.0 Databases (*.sqlite)'
|
|
||||||
"""
|
|
||||||
if filters:
|
|
||||||
filters += u';;'
|
|
||||||
filters += u'%s (*)' % UiStrings.AllFiles
|
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
|
||||||
SettingsManager.get_last_dir(self.plugin.settingsSection, 1),
|
|
||||||
filters)
|
|
||||||
if filename:
|
|
||||||
editbox.setText(filename)
|
|
||||||
SettingsManager.set_last_dir(self.plugin.settingsSection,
|
|
||||||
os.path.split(unicode(filename))[0], 1)
|
|
||||||
|
|
||||||
def getFiles(self, title, listbox, filters=u''):
|
def getFiles(self, title, listbox, filters=u''):
|
||||||
"""
|
"""
|
||||||
Opens a QFileDialog and writes the filenames to the given listbox.
|
Opens a QFileDialog and writes the filenames to the given listbox.
|
||||||
@ -671,12 +644,6 @@ class SongImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
self.removeSelectedItems(self.songBeamerFileListWidget)
|
self.removeSelectedItems(self.songBeamerFileListWidget)
|
||||||
|
|
||||||
def registerFields(self):
|
|
||||||
"""
|
|
||||||
Register song import wizard fields.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def setDefaults(self):
|
def setDefaults(self):
|
||||||
"""
|
"""
|
||||||
Set default form values for the song import wizard.
|
Set default form values for the song import wizard.
|
||||||
|
@ -31,8 +31,8 @@ import re
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from sqlalchemy.sql import or_
|
from sqlalchemy.sql import or_
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, Receiver, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||||
ItemCapabilities, translate, check_item_selected, PluginStatus
|
translate, check_item_selected, PluginStatus
|
||||||
from openlp.core.lib.ui import UiStrings
|
from openlp.core.lib.ui import UiStrings
|
||||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
||||||
SongImportForm, SongExportForm
|
SongImportForm, SongExportForm
|
||||||
@ -42,12 +42,6 @@ from openlp.core.lib.searchedit import SearchEdit
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class SongListView(BaseListWithDnD):
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
self.PluginName = u'Songs'
|
|
||||||
BaseListWithDnD.__init__(self, parent)
|
|
||||||
|
|
||||||
|
|
||||||
class SongMediaItem(MediaManagerItem):
|
class SongMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
This is the custom media manager item for Songs.
|
This is the custom media manager item for Songs.
|
||||||
@ -56,7 +50,6 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def __init__(self, parent, plugin, icon):
|
def __init__(self, parent, plugin, icon):
|
||||||
self.IconPath = u'songs/song'
|
self.IconPath = u'songs/song'
|
||||||
self.ListViewWithDnD_class = SongListView
|
|
||||||
MediaManagerItem.__init__(self, parent, self, icon)
|
MediaManagerItem.__init__(self, parent, self, icon)
|
||||||
self.edit_song_form = EditSongForm(self, self.parent.manager)
|
self.edit_song_form = EditSongForm(self, self.parent.manager)
|
||||||
self.openLyrics = OpenLyrics(self.parent.manager)
|
self.openLyrics = OpenLyrics(self.parent.manager)
|
||||||
|
Loading…
Reference in New Issue
Block a user