RFC: Different toolbar layout for Service Manager

This commit is contained in:
Jon Tibble 2009-09-11 12:18:00 +01:00
parent 20579078d4
commit af2234b945
2 changed files with 14 additions and 5 deletions

View File

@ -36,11 +36,13 @@ class OpenLPToolbar(QtGui.QToolBar):
QtGui.QToolBar.__init__(self, None) QtGui.QToolBar.__init__(self, None)
# useful to be able to reuse button icons... # useful to be able to reuse button icons...
self.icons = {} self.icons = {}
self.setIconSize(QtCore.QSize(20, 20))
self.actions = {} self.actions = {}
self.log = logging.getLogger(u'OpenLPToolbar') self.log = logging.getLogger(u'OpenLPToolbar')
self.log.debug(u'Init done') self.log.debug(u'Init done')
def addToolbarButton(self, title, icon, tooltip=None, slot=None, objectname=None): def addToolbarButton(self, title, icon, tooltip=None, slot=None,
objectname=None):
""" """
A method to help developers easily add a button to the toolbar. A method to help developers easily add a button to the toolbar.
@ -70,8 +72,8 @@ class OpenLPToolbar(QtGui.QToolBar):
ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal, ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
QtGui.QIcon.Off) QtGui.QIcon.Off)
else: else:
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)), ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(
QtGui.QIcon.Normal, QtGui.QIcon.Off) QtGui.QImage(icon)), QtGui.QIcon.Normal, QtGui.QIcon.Off)
if ButtonIcon is not None: if ButtonIcon is not None:
if slot is not None: if slot is not None:
ToolbarButton = self.addAction(ButtonIcon, title, slot) ToolbarButton = self.addAction(ButtonIcon, title, slot)

View File

@ -126,6 +126,11 @@ class ServiceManager(QtGui.QWidget):
self.ThemeWidget.setDefaultWidget(self.ThemeComboBox) self.ThemeWidget.setDefaultWidget(self.ThemeComboBox)
self.Toolbar.addAction(self.ThemeWidget) self.Toolbar.addAction(self.ThemeWidget)
self.Layout.addWidget(self.Toolbar) self.Layout.addWidget(self.Toolbar)
# *** TEST Layout for vertical service order toolbar ***
self.SubLayout = QtGui.QHBoxLayout()
self.SubLayout.setSpacing(0)
self.SubLayout.setMargin(0)
self.Layout.insertLayout(-1, self.SubLayout)
# Create the service manager list # Create the service manager list
self.ServiceManagerList = ServiceManagerList(self) self.ServiceManagerList = ServiceManagerList(self)
self.ServiceManagerList.setEditTriggers( self.ServiceManagerList.setEditTriggers(
@ -156,9 +161,11 @@ class ServiceManager(QtGui.QWidget):
self.ServiceManagerList, ':/services/service_delete', self.ServiceManagerList, ':/services/service_delete',
translate(u'ServiceManager',u'&Remove from Service'), translate(u'ServiceManager',u'&Remove from Service'),
self.onDeleteFromService)) self.onDeleteFromService))
self.Layout.addWidget(self.ServiceManagerList) self.SubLayout.addWidget(self.ServiceManagerList)
# Add the bottom toolbar # Add the bottom toolbar
self.OrderToolbar = OpenLPToolbar(self) self.OrderToolbar = OpenLPToolbar(self)
self.OrderToolbar.setOrientation(QtCore.Qt.Vertical)
self.OrderToolbar.setIconSize(QtCore.QSize(17, 17))
self.OrderToolbar.addToolbarButton(u'Move to top', self.OrderToolbar.addToolbarButton(u'Move to top',
u':/services/service_top.png', u':/services/service_top.png',
translate(u'ServiceManager', u'Move to top'), self.onServiceTop) translate(u'ServiceManager', u'Move to top'), self.onServiceTop)
@ -177,7 +184,7 @@ class ServiceManager(QtGui.QWidget):
u':/services/service_delete.png', u':/services/service_delete.png',
translate(u'ServiceManager', u'Delete From Service'), translate(u'ServiceManager', u'Delete From Service'),
self.onDeleteFromService) self.onDeleteFromService)
self.Layout.addWidget(self.OrderToolbar) self.SubLayout.addWidget(self.OrderToolbar)
# Connect up our signals and slots # Connect up our signals and slots
QtCore.QObject.connect(self.ThemeComboBox, QtCore.QObject.connect(self.ThemeComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected)