From 85a9cb13cde50789b7828150ad195e5b618ac501 Mon Sep 17 00:00:00 2001 From: Stephen Dranger Date: Thu, 31 Mar 2011 16:57:30 -0500 Subject: [PATCH] derp --- TODO | 4 ++++ irc.py | 6 ++++- menus.py | 62 +++++++++++++++++++++++++++++++++++++++++++++------ pesterchum.js | 2 +- pesterchum.py | 7 +++--- 5 files changed, 68 insertions(+), 13 deletions(-) diff --git a/TODO b/TODO index 6bb52af..c2ced0c 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,8 @@ o Bugs: +* REGEXP: \b(\S)(\S*)(\S)\b REPLACE WITH: upper(\1)\2upper(\3) <-- + this regexp, when used as a quirk and then typed in breaks +* import modified.tar +* channels aren't case sensitive! get the real name of a channel * Windows doesn't show style sheet sometimes?? Maybe related to themes. * Issues with connecting? Client not closing connection right? People keep getting "nick taken" messages * Windows XP SP2: sometimes mouse clicks dont register? must be some kinda crash diff --git a/irc.py b/irc.py index f34740a..a30294d 100644 --- a/irc.py +++ b/irc.py @@ -335,12 +335,16 @@ class PesterHandler(DefaultCommandHandler): self.channel_list = [] info = list(info) self.channel_field = info.index("Channel") # dunno if this is protocol + logging.info("---> recv \"CHANNELS: %s " % (self.channel_field)) def list(self, server, handle, *info): channel = info[self.channel_field] + usercount = info[1] if channel not in self.channel_list and channel != "#pesterchum": - self.channel_list.append(channel) + self.channel_list.append((channel, usercount)) + logging.info("---> recv \"CHANNELS: %s " % (channel)) def listend(self, server, handle, msg): pl = PesterList(self.channel_list) + logging.info("---> recv \"CHANNELS END\"") self.parent.channelListReceived.emit(pl) self.channel_list = [] diff --git a/menus.py b/menus.py index 8343983..39ef4aa 100644 --- a/menus.py +++ b/menus.py @@ -14,6 +14,7 @@ class PesterQuirkItem(QtGui.QListWidgetItem): self.quirk = quirk self.setText(unicode(quirk)) def __lt__(self, quirkitem): + """Sets the order of quirks if auto-sorted by Qt. Obsolete now.""" if self.quirk.type == "prefix": return True elif (self.quirk.type == "replace" or self.quirk.type == "regexp") and \ @@ -22,14 +23,18 @@ class PesterQuirkItem(QtGui.QListWidgetItem): else: return False -class PesterQuirkList(QtGui.QListWidget): +class PesterQuirkList(QtGui.QListWidget): #the quirklist + #todo make an add function to insert quirks after selected quirk -- not done + #todo function to shift selected quirk up and down, should keep selection the quirk being shifted -- done + #todo maybe a click and drag? -- not done def __init__(self, mainwindow, parent): QtGui.QListWidget.__init__(self, parent) self.resize(400, 200) - self.mainwindow = mainwindow + # make sure we have access to mainwindow info like profiles + self.mainwindow = mainwindow self.setStyleSheet("background:black; color:white;") - for q in mainwindow.userprofile.quirks: + for q in mainwindow.userprofile.quirks: item = PesterQuirkItem(q, self) self.addItem(item) #self.sortItems() @@ -37,6 +42,20 @@ class PesterQuirkList(QtGui.QListWidget): def currentQuirk(self): return self.item(self.currentRow()) + def upShiftQuirk(self): + i = self.currentRow() + if i > 0: + shifted_item = self.takeItem(i) + self.insertItem(i-1,shifted_item) + self.setCurrentRow(i-1) + + def downShiftQuirk(self): + i = self.currentRow() + if i < self.count() - 1 and i >= 0: + shifted_item = self.takeItem(i) + self.insertItem(i+1,shifted_item) + self.setCurrentRow(i+1) + @QtCore.pyqtSlot() def removeCurrent(self): i = self.currentRow() @@ -187,6 +206,19 @@ class PesterChooseQuirks(QtGui.QDialog): self.addMispellingButton = QtGui.QPushButton("MISPELLER", self) self.connect(self.addMispellingButton, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('addSpellDialog()')) + self.upShiftButton = QtGui.QPushButton("^", self) + self.downShiftButton = QtGui.QPushButton("v", self) + self.connect(self.upShiftButton, QtCore.SIGNAL('clicked()'), + self, QtCore.SLOT('upShiftQuirk()')) + self.connect(self.downShiftButton, QtCore.SIGNAL('clicked()'), + self, QtCore.SLOT('downShiftQuirk()')) + + layout_quirklist = QtGui.QHBoxLayout() #the nude layout quirklist + layout_shiftbuttons = QtGui.QVBoxLayout() #the shift button layout + layout_shiftbuttons.addWidget(self.upShiftButton) + layout_shiftbuttons.addWidget(self.downShiftButton) + layout_quirklist.addWidget(self.quirkList) + layout_quirklist.addLayout(layout_shiftbuttons) layout_1 = QtGui.QHBoxLayout() layout_1.addWidget(self.addPrefixButton) @@ -219,7 +251,7 @@ class PesterChooseQuirks(QtGui.QDialog): layout_ok.addWidget(self.ok) layout_0 = QtGui.QVBoxLayout() - layout_0.addWidget(self.quirkList) + layout_0.addLayout(layout_quirklist) layout_0.addLayout(layout_1) layout_0.addLayout(layout_2) layout_0.addLayout(layout_3) @@ -229,7 +261,16 @@ class PesterChooseQuirks(QtGui.QDialog): def quirks(self): return [self.quirkList.item(i).quirk for i in range(0,self.quirkList.count())] + + # could probably do away with these and just connect to the relevant methods on the quirk list widget + @QtCore.pyqtSlot() + def upShiftQuirk(self): + self.quirkList.upShiftQuirk() + @QtCore.pyqtSlot() + def downShiftQuirk(self): + self.quirkList.downShiftQuirk() + #!!! @QtCore.pyqtSlot() def editSelected(self): q = self.quirkList.currentQuirk() @@ -622,6 +663,13 @@ class PesterUserlist(QtGui.QDialog): addChum = QtCore.pyqtSignal(QtCore.QString) + +class MemoListItem(QtGui.QListWidgetItem): + def __init__(self, channel, usercount): + QtGui.QListWidgetItem.__init__(self, None) + self.target = channel + self.setText(channel + " (" + str(usercount) + ")") + class PesterMemoList(QtGui.QDialog): def __init__(self, parent, channel=""): QtGui.QDialog.__init__(self, parent) @@ -678,7 +726,7 @@ class PesterMemoList(QtGui.QDialog): def updateChannels(self, channels): for c in channels: - item = QtGui.QListWidgetItem(c[1:]) + item = MemoListItem(c[0][1:],c[1]) item.setTextColor(QtGui.QColor(self.theme["main/chums/userlistcolor"])) item.setIcon(QtGui.QIcon(self.theme["memos/memoicon"])) self.channelarea.addItem(item) @@ -704,8 +752,8 @@ class PesterMemoList(QtGui.QDialog): class LoadingScreen(QtGui.QDialog): def __init__(self, parent=None): - QtGui.QDialog.__init__(self, parent, flags=(QtCore.Qt.CustomizeWindowHint | - QtCore.Qt.FramelessWindowHint)) + QtGui.QDialog.__init__(self, parent, (QtCore.Qt.CustomizeWindowHint | + QtCore.Qt.FramelessWindowHint)) self.mainwindow = parent self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"]) diff --git a/pesterchum.js b/pesterchum.js index 97e74b2..d8f7ad6 100644 --- a/pesterchum.js +++ b/pesterchum.js @@ -1 +1 @@ -{"hideOfflineChums": true, "tabs": true, "soundon": true, "server": "irc.mindfang.org", "chums": ["unknownTraveler", "tentacleTherapist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "anguillaNuntia", "oilslickOrchid", "pretentiousFantasia", "aquaticMarinist", "lyricalKeraunoscopic", "counterRealist", "ectoBiologist", "percipientPedestrian", "asceticClinician", "doctectiveMiracles", "noSense", "ircMonster", "twinArmageddons", "cannabisHero", "jetRocket", "adiosToreador", "turntechGodhead", "magmaExploiter", "hannaSongstress", "endlessVoid", "grayscaleVisionary", "corruptedInsanity", "stupidlyBrilliant", "artsyGyarados", "obliviousCrafter", "sporadicAgent", "subtleChaotician", "nareSolee", "apostateCourier", "nocturnalTherapist", "herpaDerp", "clockworkUtopia", "digitalSamurai", "astronomicalMaster", "slipshodBrisant", "genialDustbuster", "hyperdriveTyphoon", "magnificentMiser", "gentleRuffian", "riskRepeats", "globalsoftPrika", "globalsoftPirka", "devonianCritter", "lethargicSerpent", "bluntInstrument", "sunilaSeed"], "defaultprofile": "ghostDunk", "block": []} \ No newline at end of file +{"hideOfflineChums": true, "tabs": true, "soundon": true, "server": "irc.mindfang.org", "chums": ["unknownTraveler", "tentacleTherapist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "anguillaNuntia", "oilslickOrchid", "pretentiousFantasia", "aquaticMarinist", "lyricalKeraunoscopic", "counterRealist", "ectoBiologist", "percipientPedestrian", "asceticClinician", "doctectiveMiracles", "noSense", "ircMonster", "twinArmageddons", "cannabisHero", "jetRocket", "adiosToreador", "turntechGodhead", "magmaExploiter", "hannaSongstress", "endlessVoid", "grayscaleVisionary", "corruptedInsanity", "stupidlyBrilliant", "artsyGyarados", "obliviousCrafter", "sporadicAgent", "subtleChaotician", "nareSolee", "apostateCourier", "nocturnalTherapist", "herpaDerp", "clockworkUtopia", "digitalSamurai", "astronomicalMaster", "slipshodBrisant", "genialDustbuster", "hyperdriveTyphoon", "magnificentMiser", "gentleRuffian", "riskRepeats", "globalsoftPrika", "globalsoftPirka", "devonianCritter", "lethargicSerpent", "bluntInstrument", "sunilaSeed", "ghostBinoculars", "cosmicSailor", "alGore", "nickServ", "nakNak"], "defaultprofile": "ghostDunk", "block": []} \ No newline at end of file diff --git a/pesterchum.py b/pesterchum.py index fa15c1a..8fba9a3 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -754,9 +754,8 @@ class MovingWindow(QtGui.QFrame): class PesterWindow(MovingWindow): def __init__(self, parent=None): MovingWindow.__init__(self, parent, - flags=(QtCore.Qt.CustomizeWindowHint | - QtCore.Qt.FramelessWindowHint)) - + (QtCore.Qt.CustomizeWindowHint | + QtCore.Qt.FramelessWindowHint)) self.convos = {} self.memos = {} self.tabconvo = None @@ -1525,7 +1524,7 @@ class PesterWindow(MovingWindow): channel = re.sub(r"[^A-Za-z0-9#_]", "", channel) self.newMemo(channel, time, secret=secret) elif selectedmemo: - channel = "#"+unicode(selectedmemo.text()) + channel = "#"+unicode(selectedmemo.target) self.newMemo(channel, time) self.memochooser = None @QtCore.pyqtSlot()