This commit is contained in:
Dpeta 2021-03-23 22:40:47 +01:00
parent fef7db8161
commit 4f70fda509
3 changed files with 22 additions and 21 deletions

25
irc.py
View file

@ -336,12 +336,12 @@ class PesterIRC(QtCore.QThread):
class PesterHandler(DefaultCommandHandler): class PesterHandler(DefaultCommandHandler):
def notice(self, nick, chan, msg): def notice(self, nick, chan, msg):
try: #try:
msg = msg.decode('utf-8') # msg = msg.decode('utf-8')
except UnicodeDecodeError: #except UnicodeDecodeError:
msg = msg.decode('iso-8859-1', 'ignore') # msg = msg.decode('iso-8859-1', 'ignore')
nick = nick.decode('utf-8') #nick = nick.decode('utf-8')
chan = chan.decode('utf-8') #chan = chan.decode('utf-8')
handle = nick[0:nick.find("!")] handle = nick[0:nick.find("!")]
logging.info("---> recv \"NOTICE %s :%s\"" % (handle, msg)) logging.info("---> recv \"NOTICE %s :%s\"" % (handle, msg))
if handle == "ChanServ" and chan == self.parent.mainwindow.profile().handle and msg[0:2] == "[#": if handle == "ChanServ" and chan == self.parent.mainwindow.profile().handle and msg[0:2] == "[#":
@ -349,10 +349,10 @@ class PesterHandler(DefaultCommandHandler):
else: else:
self.parent.noticeReceived.emit(handle, msg) self.parent.noticeReceived.emit(handle, msg)
def privmsg(self, nick, chan, msg): def privmsg(self, nick, chan, msg):
try: #try:
msg = msg.decode('utf-8') # msg = msg.decode('utf-8')
except UnicodeDecodeError: #except UnicodeDecodeError:
msg = msg.decode('iso-8859-1', 'ignore') # msg = msg.decode('iso-8859-1', 'ignore')
# display msg, do other stuff # display msg, do other stuff
if len(msg) == 0: if len(msg) == 0:
return return
@ -460,9 +460,10 @@ class PesterHandler(DefaultCommandHandler):
self.parent.mainwindow.randhandler.setRunning(True) self.parent.mainwindow.randhandler.setRunning(True)
self.parent.moodUpdated.emit(handle, Mood("chummy")) self.parent.moodUpdated.emit(handle, Mood("chummy"))
def mode(self, op, channel, mode, *handles): def mode(self, op, channel, mode, *handles):
channel = channel.decode('utf-8') #channel = channel.decode('utf-8')
if len(handles) <= 0: handles = [""] if len(handles) <= 0: handles = [""]
opnick = op.decode('utf-8')[0:op.decode('utf-8').find("!")] #opnick = op.decode('utf-8')[0:op.decode('utf-8').find("!")]
opnick = op[0:op.find("!")]
if op == channel or channel == self.parent.mainwindow.profile().handle: if op == channel or channel == self.parent.mainwindow.profile().handle:
modes = list(self.parent.mainwindow.modes) modes = list(self.parent.mainwindow.modes)
if modes and modes[0] == "+": modes = modes[1:] if modes and modes[0] == "+": modes = modes[1:]

View file

@ -548,7 +548,7 @@ class PesterMemo(PesterConvo):
def updateColor(self, handle, color): def updateColor(self, handle, color):
chums = self.userlist.findItems(handle, QtCore.Qt.MatchFlags(0)) chums = self.userlist.findItems(handle, QtCore.Qt.MatchFlags(0))
for c in chums: for c in chums:
c.setTextColor(color) c.setForeground(0, QtGui.QBrush(color))
def addMessage(self, text, handle): def addMessage(self, text, handle):
if type(handle) is bool: if type(handle) is bool:
chum = self.mainwindow.profile() chum = self.mainwindow.profile()
@ -669,7 +669,7 @@ class PesterMemo(PesterConvo):
else: else:
color = chumdb.getColor(handle, defaultcolor) color = chumdb.getColor(handle, defaultcolor)
item.box = (handle == "evacipatedBox") item.box = (handle == "evacipatedBox")
item.setTextColor(color) item.setForeground(QtGui.QBrush(color))
item.founder = founder item.founder = founder
item.op = op item.op = op
item.halfop = halfop item.halfop = halfop

View file

