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.parent = parent
self.live = live 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): class MainDisplay(DisplayWidget):
""" """
This is the display screen. This is the display screen.
@ -117,12 +77,6 @@ class MainDisplay(DisplayWidget):
QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay) QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay) 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): def retranslateUi(self):
""" """

View File

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

View File

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