clean ups

This commit is contained in:
Andreas Preikschat 2012-07-07 16:54:14 +02:00
parent 6f353ab01d
commit 3c69631b59
8 changed files with 14 additions and 28 deletions

View File

@ -39,7 +39,8 @@ log = logging.getLogger(__name__)
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \ from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \
ItemCapabilities, SettingsManager, translate, str_to_bool ItemCapabilities, SettingsManager, translate, str_to_bool, \
check_directory_exists
from openlp.core.lib.theme import ThemeLevel from openlp.core.lib.theme import ThemeLevel
from openlp.core.lib.settings import Settings from openlp.core.lib.settings import Settings
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
@ -556,8 +557,7 @@ class ServiceManager(QtGui.QWidget):
audio_from = os.path.join(self.servicePath, audio_from) audio_from = os.path.join(self.servicePath, audio_from)
save_file = os.path.join(self.servicePath, audio_to) save_file = os.path.join(self.servicePath, audio_to)
save_path = os.path.split(save_file)[0] save_path = os.path.split(save_file)[0]
if not os.path.exists(save_path): check_directory_exists(save_path)
os.makedirs(save_path)
if not os.path.exists(save_file): if not os.path.exists(save_file):
shutil.copy(audio_from, save_file) shutil.copy(audio_from, save_file)
zip.write(audio_from, audio_to.encode(u'utf-8')) zip.write(audio_from, audio_to.encode(u'utf-8'))

View File

@ -227,9 +227,6 @@ class ImpressDocument(PresentationDocument):
OpenOffice task started earlier. If OpenOffice is not present is is OpenOffice task started earlier. If OpenOffice is not present is is
started. Once the environment is available the presentation is loaded started. Once the environment is available the presentation is loaded
and started. and started.
``presentation``
The file name of the presentatios to the run.
""" """
log.debug(u'Load Presentation OpenOffice') log.debug(u'Load Presentation OpenOffice')
if os.name == u'nt': if os.name == u'nt':

View File

@ -119,10 +119,7 @@ class PowerpointDocument(PresentationDocument):
def load_presentation(self): def load_presentation(self):
""" """
Called when a presentation is added to the SlideController. Called when a presentation is added to the SlideController.
Opens the PowerPoint file using the process created earlier Opens the PowerPoint file using the process created earlier.
``presentation``
The file name of the presentations to run.
""" """
log.debug(u'load_presentation') log.debug(u'load_presentation')
if not self.controller.process or not self.controller.process.Visible: if not self.controller.process or not self.controller.process.Visible:

View File

@ -118,9 +118,6 @@ class PptviewDocument(PresentationDocument):
Called when a presentation is added to the SlideController. Called when a presentation is added to the SlideController.
It builds the environment, starts communcations with the background It builds the environment, starts communcations with the background
PptView task started earlier. PptView task started earlier.
``presentation``
The file name of the presentations to run.
""" """
log.debug(u'LoadPresentation') log.debug(u'LoadPresentation')
renderer = self.controller.plugin.renderer renderer = self.controller.plugin.renderer

View File

@ -47,7 +47,7 @@ class PresentationDocument(object):
**Hook Functions** **Hook Functions**
``load_presentation(presentation)`` ``load_presentation()``
Load a presentation file Load a presentation file
``close_presentation()`` ``close_presentation()``
@ -104,11 +104,8 @@ class PresentationDocument(object):
def load_presentation(self): def load_presentation(self):
""" """
Called when a presentation is added to the SlideController. Called when a presentation is added to the SlideController. Loads the
Loads the presentation and starts it presentation and starts it.
``presentation``
The file name of the presentations to the run.
Returns False if the file could not be opened Returns False if the file could not be opened
""" """

View File

@ -34,7 +34,7 @@ import shutil
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, \ from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, \
create_separated_list create_separated_list, check_directory_exists
from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, \ from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, \
critical_error_message_box, find_and_set_in_combo_box critical_error_message_box, find_and_set_in_combo_box
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
@ -880,8 +880,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
save_path = os.path.join( save_path = os.path.join(
AppLocation.get_section_data_path(self.mediaitem.plugin.name), AppLocation.get_section_data_path(self.mediaitem.plugin.name),
'audio', str(self.song.id)) 'audio', str(self.song.id))
if not os.path.exists(save_path): check_directory_exists(save_path)
os.makedirs(save_path)
self.song.media_files = [] self.song.media_files = []
files = [] files = []
for row in xrange(self.audioListWidget.count()): for row in xrange(self.audioListWidget.count()):

View File

@ -36,7 +36,8 @@ from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import or_ from sqlalchemy.sql import or_
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
translate, check_item_selected, PluginStatus, create_separated_list translate, check_item_selected, PluginStatus, create_separated_list, \
check_directory_exists
from openlp.core.lib.ui import UiStrings, create_widget_action from openlp.core.lib.ui import UiStrings, create_widget_action
from openlp.core.lib.settings import Settings from openlp.core.lib.settings import Settings
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
@ -89,8 +90,7 @@ class SongMediaItem(MediaManagerItem):
dest_file = os.path.join( dest_file = os.path.join(
AppLocation.get_section_data_path(self.plugin.name), AppLocation.get_section_data_path(self.plugin.name),
u'audio', str(song.id), os.path.split(bga)[1]) u'audio', str(song.id), os.path.split(bga)[1])
if not os.path.exists(os.path.split(dest_file)[0]): check_directory_exists(os.path.split(dest_file)[0])
os.makedirs(os.path.split(dest_file)[0])
shutil.copyfile(os.path.join( shutil.copyfile(os.path.join(
AppLocation.get_section_data_path( AppLocation.get_section_data_path(
u'servicemanager'), bga), u'servicemanager'), bga),

View File

@ -33,7 +33,7 @@ import os
from PyQt4 import QtCore from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate from openlp.core.lib import Receiver, translate, check_directory_exists
from openlp.core.ui.wizard import WizardStrings from openlp.core.ui.wizard import WizardStrings
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from openlp.plugins.songs.lib import clean_song, VerseType from openlp.plugins.songs.lib import clean_song, VerseType
@ -388,8 +388,7 @@ class SongImport(QtCore.QObject):
AppLocation.get_section_data_path( AppLocation.get_section_data_path(
self.importWizard.plugin.name), self.importWizard.plugin.name),
'audio', str(song_id)) 'audio', str(song_id))
if not os.path.exists(self.save_path): check_directory_exists(self.save_path)
os.makedirs(self.save_path)
if not filename.startswith(self.save_path): if not filename.startswith(self.save_path):
oldfile, filename = filename, os.path.join(self.save_path, oldfile, filename = filename, os.path.join(self.save_path,
os.path.split(filename)[1]) os.path.split(filename)[1])