More updates

This commit is contained in:
Tim Bentley 2010-09-26 07:20:24 +01:00
commit 271d3b4af5
3 changed files with 40 additions and 2 deletions

View File

@ -37,6 +37,7 @@ class HideMode(object):
Theme = 2 Theme = 2
Screen = 3 Screen = 3
from filerenameform import FileRenameForm
from maindisplay import MainDisplay from maindisplay import MainDisplay
from slidecontroller import HideMode from slidecontroller import HideMode
from servicenoteform import ServiceNoteForm from servicenoteform import ServiceNoteForm

View File

@ -27,7 +27,6 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from exceptiondialog import Ui_ExceptionDialog from exceptiondialog import Ui_ExceptionDialog
from openlp.core.lib import translate
class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
""" """

View File

@ -32,7 +32,7 @@ import logging
from xml.etree.ElementTree import ElementTree, XML from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.ui import AmendThemeForm from openlp.core.ui import AmendThemeForm, FileRenameForm
from openlp.core.theme import Theme from openlp.core.theme import Theme
from openlp.core.lib import OpenLPToolbar, context_menu_action, \ from openlp.core.lib import OpenLPToolbar, context_menu_action, \
ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \ ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \
@ -54,6 +54,7 @@ class ThemeManager(QtGui.QWidget):
self.layout.setSpacing(0) self.layout.setSpacing(0)
self.layout.setMargin(0) self.layout.setMargin(0)
self.amendThemeForm = AmendThemeForm(self) self.amendThemeForm = AmendThemeForm(self)
self.fileRenameForm = FileRenameForm(self)
self.toolbar = OpenLPToolbar(self) self.toolbar = OpenLPToolbar(self)
self.toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('OpenLP.ThemeManager', 'New Theme'), translate('OpenLP.ThemeManager', 'New Theme'),
@ -93,6 +94,16 @@ class ThemeManager(QtGui.QWidget):
u':/themes/theme_edit.png', u':/themes/theme_edit.png',
translate('OpenLP.ThemeManager', '&Edit Theme'), translate('OpenLP.ThemeManager', '&Edit Theme'),
self.onEditTheme)) self.onEditTheme))
self.themeListWidget.addAction(
context_menu_action(self.themeListWidget,
u':/themes/theme_edit.png',
translate('OpenLP.ThemeManager', '&Rename Theme'),
self.onRenameTheme))
self.themeListWidget.addAction(
context_menu_action(self.themeListWidget,
u':/themes/theme_edit.png',
translate('OpenLP.ThemeManager', '&Copy Theme'),
self.onCopyTheme))
self.themeListWidget.addAction( self.themeListWidget.addAction(
context_menu_separator(self.themeListWidget)) context_menu_separator(self.themeListWidget))
self.themeListWidget.addAction( self.themeListWidget.addAction(
@ -189,6 +200,33 @@ class ThemeManager(QtGui.QWidget):
self.saveThemeName = u'' self.saveThemeName = u''
self.amendThemeForm.exec_() self.amendThemeForm.exec_()
def onRenameTheme(self):
"""
Renames an existing theme to a new name
"""
item = self.themeListWidget.currentItem()
oldThemeName = unicode(item.text())
self.fileRenameForm.FileNameEdit.setText(oldThemeName)
if self.fileRenameForm.exec_():
newThemeName = self.fileRenameForm.FileNameEdit.text()
print oldThemeName, newThemeName
def onCopyTheme(self):
"""
Copies an existing theme to a new name
"""
item = self.themeListWidget.currentItem()
oldThemeName = unicode(item.text())
self.fileRenameForm.FileNameEdit.setText(oldThemeName)
if self.fileRenameForm.exec_():
newThemeName = self.fileRenameForm.FileNameEdit.text()
print oldThemeName, newThemeName
print self.path
source = os.path.join(self.path, oldThemeName)
for files in os.walk(source):
for name in files[2]:
print name
def onEditTheme(self): def onEditTheme(self):
""" """
Loads the settings for the theme that is to be edited and launches the Loads the settings for the theme that is to be edited and launches the