reverted changes + rework

This commit is contained in:
andreas 2010-07-19 10:53:01 +02:00
commit e089c8cb0c
4 changed files with 31 additions and 50 deletions

View File

@ -167,7 +167,7 @@ class DisplayWidget(QtGui.QGraphicsView):
def keyPressEvent(self, event):
if isinstance(event, QtGui.QKeyEvent):
# Here accept the event and do something.
#here accept the event and do something
if event.key() == QtCore.Qt.Key_Up:
Receiver.send_message(u'slidecontroller_live_previous')
event.accept()
@ -233,8 +233,8 @@ class MainDisplay(DisplayWidget):
self.setupBlank()
self.blankFrame = None
self.frame = None
# Hide desktop for now until we know where to put it
# and what size it should be.
#Hide desktop for now until we know where to put it
#and what size it should be.
self.setVisible(False)
def setup(self):
@ -245,12 +245,13 @@ class MainDisplay(DisplayWidget):
self.screens, self.screens.monitor_number))
self.setVisible(False)
self.screen = self.screens.current
# Sort out screen locations and sizes.
#Sort out screen locations and sizes
self.setGeometry(self.screen[u'size'])
self.scene.setSceneRect(0, 0, self.size().width(), self.size().height())
self.scene.setSceneRect(0, 0, self.size().width(),
self.size().height())
self.webView.setGeometry(0, 0, self.size().width(),
self.size().height())
# Build a custom splash screen.
#Build a custom splash screen
self.initialFrame = QtGui.QImage(
self.screen[u'size'].width(),
self.screen[u'size'].height(),
@ -269,7 +270,7 @@ class MainDisplay(DisplayWidget):
self.transparent.fill(QtCore.Qt.transparent)
self.displayImage(self.initialFrame)
self.repaint()
# Build a Black screen.
#Build a Black screen
painter = QtGui.QPainter()
self.blankFrame = QtGui.QImage(
self.screen[u'size'].width(),
@ -368,7 +369,7 @@ class MainDisplay(DisplayWidget):
self.displayBlank.setPixmap(self.transparent)
if self.isHidden():
self.setVisible(True)
# Trigger actions when display is active again.
#Trigger actions when display is active again
Receiver.send_message(u'maindisplay_active')
def addImageWithText(self, frame):
@ -419,7 +420,8 @@ class MainDisplay(DisplayWidget):
log.debug(u'adddisplayVideo')
self.displayImage(self.transparent)
self.videoDisplay.setHtml(HTMLVIDEO %
(path, self.screen[u'size'].width(), self.screen[u'size'].height()))
(path, self.screen[u'size'].width(),
self.screen[u'size'].height()))
def frameView(self, frame, transition=False):
"""
@ -507,7 +509,7 @@ class VideoDisplay(Phonon.VideoWidget):
def keyPressEvent(self, event):
if isinstance(event, QtGui.QKeyEvent):
# Here accept the event and do something.
#here accept the event and do something
if event.key() == QtCore.Qt.Key_Escape:
self.onMediaStop()
event.accept()
@ -522,7 +524,7 @@ class VideoDisplay(Phonon.VideoWidget):
log.debug(u'VideoDisplay Setup %s for %s ' % (self.screens,
self.screens.monitor_number))
self.screen = self.screens.current
# Sort out screen locations and sizes.
#Sort out screen locations and sizes
self.setGeometry(self.screen[u'size'])
# To display or not to display?
if not self.screen[u'primary']: # and self.isVisible():
@ -549,10 +551,10 @@ class VideoDisplay(Phonon.VideoWidget):
# if it is triggered from the plugin
# """
# log.debug(u'VideoDisplay Queue new media message %s' % message)
# # If not file take the stored one.
# #If not file take the stored one
# if not message:
# message = self.message
# # Still no file name then stop as it was a normal video stopping.
# # still no file name then stop as it was a normal video stopping
# if message:
# self.mediaObject.setCurrentSource(Phonon.MediaSource(message))
# self.message = message

View File

@ -114,7 +114,7 @@ class Ui_MainWindow(object):
MainWindow.setSizePolicy(sizePolicy)
MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
MainWindow.setWindowIcon(MainIcon)
# Set up the main container, which contains all the other form widgets.
# Set up the main container, which contains all the other form widgets
self.MainContent = QtGui.QWidget(MainWindow)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)

View File

@ -28,8 +28,7 @@ from sqlalchemy.sql import and_
from openlp.core.lib import Receiver, translate
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
from openlp.plugins.songs.lib.db import Author, Book, Topic, Song, \
SongsTopics, AuthorsSongs
from openlp.plugins.songs.lib.db import Author, Book, Topic, Song
from songmaintenancedialog import Ui_SongMaintenanceDialog
class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
@ -394,17 +393,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
and_(Author.first_name == existing_author.first_name,
Author.last_name == existing_author.last_name,
Author.display_name == existing_author.display_name))
songs = self.songmanager.get_all_objects_filtered(AuthorsSongs,
AuthorsSongs.author_id == existing_author.id)
songs = self.songmanager.get_all_objects(Song)
for song in songs:
# We have to check if the song has already the new_author as author.
# If that is the case we must not change song.author_id to the
# new_author's id, because then they were not unique.
temp_song = self.songmanager.get_all_objects_filtered(AuthorsSongs,
and_(AuthorsSongs.author_id == new_author.id,
AuthorsSongs.song_id == song.song_id))
if len(temp_song) < 1:
song.author_id = new_author.id
if existing_author in song.authors:
# We check if the song has already the new_author as author.
# If that is not the case we add it.
if new_author not in song.authors:
song.authors.append(new_author)
song.authors.remove(existing_author)
self.songmanager.save_object(song)
self.songmanager.delete_object(Author, existing_author.id)
@ -417,17 +413,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'''
new_topic = self.songmanager.get_object_filtered(Topic,
Topic.name == existing_topic.name)
songs = self.songmanager.get_all_objects_filtered(SongsTopics,
SongsTopics.topic_id == existing_topic.id)
songs = self.songmanager.get_all_objects(Song)
for song in songs:
# We have to check if the song has already the new_topic as topic.
# If that is the case we must not change song.topic_id to the
# new_topic's id, because then they were not unique.
temp_song = self.songmanager.get_all_objects_filtered(SongsTopics,
and_(SongsTopics.topic_id == new_topic.id,
SongsTopics.song_id == song.song_id))
if len(temp_song) < 1:
song.topic_id = new_topic.id
if existing_topic in song.topics:
# We check if the song has already the new_topic as topic.
# If that is not the case we add it.
if new_topic not in song.topics:
song.topics.append(new_topic)
song.topics.remove(existing_topic)
self.songmanager.save_object(song)
self.songmanager.delete_object(Topic, existing_topic.id)

View File

@ -58,18 +58,6 @@ class Topic(BaseModel):
"""
pass
class SongsTopics(BaseModel):
"""
Songs topics model
"""
pass
class AuthorsSongs(BaseModel):
"""
Songs authors model
"""
pass
def init_schema(url):
"""
Setup the songs database connection and initialise the database schema
@ -158,8 +146,6 @@ def init_schema(url):
'topics': relation(Topic, backref='songs',
secondary=songs_topics_table)})
mapper(Topic, topics_table)
mapper(SongsTopics, songs_topics_table)
mapper(AuthorsSongs, authors_songs_table)
metadata.create_all(checkfirst=True)
return session