correct longlines, use camelNames, correct indentations

This commit is contained in:
rimach 2011-01-16 21:54:31 +01:00
parent a5eb15f719
commit 77da076c3b
4 changed files with 114 additions and 219 deletions

View File

@ -55,46 +55,6 @@ class DisplayWidget(QtGui.QGraphicsView):
self.parent = parent
self.live = live
# self.hotkey_map = {
# QtCore.Qt.Key_Return: 'servicemanager_next_item',
# QtCore.Qt.Key_Space: 'slidecontroller_live_next_noloop',
# QtCore.Qt.Key_Enter: 'slidecontroller_live_next_noloop',
# QtCore.Qt.Key_0: 'servicemanager_next_item',
# QtCore.Qt.Key_Backspace: 'slidecontroller_live_previous_noloop'}
# self.setStyleSheet(u'border: none;')
#
# def keyPressEvent(self, event):
# """
# Handle key events from display screen
# """
# # Key events only needed for live
# if not self.live:
# return
# if isinstance(event, QtGui.QKeyEvent):
# # Here accept the event and do something
# if event.key() == QtCore.Qt.Key_Up:
# Receiver.send_message(u'slidecontroller_live_previous')
# event.accept()
# elif event.key() == QtCore.Qt.Key_Down:
# Receiver.send_message(u'slidecontroller_live_next')
# event.accept()
# elif event.key() == QtCore.Qt.Key_PageUp:
# Receiver.send_message(u'slidecontroller_live_first')
# event.accept()
# elif event.key() == QtCore.Qt.Key_PageDown:
# Receiver.send_message(u'slidecontroller_live_last')
# event.accept()
# elif event.key() in self.hotkey_map:
# Receiver.send_message(self.hotkey_map[event.key()])
# event.accept()
# elif event.key() == QtCore.Qt.Key_Escape:
# self.setVisible(False)
# self.videoStop()
# event.accept()
# event.ignore()
# else:
# event.ignore()
class MainDisplay(DisplayWidget):
"""
This is the display screen.
@ -117,12 +77,6 @@ class MainDisplay(DisplayWidget):
QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay)
# if self.live:
# self.addAction(self.parent.next_item)
# self.addAction(self.parent.previous_item)
# self.addAction(self.parent.previous_service)
# self.addAction(self.parent.next_service)
# self.addAction(self.parent.escape_item)
def retranslateUi(self):
"""

View File

