This commit is contained in:
Stephen Dranger 2011-03-31 16:57:30 -05:00
parent 2d7e83fb67
commit 85a9cb13cd
5 changed files with 68 additions and 13 deletions

4
TODO
View file

@ -1,4 +1,8 @@
o Bugs: 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. * 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 * 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 * Windows XP SP2: sometimes mouse clicks dont register? must be some kinda crash

6
irc.py
View file

@ -335,12 +335,16 @@ class PesterHandler(DefaultCommandHandler):
self.channel_list = [] self.channel_list = []
info = list(info) info = list(info)
self.channel_field = info.index("Channel") # dunno if this is protocol 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): def list(self, server, handle, *info):
channel = info[self.channel_field] channel = info[self.channel_field]
usercount = info[1]
if channel not in self.channel_list and channel != "#pesterchum": 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): def listend(self, server, handle, msg):
pl = PesterList(self.channel_list) pl = PesterList(self.channel_list)
logging.info("---> recv \"CHANNELS END\"")
self.parent.channelListReceived.emit(pl) self.parent.channelListReceived.emit(pl)
self.channel_list = [] self.channel_list = []

View file

@ -14,6 +14,7 @@ class PesterQuirkItem(QtGui.QListWidgetItem):
self.quirk = quirk self.quirk = quirk
self.setText(unicode(quirk)) self.setText(unicode(quirk))
def __lt__(self, quirkitem): def __lt__(self, quirkitem):
"""Sets the order of quirks if auto-sorted by Qt. Obsolete now."""
if self.quirk.type == "prefix": if self.quirk.type == "prefix":
return True return True
elif (self.quirk.type == "replace" or self.quirk.type == "regexp") and \ elif (self.quirk.type == "replace" or self.quirk.type == "regexp") and \
@ -22,10 +23,14 @@ class PesterQuirkItem(QtGui.QListWidgetItem):
else: else:
return False 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): def __init__(self, mainwindow, parent):
QtGui.QListWidget.__init__(self, parent) QtGui.QListWidget.__init__(self, parent)
self.resize(400, 200) self.resize(400, 200)
# make sure we have access to mainwindow info like profiles
self.mainwindow = mainwindow self.mainwindow = mainwindow
self.setStyleSheet("background:black; color:white;") self.setStyleSheet("background:black; color:white;")
@ -37,6 +42,20 @@ class PesterQuirkList(QtGui.QListWidget):
def currentQuirk(self): def currentQuirk(self):
return self.item(self.currentRow()) 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() @QtCore.pyqtSlot()
def removeCurrent(self): def removeCurrent(self):
i = self.currentRow() i = self.currentRow()
@ -187,6 +206,19 @@ class PesterChooseQuirks(QtGui.QDialog):
self.addMispellingButton = QtGui.QPushButton("MISPELLER", self) self.addMispellingButton = QtGui.QPushButton("MISPELLER", self)
self.connect(self.addMispellingButton, QtCore.SIGNAL('clicked()'), self.connect(self.addMispellingButton, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('addSpellDialog()')) 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 = QtGui.QHBoxLayout()
layout_1.addWidget(self.addPrefixButton) layout_1.addWidget(self.addPrefixButton)
@ -219,7 +251,7 @@ class PesterChooseQuirks(QtGui.QDialog):
layout_ok.addWidget(self.ok) layout_ok.addWidget(self.ok)
layout_0 = QtGui.QVBoxLayout() layout_0 = QtGui.QVBoxLayout()
layout_0.addWidget(self.quirkList) layout_0.addLayout(layout_quirklist)
layout_0.addLayout(layout_1) layout_0.addLayout(layout_1)
layout_0.addLayout(layout_2) layout_0.addLayout(layout_2)
layout_0.addLayout(layout_3) layout_0.addLayout(layout_3)
@ -230,6 +262,15 @@ class PesterChooseQuirks(QtGui.QDialog):
return [self.quirkList.item(i).quirk for i in return [self.quirkList.item(i).quirk for i in
range(0,self.quirkList.count())] 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() @QtCore.pyqtSlot()
def editSelected(self): def editSelected(self):
q = self.quirkList.currentQuirk() q = self.quirkList.currentQuirk()
@ -622,6 +663,13 @@ class PesterUserlist(QtGui.QDialog):
addChum = QtCore.pyqtSignal(QtCore.QString) 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): class PesterMemoList(QtGui.QDialog):
def __init__(self, parent, channel=""): def __init__(self, parent, channel=""):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
@ -678,7 +726,7 @@ class PesterMemoList(QtGui.QDialog):
def updateChannels(self, channels): def updateChannels(self, channels):
for c in 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.setTextColor(QtGui.QColor(self.theme["main/chums/userlistcolor"]))
item.setIcon(QtGui.QIcon(self.theme["memos/memoicon"])) item.setIcon(QtGui.QIcon(self.theme["memos/memoicon"]))
self.channelarea.addItem(item) self.channelarea.addItem(item)
@ -704,8 +752,8 @@ class PesterMemoList(QtGui.QDialog):
class LoadingScreen(QtGui.QDialog): class LoadingScreen(QtGui.QDialog):
def __init__(self, parent=None): def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent, flags=(QtCore.Qt.CustomizeWindowHint | QtGui.QDialog.__init__(self, parent, (QtCore.Qt.CustomizeWindowHint |
QtCore.Qt.FramelessWindowHint)) QtCore.Qt.FramelessWindowHint))
self.mainwindow = parent self.mainwindow = parent
self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"]) self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])

View file

@ -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": []} {"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": []}

View file

@ -754,9 +754,8 @@ class MovingWindow(QtGui.QFrame):
class PesterWindow(MovingWindow): class PesterWindow(MovingWindow):
def __init__(self, parent=None): def __init__(self, parent=None):
MovingWindow.__init__(self, parent, MovingWindow.__init__(self, parent,
flags=(QtCore.Qt.CustomizeWindowHint | (QtCore.Qt.CustomizeWindowHint |
QtCore.Qt.FramelessWindowHint)) QtCore.Qt.FramelessWindowHint))
self.convos = {} self.convos = {}
self.memos = {} self.memos = {}
self.tabconvo = None self.tabconvo = None
@ -1525,7 +1524,7 @@ class PesterWindow(MovingWindow):
channel = re.sub(r"[^A-Za-z0-9#_]", "", channel) channel = re.sub(r"[^A-Za-z0-9#_]", "", channel)
self.newMemo(channel, time, secret=secret) self.newMemo(channel, time, secret=secret)
elif selectedmemo: elif selectedmemo:
channel = "#"+unicode(selectedmemo.text()) channel = "#"+unicode(selectedmemo.target)
self.newMemo(channel, time) self.newMemo(channel, time)
self.memochooser = None self.memochooser = None
@QtCore.pyqtSlot() @QtCore.pyqtSlot()