forked from openlp/openlp
removed things, as this did not work
This commit is contained in:
parent
6f3fd53419
commit
b9b0cbbe9c
@ -177,11 +177,11 @@ class Ui_MainWindow(object):
|
|||||||
self.ImportThemeItem = base_action(
|
self.ImportThemeItem = base_action(
|
||||||
mainWindow, u'ImportThemeItem', u'Import')
|
mainWindow, u'ImportThemeItem', u'Import')
|
||||||
self.ImportLanguageItem = base_action(
|
self.ImportLanguageItem = base_action(
|
||||||
mainWindow, u'ImportLanguageItem', u'Import')
|
mainWindow, u'ImportLanguageItem')#, u'Import')
|
||||||
self.ExportThemeItem = base_action(
|
self.ExportThemeItem = base_action(
|
||||||
mainWindow, u'ExportThemeItem', u'Export')
|
mainWindow, u'ExportThemeItem', u'Export')
|
||||||
self.ExportLanguageItem = base_action(
|
self.ExportLanguageItem = base_action(
|
||||||
mainWindow, u'ExportLanguageItem', u'Export')
|
mainWindow, u'ExportLanguageItem')#, u'Export')
|
||||||
self.ViewMediaManagerItem = icon_action(mainWindow,
|
self.ViewMediaManagerItem = icon_action(mainWindow,
|
||||||
u'ViewMediaManagerItem', u':/system/system_mediamanager.png',
|
u'ViewMediaManagerItem', u':/system/system_mediamanager.png',
|
||||||
self.mediaManagerDock.isVisible(), u'View')
|
self.mediaManagerDock.isVisible(), u'View')
|
||||||
@ -240,7 +240,7 @@ class Ui_MainWindow(object):
|
|||||||
category=None)#u'Help')
|
category=None)#u'Help')
|
||||||
self.HelpDocumentationItem.setEnabled(False)
|
self.HelpDocumentationItem.setEnabled(False)
|
||||||
self.HelpAboutItem = icon_action(mainWindow, u'HelpAboutItem',
|
self.HelpAboutItem = icon_action(mainWindow, u'HelpAboutItem',
|
||||||
u':/system/system_about.png', category=None)#u'Help')
|
u':/system/system_about.png', category=u'Help')
|
||||||
self.HelpOnlineHelpItem = base_action(
|
self.HelpOnlineHelpItem = base_action(
|
||||||
mainWindow, u'HelpOnlineHelpItem', category=u'Help')
|
mainWindow, u'HelpOnlineHelpItem', category=u'Help')
|
||||||
self.helpWebSiteItem = base_action(
|
self.helpWebSiteItem = base_action(
|
||||||
|
@ -30,6 +30,7 @@ from openlp.core.lib import translate, build_icon
|
|||||||
|
|
||||||
class Ui_ShortcutListDialog(object):
|
class Ui_ShortcutListDialog(object):
|
||||||
def setupUi(self, shortcutListDialog):
|
def setupUi(self, shortcutListDialog):
|
||||||
|
shortcutListDialog.resize(440, 450)
|
||||||
shortcutListDialog.setObjectName(u'shortcutListDialog')
|
shortcutListDialog.setObjectName(u'shortcutListDialog')
|
||||||
self.dialogLayout = QtGui.QVBoxLayout(shortcutListDialog)
|
self.dialogLayout = QtGui.QVBoxLayout(shortcutListDialog)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialogLayout')
|
||||||
@ -52,6 +53,7 @@ class Ui_ShortcutListDialog(object):
|
|||||||
build_icon(u':/system/system_configure_shortcuts.png'))
|
build_icon(u':/system/system_configure_shortcuts.png'))
|
||||||
self.shortcutButton.setCheckable(True)
|
self.shortcutButton.setCheckable(True)
|
||||||
self.shortcutButton.setObjectName(u'shortcutButton')
|
self.shortcutButton.setObjectName(u'shortcutButton')
|
||||||
|
self.shortcutButton.setFixedSize(150, 30)
|
||||||
self.customLayout.addWidget(self.shortcutButton)
|
self.customLayout.addWidget(self.shortcutButton)
|
||||||
self.clearShortcutButton = QtGui.QToolButton(shortcutListDialog)
|
self.clearShortcutButton = QtGui.QToolButton(shortcutListDialog)
|
||||||
self.clearShortcutButton.setIcon(
|
self.clearShortcutButton.setIcon(
|
||||||
|
@ -41,10 +41,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
"""
|
"""
|
||||||
The shortcut list dialog
|
The shortcut list dialog
|
||||||
"""
|
"""
|
||||||
#TODO: do not close on ESC
|
#TODO: do not close on ESC, ability to remove actions, save/load shortcuts, docs
|
||||||
#TODO: ability to remove actions
|
|
||||||
#TODO: Save shortcuts
|
|
||||||
#TODO: doc
|
|
||||||
#TODO: Fix Preview/Live controller (have the same shortcut)
|
#TODO: Fix Preview/Live controller (have the same shortcut)
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
@ -87,21 +84,17 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
self.shortcutButton.setChecked(False)
|
self.shortcutButton.setChecked(False)
|
||||||
|
|
||||||
def exec_(self):
|
def exec_(self):
|
||||||
# The dialog is opened the first time
|
|
||||||
if self.treeWidget.topLevelItemCount() == 0:
|
|
||||||
QtCore.QObject.connect(actionList.signal,
|
|
||||||
QtCore.SIGNAL(u'addedAction()'), self.initialiseActionList)
|
|
||||||
self.initialiseActionList()
|
|
||||||
self.refreshActionList()
|
self.refreshActionList()
|
||||||
return QtGui.QDialog.exec_(self)
|
return QtGui.QDialog.exec_(self)
|
||||||
|
|
||||||
def refreshActionList(self):
|
def refreshActionList(self):
|
||||||
|
# As refreshing does not work, the check does not work either.
|
||||||
self.assingedShortcuts = []
|
self.assingedShortcuts = []
|
||||||
iterator = QtGui.QTreeWidgetItemIterator(self.treeWidget)
|
#self.treeWidget.clear()
|
||||||
while iterator.value():
|
for category in actionList.categories:
|
||||||
treewidgetItem = iterator.value()
|
item = QtGui.QTreeWidgetItem([category.name])
|
||||||
action = treewidgetItem.data(0, QtCore.Qt.UserRole).toPyObject()
|
for action in category.actions:
|
||||||
if action is not None:
|
self.assingedShortcuts.extend(action.shortcuts())
|
||||||
actionText = REMOVE_AMPERSAND.sub('', unicode(action.text()))
|
actionText = REMOVE_AMPERSAND.sub('', unicode(action.text()))
|
||||||
if len(action.shortcuts()) == 2:
|
if len(action.shortcuts()) == 2:
|
||||||
shortcutText = action.shortcuts()[0].toString()
|
shortcutText = action.shortcuts()[0].toString()
|
||||||
@ -109,19 +102,11 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
else:
|
else:
|
||||||
shortcutText = action.shortcut().toString()
|
shortcutText = action.shortcut().toString()
|
||||||
alternateText = u''
|
alternateText = u''
|
||||||
self.assingedShortcuts.extend(action.shortcuts())
|
actionItem = QtGui.QTreeWidgetItem(
|
||||||
treewidgetItem.setText(0, actionText)
|
[actionText, shortcutText, alternateText])
|
||||||
treewidgetItem.setText(1, shortcutText)
|
|
||||||
treewidgetItem.setText(2, alternateText)
|
|
||||||
iterator += 1
|
|
||||||
|
|
||||||
def initialiseActionList(self):
|
|
||||||
for category in actionList.categories:
|
|
||||||
item = QtGui.QTreeWidgetItem([category.name])
|
|
||||||
for action in category.actions:
|
|
||||||
actionItem = QtGui.QTreeWidgetItem()
|
|
||||||
actionItem.setIcon(0, action.icon())
|
actionItem.setIcon(0, action.icon())
|
||||||
actionItem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(action))
|
actionItem.setData(0,
|
||||||
|
QtCore.Qt.UserRole, QtCore.QVariant(action))
|
||||||
item.addChild(actionItem)
|
item.addChild(actionItem)
|
||||||
item.setExpanded(True)
|
item.setExpanded(True)
|
||||||
self.treeWidget.addTopLevelItem(item)
|
self.treeWidget.addTopLevelItem(item)
|
||||||
@ -135,13 +120,16 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
return
|
return
|
||||||
# TODO: Sort out which shortcuts should be kept.
|
# TODO: Sort out which shortcuts should be kept.
|
||||||
action.setShortcuts(QtGui.QKeySequence(self.shortcutButton.text()))
|
action.setShortcuts(QtGui.QKeySequence(self.shortcutButton.text()))
|
||||||
|
item.setText(1, self.shortcutButton.text())
|
||||||
self.refreshActionList()
|
self.refreshActionList()
|
||||||
|
|
||||||
def onItemPressed(self, item, column):
|
def onItemPressed(self, item, column):
|
||||||
item = self.treeWidget.currentItem()
|
item = self.treeWidget.currentItem()
|
||||||
action = item.data(0, QtCore.Qt.UserRole).toPyObject()
|
action = item.data(0, QtCore.Qt.UserRole).toPyObject()
|
||||||
|
self.shortcutButton.setEnabled(action is not None)
|
||||||
if action is None:
|
if action is None:
|
||||||
text = u''
|
text = u''
|
||||||
|
self.shortcutButton.setChecked(False)
|
||||||
else:
|
else:
|
||||||
if len(action.shortcuts()) == 0:
|
if len(action.shortcuts()) == 0:
|
||||||
text = u''
|
text = u''
|
||||||
@ -150,3 +138,21 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
else:
|
else:
|
||||||
text = action.shortcuts()[0].toString()
|
text = action.shortcuts()[0].toString()
|
||||||
self.shortcutButton.setText(text)
|
self.shortcutButton.setText(text)
|
||||||
|
|
||||||
|
def saveShortcuts(self):
|
||||||
|
"""
|
||||||
|
Save the shortcuts.
|
||||||
|
"""
|
||||||
|
settings = QtCore.QSettings()
|
||||||
|
settings.beginGroup(u'shortcuts')
|
||||||
|
# TODO: Save shortcuts
|
||||||
|
settings.endGroup()
|
||||||
|
|
||||||
|
def loadShortcuts(self):
|
||||||
|
"""
|
||||||
|
Load the shortcuts.
|
||||||
|
"""
|
||||||
|
settings = QtCore.QSettings()
|
||||||
|
settings.beginGroup(u'shortcuts')
|
||||||
|
# TODO: Load shortcuts
|
||||||
|
settings.endGroup()
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
The :mod:`~openlp.core.utils.actions` module provides action list classes used
|
The :mod:`~openlp.core.utils.actions` module provides action list classes used
|
||||||
by the shortcuts system.
|
by the shortcuts system.
|
||||||
"""
|
"""
|
||||||
from PyQt4 import QtCore
|
|
||||||
|
|
||||||
class ActionCategory(object):
|
class ActionCategory(object):
|
||||||
"""
|
"""
|
||||||
The :class:`~openlp.core.utils.ActionCategory` class encapsulates a
|
The :class:`~openlp.core.utils.ActionCategory` class encapsulates a
|
||||||
@ -175,7 +173,6 @@ class ActionList(object):
|
|||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.categories = CategoryList()
|
self.categories = CategoryList()
|
||||||
self.signal = Emit()
|
|
||||||
|
|
||||||
def add_action(self, action, category=u'Default', weight=None):
|
def add_action(self, action, category=u'Default', weight=None):
|
||||||
if category not in self.categories:
|
if category not in self.categories:
|
||||||
@ -184,11 +181,5 @@ class ActionList(object):
|
|||||||
self.categories[category].actions.append(action)
|
self.categories[category].actions.append(action)
|
||||||
else:
|
else:
|
||||||
self.categories[category].actions.add(action, weight)
|
self.categories[category].actions.add(action, weight)
|
||||||
self.signal.emit(QtCore.SIGNAL(u'addedAction()'))
|
|
||||||
|
|
||||||
|
|
||||||
class Emit(QtCore.QObject):
|
|
||||||
def __init__(self):
|
|
||||||
QtCore.QObject.__init__(self)
|
|
||||||
|
|
||||||
actionList = ActionList()
|
actionList = ActionList()
|
||||||
|
@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
||||||
Receiver
|
Receiver
|
||||||
from openlp.core.lib.db import Manager
|
from openlp.core.lib.db import Manager
|
||||||
from openlp.core.lib.ui import UiStrings
|
from openlp.core.lib.ui import UiStrings, base_action, icon_action
|
||||||
from openlp.plugins.songs.lib import clean_song, SongMediaItem, SongsTab
|
from openlp.plugins.songs.lib import clean_song, SongMediaItem, SongsTab
|
||||||
from openlp.plugins.songs.lib.db import init_schema, Song
|
from openlp.plugins.songs.lib.db import init_schema, Song
|
||||||
from openlp.plugins.songs.lib.importer import SongFormat
|
from openlp.plugins.songs.lib.importer import SongFormat
|
||||||
@ -78,8 +78,8 @@ class SongsPlugin(Plugin):
|
|||||||
use it as their parent.
|
use it as their parent.
|
||||||
"""
|
"""
|
||||||
# Main song import menu item - will eventually be the only one
|
# Main song import menu item - will eventually be the only one
|
||||||
self.SongImportItem = QtGui.QAction(import_menu)
|
self.SongImportItem = base_action(
|
||||||
self.SongImportItem.setObjectName(u'SongImportItem')
|
import_menu, u'SongImportItem', u'Import')
|
||||||
self.SongImportItem.setText(translate(
|
self.SongImportItem.setText(translate(
|
||||||
'SongsPlugin', '&Song'))
|
'SongsPlugin', '&Song'))
|
||||||
self.SongImportItem.setToolTip(translate('SongsPlugin',
|
self.SongImportItem.setToolTip(translate('SongsPlugin',
|
||||||
@ -99,8 +99,7 @@ class SongsPlugin(Plugin):
|
|||||||
use it as their parent.
|
use it as their parent.
|
||||||
"""
|
"""
|
||||||
# Main song import menu item - will eventually be the only one
|
# Main song import menu item - will eventually be the only one
|
||||||
self.SongExportItem = QtGui.QAction(export_menu)
|
self.SongExportItem = base_action(export_menu, u'SongExportItem', u'Export')
|
||||||
self.SongExportItem.setObjectName(u'SongExportItem')
|
|
||||||
self.SongExportItem.setText(translate(
|
self.SongExportItem.setText(translate(
|
||||||
'SongsPlugin', '&Song'))
|
'SongsPlugin', '&Song'))
|
||||||
self.SongExportItem.setToolTip(translate('SongsPlugin',
|
self.SongExportItem.setToolTip(translate('SongsPlugin',
|
||||||
@ -120,9 +119,8 @@ class SongsPlugin(Plugin):
|
|||||||
use it as their parent.
|
use it as their parent.
|
||||||
"""
|
"""
|
||||||
log.info(u'add tools menu')
|
log.info(u'add tools menu')
|
||||||
self.toolsReindexItem = QtGui.QAction(tools_menu)
|
self.toolsReindexItem = icon_action(tools_menu, u'toolsReindexItem',
|
||||||
self.toolsReindexItem.setIcon(build_icon(u':/plugins/plugin_songs.png'))
|
u':/plugins/plugin_songs.png', category=u'Tools')
|
||||||
self.toolsReindexItem.setObjectName(u'toolsReindexItem')
|
|
||||||
self.toolsReindexItem.setText(
|
self.toolsReindexItem.setText(
|
||||||
translate('SongsPlugin', '&Re-index Songs'))
|
translate('SongsPlugin', '&Re-index Songs'))
|
||||||
self.toolsReindexItem.setStatusTip(
|
self.toolsReindexItem.setStatusTip(
|
||||||
|
Loading…
Reference in New Issue
Block a user