@ -263,72 +263,81 @@ class ServiceManager(QtGui.QWidget):
self.menu.addMenu(self.themeMenu)
self.configUpdated(True)
self.setServiceHotkeys(self.serviceManagerList)
self.serviceManagerList.addActions([self.serviceManagerList.move_down,
self.serviceManagerList.move_up,
self.serviceManagerList.enter,
self.serviceManagerList.home,
self.serviceManagerList.end,
self.serviceManagerList.up,
self.serviceManagerList.down])
self.serviceManagerList.addActions(
[self.serviceManagerList.moveDown,
self.serviceManagerList.moveUp,
self.serviceManagerList.enter,
self.serviceManagerList.home,
self.serviceManagerList.end,
self.serviceManagerList.up,
self.serviceManagerList.down])
def setServiceHotkeys(self, parent=None):
widget = self
self.serviceManagerList.move_down = \
QtGui.QAction(QtGui.QIcon(u':/services/service_down.png'),
u'Move_down', parent)
ActionList.set(self.serviceManagerList.move_down,
widget, u'Move_down',
u'Service Settings', self.onServiceDown,
QtCore.Qt.Key_PageDown)
self.mainwindow.actionList.add_action(self.serviceManagerList.move_down, u'Service')
self.serviceManagerList.move_up = \
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'Move_up', parent)
ActionList.set(self.serviceManagerList.move_up,
widget, u'Move_up',
u'Service Settings', self.onServiceUp,
QtCore.Qt.Key_PageUp)
self.mainwindow.actionList.add_action(self.serviceManagerList.move_up, u'Service')
self.serviceManagerList.moveDown = \
QtGui.QAction(QtGui.QIcon(u':/services/service_down.png'),
u'Move_down', parent)
ActionList.set(self.serviceManagerList.moveDown,
widget, u'Move_down',
u'Service Settings', self.onServiceDown,
QtCore.Qt.Key_PageDown)
self.mainwindow.actionList.add_action(
self.serviceManagerList.moveDown,
u'Service')
self.serviceManagerList.moveUp = \
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'Move_up', parent)
ActionList.set(self.serviceManagerList.moveUp,
widget, u'Move_up',
u'Service Settings', self.onServiceUp,
QtCore.Qt.Key_PageUp)
self.mainwindow.actionList.add_action(self.serviceManagerList.moveUp,
u'Service')
self.serviceManagerList.enter = \
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'Make Live', parent)
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'Make Live', parent)
ActionList.set(self.serviceManagerList.enter,
widget, u'Make Live',
u'Service Settings', self.makeLive,
QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return)
self.mainwindow.actionList.add_action(self.serviceManagerList.enter, u'Service')
widget, u'Make Live',
u'Service Settings', self.makeLive,
QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return)
self.mainwindow.actionList.add_action(self.serviceManagerList.enter,
u'Service')
self.serviceManagerList.home = \
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'Home', parent)
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'Home', parent)
ActionList.set(self.serviceManagerList.home,
widget, u'Home',
u'Service Settings', self.onServiceTop,
QtCore.Qt.Key_Home)
self.mainwindow.actionList.add_action(self.serviceManagerList.home, u'Service')
widget, u'Home',
u'Service Settings', self.onServiceTop,
QtCore.Qt.Key_Home)
self.mainwindow.actionList.add_action(self.serviceManagerList.home,
u'Service')
self.serviceManagerList.end = \
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'End', parent)
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'End', parent)
ActionList.set(self.serviceManagerList.end,
widget, u'End',
u'Service Settings', self.onServiceEnd,
QtCore.Qt.Key_End)
self.mainwindow.actionList.add_action(self.serviceManagerList.end, u'Service')
widget, u'End',
u'Service Settings', self.onServiceEnd,
QtCore.Qt.Key_End)
self.mainwindow.actionList.add_action(self.serviceManagerList.end,
u'Service')
self.serviceManagerList.up = \
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'Move Selection up', parent)
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'Move Selection up', parent)
ActionList.set(self.serviceManagerList.up,
widget, u'Move Selection up',
u'Service Settings', self.onMoveSelectionUp,
QtCore.Qt.Key_Up)
self.mainwindow.actionList.add_action(self.serviceManagerList.up, u'Service')
widget, u'Move Selection up',
u'Service Settings', self.onMoveSelectionUp,
QtCore.Qt.Key_Up)
self.mainwindow.actionList.add_action(self.serviceManagerList.up,
u'Service')
self.serviceManagerList.down = \
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'Move Selection down', parent)
QtGui.QAction(QtGui.QIcon(u':/services/service_up.png'),
u'Move Selection down', parent)
ActionList.set(self.serviceManagerList.down,
widget, u'Move Selection down',
u'Service Settings', self.onMoveSelectionDown,
QtCore.Qt.Key_Down)
self.mainwindow.actionList.add_action(self.serviceManagerList.down, u'Service')
widget, u'Move Selection down',
u'Service Settings', self.onMoveSelectionDown,
QtCore.Qt.Key_Down)
self.mainwindow.actionList.add_action(self.serviceManagerList.down,
u'Service')
def setModified(self, modified=True):
"""

View File

@ -85,82 +85,3 @@ class Ui_ShortcutListDialog(object):
translate('OpenLP.ShortcutListDialog', 'Custom:'))
self.shortcutButton.setText(
translate('OpenLP.ShortcutListDialog', 'None'))
class Ui_ShortcutDialog(object):
def setupUi(self, ShortcutDialog):
ShortcutDialog.setObjectName(u'ShortcutDialog')
ShortcutDialog.resize(539, 125)
self.vboxlayout = QtGui.QVBoxLayout(ShortcutDialog)
self.vboxlayout.setObjectName(u'vboxlayout')
self.shortcutsGroup = QtGui.QGroupBox(ShortcutDialog)
self.shortcutsGroup.setTitle(u'')
self.shortcutsGroup.setObjectName(u'shortcutsGroup')
self.gridlayout = QtGui.QGridLayout(self.shortcutsGroup)
self.gridlayout.setObjectName(u'gridlayout')
self.alternateButton = QtGui.QRadioButton(self.shortcutsGroup)
self.alternateButton.setFocusPolicy(QtCore.Qt.NoFocus)
self.alternateButton.setObjectName(u'alternateButton')
self.gridlayout.addWidget(self.alternateButton, 1, 0, 1, 1)
self.primaryClearButton = QtGui.QPushButton(self.shortcutsGroup)
self.primaryClearButton.setFocusPolicy(QtCore.Qt.NoFocus)
self.primaryClearButton.setObjectName(u'primaryClearButton')
self.gridlayout.addWidget(self.primaryClearButton, 0, 1, 1, 1)
self.alternateKeyLabel = QtGui.QLabel(self.shortcutsGroup)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.alternateKeyLabel.sizePolicy().hasHeightForWidth())
self.alternateKeyLabel.setSizePolicy(sizePolicy)
self.alternateKeyLabel.setToolTip(u'')
self.alternateKeyLabel.setFrameShape(QtGui.QFrame.StyledPanel)
self.alternateKeyLabel.setFrameShadow(QtGui.QFrame.Sunken)
self.alternateKeyLabel.setText(u'')
self.alternateKeyLabel.setObjectName(u'alternateKeyLabel')
self.gridlayout.addWidget(self.alternateKeyLabel, 1, 2, 1, 1)
self.keyLabel = QtGui.QLabel(self.shortcutsGroup)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.keyLabel.sizePolicy().hasHeightForWidth())
self.keyLabel.setSizePolicy(sizePolicy)
self.keyLabel.setToolTip(u'')
self.keyLabel.setFrameShape(QtGui.QFrame.StyledPanel)
self.keyLabel.setFrameShadow(QtGui.QFrame.Sunken)
self.keyLabel.setText(u'')
self.keyLabel.setObjectName(u'keyLabel')
self.gridlayout.addWidget(self.keyLabel, 0, 2, 1, 1)
self.primaryButton = QtGui.QRadioButton(self.shortcutsGroup)
self.primaryButton.setFocusPolicy(QtCore.Qt.NoFocus)
self.primaryButton.setChecked(True)
self.primaryButton.setObjectName(u'primaryButton')
self.gridlayout.addWidget(self.primaryButton, 0, 0, 1, 1)
self.alternateClearButton = QtGui.QPushButton(self.shortcutsGroup)
self.alternateClearButton.setEnabled(False)
self.alternateClearButton.setFocusPolicy(QtCore.Qt.NoFocus)
self.alternateClearButton.setObjectName(u'alternateClearButton')
self.gridlayout.addWidget(self.alternateClearButton, 1, 1, 1, 1)
self.vboxlayout.addWidget(self.shortcutsGroup)
self.buttonBox = QtGui.QDialogButtonBox(ShortcutDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.vboxlayout.addWidget(self.buttonBox)
self.retranslateUi(ShortcutDialog)
QtCore.QObject.connect(self.primaryButton, QtCore.SIGNAL(u'toggled(bool)'), self.primaryClearButton.setEnabled)
QtCore.QObject.connect(self.alternateButton, QtCore.SIGNAL(u'toggled(bool)'), self.alternateClearButton.setEnabled)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), ShortcutDialog.reject)
QtCore.QMetaObject.connectSlotsByName(ShortcutDialog)
def retranslateUi(self, ShortcutDialog):
ShortcutDialog.setWindowTitle(QtGui.QApplication.translate("ShortcutDialog", "Edit Shortcut", None, QtGui.QApplication.UnicodeUTF8))
ShortcutDialog.setWhatsThis(QtGui.QApplication.translate("ShortcutDialog", "Press your shortcut keys and select OK", None, QtGui.QApplication.UnicodeUTF8))
self.alternateButton.setToolTip(QtGui.QApplication.translate("ShortcutDialog", "Select to change the alternative keyboard shortcut", None, QtGui.QApplication.UnicodeUTF8))
self.alternateButton.setText(QtGui.QApplication.translate("ShortcutDialog", "Alternative Shortcut:", None, QtGui.QApplication.UnicodeUTF8))
self.primaryClearButton.setToolTip(QtGui.QApplication.translate("ShortcutDialog", "Press to clear the key sequence buffer.", None, QtGui.QApplication.UnicodeUTF8))
self.primaryClearButton.setText(QtGui.QApplication.translate("ShortcutDialog", "Clear", None, QtGui.QApplication.UnicodeUTF8))
self.primaryButton.setToolTip(QtGui.QApplication.translate("ShortcutDialog", "Select to change the primary keyboard shortcut", None, QtGui.QApplication.UnicodeUTF8))
self.primaryButton.setText(QtGui.QApplication.translate("ShortcutDialog", "Primary Shortcut:", None, QtGui.QApplication.UnicodeUTF8))
self.alternateClearButton.setToolTip(QtGui.QApplication.translate("ShortcutDialog", "Press to clear the key sequence buffer.", None, QtGui.QApplication.UnicodeUTF8))
self.alternateClearButton.setText(QtGui.QApplication.translate("ShortcutDialog", "Clear", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -314,20 +314,23 @@ class SlideController(QtGui.QWidget):
self.Mediabar.setVisible(False)
if self.isLive:
self.setLiveHotkeys(self)
self.PreviewListWidget.addActions([self.previous_item,
self.next_item,
self.previous_service,
self.next_service,
self.escape_item])
self.display.addActions([self.previous_item,
self.next_item,
self.previous_service,
self.next_service,
self.escape_item])
self.PreviewListWidget.addActions(
[self.previousItem,
self.nextItem,
self.previousService,
self.nextService,
self.escapeItem])
self.display.addActions(
[self.previousItem,
self.nextItem,
self.previousService,
self.nextService,
self.escapeItem])
else:
self.setPreviewHotkeys()
self.PreviewListWidget.addActions([self.preview_next_item,
self.preview_previous_item])
self.PreviewListWidget.addActions(
[self.previewNextItem,
self.previewPreviousItem])
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.typePrefix),
self.onStopLoop)
@ -372,52 +375,59 @@ class SlideController(QtGui.QWidget):
def setPreviewHotkeys(self, parent=None):
widget = self
self.preview_previous_item = QtGui.QAction(u'previous_item', parent)
ActionList.set(self.preview_previous_item, widget, u'previous_item',
u'Preview Settings', self.onSlideSelectedPrevious, QtCore.Qt.Key_Up)
self.parent.actionList.add_action(self.preview_previous_item, u'Preview')
self.preview_next_item = QtGui.QAction(u'next_item', parent)
ActionList.set(self.preview_next_item, widget, u'next_item',
u'Preview Settings', self.onSlideSelectedNext, QtCore.Qt.Key_Down)
self.parent.actionList.add_action(self.preview_next_item, u'Preview')
self.previewPreviousItem = QtGui.QAction(u'previous_item', parent)
ActionList.set(
self.previewPreviousItem, widget, u'previous_item',
u'Preview Settings', self.onSlideSelectedPrevious,
QtCore.Qt.Key_Up)
self.parent.actionList.add_action(self.previewPreviousItem,
u'Preview')
self.previewNextItem = QtGui.QAction(u'next_item', parent)
ActionList.set(self.previewNextItem, widget, u'next_item',
u'Preview Settings', self.onSlideSelectedNext,
QtCore.Qt.Key_Down)
self.parent.actionList.add_action(self.previewNextItem, u'Preview')
def setLiveHotkeys(self, parent=None):
widget = self
self.next_item = QtGui.QAction(u'next_item', parent)
ActionList.set(self.next_item, widget, u'next_item',
self.nextItem = QtGui.QAction(u'next_item', parent)
ActionList.set(self.nextItem, widget, u'next_item',
u'Live View Settings', self.onSlideSelectedNext,
QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown,
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.parent.actionList.add_action(self.next_item, u'Live View Settings')
self.parent.actionList.add_action(self.nextItem, u'Live View Settings')
parent.previous_service = QtGui.QAction(u'previous_service', parent)
ActionList.set(parent.previous_service, widget, u'previous_service',
parent.previousService = QtGui.QAction(u'previous_service', parent)
ActionList.set(parent.previousService, widget, u'previous_service',
u'Live View Settings', self.servicePrevious,
QtCore.Qt.Key_Left,
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.parent.actionList.add_action(self.previous_service, u'Live View Settings')
self.parent.actionList.add_action(self.previousService,
u'Live View Settings')
self.next_service = QtGui.QAction(u'next_service', parent)
ActionList.set(self.next_service, widget, u'next_service',
self.nextService = QtGui.QAction(u'next_service', parent)
ActionList.set(self.nextService, widget, u'next_service',
u'Live View Settings', self.serviceNext,
QtCore.Qt.Key_Right,
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.parent.actionList.add_action(self.next_service, u'Live View Settings')
self.parent.actionList.add_action(self.nextService,
u'Live View Settings')
self.previous_item = QtGui.QAction(u'previous_item', parent)
ActionList.set(self.previous_item, widget, u'previous_item',
self.previousItem = QtGui.QAction(u'previous_item', parent)
ActionList.set(self.previousItem, widget, u'previous_item',
u'Live View Settings', self.onSlideSelectedPrevious,
QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp,
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.parent.actionList.add_action(self.previous_item, u'Live View Settings')
self.parent.actionList.add_action(self.previousItem,
u'Live View Settings')
self.escape_item = QtGui.QAction(u'escape_item', parent)
ActionList.set(self.escape_item, widget, u'escape_item',
self.escapeItem = QtGui.QAction(u'escape_item', parent)
ActionList.set(self.escapeItem, widget, u'escape_item',
u'Live View Settings', self.liveEscape,
QtCore.Qt.Key_Escape,
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.parent.actionList.add_action(self.escape_item, u'Live View Settings')
self.parent.actionList.add_action(self.escapeItem,
u'Live View Settings')
def liveEscape(self):
self.display.setVisible(False)
@ -444,11 +454,12 @@ class SlideController(QtGui.QWidget):
QtCore.QSize(self.settingsmanager.slidecontroller_image,
self.settingsmanager.slidecontroller_image / self.ratio))
if self.isLive:
self.display.addActions([self.previous_item,
self.next_item,
self.previous_service,
self.next_service,
self.escape_item])
self.display.addActions(
[self.previousItem,
self.nextItem,
self.previousService,
self.nextService,
self.escapeItem])
# The SlidePreview's ratio.
self.ratio = float(self.screens.current[u'size'].width()) / \
float(self.screens.current[u'size'].height())