@ -1545,7 +1545,7 @@ class PesterUserlist(QtWidgets.QDialog):
for n in names: for n in names:
if str(self.searchbox.text()) == "" or n.lower().find(str(self.searchbox.text()).lower()) != -1: if str(self.searchbox.text()) == "" or n.lower().find(str(self.searchbox.text()).lower()) != -1:
item = QtWidgets.QListWidgetItem(n) item = QtWidgets.QListWidgetItem(n)
item.setTextColor(QtGui.QColor(self.theme["main/chums/userlistcolor"])) item.setForeground(0, QtGui.QBrush(QtGui.QColor(self.theme["main/chums/userlistcolor"])))
self.userarea.addItem(item) self.userarea.addItem(item)
self.userarea.sortItems() self.userarea.sortItems()
@QtCore.pyqtSlot(QString, QString, QString) @QtCore.pyqtSlot(QString, QString, QString)
@ -1561,7 +1561,7 @@ class PesterUserlist(QtWidgets.QDialog):
self.addUser(h) self.addUser(h)
def addUser(self, name): def addUser(self, name):
item = QtWidgets.QListWidgetItem(name) item = QtWidgets.QListWidgetItem(name)
item.setTextColor(QtGui.QColor(self.theme["main/chums/userlistcolor"])) item.setForeground(0, QtGui.QBrush(QtGui.QColor(self.theme["main/chums/userlistcolor"])))
self.userarea.addItem(item) self.userarea.addItem(item)
self.userarea.sortItems() self.userarea.sortItems()
def delUser(self, name): def delUser(self, name):
@ -1575,7 +1575,7 @@ class PesterUserlist(QtWidgets.QDialog):
self.userarea.setStyleSheet(theme["main/chums/style"]) self.userarea.setStyleSheet(theme["main/chums/style"])
self.addChumAction.setText(theme["main/menus/rclickchumlist/addchum"]) self.addChumAction.setText(theme["main/menus/rclickchumlist/addchum"])
for item in [self.userarea.item(i) for i in range(0, self.userarea.count())]: for item in [self.userarea.item(i) for i in range(0, self.userarea.count())]:
item.setTextColor(QtGui.QColor(theme["main/chums/userlistcolor"])) item.setForeground(0, QtGui.QBrush(QtGui.QColor(theme["main/chums/userlistcolor"])))
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def addChumSlot(self): def addChumSlot(self):
@ -1625,7 +1625,7 @@ class PesterMemoList(QtWidgets.QDialog):
self.channelarea.setColumnWidth(1,10) self.channelarea.setColumnWidth(1,10)
self.channelarea.setSortingEnabled(True) self.channelarea.setSortingEnabled(True)
self.channelarea.sortByColumn(0, QtCore.Qt.AscendingOrder) self.channelarea.sortByColumn(0, QtCore.Qt.AscendingOrder)
self.channelarea.itemDoubleClicked[QTreeWidgetItem, int].connect(self.AcceptSelection) self.channelarea.itemDoubleClicked[QtWidgets.QTreeWidgetItem, int].connect(self.AcceptSelection)
self.orjoinlabel = QtWidgets.QLabel("OR MAKE A NEW MEMO:") self.orjoinlabel = QtWidgets.QLabel("OR MAKE A NEW MEMO:")
self.newmemo = QtWidgets.QLineEdit(channel, self) self.newmemo = QtWidgets.QLineEdit(channel, self)
@ -1678,8 +1678,8 @@ class PesterMemoList(QtWidgets.QDialog):
def updateChannels(self, channels): def updateChannels(self, channels):
for c in channels: for c in channels:
item = MemoListItem(c[0][1:],c[1]) item = MemoListItem(c[0][1:],c[1])
item.setTextColor(0, QtGui.QColor(self.theme["main/chums/userlistcolor"])) item.setForeground(0, QtGui.QBrush(QtGui.QColor(self.theme["main/chums/userlistcolor"])))
item.setTextColor(1, QtGui.QColor(self.theme["main/chums/userlistcolor"])) item.setForeground(1, QtGui.QBrush(QtGui.QColor(self.theme["main/chums/userlistcolor"])))
item.setIcon(0, QtGui.QIcon(self.theme["memos/memoicon"])) item.setIcon(0, QtGui.QIcon(self.theme["memos/memoicon"]))
self.channelarea.addTopLevelItem(item) self.channelarea.addTopLevelItem(item)
@ -1687,7 +1687,7 @@ class PesterMemoList(QtWidgets.QDialog):
self.theme = theme self.theme = theme
self.setStyleSheet(theme["main/defaultwindow/style"]) self.setStyleSheet(theme["main/defaultwindow/style"])
for item in [self.userarea.item(i) for i in range(0, self.channelarea.count())]: for item in [self.userarea.item(i) for i in range(0, self.channelarea.count())]:
item.setTextColor(QtGui.QColor(theme["main/chums/userlistcolor"])) item.setForeground(0, QtGui.QBrush(QtGui.QColor(theme["main/chums/userlistcolor"])))
item.setIcon(QtGui.QIcon(theme["memos/memoicon"])) item.setIcon(QtGui.QIcon(theme["memos/memoicon"]))
@QtCore.pyqtSlot() @QtCore.pyqtSlot()