This commit is contained in:
Tim Bentley 2010-04-30 15:27:05 +01:00
commit 61a1693ce0
26 changed files with 103 additions and 101 deletions

View File

@ -70,11 +70,6 @@ class MediaManagerItem(QtGui.QWidget):
The user visible name for a plugin which should use a suitable
translation function.
``self.SettingsSection``
The section in the configuration where the items in the media
manager are stored. This could potentially be
``self.PluginNameShort.lower()``.
``self.OnNewPrompt``
Defaults to *'Select Image(s)'*.
@ -103,6 +98,7 @@ class MediaManagerItem(QtGui.QWidget):
"""
QtGui.QWidget.__init__(self)
self.parent = parent
self.settings_section = title.lower()
if type(icon) is QtGui.QIcon:
self.icon = icon
elif type(icon) is types.StringType:
@ -335,20 +331,20 @@ class MediaManagerItem(QtGui.QWidget):
def onFileClick(self):
files = QtGui.QFileDialog.getOpenFileNames(
self, self.OnNewPrompt,
SettingsManager.get_last_dir(self.SettingsSection),
SettingsManager.get_last_dir(self.settings_section),
self.OnNewFileMasks)
log.info(u'New files(s) %s', unicode(files))
if files:
self.loadList(files)
dir, filename = os.path.split(unicode(files[0]))
SettingsManager.set_last_dir(self.SettingsSection, dir)
SettingsManager.set_list(
self.SettingsSection, self.SettingsSection, self.getFileList())
dir = os.path.split(unicode(files[0]))[0]
SettingsManager.set_last_dir(self.settings_section, dir)
SettingsManager.set_list(self.settings_section,
self.settings_section, self.getFileList())
def getFileList(self):
count = 0
filelist = []
while count < self.ListView.count():
while count < self.ListView.count():
bitem = self.ListView.item(count)
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
filelist.append(filename)

View File

@ -40,7 +40,7 @@ class SettingsTab(QtGui.QWidget):
QtGui.QWidget.__init__(self)
self.tabTitle = title
self.tabTitleVisible = None
self.settingsSection = self.tabTitle.lower()
self.settings_section = self.tabTitle.lower()
self.setupUi()
self.retranslateUi()
self.initialise()

View File

@ -42,7 +42,7 @@ class GeneralTab(SettingsTab):
If not set before default to last screen.
"""
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
self.MonitorNumber = settings.value(u'monitor',
QtCore.QVariant(self.screens.monitor_number)).toInt()[0]
self.screens.set_current_display(self.MonitorNumber)
@ -229,7 +229,7 @@ class GeneralTab(SettingsTab):
def load(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
for screen in self.screens.screen_list:
screen_name = u'%s %d' % (self.trUtf8('Screen'),
screen[u'number'] + 1)
@ -268,7 +268,7 @@ class GeneralTab(SettingsTab):
def save(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
settings.setValue(u'monitor', QtCore.QVariant(self.MonitorNumber))
settings.setValue(u'display on monitor',
QtCore.QVariant(self.DisplayOnMonitor))

View File

@ -424,8 +424,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QMainWindow.__init__(self)
self.screens = screens
self.applicationVersion = applicationVersion
self.generalSettingsSection = u'general'
self.uiSettingsSection = u'user interface'
# Set up settings sections for the main application
# (not for use by plugins)
self.ui_settings_section = u'user interface'
self.general_settings_section = u'general'
self.service_settings_section = u'servicemanager'
self.songs_settings_section = u'songs'
self.serviceNotSaved = False
self.settingsmanager = SettingsManager(screens)
self.displayManager = DisplayManager(screens)
@ -571,7 +575,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if self.displayManager.mainDisplay.isVisible():
self.displayManager.mainDisplay.setFocus()
self.activateWindow()
if QtCore.QSettings().value(self.generalSettingsSection + u'/auto open',
if QtCore.QSettings().value(
self.general_settings_section + u'/auto open',
QtCore.QVariant(False)).toBool():
self.ServiceManagerContents.onLoadService(True)
@ -581,7 +586,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Triggered by delay thread.
"""
settings = QtCore.QSettings()
settings.beginGroup(self.generalSettingsSection)
settings.beginGroup(self.general_settings_section)
if settings.value(u'screen blank', QtCore.QVariant(False)).toBool() \
and settings.value(u'blank warning', QtCore.QVariant(False)).toBool():
self.LiveController.onBlankDisplay(True)
@ -726,9 +731,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def loadSettings(self):
log.debug(u'Loading QSettings')
settings = QtCore.QSettings()
self.recentFiles = settings.value(
self.generalSettingsSection + u'/recent files').toStringList()
settings.beginGroup(self.uiSettingsSection)
settings.beginGroup(self.general_settings_section)
self.recentFiles = settings.value(u'recent files').toStringList()
settings.endGroup()
settings.beginGroup(self.ui_settings_section)
self.move(settings.value(u'main window position',
QtCore.QVariant(QtCore.QPoint(0, 0))).toPoint())
self.restoreGeometry(
@ -739,11 +745,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def saveSettings(self):
log.debug(u'Saving QSettings')
settings = QtCore.QSettings()
settings.beginGroup(self.general_settings_section)
recentFiles = QtCore.QVariant(self.recentFiles) \
if self.recentFiles else QtCore.QVariant()
settings.setValue(
self.generalSettingsSection + u'/recent files', recentFiles)
settings.beginGroup(self.uiSettingsSection)
settings.setValue(u'recent files', recentFiles)
settings.endGroup()
settings.beginGroup(self.ui_settings_section)
settings.setValue(u'main window position',
QtCore.QVariant(self.pos()))
settings.setValue(u'main window state',
@ -773,7 +780,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def addRecentFile(self, filename):
recentFileCount = QtCore.QSettings().value(
self.generalSettingsSection + u'/max recent files',
self.general_settings_section + u'/max recent files',
QtCore.QVariant(4)).toInt()[0]
if filename and not self.recentFiles.contains(filename):
self.recentFiles.prepend(QtCore.QString(filename))

View File

@ -45,18 +45,17 @@ class MediaDockManager(object):
log.debug(u'Inserting %s dock' % media_item.title)
match = False
for dock_index in range(0, self.media_dock.count()):
if self.media_dock.widget(dock_index).SettingsSection == \
if self.media_dock.widget(dock_index).settings_section == \
media_item.title.lower():
match = True
break
if not match:
self.media_dock.addItem(media_item, icon, media_item.title)
def remove_dock(self, name):
log.debug(u'remove %s dock' % name)
for dock_index in range(0, self.media_dock.count()):
if self.media_dock.widget(dock_index):
if self.media_dock.widget(dock_index).SettingsSection == name:
if self.media_dock.widget(dock_index).settings_section == name:
self.media_dock.widget(dock_index).hide()
self.media_dock.removeItem(dock_index)

View File

@ -1,3 +1,4 @@
import os.path
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
@ -99,8 +100,6 @@ class ServiceManager(QtGui.QWidget):
"""
QtGui.QWidget.__init__(self)
self.parent = parent
self.settingsSection = u'servicemanager'
self.generalSettingsSection = self.parent.generalSettingsSection
self.serviceItems = []
self.serviceName = u''
self.droppos = 0
@ -193,7 +192,7 @@ class ServiceManager(QtGui.QWidget):
QtCore.SIGNAL(u'config_updated'), self.regenerateServiceItems)
# Last little bits of setting up
self.service_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/service theme',
self.parent.service_settings_section + u'/service theme',
QtCore.QVariant(u'')).toString())
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
#build the context menu
@ -406,7 +405,7 @@ class ServiceManager(QtGui.QWidget):
Clear the list to create a new service
"""
if self.parent.serviceNotSaved and QtCore.QSettings().value(
self.generalSettingsSection + u'/save prompt',
self.parent.general_settings_section + u'/save prompt',
QtCore.QVariant(False)).toBool():
ret = QtGui.QMessageBox.question(self,
self.trUtf8('Save Changes to Service?'),
@ -491,17 +490,20 @@ class ServiceManager(QtGui.QWidget):
if not quick or self.isNew:
filename = QtGui.QFileDialog.getSaveFileName(self,
self.trUtf8(u'Save Service'),
SettingsManager.get_last_dir(self.settingsSection),
SettingsManager.get_last_dir(self.parent.service_settings_section),
self.trUtf8(u'OpenLP Service Files (*.osz)'))
else:
filename = SettingsManager.get_last_dir(self.settingsSection)
filename = SettingsManager.get_last_dir(
self.parent.service_settings_section)
if filename:
splittedFile = filename.split(u'.')
if splittedFile[-1] != u'osz':
filename = filename + u'.osz'
filename = unicode(filename)
self.isNew = False
SettingsManager.set_last_dir(self.settingsSection, filename)
SettingsManager.set_last_dir(
self.parent.service_settings_section,
os.path.split(filename)[0])
service = []
servicefile = filename + u'.osd'
zip = None
@ -542,12 +544,13 @@ class ServiceManager(QtGui.QWidget):
def onLoadService(self, lastService=False):
if lastService:
filename = SettingsManager.get_last_dir(self.settingsSection)
filename = SettingsManager.get_last_dir(
self.parent.service_settings_section)
else:
filename = QtGui.QFileDialog.getOpenFileName(
self, self.trUtf8('Open Service'),
SettingsManager.get_last_dir(self.settingsSection),
u'Services (*.osz)')
SettingsManager.get_last_dir(
self.parent.service_settings_section), u'Services (*.osz)')
self.loadService(filename)
def loadService(self, filename=None):
@ -576,7 +579,9 @@ class ServiceManager(QtGui.QWidget):
filename = unicode(filename)
name = filename.split(os.path.sep)
if filename:
SettingsManager.set_last_dir(self.settingsSection, filename)
SettingsManager.set_last_dir(
self.parent.service_settings_section,
os.path.split(filename)[0])
zip = None
f = None
try:
@ -645,7 +650,8 @@ class ServiceManager(QtGui.QWidget):
"""
self.service_theme = unicode(self.ThemeComboBox.currentText())
self.parent.RenderManager.set_service_theme(self.service_theme)
QtCore.QSettings().setValue(self.settingsSection + u'/service theme',
QtCore.QSettings().setValue(
self.parent.service_settings_section + u'/service theme',
QtCore.QVariant(self.service_theme))
self.regenerateServiceItems()
@ -729,7 +735,7 @@ class ServiceManager(QtGui.QWidget):
self.parent.LiveController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)
if QtCore.QSettings().value(
self.generalSettingsSection + u'/auto preview',
self.parent.general_settings_section + u'/auto preview',
QtCore.QVariant(False)).toBool():
item += 1
if self.serviceItems and item < len(self.serviceItems) and \

View File

@ -84,8 +84,6 @@ class SlideController(QtGui.QWidget):
"""
QtGui.QWidget.__init__(self, parent)
self.settingsmanager = settingsmanager
self.generalSettingsSection = u'general'
self.songsSettingsSection = u'songs'
self.isLive = isLive
self.parent = parent
self.mainDisplay = self.parent.displayManager.mainDisplay
@ -398,7 +396,7 @@ class SlideController(QtGui.QWidget):
if item.is_text():
self.Toolbar.makeWidgetsInvisible(self.loop_list)
if QtCore.QSettings().value(
self.songsSettingsSection + u'/show songbar',
self.parent.songs_settings_section + u'/show songbar',
QtCore.QVariant(True)).toBool() and len(self.slideList) > 0:
self.Toolbar.makeWidgetsVisible([u'Song Menu'])
if item.is_capable(ItemCapabilities.AllowsLoop) and \
@ -587,7 +585,7 @@ class SlideController(QtGui.QWidget):
self.hideButton.setChecked(False)
self.themeButton.setChecked(False)
QtCore.QSettings().setValue(
self.generalSettingsSection + u'/screen blank',
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(checked))
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Blank)

View File

@ -47,7 +47,7 @@ class ThemeManager(QtGui.QWidget):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.parent = parent
self.settingsSection = u'themes'
self.settings_section = u'themes'
self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0)
self.Layout.setMargin(0)
@ -106,14 +106,14 @@ class ThemeManager(QtGui.QWidget):
QtCore.SIGNAL(u'theme_update_global'), self.changeGlobalFromTab)
#Variables
self.themelist = []
self.path = AppLocation.get_section_data_path(self.settingsSection)
self.path = AppLocation.get_section_data_path(self.settings_section)
self.checkThemesExists(self.path)
self.thumbPath = os.path.join(self.path, u'thumbnails')
self.checkThemesExists(self.thumbPath)
self.amendThemeForm.path = self.path
# Last little bits of setting up
self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme',
self.settings_section + u'/global theme',
QtCore.QVariant(u'')).toString())
def changeGlobalFromTab(self, themeName):
@ -147,7 +147,7 @@ class ThemeManager(QtGui.QWidget):
name = u'%s (%s)' % (self.global_theme, self.trUtf8('default'))
self.ThemeListWidget.item(count).setText(name)
QtCore.QSettings().setValue(
self.settingsSection + u'/global theme',
self.settings_section + u'/global theme',
QtCore.QVariant(self.global_theme))
Receiver.send_message(u'theme_update_global', self.global_theme)
self.pushThemes()
@ -170,7 +170,7 @@ class ThemeManager(QtGui.QWidget):
def onDeleteTheme(self):
self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme',
self.settings_section + u'/global theme',
QtCore.QVariant(u'')).toString())
item = self.ThemeListWidget.currentItem()
if item:
@ -224,10 +224,10 @@ class ThemeManager(QtGui.QWidget):
theme = unicode(item.data(QtCore.Qt.UserRole).toString())
path = QtGui.QFileDialog.getExistingDirectory(self,
unicode(self.trUtf8('Save Theme - (%s)')) % theme,
SettingsManager.get_last_dir(self.settingsSection, 1))
SettingsManager.get_last_dir(self.settings_section, 1))
path = unicode(path)
if path:
SettingsManager.set_last_dir(self.settingsSection, path, 1)
SettingsManager.set_last_dir(self.settings_section, path, 1)
themePath = os.path.join(path, theme + u'.theme')
zip = None
try:
@ -247,12 +247,12 @@ class ThemeManager(QtGui.QWidget):
def onImportTheme(self):
files = QtGui.QFileDialog.getOpenFileNames(
self, self.trUtf8('Select Theme Import File'),
SettingsManager.get_last_dir(self.settingsSection), u'Theme (*.*)')
SettingsManager.get_last_dir(self.settings_section), u'Theme (*.*)')
log.info(u'New Themes %s', unicode(files))
if files:
for file in files:
SettingsManager.set_last_dir(
self.settingsSection, unicode(file))
self.settings_section, unicode(file))
self.unzipTheme(file, self.path)
self.loadThemes()

View File

@ -124,7 +124,7 @@ class ThemesTab(SettingsTab):
def load(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
self.theme_level = settings.value(
u'theme level', QtCore.QVariant(ThemeLevel.Global)).toInt()[0]
self.global_theme = unicode(settings.value(
@ -139,7 +139,7 @@ class ThemesTab(SettingsTab):
def save(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
settings.setValue(u'theme level',
QtCore.QVariant(self.theme_level))
settings.setValue(u'global theme',
@ -179,7 +179,7 @@ class ThemesTab(SettingsTab):
"""
#reload as may have been triggered by the ThemeManager
self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme',
self.settings_section + u'/global theme',
QtCore.QVariant(u'')).toString())
self.DefaultComboBox.clear()
for theme in theme_list:

View File

@ -28,8 +28,8 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus
from openlp.plugins.alerts.lib import AlertsManager, DBManager
from openlp.plugins.alerts.forms import AlertsTab, AlertForm
from openlp.plugins.alerts.lib import AlertsManager, AlertsTab, DBManager
from openlp.plugins.alerts.forms import AlertForm
log = logging.getLogger(__name__)

View File

@ -23,5 +23,4 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from alertstab import AlertsTab
from alertform import AlertForm

View File

@ -24,4 +24,5 @@
###############################################################################
from alertsmanager import AlertsManager
from alertstab import AlertsTab
from manager import DBManager

View File

@ -229,7 +229,7 @@ class AlertsTab(SettingsTab):
def load(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
self.timeout = settings.value(u'timeout', QtCore.QVariant(5)).toInt()[0]
self.font_color = unicode(settings.value(
u'font color', QtCore.QVariant(u'#ffffff')).toString())
@ -260,7 +260,7 @@ class AlertsTab(SettingsTab):
def save(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
self.font_face = self.FontComboBox.currentFont().family()
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
settings.setValue(u'font color', QtCore.QVariant(self.font_color))

View File

@ -189,7 +189,7 @@ class BiblesTab(SettingsTab):
def load(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
self.show_new_chapters = settings.value(
u'display new chapter', QtCore.QVariant(False)).toBool()
self.display_style = settings.value(
@ -208,7 +208,7 @@ class BiblesTab(SettingsTab):
def save(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
settings.setValue(u'display new chapter',
QtCore.QVariant(self.show_new_chapters))
settings.setValue(u'display brackets',

View File

@ -54,7 +54,6 @@ class BibleMediaItem(MediaManagerItem):
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Bible'
self.SettingsSection = title.lower()
self.IconPath = u'songs/song'
self.ListViewWithDnD_class = BibleListView
self.lastReference = []
@ -276,7 +275,7 @@ class BibleMediaItem(MediaManagerItem):
self.SearchProgress.setObjectName(u'SearchProgress')
def configUpdated(self):
if QtCore.QSettings().value(self.SettingsSection + u'/dual bibles',
if QtCore.QSettings().value(self.settings_section + u'/dual bibles',
QtCore.QVariant(False)).toBool():
self.AdvancedSecondBibleLabel.setVisible(True)
self.AdvancedSecondBibleComboBox.setVisible(True)

View File

@ -67,10 +67,10 @@ class CustomTab(SettingsTab):
def load(self):
self.displayFooter = QtCore.QSettings().value(
self.settingsSection + u'/display footer',
self.settings_section + u'/display footer',
QtCore.QVariant(True)).toBool()
self.DisplayFooterCheckBox.setChecked(self.displayFooter)
def save(self):
QtCore.QSettings().setValue(self.settingsSection + u'/display footer',
QtCore.QSettings().setValue(self.settings_section + u'/display footer',
QtCore.QVariant(self.displayFooter))

View File

@ -45,7 +45,6 @@ class CustomMediaItem(MediaManagerItem):
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Custom'
self.SettingsSection = title.lower()
self.IconPath = u'custom/custom'
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
@ -164,7 +163,7 @@ class CustomMediaItem(MediaManagerItem):
service_item.title = title
for slide in raw_slides:
service_item.add_from_text(slide[:30], slide)
if QtCore.QSettings().value(self.SettingsSection + u'/display footer',
if QtCore.QSettings().value(self.settings_section + u'/display footer',
QtCore.QVariant(True)).toBool() or credit:
raw_footer.append(title + u' ' + credit)
else:

View File

@ -72,12 +72,12 @@ class ImageTab(SettingsTab):
def load(self):
self.loop_delay = QtCore.QSettings().value(
self.settingsSection + u'/loop delay',
self.settings_section + u'/loop delay',
QtCore.QVariant(5)).toInt()[0]
self.TimeoutSpinBox.setValue(self.loop_delay)
def save(self):
QtCore.QSettings().setValue(self.settingsSection + u'/loop delay',
QtCore.QSettings().setValue(self.settings_section + u'/loop delay',
QtCore.QVariant(self.loop_delay))
Receiver.send_message(u'slidecontroller_live_spin_delay',
self.loop_delay)

View File

@ -49,7 +49,6 @@ class ImageMediaItem(MediaManagerItem):
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Image'
self.SettingsSection = title.lower()
self.IconPath = u'images/image'
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
@ -78,12 +77,12 @@ class ImageMediaItem(MediaManagerItem):
QtGui.QAbstractItemView.ExtendedSelection)
self.ListView.setIconSize(QtCore.QSize(88,50))
self.servicePath = os.path.join(
AppLocation.get_section_data_path(self.SettingsSection),
AppLocation.get_section_data_path(self.settings_section),
u'thumbnails')
if not os.path.exists(self.servicePath):
os.mkdir(self.servicePath)
self.loadList(SettingsManager.load_list(
self.SettingsSection, self.SettingsSection))
self.settings_section, self.settings_section))
def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self)
@ -122,8 +121,8 @@ class ImageMediaItem(MediaManagerItem):
#if not present do not worry
pass
self.ListView.takeItem(item.row())
SettingsManager.set_list(self.SettingsSection,\
self.SettingsSection, self.getFileList())
SettingsManager.set_list(self.settings_section,
self.settings_section, self.getFileList())
def loadList(self, list):
for file in list:

View File

@ -47,7 +47,6 @@ class MediaMediaItem(MediaManagerItem):
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Media'
self.IconPath = u'images/image'
self.SettingsSection = title.lower()
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = MediaListView
@ -90,15 +89,15 @@ class MediaMediaItem(MediaManagerItem):
QtGui.QAbstractItemView.ExtendedSelection)
self.ListView.setIconSize(QtCore.QSize(88,50))
self.loadList(SettingsManager.load_list(
self.SettingsSection, self.SettingsSection))
self.settings_section, self.settings_section))
def onDeleteClick(self):
item = self.ListView.currentItem()
if item:
row = self.ListView.row(item)
self.ListView.takeItem(row)
SettingsManager.set_list(self.SettingsSection, \
self.SettingsSection, self.getFileList())
SettingsManager.set_list(self.settings_section,
self.settings_section, self.getFileList())
def loadList(self, list):
for file in list:

View File

@ -52,7 +52,6 @@ class PresentationMediaItem(MediaManagerItem):
def __init__(self, parent, icon, title, controllers):
self.controllers = controllers
self.PluginNameShort = u'Presentation'
self.SettingsSection = title.lower()
self.IconPath = u'presentations/presentation'
self.Automatic = u''
# this next is a class, not an instance of a class - it will
@ -107,11 +106,12 @@ class PresentationMediaItem(MediaManagerItem):
def initialise(self):
self.servicePath = os.path.join(
AppLocation.get_section_data_path(self.SettingsSection),
AppLocation.get_section_data_path(self.settings_section),
u'thumbnails')
if not os.path.exists(self.servicePath):
os.mkdir(self.servicePath)
list = SettingsManager.load_list(self.SettingsSection, u'presentations')
list = SettingsManager.load_list(
self.settings_section, u'presentations')
self.loadList(list)
for item in self.controllers:
#load the drop down selection
@ -139,11 +139,13 @@ class PresentationMediaItem(MediaManagerItem):
icon = None
for controller in self.controllers:
thumbPath = os.path.join(
AppLocation.get_section_data_path(self.SettingsSection),
AppLocation.get_section_data_path(
self.settings_section),
u'thumbnails', controller, filename)
thumb = os.path.join(thumbPath, u'slide1.png')
preview = os.path.join(
AppLocation.get_section_data_path(self.SettingsSection),
AppLocation.get_section_data_path(
self.settings_section),
controller, u'thumbnails', filename, u'slide1.png')
if os.path.exists(preview):
if os.path.exists(thumb):
@ -167,8 +169,8 @@ class PresentationMediaItem(MediaManagerItem):
if item:
row = self.ListView.row(item)
self.ListView.takeItem(row)
SettingsManager.set_list(self.SettingsSection,\
self.SettingsSection, self.getFileList())
SettingsManager.set_list(self.settings_section,
self.settings_section, self.getFileList())
filepath = unicode((item.data(QtCore.Qt.UserRole)).toString())
#not sure of this has errors
#John please can you look at .

View File

@ -101,7 +101,7 @@ class PresentationTab(SettingsTab):
if controller.available:
checkbox = self.PresenterCheckboxes[controller.name]
checkbox.setChecked(QtCore.QSettings().value(
self.settingsSection + u'/' + controller.name,
self.settings_section + u'/' + controller.name,
QtCore.QVariant(0)).toInt()[0])
def save(self):
@ -109,5 +109,5 @@ class PresentationTab(SettingsTab):
controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name]
QtCore.QSettings().setValue(
self.settingsSection + u'/' + controller.name,
self.settings_section + u'/' + controller.name,
QtCore.QVariant(checkbox.checkState()))

View File

@ -57,9 +57,9 @@ class RemoteTab(SettingsTab):
def load(self):
self.RemotePortSpinBox.setValue(
QtCore.QSettings().value(self.settingsSection + u'/remote port',
QtCore.QSettings().value(self.settings_section + u'/remote port',
QtCore.QVariant(4316)).toInt()[0])
def save(self):
QtCore.QSettings().setValue(self.settingsSection + u'/remote port',
QtCore.QSettings().setValue(self.settings_section + u'/remote port',
QtCore.QVariant(self.RemotePortSpinBox.value()))

View File

@ -46,7 +46,6 @@ class SongMediaItem(MediaManagerItem):
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Song'
self.SettingsSection = title.lower()
self.IconPath = u'songs/song'
self.ListViewWithDnD_class = SongListView
MediaManagerItem.__init__(self, parent, icon, title)
@ -134,7 +133,7 @@ class SongMediaItem(MediaManagerItem):
def configUpdated(self):
self.searchAsYouType = QtCore.QSettings().value(
self.SettingsSection + u'/search as type',
self.settings_section + u'/search as type',
QtCore.QVariant(u'False')).toBool()
def retranslateUi(self):

View File

@ -81,7 +81,7 @@ class SongsTab(SettingsTab):
def load(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
self.song_search = settings.value(
u'search as type', QtCore.QVariant(False)).toBool()
self.song_bar = settings.value(
@ -92,7 +92,7 @@ class SongsTab(SettingsTab):
def save(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
settings.beginGroup(self.settings_section)
settings.setValue(u'search as type', QtCore.QVariant(self.song_search))
settings.setValue(u'display songbar', QtCore.QVariant(self.song_bar))
settings.endGroup()

View File

@ -45,7 +45,6 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
"""
QtGui.QDialog.__init__(self, None)
self.parent = parent
self.settingsSection = u'songusage'
self.setupUi(self)
def initialise(self):
@ -57,15 +56,15 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
self.FromDate.setSelectedDate(fromDate)
self.ToDate.setSelectedDate(toDate)
self.FileLineEdit.setText(
SettingsManager.get_last_dir(self.settingsSection, 1))
SettingsManager.get_last_dir(self.parent.settings_section, 1))
def defineOutputLocation(self):
path = QtGui.QFileDialog.getExistingDirectory(self,
self.trUtf8('Output File Location'),
SettingsManager.get_last_dir(self.settingsSection, 1))
SettingsManager.get_last_dir(self.parent.settings_section, 1))
path = unicode(path)
if path != u'':
SettingsManager.set_last_dir(self.settingsSection, path, 1)
SettingsManager.set_last_dir(self.parent.settings_section, path, 1)
self.FileLineEdit.setText(path)
def accept(self):