This commit is contained in:
Stephen Dranger 2011-02-13 04:30:08 -06:00
parent c7987a37aa
commit 2cde4e6ec7
6 changed files with 20 additions and 8 deletions

2
TODO
View file

@ -1,12 +1,10 @@
Features:
* More complex quirks: spelling, by-sound
* random quirk string enter must clear text box and focus input on add
* IRC message limit!!!
* on ban, redirect to memo chooser
* ? time option???
* help menu -- about and forum
* Tray doesn't disappear on windows after close
* memo sending from unknown color breaks -- over IRC??
-- release alpha
* shared buddy lists - changes to the buddy list should refresh it?
multiple clients share buddy list???

View file

@ -92,26 +92,29 @@ class pesterQuirks(object):
q.type=='replace' or q.type=='regexp']
random = [q for q in self.quirklist if q.type=='random']
firstStr = True
newlist = []
for (i, o) in enumerate(lexed):
if type(o) not in [str, unicode]:
if i == 0:
string = " "
for p in prefix:
string += p.apply(string)
newlist.append(string)
newlist.append(o)
continue
lastStr = (i == len(lexed)-1)
string = o
for r in random:
string = r.apply(string, first=firstStr, last=lastStr)
string = r.apply(string, first=(i==0), last=lastStr)
for r in replace:
string = r.apply(string, first=firstStr, last=lastStr)
if firstStr:
string = r.apply(string, first=(i==0), last=lastStr)
if i == 0:
for p in prefix:
string = p.apply(string)
if lastStr:
for s in suffix:
string = s.apply(string)
newlist.append(string)
firstStr = False
return newlist

Binary file not shown.

View file

@ -101,12 +101,13 @@ class RandomQuirkDialog(MultiTextDialog):
text = unicode(self.replaceinput.text())
item = QtGui.QListWidgetItem(text, self.replacelist)
self.replaceinput.setText("")
self.replaceinput.setFocus()
@QtCore.pyqtSlot()
def removeRandomString(self):
if not self.replacelist.currentItem():
return
else:
self.replacelist.takeItem(self.currentRow())
self.replacelist.takeItem(self.replacelist.currentRow())
self.replaceinput.setFocus()
class PesterChooseQuirks(QtGui.QDialog):
@ -175,6 +176,8 @@ class PesterChooseQuirks(QtGui.QDialog):
@QtCore.pyqtSlot()
def addPrefixDialog(self):
pdict = MultiTextDialog("ENTER PREFIX", self, {"label": "Value:", "inputname": "value"}).getText()
if pdict is None:
return
pdict["type"] = "prefix"
prefix = pesterQuirk(pdict)
pitem = PesterQuirkItem(prefix, self.quirkList)
@ -183,6 +186,8 @@ class PesterChooseQuirks(QtGui.QDialog):
@QtCore.pyqtSlot()
def addSuffixDialog(self):
vdict = MultiTextDialog("ENTER SUFFIX", self, {"label": "Value:", "inputname": "value"}).getText()
if vdict is None:
return
vdict["type"] = "suffix"
quirk = pesterQuirk(vdict)
item = PesterQuirkItem(quirk, self.quirkList)
@ -191,6 +196,8 @@ class PesterChooseQuirks(QtGui.QDialog):
@QtCore.pyqtSlot()
def addSimpleReplaceDialog(self):
vdict = MultiTextDialog("REPLACE", self, {"label": "Replace:", "inputname": "from"}, {"label": "With:", "inputname": "to"}).getText()
if vdict is None:
return
vdict["type"] = "replace"
quirk = pesterQuirk(vdict)
item = PesterQuirkItem(quirk, self.quirkList)
@ -199,6 +206,8 @@ class PesterChooseQuirks(QtGui.QDialog):
@QtCore.pyqtSlot()
def addRegexpDialog(self):
vdict = MultiTextDialog("REGEXP REPLACE", self, {"label": "Regexp:", "inputname": "from"}, {"label": "Replace With:", "inputname": "to"}).getText()
if vdict is None:
return
vdict["type"] = "regexp"
try:
re.compile(vdict["from"])
@ -216,6 +225,8 @@ class PesterChooseQuirks(QtGui.QDialog):
@QtCore.pyqtSlot()
def addRandomDialog(self):
vdict = RandomQuirkDialog(self).getText()
if vdict is None:
return
vdict["type"] = "random"
try:
re.compile(vdict["from"])

BIN
menus.pyc

Binary file not shown.

Binary file not shown.