Merge branch 'master' of github.com:kiooeht/pesterchum

This commit is contained in:
Kiooeht 2011-12-23 22:15:58 -08:00
commit a9a6c58e1b
6 changed files with 47 additions and 44 deletions

View file

@ -264,7 +264,7 @@ class PesterLogViewer(QtGui.QDialog):
textCur = self.textArea.textCursor() textCur = self.textArea.textCursor()
textCur.movePosition(1) textCur.movePosition(1)
self.textArea.setTextCursor(textCur) 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): def logSearch(self, search):
self.hilight.searchTerm = search self.hilight.searchTerm = search

View file

@ -28,8 +28,8 @@ def osVer():
def getDataDir(): def getDataDir():
if isOSX(): 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(): elif isLinux():
return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.HomeLocation).toLatin1()), ".pesterchum/") return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.HomeLocation)), ".pesterchum/")
else: else:
return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.DataLocation).toLatin1()), "pesterchum/") return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "pesterchum/")

View file

@ -303,7 +303,7 @@ class chumArea(RightClickTree):
def getOptionsMenu(self): def getOptionsMenu(self):
if not self.currentItem(): if not self.currentItem():
return None return None
text = str(self.currentItem().text(0)) text = unicode(self.currentItem().text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
if text == "Chums": if text == "Chums":
@ -349,10 +349,13 @@ class chumArea(RightClickTree):
if thisitem.rfind(" (") != -1: if thisitem.rfind(" (") != -1:
thisitem = thisitem[0:thisitem.rfind(" (")] thisitem = thisitem[0:thisitem.rfind(" (")]
# Drop item is a group # 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: if thisitem == "Chums" or thisitem in self.groups:
droppos = self.itemAt(event.pos()) droppos = self.itemAt(event.pos())
if not droppos: return if not droppos: return
droppos = str(droppos.text(0)) droppos = unicode(droppos.text(0))
if droppos.rfind(" ") != -1: if droppos.rfind(" ") != -1:
droppos = droppos[0:droppos.rfind(" ")] droppos = droppos[0:droppos.rfind(" ")]
if droppos == "Chums" or droppos in self.groups: if droppos == "Chums" or droppos in self.groups:
@ -365,7 +368,7 @@ class chumArea(RightClickTree):
gTemp = [] gTemp = []
for i in range(self.topLevelItemCount()): for i in range(self.topLevelItemCount()):
text = str(self.topLevelItem(i).text(0)) text = unicode(self.topLevelItem(i).text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
gTemp.append([unicode(text), self.topLevelItem(i).isExpanded()]) gTemp.append([unicode(text), self.topLevelItem(i).isExpanded()])
@ -374,7 +377,7 @@ class chumArea(RightClickTree):
else: else:
item = self.itemAt(event.pos()) item = self.itemAt(event.pos())
if item: if item:
text = str(item.text(0)) text = unicode(item.text(0))
# Figure out which group to drop into # Figure out which group to drop into
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
@ -382,7 +385,7 @@ class chumArea(RightClickTree):
group = text group = text
gitem = item gitem = item
else: else:
ptext = str(item.parent().text(0)) ptext = unicode(item.parent().text(0))
if ptext.rfind(" ") != -1: if ptext.rfind(" ") != -1:
ptext = ptext[0:ptext.rfind(" ")] ptext = ptext[0:ptext.rfind(" ")]
group = ptext group = ptext
@ -417,9 +420,9 @@ class chumArea(RightClickTree):
currentGroup = self.currentItem() currentGroup = self.currentItem()
if currentGroup: if currentGroup:
if currentGroup.parent(): if currentGroup.parent():
text = str(currentGroup.parent().text(0)) text = unicode(currentGroup.parent().text(0))
else: else:
text = str(currentGroup.text(0)) text = unicode(currentGroup.text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
currentGroup = text currentGroup = text
@ -478,7 +481,7 @@ class chumArea(RightClickTree):
return return
curgroups = [] curgroups = []
for i in range(self.topLevelItemCount()): for i in range(self.topLevelItemCount()):
text = str(self.topLevelItem(i).text(0)) text = unicode(self.topLevelItem(i).text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
curgroups.append(text) curgroups.append(text)
@ -502,30 +505,30 @@ class chumArea(RightClickTree):
totals = {'Chums': 0} totals = {'Chums': 0}
online = {'Chums': 0} online = {'Chums': 0}
for g in self.groups: for g in self.groups:
totals[str(g)] = 0 totals[unicode(g)] = 0
online[str(g)] = 0 online[unicode(g)] = 0
for c in self.chums: for c in self.chums:
yes = c.mood.name() != "offline" yes = c.mood.name() != "offline"
if c.group == "Chums": if c.group == "Chums":
totals[str(c.group)] = totals[str(c.group)]+1 totals[unicode(c.group)] = totals[unicode(c.group)]+1
if yes: 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: 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: if yes:
online[str(c.group)] = online[str(c.group)]+1 online[unicode(c.group)] = online[unicode(c.group)]+1
else: else:
totals["Chums"] = totals["Chums"]+1 totals["Chums"] = totals["Chums"]+1
if yes: if yes:
online["Chums"] = online["Chums"]+1 online["Chums"] = online["Chums"]+1
for i in range(self.topLevelItemCount()): for i in range(self.topLevelItemCount()):
text = str(self.topLevelItem(i).text(0)) text = unicode(self.topLevelItem(i).text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
self.topLevelItem(i).setText(0, "%s (%i/%i)" % (text, online[text], totals[text])) self.topLevelItem(i).setText(0, "%s (%i/%i)" % (text, online[text], totals[text]))
def hideOnlineNumbers(self): def hideOnlineNumbers(self):
for i in range(self.topLevelItemCount()): for i in range(self.topLevelItemCount()):
text = str(self.topLevelItem(i).text(0)) text = unicode(self.topLevelItem(i).text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
self.topLevelItem(i).setText(0, "%s" % (text)) self.topLevelItem(i).setText(0, "%s" % (text))
@ -541,7 +544,7 @@ class chumArea(RightClickTree):
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def expandGroup(self): def expandGroup(self):
item = self.currentItem() item = self.currentItem()
text = str(item.text(0)) text = unicode(item.text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
@ -556,7 +559,7 @@ class chumArea(RightClickTree):
self.mainwindow.config.addGroup("Chums") self.mainwindow.config.addGroup("Chums")
curgroups = [] curgroups = []
for i in range(self.topLevelItemCount()): for i in range(self.topLevelItemCount()):
text = str(self.topLevelItem(i).text(0)) text = unicode(self.topLevelItem(i).text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
curgroups.append(text) curgroups.append(text)
@ -573,7 +576,7 @@ class chumArea(RightClickTree):
if self.openGroups[self.groups.index("%s" % (chumLabel.chum.group))]: if self.openGroups[self.groups.index("%s" % (chumLabel.chum.group))]:
child_1.setExpanded(True) child_1.setExpanded(True)
for i in range(self.topLevelItemCount()): for i in range(self.topLevelItemCount()):
text = str(self.topLevelItem(i).text(0)) text = unicode(self.topLevelItem(i).text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
if text == chumLabel.chum.group: if text == chumLabel.chum.group:
@ -789,7 +792,7 @@ class chumArea(RightClickTree):
index = self.indexOfTopLevelItem(currentGroup) index = self.indexOfTopLevelItem(currentGroup)
if index != -1: if index != -1:
expanded = currentGroup.isExpanded() expanded = currentGroup.isExpanded()
text = str(currentGroup.text(0)) text = unicode(currentGroup.text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
self.mainwindow.config.delGroup(text) self.mainwindow.config.delGroup(text)
@ -809,7 +812,7 @@ class chumArea(RightClickTree):
currentGroup = self.currentItem() currentGroup = self.currentItem()
if not currentGroup: if not currentGroup:
return return
text = str(currentGroup.text(0)) text = unicode(currentGroup.text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
self.mainwindow.config.delGroup(text) self.mainwindow.config.delGroup(text)
@ -830,7 +833,7 @@ class chumArea(RightClickTree):
def moveToGroup(self, item): def moveToGroup(self, item):
if not item: if not item:
return return
group = str(item.text()) group = unicode(item.text())
chumLabel = self.currentItem() chumLabel = self.currentItem()
if not chumLabel: if not chumLabel:
return return
@ -1219,7 +1222,7 @@ class PesterWindow(MovingWindow):
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def updatePC(self): def updatePC(self):
version.updateDownload(str(self.updatemenu.url)) version.updateDownload(unicode(self.updatemenu.url))
self.updatemenu = None self.updatemenu = None
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def noUpdatePC(self): def noUpdatePC(self):
@ -1388,16 +1391,16 @@ class PesterWindow(MovingWindow):
self.connect(convoWindow, QtCore.SIGNAL('windowClosed(QString)'), self.connect(convoWindow, QtCore.SIGNAL('windowClosed(QString)'),
self, QtCore.SLOT('closeConvo(QString)')) self, QtCore.SLOT('closeConvo(QString)'))
self.convos[chum.handle] = convoWindow self.convos[chum.handle] = convoWindow
if str(chum.handle).upper() == "NICKSERV" or \ if unicode(chum.handle).upper() == "NICKSERV" or \
str(chum.handle).upper() == "CHANSERV" or \ unicode(chum.handle).upper() == "CHANSERV" or \
str(chum.handle).upper() == "MEMOSERV" or \ unicode(chum.handle).upper() == "MEMOSERV" or \
str(chum.handle).upper() == "OPERSERV" or \ unicode(chum.handle).upper() == "OPERSERV" or \
str(chum.handle).upper() == "HELPSERV": unicode(chum.handle).upper() == "HELPSERV":
convoWindow.toggleQuirks(True) convoWindow.toggleQuirks(True)
convoWindow.quirksOff.setChecked(True) convoWindow.quirksOff.setChecked(True)
else: else:
if str(chum.handle).upper() == "CALSPRITE" or \ if unicode(chum.handle).upper() == "CALSPRITE" or \
str(chum.handle).upper() == "RANDOMENCOUNTER": unicode(chum.handle).upper() == "RANDOMENCOUNTER":
convoWindow.toggleQuirks(True) convoWindow.toggleQuirks(True)
convoWindow.quirksOff.setChecked(True) convoWindow.quirksOff.setChecked(True)
self.newConvoStarted.emit(QtCore.QString(chum.handle), initiated) self.newConvoStarted.emit(QtCore.QString(chum.handle), initiated)
@ -1690,7 +1693,7 @@ class PesterWindow(MovingWindow):
def pesterSelectedChum(self): def pesterSelectedChum(self):
curChum = self.chumList.currentItem() curChum = self.chumList.currentItem()
if curChum: if curChum:
text = str(curChum.text(0)) text = unicode(curChum.text(0))
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
if text not in self.chumList.groups and \ 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()] available_groups = [g[0] for g in self.config.getGroups()]
self.addchumdialog = AddChumDialog(available_groups, self) self.addchumdialog = AddChumDialog(available_groups, self)
ok = self.addchumdialog.exec_() ok = self.addchumdialog.exec_()
handle = str(self.addchumdialog.chumBox.text()).strip() handle = unicode(self.addchumdialog.chumBox.text()).strip()
newgroup = str(self.addchumdialog.newgroup.text()).strip() newgroup = unicode(self.addchumdialog.newgroup.text()).strip()
selectedGroup = self.addchumdialog.groupBox.currentText() selectedGroup = self.addchumdialog.groupBox.currentText()
group = newgroup if newgroup else selectedGroup group = newgroup if newgroup else selectedGroup
if ok: if ok:
@ -2370,7 +2373,7 @@ class PesterWindow(MovingWindow):
self.config.set('blink', blinksetting) self.config.set('blink', blinksetting)
# toast notifications # toast notifications
self.tm.setEnabled(self.optionmenu.notifycheck.isChecked()) 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 notifysetting = 0
if self.optionmenu.notifySigninCheck.isChecked(): if self.optionmenu.notifySigninCheck.isChecked():
notifysetting |= self.config.SIGNIN notifysetting |= self.config.SIGNIN

View file

@ -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.LOG: return
if not self.parent.config.logPesters() & self.parent.config.STAMP: if not self.parent.config.logPesters() & self.parent.config.STAMP:
time = "" time = ""
if str(handle).upper() == "NICKSERV": return if unicode(handle).upper() == "NICKSERV": return
#watch out for illegal characters #watch out for illegal characters
handle = re.sub(r'[<>:"/\\|?*]', "_", handle) handle = re.sub(r'[<>:"/\\|?*]', "_", handle)
bbcodemsg = time + convertTags(msg, "bbcode") bbcodemsg = time + convertTags(msg, "bbcode")

View file

@ -234,7 +234,7 @@ class PesterToast(QtGui.QWidget, DefaultToast):
self.msg.setStyleSheet(self.parent().theme["toasts/content/style"]) self.msg.setStyleSheet(self.parent().theme["toasts/content/style"])
self.layout().setSpacing(0) 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() p = QtGui.QApplication.desktop().availableGeometry(self).bottomRight()
o = QtGui.QApplication.desktop().screenGeometry(self).bottomRight() o = QtGui.QApplication.desktop().screenGeometry(self).bottomRight()
@ -253,8 +253,8 @@ class PesterToast(QtGui.QWidget, DefaultToast):
def done(self): def done(self):
QtGui.QWidget.hide(self) QtGui.QWidget.hide(self)
t = self.machine.toasts[0] t = self.machine.toasts[0]
if t.title == str(self.title.text()) and \ if t.title == unicode(self.title.text()) and \
t.msg == str(self.content): t.msg == unicode(self.content):
self.machine.toasts.pop(0) self.machine.toasts.pop(0)
self.machine.displaying = False self.machine.displaying = False
if self.machine.on: if self.machine.on:

View file

@ -27,11 +27,11 @@ elif OS_TYPE == "darwin":
_pcMajor = "3.41" _pcMajor = "3.41"
_pcMinor = "3" _pcMinor = "3"
_pcStatus = "RC" # A = alpha _pcStatus = "" # A = alpha
# B = beta # B = beta
# RC = release candidate # RC = release candidate
# None = public release # None = public release
_pcRevision = "1" _pcRevision = ""
_pcVersion = "" _pcVersion = ""
def pcVerCalc(): def pcVerCalc():