correct indentation, cleanup, docu

This commit is contained in:
rimach 2011-01-17 23:25:05 +01:00
parent 0762f5ef63
commit abf5353993
3 changed files with 51 additions and 73 deletions

View File

@ -273,69 +273,53 @@ class ServiceManager(QtGui.QWidget):
self.serviceManagerList.down])
def setServiceHotkeys(self, parent=None):
widget = self
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)
u'Move_down', parent)
ActionList.set(self.serviceManagerList.moveDown, u'Move_down',
self.onServiceDown, QtCore.Qt.Key_PageDown)
self.mainwindow.actionList.add_action(
self.serviceManagerList.moveDown,
u'Service')
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)
u'Move_up', parent)
ActionList.set(self.serviceManagerList.moveUp,
u'Move_up', 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)
ActionList.set(self.serviceManagerList.enter,
widget, u'Make Live',
u'Service Settings', self.makeLive,
QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return)
u'Make Live', parent)
ActionList.set(self.serviceManagerList.enter, u'Make Live',
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)
ActionList.set(self.serviceManagerList.home,
widget, u'Home',
u'Service Settings', self.onServiceTop,
QtCore.Qt.Key_Home)
u'Home', parent)
ActionList.set(self.serviceManagerList.home, u'Home',
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)
ActionList.set(self.serviceManagerList.end,
widget, u'End',
u'Service Settings', self.onServiceEnd,
QtCore.Qt.Key_End)
u'End', parent)
ActionList.set(self.serviceManagerList.end, u'End',
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)
ActionList.set(self.serviceManagerList.up,
widget, u'Move Selection up',
u'Service Settings', self.onMoveSelectionUp,
QtCore.Qt.Key_Up)
u'Move Selection up', parent)
ActionList.set(self.serviceManagerList.up, u'Move Selection up',
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)
ActionList.set(self.serviceManagerList.down,
widget, u'Move Selection down',
u'Service Settings', self.onMoveSelectionDown,
QtCore.Qt.Key_Down)
u'Move Selection down', parent)
ActionList.set(self.serviceManagerList.down, u'Move Selection down',
self.onMoveSelectionDown, QtCore.Qt.Key_Down)
self.mainwindow.actionList.add_action(self.serviceManagerList.down,
u'Service')

View File

@ -374,57 +374,43 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged)
def setPreviewHotkeys(self, parent=None):
widget = self
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)
ActionList.set(self.previewPreviousItem, u'previous_item',
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)
ActionList.set(self.previewNextItem, u'next_item',
self.onSlideSelectedNext, QtCore.Qt.Key_Down)
self.parent.actionList.add_action(self.previewNextItem, u'Preview')
def setLiveHotkeys(self, parent=None):
widget = self
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,
ActionList.set(self.nextItem, u'next_item', self.onSlideSelectedNext,
QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown,
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.parent.actionList.add_action(self.nextItem, u'Live View Settings')
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,
ActionList.set(parent.previousService, u'previous_service',
self.servicePrevious, QtCore.Qt.Key_Left,
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.parent.actionList.add_action(self.previousService,
u'Live View Settings')
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,
ActionList.set(self.nextService, u'next_service',
self.serviceNext, QtCore.Qt.Key_Right,
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.parent.actionList.add_action(self.nextService,
u'Live View Settings')
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)
ActionList.set(self.previousItem, u'previous_item',
self.onSlideSelectedPrevious, QtCore.Qt.Key_Up,
QtCore.Qt.Key_PageUp, context=QtCore.Qt.WidgetWithChildrenShortcut)
self.parent.actionList.add_action(self.previousItem,
u'Live View Settings')
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,
ActionList.set(self.escapeItem, u'escape_item',
self.liveEscape, QtCore.Qt.Key_Escape,
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.parent.actionList.add_action(self.escapeItem,
u'Live View Settings')
@ -949,7 +935,7 @@ class SlideController(QtGui.QWidget):
if loop:
row = 0
else:
#Receiver.send_message('servicemanager_next_item')
Receiver.send_message('servicemanager_next_item')
return
if row + 1 < self.PreviewListWidget.rowCount():
self.PreviewListWidget.scrollToItem(

View File

@ -185,11 +185,19 @@ class ActionList(object):
self.categories[category].actions.add(action, weight)
@staticmethod
def set(action, widget, text, category, slot, shortcut,
alternate=0, context=QtCore.Qt.WidgetShortcut):
def set(action, text, slot, shortcut, alternate=0,
context=QtCore.Qt.WidgetShortcut):
"""
Set Parameter for Action Items
``action`` action Item
``text`` object name and menu title
``slot`` connected slot
``shortcut`` first shortcut
``alternate`` alternate shortcut
``context`` used context for this action
"""
action.setObjectName(text)
action.setShortcuts([shortcut, alternate])
action.setShortcutContext(context)
action.setData(QtCore.QVariant(category))
QtCore.QObject.connect(action,
QtCore.SIGNAL(u'triggered()'), slot)
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)