fixes to custom and save state of screen

This commit is contained in:
Tim Bentley 2009-09-11 20:29:57 +01:00
parent b657af7a64
commit 07452df24a
7 changed files with 45 additions and 22 deletions

View File

@ -174,7 +174,7 @@ class MediaManagerItem(QtGui.QWidget):
# Add a toolbar
self.addToolbar()
#Allow the plugin to define it's own header
self.addHeaderBar1()
self.addStartHeaderBar()
# Create buttons for the toolbar
## File Button ##
if self.hasFileIcon:
@ -217,7 +217,7 @@ class MediaManagerItem(QtGui.QWidget):
translate(self.TranslationContext, u'Add the selected item(s) to the service'),
u':/system/system_add.png', self.onAddClick, self.PluginTextShort+u'AddItem')
#Allow the plugin to define it's own header
self.addHeaderBar2()
self.addEndHeaderBar()
#Add the List widget
self.ListView = self.ListViewWithDnD_class()
self.ListView.uniformItemSizes = True
@ -260,15 +260,15 @@ class MediaManagerItem(QtGui.QWidget):
"""
pass
def addHeaderBar1(self):
def addStartHeaderBar(self):
"""
Slot at start of toolbar for pluin to addwidgets
Slot at start of toolbar for plugin to addwidgets
"""
pass
def addHeaderBar2(self):
def addEndHeaderBar(self):
"""
Slot at end of toolbar for pluin to add widgets
Slot at end of toolbar for plugin to add widgets
"""
pass

View File

@ -34,13 +34,22 @@ class SettingsManager(object):
self.width = self.screen[u'size'].width()
self.height = self.screen[u'size'].height()
self.mainwindow_height = self.height * 0.8
self.mainwindow_docbars = self.width / 5
if self.mainwindow_docbars > 300:
self.mainwindow_docbars > 300
self.mainwindow_slidecontroller = self.width / 6
self.slidecontroller = ((self.width - (self.mainwindow_docbars * 3 ) / 2 ) / 2 ) -100
mainwindow_docbars = self.width / 5
self.mainwindow_left = 0
self.mainwindow_right = 0
if mainwindow_docbars > 300:
self.mainwindow_left = 300
self.mainwindow_right = 300
self.mainwindow_left = int( ConfigHelper.get_config(
u'user interface', u'mediamanager left', self.mainwindow_left))
self.mainwindow_right = int( ConfigHelper.get_config(
u'user interface', u'mediamanager right', self.mainwindow_right))
print self.mainwindow_left, self.mainwindow_right
self.slidecontroller = (self.width - (self.mainwindow_left + self.mainwindow_right) - 100 ) / 2
self.slidecontroller_image = self.slidecontroller - 50
print self.width, self.mainwindow_docbars, self.slidecontroller, self.slidecontroller_image
print self.width, mainwindow_docbars, self.slidecontroller, self.slidecontroller_image
self.showMediaManager = str_to_bool( ConfigHelper.get_config(
u'user interface', u'display mediamanager', True))
@ -67,3 +76,6 @@ class SettingsManager(object):
ConfigHelper.set_config(u'user interface', u'display previewpanel',
isVisible)
def setDockbarLeft(self, value):
ConfigHelper.set_config(u'user interface', u'mediamanager left', value)

View File

@ -31,6 +31,15 @@ from openlp.core.lib import translate, Plugin, MediaManagerItem, \
from openlp.core.utils import ConfigHelper
class mediaDock(QtGui.QDockWidget):
def __init__(self, parent=None, name=None):
QtGui.QDockWidget.__init__(self, parent)
self.parent = parent
def resizeEvent(self, resizeEvent):
if resizeEvent.size().width() != resizeEvent.oldSize().width():
self.parent.settingsmanager.setDockbarLeft(resizeEvent.size().width())
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
"""
@ -102,15 +111,20 @@ class Ui_MainWindow(object):
self.DefaultThemeLabel.setObjectName(u'DefaultThemeLabel')
self.StatusBar.addPermanentWidget(self.DefaultThemeLabel)
# Create the MediaManager
self.MediaManagerDock = QtGui.QDockWidget(MainWindow)
self.MediaManagerDock = mediaDock(MainWindow)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(u':/system/system_mediamanager.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.MediaManagerDock.setWindowIcon(icon)
self.MediaManagerDock.setFloating(False)
self.MediaManagerDock.setObjectName(u'MediaManagerDock')
self.MediaManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_docbars)
self.MediaManagerDock.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored,
QtGui.QSizePolicy.Maximum))
geometry = self.MediaManagerDock.geometry()
geometry.setWidth(self.settingsmanager.mainwindow_left)
self.MediaManagerDock.setGeometry(geometry)
self.MediaManagerDock.setMinimumWidth(10)
self.MediaManagerContents = QtGui.QWidget()
self.MediaManagerContents.setObjectName(u'MediaManagerContents')
self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
@ -134,7 +148,7 @@ class Ui_MainWindow(object):
QtGui.QDockWidget.AllDockWidgetFeatures)
self.ServiceManagerDock.setObjectName(u'ServiceManagerDock')
self.ServiceManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_docbars)
self.settingsmanager.mainwindow_right)
self.ServiceManagerContents = ServiceManager(self)
self.ServiceManagerDock.setWidget(self.ServiceManagerContents)
MainWindow.addDockWidget(

View File

@ -374,6 +374,3 @@ class SlideController(QtGui.QWidget):
def timerEvent(self, event):
if event.timerId() == self.timer_id:
self.onSlideSelectedNext()

View File

@ -57,7 +57,8 @@ class ImpressController(object):
when required.
"""
log.debug(u'start Openoffice')
cmd = u'openoffice.org -nologo -norestore -minimized -headless ' + u'"' + u'-accept=socket,host=localhost,port=2002;urp;'+ u'"'
# -headless
cmd = u'openoffice.org -nologo -norestore -minimized -invisible ' + u'"' + u'-accept=socket,host=localhost,port=2002;urp;'+ u'"'
self.process = QtCore.QProcess()
self.process.startDetached(cmd)
self.process.waitForStarted()

View File

@ -57,7 +57,7 @@ class PresentationMediaItem(MediaManagerItem):
MediaManagerItem.__init__(self, parent, icon, title)
self.message_listener = MessageListener(controllers)
def addHeaderBar2(self):
def addEndHeaderBar(self):
self.PresentationWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)

View File

@ -104,5 +104,4 @@ class PresentationPlugin(Plugin):
log.debug(u'Finalise')
#Ask each controller to tidy up
for controller in self.controllers:
print controller
self.controllers[controller].kill()