Did some more string format conversions.

Tue, 27 Jul 2010 08:25:53 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 27 Jul 2010 08:25:53 +0200
changeset 410
e5d1addeb90c
parent 409
0ea528e80202
child 411
99409cddaaa9

Did some more string format conversions.

E5Gui/E5Action.py file | annotate | diff | comparison | revisions
E5Gui/E5Application.py file | annotate | diff | comparison | revisions
E5Gui/E5SingleApplication.py file | annotate | diff | comparison | revisions
E5Gui/E5ToolBarDialog.py file | annotate | diff | comparison | revisions
E5Gui/E5ToolBarManager.py file | annotate | diff | comparison | revisions
E5Network/E5NetworkMonitor.py file | annotate | diff | comparison | revisions
eric5.e4p file | annotate | diff | comparison | revisions
--- a/E5Gui/E5Action.py	Mon Jul 26 19:59:27 2010 +0200
+++ b/E5Gui/E5Action.py	Tue Jul 27 08:25:53 2010 +0200
@@ -70,11 +70,13 @@
             icon = None
             incr = 0
         if len(args) < 6+incr:
-            raise ArgumentsError("Not enough arguments, %d expected, got %d" % \
-                                 (6+incr, len(args)))
+            raise ArgumentsError(
+                "Not enough arguments, {0:d} expected, got {1:d}".format(
+                6 + incr, len(args)))
         elif len(args) > 7+incr:
-            raise ArgumentsError("Too many arguments, max. %d expected, got %d" % \
-                                 (7+incr, len(args)))
+            raise ArgumentsError(
+                "Too many arguments, max. {0:d} expected, got {1:d}".format(
+                7 + incr, len(args)))
             
         parent = args[4+incr]
         QAction.__init__(self, parent)
--- a/E5Gui/E5Application.py	Mon Jul 26 19:59:27 2010 +0200
+++ b/E5Gui/E5Application.py	Tue Jul 27 08:25:53 2010 +0200
@@ -34,7 +34,7 @@
         @exception KeyError raised when the given name is already in use
         """
         if name in self.__objectRegistry:
-            raise KeyError('Object "%s" already registered.' % name)
+            raise KeyError('Object "{0}" already registered.'.format(name))
         else:
             self.__objectRegistry[name] = object
         
@@ -49,7 +49,7 @@
         if name in self.__objectRegistry:
             return self.__objectRegistry[name]
         else:
-            raise KeyError('Object "%s" is not registered.' % name)
+            raise KeyError('Object "{0}" is not registered.'.format(name))
         
     def registerPluginObject(self, name, object, pluginType = None):
         """
@@ -61,7 +61,7 @@
         @exception KeyError raised when the given name is already in use
         """
         if name in self.__pluginObjectRegistry:
-            raise KeyError('Pluginobject "%s" already registered.' % name)
+            raise KeyError('Pluginobject "{0}" already registered.'.format(name))
         else:
             self.__pluginObjectRegistry[name] = (object, pluginType)
         
@@ -85,7 +85,7 @@
         if name in self.__pluginObjectRegistry:
             return self.__pluginObjectRegistry[name][0]
         else:
-            raise KeyError('Pluginobject "%s" is not registered.' % name)
+            raise KeyError('Pluginobject "{0}" is not registered.'.format(name))
         
     def getPluginObjects(self):
         """
@@ -110,6 +110,6 @@
         if name in self.__pluginObjectRegistry:
             return self.__pluginObjectRegistry[name][1]
         else:
-            raise KeyError('Pluginobject "%s" is not registered.' % name)
+            raise KeyError('Pluginobject "{0}" is not registered.'.format(name))
 
-e5App = QCoreApplication.instance
\ No newline at end of file
+e5App = QCoreApplication.instance
--- a/E5Gui/E5SingleApplication.py	Mon Jul 26 19:59:27 2010 +0200
+++ b/E5Gui/E5SingleApplication.py	Tue Jul 27 08:25:53 2010 +0200
@@ -118,7 +118,7 @@
                 if argsStr is None:
                     argsStr = arg
                 else:
-                    argsStr = "%s %s" % (argsStr, arg)
+                    argsStr = "{0} {1}".format(argsStr, arg)
                 continue
             
             ext = os.path.splitext(arg)[1]
@@ -141,7 +141,7 @@
         
         @param fname name of file to be opened (string)
         """
-        cmd = "%s%s\n" % (SAOpenFile, Utilities.normabspath(fname))
+        cmd = "{0}{1}\n".format(SAOpenFile, Utilities.normabspath(fname))
         self.sendCommand(cmd)
         
     def __openProject(self, pfname):
@@ -150,7 +150,7 @@
         
         @param pfname name of the projectfile to be opened (string)
         """
-        cmd = "%s%s\n" % (SAOpenProject, Utilities.normabspath(pfname))
+        cmd = "{0}{1}\n".format(SAOpenProject, Utilities.normabspath(pfname))
         self.sendCommand(cmd)
         
     def __sendArguments(self, argsStr):
@@ -159,5 +159,5 @@
         
         @param argsStr space delimited list of command args (string)
         """
-        cmd = "%s%s\n" % (SAArguments, argsStr)
+        cmd = "{0}{1}\n".format(SAArguments, argsStr)
         self.sendCommand(cmd)
--- a/E5Gui/E5ToolBarDialog.py	Mon Jul 26 19:59:27 2010 +0200
+++ b/E5Gui/E5ToolBarDialog.py	Tue Jul 27 08:25:53 2010 +0200
@@ -54,7 +54,7 @@
         self.__currentToolBarItem = None
         self.__removedToolBarIDs = []   # remember custom toolbars to be deleted
         
-        self.__widgetActionToToolBarItemID = {}   # maps widget action IDs to toolbar item IDs
+        self.__widgetActionToToolBarItemID = {} # maps widget action IDs to toolbar item IDs
         self.__toolBarItemToWidgetActionID = {} # maps toolbar item IDs to widget action IDs
         
         self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow.png"))
@@ -406,7 +406,7 @@
                 else:
                     action = self.__manager.actionById(actionID)
                     if action is None:
-                        raise RuntimeError("No such action, id: 0x%x" % actionID)
+                        raise RuntimeError("No such action, id: 0x{0:x}".format(actionID))
                     actions.append(action)
             self.__manager.setToolBar(tb, actions)
             tbItem.isChanged = False
@@ -458,4 +458,4 @@
         tbID = self.__currentToolBarItem.toolBarId
         actions = self.__manager.defaultToolBarActions(tbID)
         self.__restoreCurrentToolbar(actions)
-        self.__currentToolBarItem.isChanged = True
\ No newline at end of file
+        self.__currentToolBarItem.isChanged = True
--- a/E5Gui/E5ToolBarManager.py	Mon Jul 26 19:59:27 2010 +0200
+++ b/E5Gui/E5ToolBarManager.py	Tue Jul 27 08:25:53 2010 +0200
@@ -303,10 +303,10 @@
         toolBar.setToolTip(title)
         index = 1
         customPrefix = "__CustomPrefix__"
-        name = "%s%d" % (customPrefix, index)
+        name = "{0}{1:d}".format(customPrefix, index)
         while self.__toolBarByName(name) is not None:
             index += 1
-            name = "%s%d" % (customPrefix, index)
+            name = "{0}{1:d}".format(customPrefix, index)
         toolBar.setObjectName(name)
         self.__mainWindow.addToolBar(toolBar)
         
@@ -676,4 +676,4 @@
         """
         if tbID not in self.__defaultToolBars:
             return []
-        return self.__defaultToolBars[tbID][:]
\ No newline at end of file
+        return self.__defaultToolBars[tbID][:]
--- a/E5Network/E5NetworkMonitor.py	Mon Jul 26 19:59:27 2010 +0200
+++ b/E5Network/E5NetworkMonitor.py	Tue Jul 27 08:25:53 2010 +0200
@@ -286,7 +286,7 @@
         # save reply info to be displayed
         status = reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) or 0
         reason = reply.attribute(QNetworkRequest.HttpReasonPhraseAttribute) or ""
-        self.requests[offset].response = "%d %s" % (status, reason)
+        self.requests[offset].response = "{0:d} {1}".format(status, reason)
         self.requests[offset].length = reply.header(QNetworkRequest.ContentLengthHeader)
         self.requests[offset].contentType = reply.header(QNetworkRequest.ContentTypeHeader)
         
--- a/eric5.e4p	Mon Jul 26 19:59:27 2010 +0200
+++ b/eric5.e4p	Tue Jul 27 08:25:53 2010 +0200
@@ -1131,7 +1131,6 @@
     <Other>Plugins/VcsPlugins/vcsMercurial/icons/startServer.png</Other>
     <Other>Plugins/VcsPlugins/vcsMercurial/icons/stopServer.png</Other>
     <Other>CSSs/blue.css</Other>
-    <Other>CSSs/default.css</Other>
   </Others>
   <MainScript>eric5.py</MainScript>
   <Vcs>

eric ide

mercurial