Permalink
Browse files

unicodes formatted strings need

Fixes errors like

File "/Users/carpincho/Dev/ninja-ide/ninja_ide/gui/status_bar.py", line 267, in __init_
QKeySequence.NativeText)))

TypeError: function takes exactly 5 arguments (1 given)

PROBLEM:    "unicode format string here" % unicode content string

SOLUTION:  u"unicode format string here".format( unicode content string )
  • Loading branch information...
1 parent e78ec78 commit 340d0e677cc527c34e9fa776c84451b26b0b40ca @marchon committed Oct 7, 2012
@@ -215,13 +215,13 @@ def __init__(self, explorer):
self.combo = QComboBox()
ui_tools.ComboBoxButton(self.combo, self.combo.clear,
self.style().standardPixmap(self.style().SP_TrashIcon))
- self.combo.setToolTip(self.tr("Select the item from the Paste "
+ self.combo.setToolTip(self.tr(u"Select the item from the Paste "
"Historial list.\nYou can Copy items into this list with: "
- "%s\nor Paste them using: %s" %
+ "%s\nor Paste them using: %s".format(
(resources.get_shortcut("History-Copy").toString(
QKeySequence.NativeText),
resources.get_shortcut("History-Paste").toString(
- QKeySequence.NativeText))))
+ QKeySequence.NativeText)))))
self.combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
hbox.addWidget(self.combo)
vbox.addLayout(hbox)
@@ -36,37 +36,37 @@ def __init__(self, menuEdit, toolbar):
QObject.__init__(self)
undoAction = menuEdit.addAction(QIcon(resources.IMAGES['undo']),
- self.tr("Undo (%s+Z)" % settings.OS_KEY))
+ self.tr(u"Undo (%s+Z)".format( settings.OS_KEY)))
redoAction = menuEdit.addAction(QIcon(resources.IMAGES['redo']),
- self.tr("Redo (%s)" % resources.get_shortcut("Redo").toString(
- QKeySequence.NativeText)))
+ self.tr(u"Redo (%s)".format( resources.get_shortcut("Redo").toString(
+ QKeySequence.NativeText))))
cutAction = menuEdit.addAction(QIcon(resources.IMAGES['cut']),
- self.tr("&Cut (%s+X)" % settings.OS_KEY))
+ self.tr(u"&Cut (%s+X)".format( settings.OS_KEY)))
copyAction = menuEdit.addAction(QIcon(resources.IMAGES['copy']),
- self.tr("&Copy (%s+C)" % settings.OS_KEY))
+ self.tr(u"&Copy (%s+C)".format( settings.OS_KEY)))
pasteAction = menuEdit.addAction(QIcon(resources.IMAGES['paste']),
- self.tr("&Paste (%s+V)" % settings.OS_KEY))
+ self.tr(u"&Paste (%s+V)".format( settings.OS_KEY)))
menuEdit.addSeparator()
findAction = menuEdit.addAction(QIcon(resources.IMAGES['find']),
- self.tr("Find (%s)" % resources.get_shortcut("Find").toString(
- QKeySequence.NativeText)))
+ self.tr(u"Find (%s)".format( resources.get_shortcut("Find").toString(
+ QKeySequence.NativeText))))
findReplaceAction = menuEdit.addAction(
QIcon(resources.IMAGES['findReplace']),
- self.tr("Find/Replace (%s)" %
+ self.tr(u"Find/Replace (%s)".format(
resources.get_shortcut("Find-replace").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
findWithWordAction = menuEdit.addAction(
- self.tr("Find using word under cursor (%s)" %
+ self.tr(u"Find using word under cursor (%s)".format(
resources.get_shortcut("Find-with-word").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
findInFilesAction = menuEdit.addAction(QIcon(resources.IMAGES['find']),
- self.tr("Find in Files (%s)" %
+ self.tr(u"Find in Files (%s)".format(
resources.get_shortcut("Find-in-files").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
locatorAction = menuEdit.addAction(QIcon(resources.IMAGES['locator']),
- self.tr("Code Locator (%s)" %
+ self.tr(u"Code Locator (%s)".format(
resources.get_shortcut("Code-locator").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
menuEdit.addSeparator()
upperAction = menuEdit.addAction(
self.tr("Convert selected Text to: UPPER"))
@@ -39,28 +39,28 @@ def __init__(self, menuFile, toolbar, ide):
QObject.__init__(self)
newAction = menuFile.addAction(QIcon(resources.IMAGES['new']),
- self.tr("&New File (%s)" %
+ self.tr(u"&New File (%s)".format(
resources.get_shortcut("New-file").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
newProjectAction = menuFile.addAction(
QIcon(resources.IMAGES['newProj']),
- self.tr("New Pro&ject (%s)" %
+ self.tr(u"New Pro&ject (%s)".format (
resources.get_shortcut("New-project").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
menuFile.addSeparator()
saveAction = menuFile.addAction(QIcon(resources.IMAGES['save']),
- self.tr("&Save (%s)" %
+ self.tr(u"&Save (%s)".format(
resources.get_shortcut("Save-file").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
saveAsAction = menuFile.addAction(QIcon(resources.IMAGES['saveAs']),
self.tr("Save &As"))
saveAllAction = menuFile.addAction(QIcon(resources.IMAGES['saveAll']),
self.tr("Save All"))
saveProjectAction = menuFile.addAction(QIcon(
resources.IMAGES['saveAll']),
- self.tr("Save Pro&ject (%s)" %
+ self.tr(u"Save Pro&ject (%s)".format(
resources.get_shortcut("Save-project").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
menuFile.addSeparator()
reloadFileAction = menuFile.addAction(
QIcon(resources.IMAGES['reload-file']),
@@ -69,14 +69,14 @@ def __init__(self, menuFile, toolbar, ide):
QKeySequence.NativeText)))
menuFile.addSeparator()
openAction = menuFile.addAction(QIcon(resources.IMAGES['open']),
- self.tr("&Open (%s)" %
+ self.tr(u"&Open (%s)".format(
resources.get_shortcut("Open-file").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
openProjectAction = menuFile.addAction(
QIcon(resources.IMAGES['openProj']),
- self.tr("Open &Project (%s)" %
+ self.tr(u"Open &Project (%s)".format(
resources.get_shortcut("Open-project").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
self.recent_files = menuFile.addMenu(self.tr('Open Recent Files'))
menuFile.addSeparator()
activateProfileAction = menuFile.addAction(
@@ -87,14 +87,14 @@ def __init__(self, menuFile, toolbar, ide):
self.tr("Deactivate Profile"))
menuFile.addSeparator()
printFile = menuFile.addAction(QIcon(resources.IMAGES['print']),
- self.tr("Pr&int File (%s)" %
+ self.tr(u"Pr&int File (%s)".format(
resources.get_shortcut("Print-file").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
closeAction = menuFile.addAction(
ide.style().standardIcon(QStyle.SP_DialogCloseButton),
- self.tr("&Close Tab (%s)" %
+ self.tr(u"&Close Tab (%s)".format(
resources.get_shortcut("Close-tab").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
closeProjectsAction = menuFile.addAction(
ide.style().standardIcon(QStyle.SP_DialogCloseButton),
self.tr("&Close All Projects"))
@@ -160,4 +160,4 @@ def update_recent_files(self, files):
def _open_file(self, action):
"""Open the file selected in the recent files menu."""
path = action.text()
- self.emit(SIGNAL("openFile(QString)"), path)
+ self.emit(SIGNAL("openFile(QString)"), path)
@@ -41,13 +41,13 @@ def __init__(self, menuProject, toolbar):
# QKeySequence.NativeText)))
runFileAction = menuProject.addAction(
QIcon(resources.IMAGES['file-run']),
- self.tr("Run File (%s)" %
+ self.tr(u"Run File (%s)".format(
resources.get_shortcut("Run-file").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
stopAction = menuProject.addAction(QIcon(resources.IMAGES['stop']),
- self.tr("Stop (%s)" %
+ self.tr("Stop (%s)".format(
resources.get_shortcut("Stop-execution").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
menuProject.addSeparator()
projectPropertiesAction = menuProject.addAction(
self.tr("Open Project Properties"))
@@ -34,24 +34,24 @@ def __init__(self, menuSource):
indentMoreAction = menuSource.addAction(
QIcon(resources.IMAGES['indent-more']),
- self.tr("Indent More (%s)" %
- QKeySequence(Qt.Key_Tab).toString(QKeySequence.NativeText)))
+ self.tr(u"Indent More (%s)".format(
+ QKeySequence(Qt.Key_Tab).toString(QKeySequence.NativeText))))
indentLessAction = menuSource.addAction(
QIcon(resources.IMAGES['indent-less']),
- self.tr("Indent Less (%s)" %
+ self.tr(u"Indent Less (%s)".format(
resources.get_shortcut("Indent-less").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
menuSource.addSeparator()
commentAction = menuSource.addAction(
QIcon(resources.IMAGES['comment-code']),
- self.tr("Comment (%s)" %
+ self.tr(u"Comment (%s)".format(
resources.get_shortcut("Comment").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
unCommentAction = menuSource.addAction(
QIcon(resources.IMAGES['uncomment-code']),
- self.tr("Uncomment (%s)" %
+ self.tr(u"Uncomment (%s)".format(
resources.get_shortcut("Uncomment").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
horizontalLineAction = menuSource.addAction(
self.tr("Insert Horizontal Line (%s)" %
resources.get_shortcut("Horizontal-line").toString(
@@ -68,15 +68,15 @@ def __init__(self, menuSource):
# tellTaleAction.setEnabled(False)
goToDefinitionAction = menuSource.addAction(
QIcon(resources.IMAGES['go-to-definition']),
- self.tr("Go To Definition (%s or %s+Click)" %
+ self.tr(u"Go To Definition (%s or %s+Click)".format(
(resources.get_shortcut("Go-to-definition").toString(
QKeySequence.NativeText),
- settings.OS_KEY)))
+ settings.OS_KEY))))
insertImport = menuSource.addAction(
QIcon(resources.IMAGES['insert-import']),
- self.tr("Insert &Import (%s)" %
+ self.tr(u"Insert &Import (%s)".format(
resources.get_shortcut("Import").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
menu_debugging = menuSource.addMenu(self.tr("Debugging Tricks"))
insertPrints = menu_debugging.addAction(
self.tr("Insert Prints per selected line."))
@@ -93,20 +93,20 @@ def __init__(self, menuSource):
self.tr("&Remove Trailing Spaces"))
replaceTabsSpaces = menuSource.addAction(
self.tr("Replace Tabs With &Spaces"))
- moveUp = menuSource.addAction(self.tr("Move &Up (%s)" %
+ moveUp = menuSource.addAction(self.tr(u"Move &Up (%s)".format(
resources.get_shortcut("Move-up").toString(
- QKeySequence.NativeText)))
- moveDown = menuSource.addAction(self.tr("Move &Down (%s)" %
+ QKeySequence.NativeText))))
+ moveDown = menuSource.addAction(self.tr(u"Move &Down (%s)".format(
resources.get_shortcut("Move-down").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
duplicate = menuSource.addAction(
- self.tr("Duplica&te (%s)" %
+ self.tr("Duplica&te (%s)".format(
resources.get_shortcut("Duplicate").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
remove = menuSource.addAction(
- self.tr("&Remove Line (%s)" %
+ self.tr(u"&Remove Line (%s)".format(
resources.get_shortcut("Remove-line").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
self.toolbar_items = {
'indent-more': indentMoreAction,
@@ -58,9 +58,9 @@ def __init__(self, menuView, toolbar, ide):
self.hideToolbarAction.setCheckable(True)
self.fullscreenAction = menuView.addAction(
QIcon(resources.IMAGES['fullscreen']),
- self.tr("Full Screen &Mode (%s)" %
+ self.tr(u"Full Screen &Mode (%s)".format(
resources.get_shortcut("Full-screen").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
menuView.addSeparator()
splitTabHAction = menuView.addAction(
QIcon(resources.IMAGES['splitH']),
@@ -74,9 +74,9 @@ def __init__(self, menuView, toolbar, ide):
QKeySequence.NativeText)))
followModeAction = menuView.addAction(
QIcon(resources.IMAGES['follow']),
- self.tr("Follow Mode (%s)" %
+ self.tr(u"Follow Mode (%s)".format(
resources.get_shortcut("Follow-mode").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
groupTabsAction = menuView.addAction(self.tr("Group Tabs by Project"))
deactivateGroupTabsAction = menuView.addAction(
self.tr("Deactivate Group Tabs"))
@@ -262,14 +262,14 @@ def __init__(self, parent):
self._btnFind = QPushButton(QIcon(resources.IMAGES['find']), '')
self.btnPrevious = QPushButton(
self.style().standardIcon(QStyle.SP_ArrowLeft), '')
- self.btnPrevious.setToolTip(self.tr("Press %s" %
+ self.btnPrevious.setToolTip(self.tr(u"Press %s".format(
resources.get_shortcut("Find-previous").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
self.btnNext = QPushButton(
self.style().standardIcon(QStyle.SP_ArrowRight), '')
- self.btnNext.setToolTip(self.tr("Press %s" %
+ self.btnNext.setToolTip(self.tr(u"Press %s".format(
resources.get_shortcut("Find-next").toString(
- QKeySequence.NativeText)))
+ QKeySequence.NativeText))))
hSearch.addWidget(self._btnClose)
hSearch.addWidget(self._line)
hSearch.addWidget(self._btnFind)

0 comments on commit 340d0e6

Please sign in to comment.