diff --git a/TODO b/TODO index e597fd2..c68d534 100644 --- a/TODO +++ b/TODO @@ -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??? diff --git a/dataobjs.py b/dataobjs.py index 263d324..e0da239 100644 --- a/dataobjs.py +++ b/dataobjs.py @@ -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 diff --git a/dataobjs.pyc b/dataobjs.pyc index b9744fc..670a7cc 100644 Binary files a/dataobjs.pyc and b/dataobjs.pyc differ diff --git a/menus.py b/menus.py index 15794fd..f7ff4e6 100644 --- a/menus.py +++ b/menus.py @@ -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"]) diff --git a/menus.pyc b/menus.pyc index 657ace7..271db3a 100644 Binary files a/menus.pyc and b/menus.pyc differ diff --git a/parsetools.pyc b/parsetools.pyc index 7323615..35887e8 100644 Binary files a/parsetools.pyc and b/parsetools.pyc differ