From 0564f5f833b6a18bb743bac721f93d0ce0450219 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Sun, 27 Nov 2011 02:58:51 -0800 Subject: [PATCH 1/2] dump beta version number --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index ff01b34..68006cb 100644 --- a/version.py +++ b/version.py @@ -31,7 +31,7 @@ _pcStatus = "B" # A = alpha # B = beta # RC = release candidate # None = public release -_pcRevision = "6" +_pcRevision = "7" _pcVersion = "" def pcVerCalc(): From 24fbb6c7d35b294b16e87ea806e1f45689516bc4 Mon Sep 17 00:00:00 2001 From: Stephen Dranger Date: Fri, 16 Dec 2011 11:25:41 -0600 Subject: [PATCH 2/2] str() -> unicode() Conflicts: pesterchum.py --- logviewer.py | 2 +- ostools.py | 6 ++--- pesterchum.py | 71 +++++++++++++++++++++++++++------------------------ profile.py | 2 +- toast.py | 6 ++--- 5 files changed, 45 insertions(+), 42 deletions(-) diff --git a/logviewer.py b/logviewer.py index 77935ca..4ee809a 100644 --- a/logviewer.py +++ b/logviewer.py @@ -264,7 +264,7 @@ class PesterLogViewer(QtGui.QDialog): textCur = self.textArea.textCursor() textCur.movePosition(1) self.textArea.setTextCursor(textCur) - self.instructions.setText("Pesterlog with " +self.chum+ " on " + self.fileToTime(str(fname))) + self.instructions.setText("Pesterlog with " +self.chum+ " on " + self.fileToTime(unicode(fname))) def logSearch(self, search): self.hilight.searchTerm = search diff --git a/ostools.py b/ostools.py index 83e97f6..85e0e9e 100644 --- a/ostools.py +++ b/ostools.py @@ -28,8 +28,8 @@ def osVer(): def getDataDir(): if isOSX(): - return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.DataLocation).toLatin1()), "Pesterchum/") + return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "Pesterchum/") elif isLinux(): - return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.HomeLocation).toLatin1()), ".pesterchum/") + return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.HomeLocation)), ".pesterchum/") else: - return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.DataLocation).toLatin1()), "pesterchum/") + return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "pesterchum/") diff --git a/pesterchum.py b/pesterchum.py index b5b7d4a..2f3807d 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -303,7 +303,7 @@ class chumArea(RightClickTree): def getOptionsMenu(self): if not self.currentItem(): return None - text = str(self.currentItem().text(0)) + text = unicode(self.currentItem().text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] if text == "Chums": @@ -349,10 +349,13 @@ class chumArea(RightClickTree): if thisitem.rfind(" (") != -1: thisitem = thisitem[0:thisitem.rfind(" (")] # Drop item is a group + thisitem = unicode(event.source().currentItem().text(0)) + if thisitem.rfind(" (") != -1: + thisitem = thisitem[0:thisitem.rfind(" (")] if thisitem == "Chums" or thisitem in self.groups: droppos = self.itemAt(event.pos()) if not droppos: return - droppos = str(droppos.text(0)) + droppos = unicode(droppos.text(0)) if droppos.rfind(" ") != -1: droppos = droppos[0:droppos.rfind(" ")] if droppos == "Chums" or droppos in self.groups: @@ -365,7 +368,7 @@ class chumArea(RightClickTree): gTemp = [] for i in range(self.topLevelItemCount()): - text = str(self.topLevelItem(i).text(0)) + text = unicode(self.topLevelItem(i).text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] gTemp.append([unicode(text), self.topLevelItem(i).isExpanded()]) @@ -374,7 +377,7 @@ class chumArea(RightClickTree): else: item = self.itemAt(event.pos()) if item: - text = str(item.text(0)) + text = unicode(item.text(0)) # Figure out which group to drop into if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] @@ -382,7 +385,7 @@ class chumArea(RightClickTree): group = text gitem = item else: - ptext = str(item.parent().text(0)) + ptext = unicode(item.parent().text(0)) if ptext.rfind(" ") != -1: ptext = ptext[0:ptext.rfind(" ")] group = ptext @@ -417,9 +420,9 @@ class chumArea(RightClickTree): currentGroup = self.currentItem() if currentGroup: if currentGroup.parent(): - text = str(currentGroup.parent().text(0)) + text = unicode(currentGroup.parent().text(0)) else: - text = str(currentGroup.text(0)) + text = unicode(currentGroup.text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] currentGroup = text @@ -478,7 +481,7 @@ class chumArea(RightClickTree): return curgroups = [] for i in range(self.topLevelItemCount()): - text = str(self.topLevelItem(i).text(0)) + text = unicode(self.topLevelItem(i).text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] curgroups.append(text) @@ -502,30 +505,30 @@ class chumArea(RightClickTree): totals = {'Chums': 0} online = {'Chums': 0} for g in self.groups: - totals[str(g)] = 0 - online[str(g)] = 0 + totals[unicode(g)] = 0 + online[unicode(g)] = 0 for c in self.chums: yes = c.mood.name() != "offline" if c.group == "Chums": - totals[str(c.group)] = totals[str(c.group)]+1 + totals[unicode(c.group)] = totals[unicode(c.group)]+1 if yes: - online[str(c.group)] = online[str(c.group)]+1 + online[unicode(c.group)] = online[unicode(c.group)]+1 elif c.group in totals: - totals[str(c.group)] = totals[str(c.group)]+1 + totals[unicode(c.group)] = totals[unicode(c.group)]+1 if yes: - online[str(c.group)] = online[str(c.group)]+1 + online[unicode(c.group)] = online[unicode(c.group)]+1 else: totals["Chums"] = totals["Chums"]+1 if yes: online["Chums"] = online["Chums"]+1 for i in range(self.topLevelItemCount()): - text = str(self.topLevelItem(i).text(0)) + text = unicode(self.topLevelItem(i).text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] self.topLevelItem(i).setText(0, "%s (%i/%i)" % (text, online[text], totals[text])) def hideOnlineNumbers(self): for i in range(self.topLevelItemCount()): - text = str(self.topLevelItem(i).text(0)) + text = unicode(self.topLevelItem(i).text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] self.topLevelItem(i).setText(0, "%s" % (text)) @@ -541,7 +544,7 @@ class chumArea(RightClickTree): @QtCore.pyqtSlot() def expandGroup(self): item = self.currentItem() - text = str(item.text(0)) + text = unicode(item.text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] @@ -556,7 +559,7 @@ class chumArea(RightClickTree): self.mainwindow.config.addGroup("Chums") curgroups = [] for i in range(self.topLevelItemCount()): - text = str(self.topLevelItem(i).text(0)) + text = unicode(self.topLevelItem(i).text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] curgroups.append(text) @@ -573,7 +576,7 @@ class chumArea(RightClickTree): if self.openGroups[self.groups.index("%s" % (chumLabel.chum.group))]: child_1.setExpanded(True) for i in range(self.topLevelItemCount()): - text = str(self.topLevelItem(i).text(0)) + text = unicode(self.topLevelItem(i).text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] if text == chumLabel.chum.group: @@ -789,7 +792,7 @@ class chumArea(RightClickTree): index = self.indexOfTopLevelItem(currentGroup) if index != -1: expanded = currentGroup.isExpanded() - text = str(currentGroup.text(0)) + text = unicode(currentGroup.text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] self.mainwindow.config.delGroup(text) @@ -809,7 +812,7 @@ class chumArea(RightClickTree): currentGroup = self.currentItem() if not currentGroup: return - text = str(currentGroup.text(0)) + text = unicode(currentGroup.text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] self.mainwindow.config.delGroup(text) @@ -830,7 +833,7 @@ class chumArea(RightClickTree): def moveToGroup(self, item): if not item: return - group = str(item.text()) + group = unicode(item.text()) chumLabel = self.currentItem() if not chumLabel: return @@ -1219,7 +1222,7 @@ class PesterWindow(MovingWindow): @QtCore.pyqtSlot() def updatePC(self): - version.updateDownload(str(self.updatemenu.url)) + version.updateDownload(unicode(self.updatemenu.url)) self.updatemenu = None @QtCore.pyqtSlot() def noUpdatePC(self): @@ -1388,16 +1391,16 @@ class PesterWindow(MovingWindow): self.connect(convoWindow, QtCore.SIGNAL('windowClosed(QString)'), self, QtCore.SLOT('closeConvo(QString)')) self.convos[chum.handle] = convoWindow - if str(chum.handle).upper() == "NICKSERV" or \ - str(chum.handle).upper() == "CHANSERV" or \ - str(chum.handle).upper() == "MEMOSERV" or \ - str(chum.handle).upper() == "OPERSERV" or \ - str(chum.handle).upper() == "HELPSERV": + if unicode(chum.handle).upper() == "NICKSERV" or \ + unicode(chum.handle).upper() == "CHANSERV" or \ + unicode(chum.handle).upper() == "MEMOSERV" or \ + unicode(chum.handle).upper() == "OPERSERV" or \ + unicode(chum.handle).upper() == "HELPSERV": convoWindow.toggleQuirks(True) convoWindow.quirksOff.setChecked(True) else: - if str(chum.handle).upper() == "CALSPRITE" or \ - str(chum.handle).upper() == "RANDOMENCOUNTER": + if unicode(chum.handle).upper() == "CALSPRITE" or \ + unicode(chum.handle).upper() == "RANDOMENCOUNTER": convoWindow.toggleQuirks(True) convoWindow.quirksOff.setChecked(True) self.newConvoStarted.emit(QtCore.QString(chum.handle), initiated) @@ -1690,7 +1693,7 @@ class PesterWindow(MovingWindow): def pesterSelectedChum(self): curChum = self.chumList.currentItem() if curChum: - text = str(curChum.text(0)) + text = unicode(curChum.text(0)) if text.rfind(" (") != -1: text = text[0:text.rfind(" (")] if text not in self.chumList.groups and \ @@ -1864,8 +1867,8 @@ class PesterWindow(MovingWindow): available_groups = [g[0] for g in self.config.getGroups()] self.addchumdialog = AddChumDialog(available_groups, self) ok = self.addchumdialog.exec_() - handle = str(self.addchumdialog.chumBox.text()).strip() - newgroup = str(self.addchumdialog.newgroup.text()).strip() + handle = unicode(self.addchumdialog.chumBox.text()).strip() + newgroup = unicode(self.addchumdialog.newgroup.text()).strip() selectedGroup = self.addchumdialog.groupBox.currentText() group = newgroup if newgroup else selectedGroup if ok: @@ -2370,7 +2373,7 @@ class PesterWindow(MovingWindow): self.config.set('blink', blinksetting) # toast notifications self.tm.setEnabled(self.optionmenu.notifycheck.isChecked()) - self.tm.setCurrentType(str(self.optionmenu.notifyOptions.currentText())) + self.tm.setCurrentType(unicode(self.optionmenu.notifyOptions.currentText())) notifysetting = 0 if self.optionmenu.notifySigninCheck.isChecked(): notifysetting |= self.config.SIGNIN diff --git a/profile.py b/profile.py index 8c93778..3a798db 100644 --- a/profile.py +++ b/profile.py @@ -41,7 +41,7 @@ class PesterLog(object): if not self.parent.config.logPesters() & self.parent.config.LOG: return if not self.parent.config.logPesters() & self.parent.config.STAMP: time = "" - if str(handle).upper() == "NICKSERV": return + if unicode(handle).upper() == "NICKSERV": return #watch out for illegal characters handle = re.sub(r'[<>:"/\\|?*]', "_", handle) bbcodemsg = time + convertTags(msg, "bbcode") diff --git a/toast.py b/toast.py index 4230738..2bcec80 100644 --- a/toast.py +++ b/toast.py @@ -234,7 +234,7 @@ class PesterToast(QtGui.QWidget, DefaultToast): self.msg.setStyleSheet(self.parent().theme["toasts/content/style"]) self.layout().setSpacing(0) - self.msg.setText(PesterToast.wrapText(self.msg.font(), str(self.msg.text()), self.parent().theme["toasts/width"], self.parent().theme["toasts/content/style"])) + self.msg.setText(PesterToast.wrapText(self.msg.font(), unicode(self.msg.text()), self.parent().theme["toasts/width"], self.parent().theme["toasts/content/style"])) p = QtGui.QApplication.desktop().availableGeometry(self).bottomRight() o = QtGui.QApplication.desktop().screenGeometry(self).bottomRight() @@ -253,8 +253,8 @@ class PesterToast(QtGui.QWidget, DefaultToast): def done(self): QtGui.QWidget.hide(self) t = self.machine.toasts[0] - if t.title == str(self.title.text()) and \ - t.msg == str(self.content): + if t.title == unicode(self.title.text()) and \ + t.msg == unicode(self.content): self.machine.toasts.pop(0) self.machine.displaying = False if self.machine.on: