Wed, 28 Jul 2010 15:12:20 +0200
Did some more string format conversions.
--- a/Plugins/VcsPlugins/vcsSubversion/SvnBlameDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnBlameDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -158,7 +158,7 @@ @param text line of text from the annotated file (string) """ itm = QTreeWidgetItem(self.blameList, - [revision, author, "%d" % self.lineno, text]) + [revision, author, "{0:d}".format(self.lineno), text]) self.lineno += 1 itm.setTextAlignment(0, Qt.AlignRight) itm.setTextAlignment(2, Qt.AlignRight)
--- a/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -123,7 +123,7 @@ if rev1 is not None or rev2 is not None: args.append('-r') if rev1 is not None and rev2 is not None: - args.append('%s:%s' % (rev1, rev2)) + args.append('{0}:{1}'.format(rev1, rev2)) elif rev2 is None: args.append(rev1) elif rev1 is None: @@ -134,8 +134,8 @@ if summary: args.append("--summarize") self.summaryPath = urls[0] - args.append("--old=%s" % urls[0]) - args.append("--new=%s" % urls[1]) + args.append("--old={0}".format(urls[0])) + args.append("--new={0}".format(urls[1])) if isinstance(fn, list): dname, fnames = self.vcs.splitPathList(fn) else: @@ -269,7 +269,7 @@ else: dname, fname = self.vcs.splitPath(self.filename[0]) if fname != '.': - fname = "%s.diff" % self.filename[0] + fname = "{0}.diff".format(self.filename[0]) else: fname = dname else: @@ -362,4 +362,4 @@ self.intercept = False evt.accept() return - QWidget.keyPressEvent(self, evt) \ No newline at end of file + QWidget.keyPressEvent(self, evt)
--- a/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -155,7 +155,7 @@ msg.append(line.strip()) itm = QTreeWidgetItem(self.logTree, [ - "%7s" % revision, + "{0:7}".format(revision), author, date, " ".join(msg), @@ -225,10 +225,10 @@ self.vcs.addArguments(args, self.vcs.options['log']) args.append('--verbose') args.append('--limit') - args.append('%d' % self.limitSpinBox.value()) + args.append('{0:d}'.format(self.limitSpinBox.value())) if startRev is not None: args.append('--revision') - args.append('%s:0' % startRev) + args.append('{0}:0'.format(startRev)) if self.stopCheckBox.isChecked(): args.append('--stop-on-copy') args.append(self.fname) @@ -556,7 +556,7 @@ fieldIndex = 0 txt = self.rxEdit.text() if txt.startswith("^"): - searchRx = QRegExp("^\s*%s" % txt[1:], Qt.CaseInsensitive) + searchRx = QRegExp("^\s*{0}".format(txt[1:]), Qt.CaseInsensitive) else: searchRx = QRegExp(txt, Qt.CaseInsensitive) else:
--- a/Plugins/VcsPlugins/vcsSubversion/SvnLogDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnLogDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -171,7 +171,7 @@ query = QByteArray() query.append(lv).append('_').append(ver) url.setEncodedQuery(query) - dstr += ' [<a href="%s" name="%s">%s</a>]' % ( + dstr += ' [<a href="{0}" name="{1}">{2}</a>]'.format( url.toString(), query, self.trUtf8('diff to {0}').format(lv),
--- a/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -127,10 +127,10 @@ scheme = self.protocolCombo.currentText() url = self.vcsUrlEdit.text() if scheme == "file://" and url[0] not in ["\\", "/"]: - url = "/%s" % url + url = "/{0}".format(url) vcsdatadict = { - "url" : '%s%s' % (scheme, url), + "url" : '{0}{1}'.format(scheme, url), "tag" : self.vcsTagEdit.text(), "standardLayout" : self.layoutCheckBox.isChecked(), } - return (self.vcsProjectDirEdit.text(), vcsdatadict) \ No newline at end of file + return (self.vcsProjectDirEdit.text(), vcsdatadict)
--- a/Plugins/VcsPlugins/vcsSubversion/SvnOptionsDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnOptionsDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -102,10 +102,10 @@ scheme = self.protocolCombo.currentText() url = self.vcsUrlEdit.text() if scheme == "file://" and url[0] not in ["\\", "/"]: - url = "/%s" % url + url = "/{0}".format(url) vcsdatadict = { - "url" : '%s%s' % (scheme, url), + "url" : '{0}{1}'.format(scheme, url), "message" : self.vcsLogEdit.text(), "standardLayout" : self.layoutCheckBox.isChecked(), } - return vcsdatadict \ No newline at end of file + return vcsdatadict
--- a/Plugins/VcsPlugins/vcsSubversion/SvnRepoBrowserDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnRepoBrowserDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -204,7 +204,7 @@ urlPart = repoRoot for element in url.replace(repoRoot, "").split("/"): if element: - urlPart = "%s/%s" % (urlPart, element) + urlPart = "{0}/{1}".format(urlPart, element) itm = self.__generateItem(element, "", "", "", "", "dir", urlPart) itm.setExpanded(True) self.parentItem = itm @@ -389,7 +389,7 @@ nodekind = "file" else: continue - url = "%s/%s" % (self.repoUrl, name) + url = "{0}/{1}".format(self.repoUrl, name) self.__generateItem(name, revision, author, size, date, nodekind, url) def __readStderr(self):
--- a/Plugins/VcsPlugins/vcsSubversion/SvnRevisionSelectionDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnRevisionSelectionDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -62,8 +62,8 @@ if numberButton.isChecked(): return numberSpinBox.value() elif dateButton.isChecked(): - return "{%s}" % \ - QDateTime(dateEdit.date(), timeEdit.time()).toString(Qt.ISODate) + return "{{{0}}}".format( + QDateTime(dateEdit.date(), timeEdit.time()).toString(Qt.ISODate)) elif headButton.isChecked(): return "HEAD" elif workingButton.isChecked():
--- a/Plugins/VcsPlugins/vcsSubversion/SvnStatusDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnStatusDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -220,8 +220,8 @@ self.switched[switched], self.lockinfo[lockinfo], self.uptodate[uptodate], - "%7s" % str(revision), - "%7s" % str(change), + "{0:7}".format(str(revision)), + "{0:7}".format(str(change)), author, path, ])
--- a/Plugins/VcsPlugins/vcsSubversion/SvnStatusMonitorThread.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnStatusMonitorThread.py Wed Jul 28 15:12:20 2010 +0200 @@ -96,12 +96,12 @@ states[name] = status try: if self.reportedStates[name] != status: - self.statusList.append("%s %s" % (status, name)) + self.statusList.append("{0} {1}".format(status, name)) except KeyError: - self.statusList.append("%s %s" % (status, name)) + self.statusList.append("{0} {1}".format(status, name)) for name in list(self.reportedStates.keys()): if name not in states: - self.statusList.append(" %s" % name) + self.statusList.append(" {0}".format(name)) self.reportedStates = states return True, \ self.trUtf8("Subversion status checked successfully (using svn)")
--- a/Plugins/VcsPlugins/vcsSubversion/SvnTagBranchListDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnTagBranchListDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -115,9 +115,9 @@ reposRoot = rx_base.cap(1) if tags: - args.append("%s/tags" % reposRoot) + args.append("{0}/tags".format(reposRoot)) else: - args.append("%s/branches" % reposRoot) + args.append("{0}/branches".format(reposRoot)) self.path = None else: reposPath, ok = QInputDialog.getText(\ @@ -235,7 +235,7 @@ Preferences.getSystem("IOEncoding"), 'replace') if self.rx_list.exactMatch(s): - rev = "%6s" % self.rx_list.cap(1) + rev = "{0:6}".format(self.rx_list.cap(1)) author = self.rx_list.cap(2) date = self.rx_list.cap(3) path = self.rx_list.cap(4)
--- a/Plugins/VcsPlugins/vcsSubversion/subversion.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/subversion.py Wed Jul 28 15:12:20 2010 +0200 @@ -212,7 +212,7 @@ if os.getcwd() == project.ppath: os.chdir(os.path.dirname(project.ppath)) cwdIsPpath = True - tmpProjectDir = "%s_tmp" % project.ppath + tmpProjectDir = "{0}_tmp".format(project.ppath) shutil.rmtree(tmpProjectDir, True) os.rename(project.ppath, tmpProjectDir) os.makedirs(project.ppath) @@ -263,14 +263,14 @@ vcsDir = self.svnNormalizeURL(vcsDataDict["url"]) if vcsDir.startswith('/'): - vcsDir = 'file://%s' % vcsDir + vcsDir = 'file://{0}'.format(vcsDir) elif vcsDir[1] in ['|', ':']: - vcsDir = 'file:///%s' % vcsDir + vcsDir = 'file:///{0}'.format(vcsDir) project = vcsDir[vcsDir.rfind('/')+1:] # create the dir structure to be imported into the repository - tmpDir = '%s_tmp' % projectDir + tmpDir = '{0}_tmp'.format(projectDir) try: os.makedirs(tmpDir) if self.otherData["standardLayout"]: @@ -321,13 +321,13 @@ tag = None vcsDir = self.svnNormalizeURL(vcsDataDict["url"]) if vcsDir.startswith('/'): - vcsDir = 'file://%s' % vcsDir + vcsDir = 'file://{0}'.format(vcsDir) elif vcsDir[1] in ['|', ':']: - vcsDir = 'file:///%s' % vcsDir + vcsDir = 'file:///{0}'.format(vcsDir) if self.otherData["standardLayout"]: if tag is None or tag == '': - svnUrl = '%s/trunk' % vcsDir + svnUrl = '{0}/trunk'.format(vcsDir) else: if not tag.startswith('tags') and not tag.startswith('branches'): type, ok = QInputDialog.getItem(\ @@ -340,8 +340,8 @@ 0, False) if not ok: return False - tag = '%s/%s' % (type, tag) - svnUrl = '%s/%s' % (vcsDir, tag) + tag = '{0}/{1}'.format(type, tag) + svnUrl = '{0}/{1}'.format(vcsDir, tag) else: svnUrl = vcsDir @@ -375,11 +375,11 @@ tag = None vcsDir = self.svnNormalizeURL(vcsDataDict["url"]) if vcsDir.startswith('/') or vcsDir[1] == '|': - vcsDir = 'file://%s' % vcsDir + vcsDir = 'file://{0}'.format(vcsDir) if self.otherData["standardLayout"]: if tag is None or tag == '': - svnUrl = '%s/trunk' % vcsDir + svnUrl = '{0}/trunk'.format(vcsDir) else: if not tag.startswith('tags') and not tag.startswith('branches'): type, ok = QInputDialog.getItem(\ @@ -392,8 +392,8 @@ 0, False) if not ok: return False - tag = '%s/%s' % (type, tag) - svnUrl = '%s/%s' % (vcsDir, tag) + tag = '{0}/{1}'.format(type, tag) + svnUrl = '{0}/{1}'.format(vcsDir, tag) else: svnUrl = vcsDir @@ -841,9 +841,9 @@ reposRoot = rx_base.cap(1) if tagOp in [1, 4]: - url = '%s/tags/%s' % (reposRoot, urllib.parse.quote(tag)) + url = '{0}/tags/{1}'.format(reposRoot, urllib.parse.quote(tag)) elif tagOp in [2, 8]: - url = '%s/branches/%s' % (reposRoot, urllib.parse.quote(tag)) + url = '{0}/branches/{1}'.format(reposRoot, urllib.parse.quote(tag)) else: url = self.__svnURL(tag) @@ -853,7 +853,7 @@ self.addArguments(args, self.options['global']) self.addArguments(args, self.options['tag']) args.append('--message') - args.append('Created tag <%s>' % tag) + args.append('Created tag <{0}>'.format(tag)) args.append(reposURL) args.append(url) else: @@ -861,7 +861,7 @@ self.addArguments(args, self.options['global']) self.addArguments(args, self.options['tag']) args.append('--message') - args.append('Deleted tag <%s>' % tag) + args.append('Deleted tag <{0}>'.format(tag)) args.append(url) dia = SvnDialog(self.trUtf8('Tagging {0} in the Subversion repository') @@ -936,11 +936,11 @@ reposRoot = rx_base.cap(1) tn = tag if tagType == 1: - url = '%s/tags/%s' % (reposRoot, urllib.parse.quote(tag)) + url = '{0}/tags/{1}'.format(reposRoot, urllib.parse.quote(tag)) elif tagType == 2: - url = '%s/branches/%s' % (reposRoot, urllib.parse.quote(tag)) + url = '{0}/branches/{1}'.format(reposRoot, urllib.parse.quote(tag)) elif tagType == 4: - url = '%s/trunk' % (reposRoot) + url = '{0}/trunk'.format(reposRoot) tn = 'HEAD' else: url = self.__svnURL(tag) @@ -1240,7 +1240,8 @@ value = line.replace('<date>', '').replace('</date>', '') date, time = value.split('T') info['committed-date'] = date - info['committed-time'] = "%s%s" % (time.split('.')[0], time[-1]) + info['committed-time'] = "{0}{1}".format( + time.split('.')[0], time[-1]) return QApplication.translate('subversion', """<h3>Repository information</h3>""" @@ -1760,14 +1761,14 @@ scheme = url[0] host = url[1] port, path = url[2].split("/",1) - return "%s:%s:%s/%s" % (scheme, host, port, urllib.parse.quote(path)) + return "{0}:{1}:{2}/{3}".format(scheme, host, port, urllib.parse.quote(path)) else: scheme = url[0] if scheme == "file": - return "%s:%s" % (scheme, urllib.parse.quote(url[1])) + return "{0}:{1}".format(scheme, urllib.parse.quote(url[1])) else: host, path = url[1][2:].split("/",1) - return "%s://%s/%s" % (scheme, host, urllib.parse.quote(path)) + return "{0}://{1}/{2}".format(scheme, host, urllib.parse.quote(path)) def svnNormalizeURL(self, url): """ @@ -1780,7 +1781,7 @@ if url.endswith('/'): url = url[:-1] urll = url.split('//') - return "%s//%s" % (urll[0], '/'.join(urll[1:])) + return "{0}//{1}".format(urll[0], '/'.join(urll[1:])) ############################################################################ ## Methods to get the helper objects are below.
--- a/Plugins/ViewManagerPlugins/MdiArea/MdiArea.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/ViewManagerPlugins/MdiArea/MdiArea.py Wed Jul 28 15:12:20 2010 +0200 @@ -188,10 +188,10 @@ txt = sv.windowTitle() accel = "" if idx < 10: - accel = "&%d. " % idx + accel = "&{0:d}. ".format(idx) elif idx < 36: - accel = "&%c. " % chr(idx - 9 + ord("@")) - act = menu.addAction("%s%s" % (accel, txt)) + accel = "&{0}. ".format(chr(idx - 9 + ord("@"))) + act = menu.addAction("{0}{1}".format(accel, txt)) self.connect(act, SIGNAL("triggered()"), self.__windowMapper, SLOT("map()")) self.__windowMapper.setMapping(act, subWindow)
--- a/Plugins/ViewManagerPlugins/Tabview/Tabview.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/ViewManagerPlugins/Tabview/Tabview.py Wed Jul 28 15:12:20 2010 +0200 @@ -381,7 +381,7 @@ maxFileNameChars = Preferences.getUI("TabViewManagerFilenameLength") if len(txt) > maxFileNameChars: - txt = "...%s" % txt[-maxFileNameChars:] + txt = "...{0}".format(txt[-maxFileNameChars:]) if editor.isReadOnly(): txt = self.trUtf8("{0} (ro)").format(txt) @@ -747,7 +747,7 @@ else: txt = e5App().getObject("Project").getRelativePath(fn) if len(txt) > self.maxFileNameChars: - txt = "...%s" % txt[-self.maxFileNameChars:] + txt = "...{0}".format(txt[-self.maxFileNameChars:]) if not QFileInfo(fn).isWritable(): txt = self.trUtf8("{0} (ro)").format(txt) self.currentTabWidget.addTab(win, txt) @@ -784,7 +784,7 @@ else: txt = e5App().getObject("Project").getRelativePath(fn) if len(txt) > self.maxFileNameChars: - txt = "...%s" % txt[-self.maxFileNameChars:] + txt = "...{0}".format(txt[-self.maxFileNameChars:]) if not QFileInfo(fn).isWritable(): txt = self.trUtf8("{0} (ro)").format(txt) nindex = tabWidget.insertWidget(index, win, txt) @@ -852,7 +852,7 @@ else: tabName = e5App().getObject("Project").getRelativePath(newName) if len(tabName) > self.maxFileNameChars: - tabName = "...%s" % tabName[-self.maxFileNameChars:] + tabName = "...{0}".format(tabName[-self.maxFileNameChars:]) index = self.currentTabWidget.indexOf(editor) self.currentTabWidget.setTabText(index, tabName) self.currentTabWidget.setTabToolTip(index, newName) @@ -1083,7 +1083,7 @@ else: txt = e5App().getObject("Project").getRelativePath(fn) if len(txt) > self.maxFileNameChars: - txt = "...%s" % txt[-self.maxFileNameChars:] + txt = "...{0}".format(txt[-self.maxFileNameChars:]) if not QFileInfo(fn).isWritable(): txt = self.trUtf8("{0} (ro)").format(txt) tabWidget.setTabText(index, txt)
--- a/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -58,15 +58,15 @@ else: coStr = self.eColor.currentText() if coStr.startswith('#'): - coStr = "QColor('%s')" % coStr + coStr = "QColor('{0}')".format(coStr) else: - coStr = "QColor(%s)" % coStr + coStr = "QColor({0})".format(coStr) try: if self.rQt45.isChecked(): - exec('QColorDialog.getColor(%s, None, "%s")' % \ - (coStr, self.eTitle.text())) + exec('QColorDialog.getColor({0}, None, "{1}")'.format( + coStr, self.eTitle.text())) else: - exec('QColorDialog.getColor(%s)' % coStr) + exec('QColorDialog.getColor({0})'.format(coStr)) except: QMessageBox.critical(None, self.trUtf8("QColorDialog Wizard Error"), @@ -142,41 +142,41 @@ if self.eColor.currentText(): col = self.eColor.currentText() if col.startswith('#'): - code += 'QColor("%s")' % col + code += 'QColor("{0}")'.format(col) else: - code += 'QColor(%s)' % col + code += 'QColor({0})'.format(col) if self.rQt45.isChecked(): - code += ', None,%s' % os.linesep - code += '%sself.trUtf8("%s"),%s' % \ - (istring, self.eTitle.text(), os.linesep) + code += ', None,{0}'.format(os.linesep) + code += '{0}self.trUtf8("{1}"),{2}'.format( + istring, self.eTitle.text(), os.linesep) code += \ - '%sQColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)' % \ - istring - code += ')%s' % os.linesep + '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ + .format(istring) + code += '){0}'.format(os.linesep) elif self.rRGBA.isChecked(): if self.rQt45.isChecked(): code += 'getColor(' if not self.eRGB.text(): - code += 'QColor(%d, %d, %d, %d),%s' % \ - (self.sRed.value(), self.sGreen.value(), self.sBlue.value(), + code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format( + self.sRed.value(), self.sGreen.value(), self.sBlue.value(), self.sAlpha.value(), os.linesep) else: - code += '%s,%s' % (self.eRGB.text(), os.linesep) - code += '%sNone,%s' % (istring, os.linesep) - code += '%sself.trUtf8("%s"),%s' % \ - (istring, self.eTitle.text(), os.linesep) + code += '{0},{1}'.format(self.eRGB.text(), os.linesep) + code += '{0}None,{1}'.format(istring, os.linesep) + code += '{0}self.trUtf8("{1}"),{2}'.format( + istring, self.eTitle.text(), os.linesep) code += \ - '%sQColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)' % \ - istring - code += ')%s' % os.linesep + '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ + .format(istring) + code += '){0}'.format(os.linesep) else: code += 'getRgba(' if not self.eRGB.text(): - code += 'qRgba(%d, %d, %d, %d)' % \ - (self.sRed.value(), self.sGreen.value(), self.sBlue.value(), + code += 'qRgba({0:d}, {1:d}, {2:d}, {3:d})'.format( + self.sRed.value(), self.sGreen.value(), self.sBlue.value(), self.sAlpha.value()) else: code += self.eRGB.text() - code += ')%s' % os.linesep + code += '){0}'.format(os.linesep) return code
--- a/Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -149,102 +149,102 @@ code = 'QFileDialog.' if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked(): if self.rOpenFile.isChecked(): - code += 'getOpenFileName(\\%s%s' % (os.linesep, istring) + code += 'getOpenFileName(\\{0}{1}'.format(os.linesep, istring) else: - code += 'getOpenFileNameAndFilter(\\%s%s' % (os.linesep, istring) - code += 'None,%s%s' % (os.linesep, istring) + code += 'getOpenFileNameAndFilter(\\{0}{1}'.format(os.linesep, istring) + code += 'None,{0}{1}'.format(os.linesep, istring) if not self.eCaption.text(): - code += '"",%s%s' % (os.linesep, istring) + code += '"",{0}{1}'.format(os.linesep, istring) else: - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eCaption.text(), os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eCaption.text(), os.linesep, istring) if not self.eStartWith.text(): - code += '"",%s%s' % (os.linesep, istring) + code += '"",{0}{1}'.format(os.linesep, istring) else: if self.cStartWith.isChecked(): - fmt = '%s,%s%s' + fmt = '{0},{1}{2}' else: - fmt = 'self.trUtf8("%s"),%s%s' - code += fmt % (self.eStartWith.text(), os.linesep, istring) + fmt = 'self.trUtf8("{0}"),{1}{2}' + code += fmt.format(self.eStartWith.text(), os.linesep, istring) if self.eFilters.text() == "": code += '""' else: if self.cFilters.isChecked(): - fmt = '%s' + fmt = '{0}' else: - fmt = 'self.trUtf8("%s")' - code += fmt % self.eFilters.text() + fmt = 'self.trUtf8("{0}")' + code += fmt.format(self.eFilters.text()) if self.rfOpenFile.isChecked(): - code += ',%s%sNone' % (os.linesep, istring) + code += ',{0}{1}None'.format(os.linesep, istring) if not self.cSymlinks.isChecked(): - code += ',%s%sQFileDialog.Options(QFileDialog.DontResolveSymlinks)' % \ - (os.linesep, istring) - code += ')%s' % os.linesep + code += ',{0}{1}QFileDialog.Options(QFileDialog.DontResolveSymlinks)'\ + .format(os.linesep, istring) + code += '){0}'.format(os.linesep) elif self.rOpenFiles.isChecked() or self.rfOpenFiles.isChecked(): if self.rOpenFiles.isChecked(): - code += 'getOpenFileNames(\\%s%s' % (os.linesep, istring) + code += 'getOpenFileNames(\\{0}{1}'.format(os.linesep, istring) else: - code += 'getOpenFileNamesAndFilter(\\%s%s' % (os.linesep, istring) - code += 'None,%s%s' % (os.linesep, istring) + code += 'getOpenFileNamesAndFilter(\\{0}{1}'.format(os.linesep, istring) + code += 'None,{0}{1}'.format(os.linesep, istring) if not self.eCaption.text(): - code += '"",%s%s' % (os.linesep, istring) + code += '"",{0}{1}'.format(os.linesep, istring) else: - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eCaption.text(), os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eCaption.text(), os.linesep, istring) if not self.eStartWith.text(): - code += '"",%s%s' % (os.linesep, istring) + code += '"",{0}{1}'.format(os.linesep, istring) else: if self.cStartWith.isChecked(): - fmt = '%s,%s%s' + fmt = '{0},{1}{2}' else: - fmt = 'self.trUtf8("%s"),%s%s' - code += fmt % (self.eStartWith.text(), os.linesep, istring) + fmt = 'self.trUtf8("{0}"),{1}{2}' + code += fmt.format(self.eStartWith.text(), os.linesep, istring) if not self.eFilters.text(): code += '""' else: if self.cFilters.isChecked(): - fmt = '%s' + fmt = '{0}' else: - fmt = 'self.trUtf8("%s")' - code += fmt % self.eFilters.text() + fmt = 'self.trUtf8("{0}")' + code += fmt.format(self.eFilters.text()) if self.rfOpenFiles.isChecked(): - code += ',%s%sNone' % (os.linesep, istring) + code += ',{0}{1}None'.format(os.linesep, istring) if not self.cSymlinks.isChecked(): - code += ',%s%sQFileDialog.Options(QFileDialog.DontResolveSymlinks)' % \ - (os.linesep, istring) - code += ')%s' % os.linesep + code += ',{0}{1}QFileDialog.Options(QFileDialog.DontResolveSymlinks)'\ + .format(os.linesep, istring) + code += '){0}'.format(os.linesep) elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked(): if self.rSaveFile.isChecked(): - code += 'getSaveFileName(\\%s%s' % (os.linesep, istring) + code += 'getSaveFileName(\\{0}{1}'.format(os.linesep, istring) else: - code += 'getSaveFileNameAndFilter(\\%s%s' % (os.linesep, istring) - code += 'None,%s%s' % (os.linesep, istring) + code += 'getSaveFileNameAndFilter(\\{0}{1}'.format(os.linesep, istring) + code += 'None,{0}{1}'.format(os.linesep, istring) if not self.eCaption.text(): - code += '"",%s%s' % (os.linesep, istring) + code += '"",{0}{1}'.format(os.linesep, istring) else: - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eCaption.text(), os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eCaption.text(), os.linesep, istring) if not self.eStartWith.text(): - code += '"",%s%s' % (os.linesep, istring) + code += '"",{0}{1}'.format(os.linesep, istring) else: if self.cStartWith.isChecked(): - fmt = '%s,%s%s' + fmt = '{0},{1}{2}' else: - fmt = 'self.trUtf8("%s"),%s%s' - code += fmt % (self.eStartWith.text(), os.linesep, istring) + fmt = 'self.trUtf8("{0}"),{1}{2}' + code += fmt.format(self.eStartWith.text(), os.linesep, istring) if not self.eFilters.text(): code += '""' else: if self.cFilters.isChecked(): - fmt = '%s' + fmt = '{0}' else: - fmt = 'self.trUtf8("%s")' - code += fmt % self.eFilters.text() + fmt = 'self.trUtf8("{0}")' + code += fmt.format(self.eFilters.text()) if self.rfSaveFile.isChecked(): - code += ',%s%sNone' % (os.linesep, istring) + code += ',{0}{1}None'.format(os.linesep, istring) if (not self.cSymlinks.isChecked()) or \ (not self.cConfirmOverwrite.isChecked()): - code += ',%s%sQFileDialog.Options(' % (os.linesep, istring) + code += ',{0}{1}QFileDialog.Options('.format(os.linesep, istring) if not self.cSymlinks.isChecked(): code += 'QFileDialog.DontResolveSymlinks' if (not self.cSymlinks.isChecked()) and \ @@ -253,31 +253,31 @@ if not self.cConfirmOverwrite.isChecked(): code += 'QFileDialog.DontConfirmOverwrite' code += ')' - code += ')%s' % os.linesep + code += '){0}'.format(os.linesep) elif self.rDirectory.isChecked(): - code += 'getExistingDirectory(\\%s%s' % (os.linesep, istring) - code += 'None,%s%s' % (os.linesep, istring) + code += 'getExistingDirectory(\\{0}{1}'.format(os.linesep, istring) + code += 'None,{0}{1}'.format(os.linesep, istring) if not self.eCaption.text(): - code += '"",%s%s' % (os.linesep, istring) + code += '"",{0}{1}'.format(os.linesep, istring) else: - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eCaption.text(), os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eCaption.text(), os.linesep, istring) if not self.eWorkDir.text(): code += '""' else: if self.cWorkDir.isChecked(): - fmt = '%s' + fmt = '{0}' else: - fmt = 'self.trUtf8("%s")' - code += fmt % self.eWorkDir.text() - code += ',%s%sQFileDialog.Options(' % (os.linesep, istring) + fmt = 'self.trUtf8("{0}")' + code += fmt.format(self.eWorkDir.text()) + code += ',{0}{1}QFileDialog.Options('.format(os.linesep, istring) if not self.cSymlinks.isChecked(): code += 'QFileDialog.DontResolveSymlinks | ' if self.cDirOnly.isChecked(): code += 'QFileDialog.ShowDirsOnly' else: code += 'QFileDialog.Option(0)' - code += '))%s' % os.linesep + code += ')){0}'.format(os.linesep) return code
--- a/Plugins/WizardPlugins/FontDialogWizard/FontDialogWizardDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/FontDialogWizard/FontDialogWizardDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -92,11 +92,11 @@ code = 'QFontDialog.getFont(' if not self.eVariable.text(): if self.font is not None: - code += 'QFont("%s", %d, %d, %d)' % \ - (self.font.family(), self.font.pointSize(), + code += 'QFont("{0}", {1:d}, {2:d}, {3:d})'.format( + self.font.family(), self.font.pointSize(), self.font.weight(), self.font.italic()) else: code += self.eVariable.text() - code += ')%s' % os.linesep + code += '){0}'.format(os.linesep) return code
--- a/Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -123,12 +123,12 @@ # now generate the code code = 'QInputDialog.' if self.rText.isChecked(): - code += 'getText(\\%s%s' % (os.linesep, istring) - code += 'None,%s%s' % (os.linesep, istring) - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eCaption.text(), os.linesep, istring) - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eLabel.text(), os.linesep, istring) + code += 'getText(\\{0}{1}'.format(os.linesep, istring) + code += 'None,{0}{1}'.format(os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eCaption.text(), os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eLabel.text(), os.linesep, istring) if self.rEchoNormal.isChecked(): code += 'QLineEdit.Normal' elif self.rEchoNoEcho.isChecked(): @@ -136,18 +136,18 @@ else: code += 'QLineEdit.Password' if self.eTextDefault.text(): - code += ',%s%sself.trUtf8("%s")' % \ - (os.linesep, istring, self.eTextDefault.text()) - code += ')%s' % os.linesep + code += ',{0}{1}self.trUtf8("{2}")'.format( + os.linesep, istring, self.eTextDefault.text()) + code += '){0}'.format(os.linesep) elif self.rInteger.isChecked(): - code += 'getInteger(\\%s%s' % (os.linesep, istring) - code += 'None,%s%s' % (os.linesep, istring) - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eCaption.text(), os.linesep, istring) - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eLabel.text(), os.linesep, istring) - code += '%d, %d, %d, %d)%s' % \ - (self.sIntDefault.value(), self.sIntFrom.value(), + code += 'getInteger(\\{0}{1}'.format(os.linesep, istring) + code += 'None,{0}{1}'.format(os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eCaption.text(), os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eLabel.text(), os.linesep, istring) + code += '{0:d}, {1:d}, {2:d}, {3:d}){4}'.format( + self.sIntDefault.value(), self.sIntFrom.value(), self.sIntTo.value(), self.sIntStep.value(), os.linesep) elif self.rDouble.isChecked(): try: @@ -162,25 +162,25 @@ doubleTo = float(self.eDoubleTo.text()) except ValueError: doubleTo = 2147483647 - code += 'getDouble(\\%s%s' % (os.linesep, istring) - code += 'None,%s%s' % (os.linesep, istring) - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eCaption.text(), os.linesep, istring) - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eLabel.text(), os.linesep, istring) - code += '%s, %s, %s, %d)%s' % \ - (doubleDefault, doubleFrom, doubleTo, + code += 'getDouble(\\{0}{1}'.format(os.linesep, istring) + code += 'None,{0}{1}'.format(os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eCaption.text(), os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eLabel.text(), os.linesep, istring) + code += '{0}, {1}, {2}, {3:d}){4}'.format( + doubleDefault, doubleFrom, doubleTo, self.sDoubleDecimals.value(), os.linesep) elif self.rItem.isChecked(): - code += 'getItem(\\%s%s' % (os.linesep, istring) - code += 'None,%s%s' % (os.linesep, istring) - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eCaption.text(), os.linesep, istring) - code += 'self.trUtf8("%s"),%s%s' % \ - (self.eLabel.text(), os.linesep, istring) - code += '%s,%s%s' % (self.eVariable.text(), os.linesep, istring) - code += '%d, %s)%s' % \ - (self.sCurrentItem.value(), self.cEditable.isChecked(), os.linesep) + code += 'getItem(\\{0}{1}'.format(os.linesep, istring) + code += 'None,{0}{1}'.format(os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eCaption.text(), os.linesep, istring) + code += 'self.trUtf8("{0}"),{1}{2}'.format( + self.eLabel.text(), os.linesep, istring) + code += '{0},{1}{2}'.format(self.eVariable.text(), os.linesep, istring) + code += '{0:d}, {1}){2}'.format( + self.sCurrentItem.value(), self.cEditable.isChecked(), os.linesep) return code
--- a/Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -274,12 +274,12 @@ return "" istring2 = istring + indString - joinstring = ' | \\%s%s' % (os.linesep, istring2) - btnCode = ',%s%sQMessageBox.StandardButtons(\\' % (os.linesep, istring) - btnCode += '%s%s%s)' % (os.linesep, istring2, joinstring.join(buttons)) + joinstring = ' | \\{0}{1}'.format(os.linesep, istring2) + btnCode = ',{0}{1}QMessageBox.StandardButtons(\\'.format(os.linesep, istring) + btnCode += '{0}{1}{2})'.format(os.linesep, istring2, joinstring.join(buttons)) defaultIndex = self.defaultCombo.currentIndex() if defaultIndex: - btnCode += ',%s%s%s' % (os.linesep, istring, + btnCode += ',{0}{1}{2}'.format(os.linesep, istring, self.buttonsCodeListText[defaultIndex]) return btnCode @@ -298,22 +298,22 @@ # now generate the code msgdlg = 'QMessageBox.' if self.rAbout.isChecked(): - msgdlg += "about(None,%s" % os.linesep + msgdlg += "about(None,{0}".format(os.linesep) elif self.rAboutQt.isChecked(): - msgdlg += "aboutQt(None, %s" % os.linesep + msgdlg += "aboutQt(None, {0}".format(os.linesep) elif self.rInformation.isChecked(): - msgdlg += "information(None,%s" % os.linesep + msgdlg += "information(None,{0}".format(os.linesep) elif self.rQuestion.isChecked(): - msgdlg += "question(None,%s" % os.linesep + msgdlg += "question(None,{0}".format(os.linesep) elif self.rWarning.isChecked(): - msgdlg += "warning(None,%s" % os.linesep + msgdlg += "warning(None,{0}".format(os.linesep) else: - msgdlg +="critical(None,%s" % os.linesep - msgdlg += '%sself.trUtf8("%s")' % (istring, self.eCaption.text()) + msgdlg +="critical(None,{0}".format(os.linesep) + msgdlg += '{0}self.trUtf8("{1}")'.format(istring, self.eCaption.text()) if not self.rAboutQt.isChecked(): - msgdlg += ',%s%sself.trUtf8("""%s""")' % \ - (os.linesep, istring, self.eMessage.toPlainText()) + msgdlg += ',{0}{1}self.trUtf8("""{2}""")'.format( + os.linesep, istring, self.eMessage.toPlainText()) if not self.rAbout.isChecked() and not self.rAboutQt.isChecked(): msgdlg += self.__getQt42ButtonCode(istring, indString) - msgdlg +=')%s' % os.linesep + msgdlg +='){0}'.format(os.linesep) return msgdlg
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardCharactersDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardCharactersDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -247,9 +247,9 @@ if index == 0: return char elif index == 1: - return "\\x%s" % char.lower() + return "\\x{0}".format(char.lower()) elif index == 2: - return "\\0%s" % char + return "\\0{0}".format(char) else: try: return self.specialChars[index] @@ -295,7 +295,7 @@ continue index = entrieslist[0].currentIndex() char = entrieslist[1].text() - regexp += "%s-" % self.__formatCharacter(index, char) + regexp += "{0}-".format(self.__formatCharacter(index, char)) index = entrieslist[2].currentIndex() char = entrieslist[3].text() regexp += self.__formatCharacter(index, char) @@ -304,6 +304,6 @@ if len(regexp) == 2 and regexp in self.predefinedClasses: return regexp else: - return "[%s]" % regexp + return "[{0}]".format(regexp) else: return ""
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -174,7 +174,7 @@ names, 0, True) if ok and groupName: - self.__insertString("(?P=%s)" % groupName) + self.__insertString("(?P={0})".format(groupName)) @pyqtSlot() def on_altnButton_clicked(self): @@ -463,13 +463,13 @@ self.resultTable.setItem(row, 0, QTableWidgetItem(self.trUtf8("Offset"))) self.resultTable.setItem(row, 1, - QTableWidgetItem("%d" % matchobj.start(0))) + QTableWidgetItem("{0:d}".format(matchobj.start(0)))) row += 1 self.resultTable.setItem(row, 0, QTableWidgetItem(self.trUtf8("Captures"))) self.resultTable.setItem(row, 1, - QTableWidgetItem("%d" % captures)) + QTableWidgetItem("{0:d}".format(captures))) row += 1 self.resultTable.setItem(row, 1, QTableWidgetItem(self.trUtf8("Text"))) @@ -482,7 +482,7 @@ self.resultTable.setItem(row, 1, QTableWidgetItem(matchobj.group(0))) self.resultTable.setItem(row, 2, - QTableWidgetItem("%d" % len(matchobj.group(0)))) + QTableWidgetItem("{0:d}".format(len(matchobj.group(0))))) for i in range(1, captures + 1): if matchobj.group(i) is not None: @@ -493,7 +493,7 @@ self.resultTable.setItem(row, 1, QTableWidgetItem(matchobj.group(i))) self.resultTable.setItem(row, 2, - QTableWidgetItem("%d" % len(matchobj.group(i)))) + QTableWidgetItem("{0:d}".format(len(matchobj.group(i))))) # highlight the matched text tc = self.textTextEdit.textCursor() @@ -615,12 +615,12 @@ code = '' if self.importCheckBox.isChecked(): - code += 'import re%s%s' % (os.linesep, istring) - code += '%s = re.compile(r"""%s"""' % \ - (reVar, regexp.replace('"', '\\"')) + code += 'import re{0}{1}'.format(os.linesep, istring) + code += '{0} = re.compile(r"""{1}"""'.format( + reVar, regexp.replace('"', '\\"')) if flags: - code += ', \\%s%s%s' % (os.linesep, i1string, flags) - code += ')%s' % os.linesep + code += ', \\{0}{1}{2}'.format(os.linesep, i1string, flags) + code += '){0}'.format(os.linesep) return code class PyRegExpWizardDialog(QDialog):
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardRepeatDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardRepeatDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -66,17 +66,17 @@ if reps == 1: return "+" + minimal else: - return "{%d,}%s" % (reps, minimal) + return "{{{0:d},}}{1}".format(reps, minimal) elif self.maxButton.isChecked(): reps = self.maxSpin.value() if reps == 1: return "?" + minimal else: - return "{,%d}%s" % (reps, minimal) + return "{{,{0:d}}}{1}".format(reps, minimal) elif self.exactButton.isChecked(): reps = self.exactSpin.value() - return "{%d}%s" % (reps, minimal) + return "{{{0:d}}}{1}".format(reps, minimal) elif self.betweenButton.isChecked(): repsMin = self.lowerSpin.value() repsMax = self.upperSpin.value() - return "{%d,%d}%s" % (repsMin, repsMax, minimal) \ No newline at end of file + return "{{{0:d},{1:d}}}{2}".format(repsMin, repsMax, minimal)
--- a/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardCharactersDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardCharactersDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -247,9 +247,9 @@ if index == 0: return char elif index == 1: - return "\\x%s" % char.lower() + return "\\x{0}".format(char.lower()) elif index == 2: - return "\\0%s" % char + return "\\0{0}".format(char) else: try: return self.specialChars[index] @@ -295,7 +295,7 @@ continue index = entrieslist[0].currentIndex() char = entrieslist[1].text() - regexp += "%s-" % self.__formatCharacter(index, char) + regexp += "{0}-".format(self.__formatCharacter(index, char)) index = entrieslist[2].currentIndex() char = entrieslist[3].text() regexp += self.__formatCharacter(index, char) @@ -304,6 +304,6 @@ if len(regexp) == 2 and regexp in self.predefinedClasses: return regexp else: - return "[%s]" % regexp + return "[{0}]".format(regexp) else: return ""
--- a/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -360,14 +360,14 @@ self.nextButton.setEnabled(True) row += 1 self.resultTable.setItem(row, 0, QTableWidgetItem(self.trUtf8("Offset"))) - self.resultTable.setItem(row, 1, QTableWidgetItem("%d" % offset)) + self.resultTable.setItem(row, 1, QTableWidgetItem("{0:d}".format(offset))) if not wildcard: row += 1 self.resultTable.setItem(row, 0, QTableWidgetItem(self.trUtf8("Captures"))) self.resultTable.setItem(row, 1, - QTableWidgetItem("%d" % captures)) + QTableWidgetItem("{0:d}".format(captures))) row += 1 self.resultTable.setItem(row, 1, QTableWidgetItem(self.trUtf8("Text"))) @@ -380,7 +380,7 @@ self.resultTable.setItem(row, 1, QTableWidgetItem(re.cap(0))) self.resultTable.setItem(row, 2, - QTableWidgetItem("%d" % re.matchedLength())) + QTableWidgetItem("{0:d}".format(re.matchedLength()))) if not wildcard: for i in range(1, captures + 1): @@ -392,7 +392,7 @@ self.resultTable.setItem(row, 1, QTableWidgetItem(re.cap(i))) self.resultTable.setItem(row, 2, - QTableWidgetItem("%d" % len(re.cap(i)))) + QTableWidgetItem("{0:d}".format(len(re.cap(i))))) else: self.resultTable.setRowCount(3) @@ -459,16 +459,16 @@ regexp = self.regexpLineEdit.text() - code = '%s = QRegExp(r"""%s""")%s' % \ - (reVar, regexp.replace('"', '\\"'), os.linesep) + code = '{0} = QRegExp(r"""{1}"""){2}'.format( + reVar, regexp.replace('"', '\\"'), os.linesep) if not self.caseSensitiveCheckBox.isChecked(): - code += '%s%s.setCaseSensitivity(Qt.CaseInsensitive)%s' % \ - (istring, reVar, os.linesep) + code += '{0}{1}.setCaseSensitivity(Qt.CaseInsensitive){2}'.format( + istring, reVar, os.linesep) if self.minimalCheckBox.isChecked(): - code += '%s%s.setMinimal(1)%s' % (istring, reVar, os.linesep) + code += '{0}{1}.setMinimal(1){2}'.format(istring, reVar, os.linesep) if self.wildcardCheckBox.isChecked(): - code += '%s%s.setPatternSyntax(QRegExp.Wildcard)%s' % \ - (istring, reVar, os.linesep) + code += '{0}{1}.setPatternSyntax(QRegExp.Wildcard){2}'.format( + istring, reVar, os.linesep) return code class QRegExpWizardDialog(QDialog):
--- a/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardRepeatDialog.py Wed Jul 28 09:10:19 2010 +0200 +++ b/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardRepeatDialog.py Wed Jul 28 15:12:20 2010 +0200 @@ -61,17 +61,17 @@ if reps == 1: return "+" else: - return "{%d,}" % reps + return "{{{0:d},}}".format(reps) elif self.maxButton.isChecked(): reps = self.maxSpin.value() if reps == 1: return "?" else: - return "{,%d}" % reps + return "{{,{0:d}}}".format(reps) elif self.exactButton.isChecked(): reps = self.exactSpin.value() - return "{%d}" % reps + return "{{{0:d}}}".format(reps) elif self.betweenButton.isChecked(): repsMin = self.lowerSpin.value() repsMax = self.upperSpin.value() - return "{%d,%d}" % (repsMin, repsMax) \ No newline at end of file + return "{{{0:d},{1:d}}}".format(repsMin, repsMax)