Merge pull request #122 from Dpeta/str_typecasts_and_qstring
Remove most unnecessary str() typecasts and just use 'str' for Qt slots/signals
This commit is contained in:
commit
7c8e682c36
13 changed files with 274 additions and 317 deletions
29
convo.py
29
convo.py
|
@ -218,7 +218,7 @@ class PesterTabWindow(QtWidgets.QFrame):
|
||||||
i = self.tabs.tabAt(self.mapFromGlobal(QtGui.QCursor.pos()))
|
i = self.tabs.tabAt(self.mapFromGlobal(QtGui.QCursor.pos()))
|
||||||
if i == -1:
|
if i == -1:
|
||||||
i = self.tabs.currentIndex()
|
i = self.tabs.currentIndex()
|
||||||
handle = str(self.tabs.tabText(i))
|
handle = self.tabs.tabText(i)
|
||||||
self.clearNewMessage(handle)
|
self.clearNewMessage(handle)
|
||||||
|
|
||||||
def convoHasFocus(self, handle):
|
def convoHasFocus(self, handle):
|
||||||
|
@ -267,13 +267,13 @@ class PesterTabWindow(QtWidgets.QFrame):
|
||||||
self.tabs.setTabIcon(tabi, c.icon())
|
self.tabs.setTabIcon(tabi, c.icon())
|
||||||
currenttabi = self.tabs.currentIndex()
|
currenttabi = self.tabs.currentIndex()
|
||||||
if currenttabi >= 0:
|
if currenttabi >= 0:
|
||||||
currentHandle = str(self.tabs.tabText(self.tabs.currentIndex()))
|
currentHandle = self.tabs.tabText(self.tabs.currentIndex())
|
||||||
self.setWindowIcon(self.convos[currentHandle].icon())
|
self.setWindowIcon(self.convos[currentHandle].icon())
|
||||||
self.defaultTabTextColor = self.getTabTextColor()
|
self.defaultTabTextColor = self.getTabTextColor()
|
||||||
|
|
||||||
@QtCore.pyqtSlot(int)
|
@QtCore.pyqtSlot(int)
|
||||||
def tabClose(self, i):
|
def tabClose(self, i):
|
||||||
handle = str(self.tabs.tabText(i))
|
handle = self.tabs.tabText(i)
|
||||||
self.mainwindow.waitingMessages.messageAnswered(handle)
|
self.mainwindow.waitingMessages.messageAnswered(handle)
|
||||||
# print(self.convos.keys())
|
# print(self.convos.keys())
|
||||||
# I, legit don' t know why this is an issue, but, uh, yeah-
|
# I, legit don' t know why this is an issue, but, uh, yeah-
|
||||||
|
@ -296,7 +296,7 @@ class PesterTabWindow(QtWidgets.QFrame):
|
||||||
return
|
return
|
||||||
if self.currentConvo == convo:
|
if self.currentConvo == convo:
|
||||||
currenti = self.tabs.currentIndex()
|
currenti = self.tabs.currentIndex()
|
||||||
currenth = str(self.tabs.tabText(currenti))
|
currenth = self.tabs.tabText(currenti)
|
||||||
self.currentConvo = self.convos[currenth]
|
self.currentConvo = self.convos[currenth]
|
||||||
self.currentConvo.raiseChat()
|
self.currentConvo.raiseChat()
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ class PesterTabWindow(QtWidgets.QFrame):
|
||||||
if self.changedTab:
|
if self.changedTab:
|
||||||
self.changedTab = False
|
self.changedTab = False
|
||||||
return
|
return
|
||||||
handle = str(self.tabs.tabText(i))
|
handle = self.tabs.tabText(i)
|
||||||
convo = self.convos[handle]
|
convo = self.convos[handle]
|
||||||
if self.currentConvo:
|
if self.currentConvo:
|
||||||
self.layout.removeWidget(self.currentConvo)
|
self.layout.removeWidget(self.currentConvo)
|
||||||
|
@ -344,7 +344,7 @@ class PesterMovie(QtGui.QMovie):
|
||||||
if text.mainwindow.config.animations():
|
if text.mainwindow.config.animations():
|
||||||
movie = self
|
movie = self
|
||||||
url = text.urls[movie].toString()
|
url = text.urls[movie].toString()
|
||||||
html = str(text.toHtml())
|
html = text.toHtml()
|
||||||
if html.find(url) != -1:
|
if html.find(url) != -1:
|
||||||
try:
|
try:
|
||||||
# PyQt6
|
# PyQt6
|
||||||
|
@ -606,7 +606,7 @@ class PesterText(QtWidgets.QTextEdit):
|
||||||
if url[0] == "#" and url != "#pesterchum":
|
if url[0] == "#" and url != "#pesterchum":
|
||||||
self.parent().mainwindow.showMemos(url[1:])
|
self.parent().mainwindow.showMemos(url[1:])
|
||||||
elif url[0] == "@":
|
elif url[0] == "@":
|
||||||
handle = str(url[1:])
|
handle = url[1:]
|
||||||
self.parent().mainwindow.newConversation(handle)
|
self.parent().mainwindow.newConversation(handle)
|
||||||
else:
|
else:
|
||||||
if event.modifiers() == QtCore.Qt.KeyboardModifier.ControlModifier:
|
if event.modifiers() == QtCore.Qt.KeyboardModifier.ControlModifier:
|
||||||
|
@ -664,7 +664,7 @@ class PesterInput(QtWidgets.QLineEdit):
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
if event.key() == QtCore.Qt.Key.Key_Up:
|
if event.key() == QtCore.Qt.Key.Key_Up:
|
||||||
text = str(self.text())
|
text = self.text()
|
||||||
next = self.parent().history.next(text)
|
next = self.parent().history.next(text)
|
||||||
if next is not None:
|
if next is not None:
|
||||||
self.setText(next)
|
self.setText(next)
|
||||||
|
@ -1091,14 +1091,13 @@ class PesterConvo(QtWidgets.QFrame):
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def sentMessage(self):
|
def sentMessage(self):
|
||||||
# Offloaded to another function, like its sisters.
|
"""Offloaded to another function, like its sisters.
|
||||||
# Fetch the raw text from the input box.
|
|
||||||
text = self.textInput.text()
|
|
||||||
text = str(self.textInput.text())
|
|
||||||
|
|
||||||
|
Fetch the raw text from the input box.
|
||||||
|
"""
|
||||||
return parsetools.kxhandleInput(
|
return parsetools.kxhandleInput(
|
||||||
self,
|
self,
|
||||||
text,
|
self.textInput.text(),
|
||||||
flavor="convo",
|
flavor="convo",
|
||||||
irc_compatible=self.mainwindow.config.irc_compatibility_mode(),
|
irc_compatible=self.mainwindow.config.irc_compatibility_mode(),
|
||||||
)
|
)
|
||||||
|
@ -1152,8 +1151,8 @@ class PesterConvo(QtWidgets.QFrame):
|
||||||
def toggleMute(self, toggled):
|
def toggleMute(self, toggled):
|
||||||
self.notifications_muted = toggled
|
self.notifications_muted = toggled
|
||||||
|
|
||||||
messageSent = QtCore.pyqtSignal("QString", "QString")
|
messageSent = QtCore.pyqtSignal(str, str)
|
||||||
windowClosed = QtCore.pyqtSignal("QString")
|
windowClosed = QtCore.pyqtSignal(str)
|
||||||
|
|
||||||
aligndict = {
|
aligndict = {
|
||||||
"h": {
|
"h": {
|
||||||
|
|
|
@ -147,7 +147,7 @@ class pesterQuirks:
|
||||||
|
|
||||||
newlist = []
|
newlist = []
|
||||||
for i, o in enumerate(lexed):
|
for i, o in enumerate(lexed):
|
||||||
if type(o) not in [str, str]:
|
if not isinstance(o, str):
|
||||||
if i == 0:
|
if i == 0:
|
||||||
string = " "
|
string = " "
|
||||||
for p in prefix:
|
for p in prefix:
|
||||||
|
@ -250,7 +250,7 @@ class pesterQuirks:
|
||||||
newlist.append(string)
|
newlist.append(string)
|
||||||
final = []
|
final = []
|
||||||
for n in newlist:
|
for n in newlist:
|
||||||
if type(n) in [str, str]:
|
if isinstance(n, str):
|
||||||
final.extend(lexMessage(n))
|
final.extend(lexMessage(n))
|
||||||
else:
|
else:
|
||||||
final.append(n)
|
final.append(n)
|
||||||
|
@ -456,7 +456,7 @@ class PesterProfile:
|
||||||
opinit,
|
opinit,
|
||||||
self.colorhtml(),
|
self.colorhtml(),
|
||||||
", ".join(initials),
|
", ".join(initials),
|
||||||
str(reason),
|
reason,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -477,7 +477,7 @@ class PesterProfile:
|
||||||
opinit,
|
opinit,
|
||||||
self.colorhtml(),
|
self.colorhtml(),
|
||||||
initials,
|
initials,
|
||||||
str(reason),
|
reason,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class PesterList(list):
|
||||||
class PesterIcon(QtGui.QIcon):
|
class PesterIcon(QtGui.QIcon):
|
||||||
def __init__(self, *x):
|
def __init__(self, *x):
|
||||||
super().__init__(x[0])
|
super().__init__(x[0])
|
||||||
if type(x[0]) in [str, str]:
|
if isinstance(x[0], str):
|
||||||
self.icon_pixmap = QtGui.QPixmap(x[0])
|
self.icon_pixmap = QtGui.QPixmap(x[0])
|
||||||
else:
|
else:
|
||||||
self.icon_pixmap = None
|
self.icon_pixmap = None
|
||||||
|
@ -117,7 +117,7 @@ class MultiTextDialog(QtWidgets.QDialog):
|
||||||
if r == QtWidgets.QDialog.DialogCode.Accepted:
|
if r == QtWidgets.QDialog.DialogCode.Accepted:
|
||||||
retval = {}
|
retval = {}
|
||||||
for name, widget in self.inputs.items():
|
for name, widget in self.inputs.items():
|
||||||
retval[name] = str(widget.text())
|
retval[name] = widget.text()
|
||||||
return retval
|
return retval
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
@ -150,7 +150,7 @@ class MovingWindow(QtWidgets.QFrame):
|
||||||
self.moving = event.globalPos() - self.pos()
|
self.moving = event.globalPos() - self.pos()
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
print("PyQt <= 5.14?")
|
print("PyQt <= 5.14?")
|
||||||
print(str(e))
|
print(e)
|
||||||
if event.button() == 1:
|
if event.button() == 1:
|
||||||
self.moving = event.globalPos() - self.pos()
|
self.moving = event.globalPos() - self.pos()
|
||||||
|
|
||||||
|
|
34
irc.py
34
irc.py
|
@ -437,7 +437,7 @@ class PesterIRC(QtCore.QThread):
|
||||||
"""Update and send color, slot is called from main thread."""
|
"""Update and send color, slot is called from main thread."""
|
||||||
# Update color metadata field
|
# Update color metadata field
|
||||||
color = self.mainwindow.profile().color
|
color = self.mainwindow.profile().color
|
||||||
self._send_irc.metadata("*", "set", "color", str(color.name()))
|
self._send_irc.metadata("*", "set", "color", color.name())
|
||||||
# Send color messages
|
# Send color messages
|
||||||
for convo in list(self.mainwindow.convos.keys()):
|
for convo in list(self.mainwindow.convos.keys()):
|
||||||
self._send_irc.privmsg(
|
self._send_irc.privmsg(
|
||||||
|
@ -1019,22 +1019,22 @@ class PesterIRC(QtCore.QThread):
|
||||||
""" "METADATA DRAFT numeric reply 770 RPL_METADATASUBOK, we subbed to a key."""
|
""" "METADATA DRAFT numeric reply 770 RPL_METADATASUBOK, we subbed to a key."""
|
||||||
PchumLog.info("_metadatasubok: %s", params)
|
PchumLog.info("_metadatasubok: %s", params)
|
||||||
|
|
||||||
moodUpdated = QtCore.pyqtSignal("QString", Mood)
|
moodUpdated = QtCore.pyqtSignal(str, Mood)
|
||||||
colorUpdated = QtCore.pyqtSignal("QString", QtGui.QColor)
|
colorUpdated = QtCore.pyqtSignal(str, QtGui.QColor)
|
||||||
messageReceived = QtCore.pyqtSignal("QString", "QString")
|
messageReceived = QtCore.pyqtSignal(str, str)
|
||||||
memoReceived = QtCore.pyqtSignal("QString", "QString", "QString")
|
memoReceived = QtCore.pyqtSignal(str, str, str)
|
||||||
noticeReceived = QtCore.pyqtSignal("QString", "QString")
|
noticeReceived = QtCore.pyqtSignal(str, str)
|
||||||
inviteReceived = QtCore.pyqtSignal("QString", "QString")
|
inviteReceived = QtCore.pyqtSignal(str, str)
|
||||||
timeCommand = QtCore.pyqtSignal("QString", "QString", "QString")
|
timeCommand = QtCore.pyqtSignal(str, str, str)
|
||||||
namesReceived = QtCore.pyqtSignal("QString", PesterList)
|
namesReceived = QtCore.pyqtSignal(str, PesterList)
|
||||||
channelListReceived = QtCore.pyqtSignal(PesterList)
|
channelListReceived = QtCore.pyqtSignal(PesterList)
|
||||||
nickCollision = QtCore.pyqtSignal("QString", "QString")
|
nickCollision = QtCore.pyqtSignal(str, str)
|
||||||
getSvsnickedOn = QtCore.pyqtSignal("QString", "QString")
|
getSvsnickedOn = QtCore.pyqtSignal(str, str)
|
||||||
myHandleChanged = QtCore.pyqtSignal("QString")
|
myHandleChanged = QtCore.pyqtSignal(str)
|
||||||
chanInviteOnly = QtCore.pyqtSignal("QString")
|
chanInviteOnly = QtCore.pyqtSignal(str)
|
||||||
modesUpdated = QtCore.pyqtSignal("QString", "QString")
|
modesUpdated = QtCore.pyqtSignal(str, str)
|
||||||
connected = QtCore.pyqtSignal()
|
connected = QtCore.pyqtSignal()
|
||||||
askToConnect = QtCore.pyqtSignal(Exception)
|
askToConnect = QtCore.pyqtSignal(Exception)
|
||||||
userPresentUpdate = QtCore.pyqtSignal("QString", "QString", "QString")
|
userPresentUpdate = QtCore.pyqtSignal(str, str, str)
|
||||||
cannotSendToChan = QtCore.pyqtSignal("QString", "QString")
|
cannotSendToChan = QtCore.pyqtSignal(str, str)
|
||||||
signal_forbiddenchannel = QtCore.pyqtSignal("QString", "QString")
|
signal_forbiddenchannel = QtCore.pyqtSignal(str, str)
|
||||||
|
|
11
logviewer.py
11
logviewer.py
|
@ -42,10 +42,7 @@ class PesterLogHighlighter(QtGui.QSyntaxHighlighter):
|
||||||
|
|
||||||
def highlightBlock(self, text):
|
def highlightBlock(self, text):
|
||||||
for i in range(0, len(text) - (len(self.searchTerm) - 1)):
|
for i in range(0, len(text) - (len(self.searchTerm) - 1)):
|
||||||
if (
|
if text[i : i + len(self.searchTerm)].lower() == self.searchTerm.lower():
|
||||||
str(text[i : i + len(self.searchTerm)]).lower()
|
|
||||||
== str(self.searchTerm).lower()
|
|
||||||
):
|
|
||||||
self.setFormat(i, len(self.searchTerm), self.hilightstyle)
|
self.setFormat(i, len(self.searchTerm), self.hilightstyle)
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,7 +294,7 @@ class PesterLogViewer(QtWidgets.QDialog):
|
||||||
if len(self.tree.currentItem().text(0)) > len("September 2011"):
|
if len(self.tree.currentItem().text(0)) > len("September 2011"):
|
||||||
self.loadLog(self.timeToFile(self.tree.currentItem().text(0)))
|
self.loadLog(self.timeToFile(self.tree.currentItem().text(0)))
|
||||||
|
|
||||||
def loadLog(self, fname):
|
def loadLog(self, fname: str):
|
||||||
fp = codecs.open(
|
fp = codecs.open(
|
||||||
"%s/%s/%s/%s/%s"
|
"%s/%s/%s/%s/%s"
|
||||||
% (self.logpath, self.handle, self.chum, self.format, fname),
|
% (self.logpath, self.handle, self.chum, self.format, fname),
|
||||||
|
@ -318,7 +315,7 @@ class PesterLogViewer(QtWidgets.QDialog):
|
||||||
# textCur.movePosition(1)
|
# textCur.movePosition(1)
|
||||||
self.textArea.setTextCursor(textCur)
|
self.textArea.setTextCursor(textCur)
|
||||||
self.instructions.setText(
|
self.instructions.setText(
|
||||||
"Pesterlog with " + self.chum + " on " + self.fileToTime(str(fname))
|
"Pesterlog with " + self.chum + " on " + self.fileToTime(fname)
|
||||||
)
|
)
|
||||||
|
|
||||||
def logSearch(self, search):
|
def logSearch(self, search):
|
||||||
|
@ -359,7 +356,7 @@ class PesterLogText(PesterText):
|
||||||
if url[0] == "#" and url != "#pesterchum":
|
if url[0] == "#" and url != "#pesterchum":
|
||||||
self.parent().parent.showMemos(url[1:])
|
self.parent().parent.showMemos(url[1:])
|
||||||
elif url[0] == "@":
|
elif url[0] == "@":
|
||||||
handle = str(url[1:])
|
handle = url[1:]
|
||||||
self.parent().parent.newConversation(handle)
|
self.parent().parent.newConversation(handle)
|
||||||
else:
|
else:
|
||||||
QtGui.QDesktopServices.openUrl(
|
QtGui.QDesktopServices.openUrl(
|
||||||
|
|
70
memos.py
70
memos.py
|
@ -30,8 +30,6 @@ PchumLog = logging.getLogger("pchumLogger")
|
||||||
_valid_memo_msg_start = re.compile(
|
_valid_memo_msg_start = re.compile(
|
||||||
r"^<c=((\d+,\d+,\d+)|(#([a-fA-F0-9]{6})|(#[a-fA-F0-9]{3})))>([A-Z]{3}):\s"
|
r"^<c=((\d+,\d+,\d+)|(#([a-fA-F0-9]{6})|(#[a-fA-F0-9]{3})))>([A-Z]{3}):\s"
|
||||||
)
|
)
|
||||||
# Python 3
|
|
||||||
QString = str
|
|
||||||
|
|
||||||
|
|
||||||
def delta2txt(d, format="pc"):
|
def delta2txt(d, format="pc"):
|
||||||
|
@ -242,7 +240,7 @@ class TimeInput(QtWidgets.QLineEdit):
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def setSlider(self):
|
def setSlider(self):
|
||||||
value = str(self.text())
|
value = self.text()
|
||||||
timed = txt2delta(value)
|
timed = txt2delta(value)
|
||||||
if isinstance(timed, mysteryTime):
|
if isinstance(timed, mysteryTime):
|
||||||
self.timeslider.setValue(0)
|
self.timeslider.setValue(0)
|
||||||
|
@ -1010,10 +1008,9 @@ class PesterMemo(PesterConvo):
|
||||||
PchumLog.debug("updateChanModes(%s, %s)", modes, op)
|
PchumLog.debug("updateChanModes(%s, %s)", modes, op)
|
||||||
if not hasattr(self, "modes"):
|
if not hasattr(self, "modes"):
|
||||||
self.modes = ""
|
self.modes = ""
|
||||||
chanmodes = list(str(self.modes))
|
chanmodes = list((self.modes))
|
||||||
if chanmodes and chanmodes[0] == "+":
|
if chanmodes and chanmodes[0] == "+":
|
||||||
chanmodes = chanmodes[1:]
|
chanmodes = chanmodes[1:]
|
||||||
modes = str(modes)
|
|
||||||
if op:
|
if op:
|
||||||
systemColor = QtGui.QColor(self.mainwindow.theme["memos/systemMsgColor"])
|
systemColor = QtGui.QColor(self.mainwindow.theme["memos/systemMsgColor"])
|
||||||
chum = self.mainwindow.profile()
|
chum = self.mainwindow.profile()
|
||||||
|
@ -1430,7 +1427,7 @@ class PesterMemo(PesterConvo):
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def sentMessage(self):
|
def sentMessage(self):
|
||||||
text = str(self.textInput.text())
|
text = self.textInput.text()
|
||||||
|
|
||||||
return parsetools.kxhandleInput(
|
return parsetools.kxhandleInput(
|
||||||
self,
|
self,
|
||||||
|
@ -1439,10 +1436,9 @@ class PesterMemo(PesterConvo):
|
||||||
irc_compatible=self.mainwindow.config.irc_compatibility_mode(),
|
irc_compatible=self.mainwindow.config.irc_compatibility_mode(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def namesUpdated(self, channel):
|
def namesUpdated(self, channel):
|
||||||
c = str(channel)
|
if channel.lower() != self.channel.lower():
|
||||||
if c.lower() != self.channel.lower():
|
|
||||||
return
|
return
|
||||||
# get namesdb (unused)
|
# get namesdb (unused)
|
||||||
# namesdb = self.mainwindow.namesdb
|
# namesdb = self.mainwindow.namesdb
|
||||||
|
@ -1451,17 +1447,16 @@ class PesterMemo(PesterConvo):
|
||||||
for n in self.mainwindow.namesdb[self.channel]:
|
for n in self.mainwindow.namesdb[self.channel]:
|
||||||
self.addUser(n)
|
self.addUser(n)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def modesUpdated(self, channel, modes):
|
def modesUpdated(self, channel, modes):
|
||||||
PchumLog.debug("modesUpdated(%s, %s)", channel, modes)
|
PchumLog.debug("modesUpdated(%s, %s)", channel, modes)
|
||||||
if channel.lower() == self.channel.lower():
|
if channel.lower() == self.channel.lower():
|
||||||
self.updateChanModes(modes, None)
|
self.updateChanModes(modes, None)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def closeInviteOnly(self, channel):
|
def closeInviteOnly(self, channel):
|
||||||
c = str(channel)
|
if channel.lower() == self.channel.lower():
|
||||||
if c.lower() == self.channel.lower():
|
self.mainwindow.inviteOnlyChan[str].disconnect(self.closeInviteOnly)
|
||||||
self.mainwindow.inviteOnlyChan["QString"].disconnect(self.closeInviteOnly)
|
|
||||||
if self.parent():
|
if self.parent():
|
||||||
PchumLog.info(self.channel)
|
PchumLog.info(self.channel)
|
||||||
i = self.parent().tabIndices[self.channel]
|
i = self.parent().tabIndices[self.channel]
|
||||||
|
@ -1472,7 +1467,7 @@ class PesterMemo(PesterConvo):
|
||||||
msgbox.setStyleSheet(
|
msgbox.setStyleSheet(
|
||||||
"QMessageBox{ %s }" % self.mainwindow.theme["main/defaultwindow/style"]
|
"QMessageBox{ %s }" % self.mainwindow.theme["main/defaultwindow/style"]
|
||||||
)
|
)
|
||||||
msgbox.setText("%s: Invites only!" % (c))
|
msgbox.setText(f"{channel}: Invites only!")
|
||||||
msgbox.setInformativeText(
|
msgbox.setInformativeText(
|
||||||
"This channel is invite-only. "
|
"This channel is invite-only. "
|
||||||
"You must get an invitation from someone on the inside before entering."
|
"You must get an invitation from someone on the inside before entering."
|
||||||
|
@ -1480,13 +1475,10 @@ class PesterMemo(PesterConvo):
|
||||||
msgbox.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok)
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok)
|
||||||
msgbox.exec()
|
msgbox.exec()
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def closeForbidden(self, channel, reason):
|
def closeForbidden(self, channel, reason):
|
||||||
c = str(channel)
|
if channel.lower() == self.channel.lower():
|
||||||
if c.lower() == self.channel.lower():
|
self.mainwindow.forbiddenChan[str, str].disconnect(self.closeForbidden)
|
||||||
self.mainwindow.forbiddenChan["QString", "QString"].disconnect(
|
|
||||||
self.closeForbidden
|
|
||||||
)
|
|
||||||
if self.parent():
|
if self.parent():
|
||||||
PchumLog.info(self.channel)
|
PchumLog.info(self.channel)
|
||||||
i = self.parent().tabIndices[self.channel]
|
i = self.parent().tabIndices[self.channel]
|
||||||
|
@ -1497,7 +1489,7 @@ class PesterMemo(PesterConvo):
|
||||||
msgbox.setStyleSheet(
|
msgbox.setStyleSheet(
|
||||||
"QMessageBox{ %s }" % self.mainwindow.theme["main/defaultwindow/style"]
|
"QMessageBox{ %s }" % self.mainwindow.theme["main/defaultwindow/style"]
|
||||||
)
|
)
|
||||||
msgbox.setText("%s: D: CANT JOIN MEMO!!!" % (c))
|
msgbox.setText(f"{channel}: D: CANT JOIN MEMO!!!")
|
||||||
msgbox.setInformativeText(reason)
|
msgbox.setInformativeText(reason)
|
||||||
msgbox.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok)
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok)
|
||||||
msgbox.exec()
|
msgbox.exec()
|
||||||
|
@ -1571,13 +1563,10 @@ class PesterMemo(PesterConvo):
|
||||||
self.mainwindow.chatlog.log(self.channel, msg)
|
self.mainwindow.chatlog.log(self.channel, msg)
|
||||||
del self.netsplit
|
del self.netsplit
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString, QString)
|
@QtCore.pyqtSlot(str, str, str)
|
||||||
def userPresentChange(self, handle, channel, update):
|
def userPresentChange(self, handle: str, channel: str, update: str):
|
||||||
# print("handle: %s, channel: %s, update: %s" % (handle, channel, update))
|
h = handle
|
||||||
h = str(handle)
|
c = channel
|
||||||
c = str(channel)
|
|
||||||
update = str(update)
|
|
||||||
# PchumLog.debug("h=%s\nc=%s\nupdate=%s" % (h,c,update))
|
|
||||||
if update[0:4] == "kick": # yeah, i'm lazy.
|
if update[0:4] == "kick": # yeah, i'm lazy.
|
||||||
l = update.split(":")
|
l = update.split(":")
|
||||||
update = l[0]
|
update = l[0]
|
||||||
|
@ -1794,7 +1783,7 @@ class PesterMemo(PesterConvo):
|
||||||
for c in chums:
|
for c in chums:
|
||||||
c.op = True
|
c.op = True
|
||||||
self.iconCrap(c)
|
self.iconCrap(c)
|
||||||
if str(c.text()) == self.mainwindow.profile().handle:
|
if (c.text()) == self.mainwindow.profile().handle:
|
||||||
self.userlist.optionsMenu.addAction(self.opAction)
|
self.userlist.optionsMenu.addAction(self.opAction)
|
||||||
self.userlist.optionsMenu.addAction(self.voiceAction)
|
self.userlist.optionsMenu.addAction(self.voiceAction)
|
||||||
self.userlist.optionsMenu.addAction(self.banuserAction)
|
self.userlist.optionsMenu.addAction(self.banuserAction)
|
||||||
|
@ -1811,7 +1800,7 @@ class PesterMemo(PesterConvo):
|
||||||
for c in chums:
|
for c in chums:
|
||||||
c.op = False
|
c.op = False
|
||||||
self.iconCrap(c)
|
self.iconCrap(c)
|
||||||
if str(c.text()) == self.mainwindow.profile().handle:
|
if (c.text()) == self.mainwindow.profile().handle:
|
||||||
self.userlist.optionsMenu.removeAction(self.opAction)
|
self.userlist.optionsMenu.removeAction(self.opAction)
|
||||||
self.userlist.optionsMenu.removeAction(self.voiceAction)
|
self.userlist.optionsMenu.removeAction(self.voiceAction)
|
||||||
self.userlist.optionsMenu.removeAction(self.banuserAction)
|
self.userlist.optionsMenu.removeAction(self.banuserAction)
|
||||||
|
@ -1827,7 +1816,7 @@ class PesterMemo(PesterConvo):
|
||||||
for c in chums:
|
for c in chums:
|
||||||
c.halfop = True
|
c.halfop = True
|
||||||
self.iconCrap(c)
|
self.iconCrap(c)
|
||||||
if str(c.text()) == self.mainwindow.profile().handle:
|
if (c.text()) == self.mainwindow.profile().handle:
|
||||||
self.userlist.optionsMenu.addAction(self.opAction)
|
self.userlist.optionsMenu.addAction(self.opAction)
|
||||||
self.userlist.optionsMenu.addAction(self.voiceAction)
|
self.userlist.optionsMenu.addAction(self.voiceAction)
|
||||||
self.userlist.optionsMenu.addAction(self.banuserAction)
|
self.userlist.optionsMenu.addAction(self.banuserAction)
|
||||||
|
@ -1844,7 +1833,7 @@ class PesterMemo(PesterConvo):
|
||||||
for c in chums:
|
for c in chums:
|
||||||
c.halfop = False
|
c.halfop = False
|
||||||
self.iconCrap(c)
|
self.iconCrap(c)
|
||||||
if str(c.text()) == self.mainwindow.profile().handle:
|
if (c.text()) == self.mainwindow.profile().handle:
|
||||||
self.userlist.optionsMenu.removeAction(self.opAction)
|
self.userlist.optionsMenu.removeAction(self.opAction)
|
||||||
self.userlist.optionsMenu.removeAction(self.voiceAction)
|
self.userlist.optionsMenu.removeAction(self.voiceAction)
|
||||||
self.userlist.optionsMenu.removeAction(self.banuserAction)
|
self.userlist.optionsMenu.removeAction(self.banuserAction)
|
||||||
|
@ -1892,21 +1881,21 @@ class PesterMemo(PesterConvo):
|
||||||
user = self.userlist.currentItem()
|
user = self.userlist.currentItem()
|
||||||
if not user:
|
if not user:
|
||||||
return
|
return
|
||||||
user = str(user.text())
|
user = user.text()
|
||||||
self.mainwindow.newConversation(user)
|
self.mainwindow.newConversation(user)
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def addChumSlot(self):
|
def addChumSlot(self):
|
||||||
if not self.userlist.currentItem():
|
if not self.userlist.currentItem():
|
||||||
return
|
return
|
||||||
currentChum = PesterProfile(str(self.userlist.currentItem().text()))
|
currentChum = PesterProfile((self.userlist.currentItem().text()))
|
||||||
self.mainwindow.addChum(currentChum)
|
self.mainwindow.addChum(currentChum)
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def banSelectedUser(self):
|
def banSelectedUser(self):
|
||||||
if not self.userlist.currentItem():
|
if not self.userlist.currentItem():
|
||||||
return
|
return
|
||||||
currentHandle = str(self.userlist.currentItem().text())
|
currentHandle = self.userlist.currentItem().text()
|
||||||
(reason, ok) = QtWidgets.QInputDialog.getText(
|
(reason, ok) = QtWidgets.QInputDialog.getText(
|
||||||
self, "Ban User", "Enter the reason you are banning this user (optional):"
|
self, "Ban User", "Enter the reason you are banning this user (optional):"
|
||||||
)
|
)
|
||||||
|
@ -1917,21 +1906,21 @@ class PesterMemo(PesterConvo):
|
||||||
def opSelectedUser(self):
|
def opSelectedUser(self):
|
||||||
if not self.userlist.currentItem():
|
if not self.userlist.currentItem():
|
||||||
return
|
return
|
||||||
currentHandle = str(self.userlist.currentItem().text())
|
currentHandle = self.userlist.currentItem().text()
|
||||||
self.mainwindow.setChannelMode.emit(self.channel, "+o", currentHandle)
|
self.mainwindow.setChannelMode.emit(self.channel, "+o", currentHandle)
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def voiceSelectedUser(self):
|
def voiceSelectedUser(self):
|
||||||
if not self.userlist.currentItem():
|
if not self.userlist.currentItem():
|
||||||
return
|
return
|
||||||
currentHandle = str(self.userlist.currentItem().text())
|
currentHandle = self.userlist.currentItem().text()
|
||||||
self.mainwindow.setChannelMode.emit(self.channel, "+v", currentHandle)
|
self.mainwindow.setChannelMode.emit(self.channel, "+v", currentHandle)
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def killQuirkUser(self):
|
def killQuirkUser(self):
|
||||||
if not self.userlist.currentItem():
|
if not self.userlist.currentItem():
|
||||||
return
|
return
|
||||||
currentHandle = str(self.userlist.currentItem().text())
|
currentHandle = self.userlist.currentItem().text()
|
||||||
self.mainwindow.killSomeQuirks.emit(self.channel, currentHandle)
|
self.mainwindow.killSomeQuirks.emit(self.channel, currentHandle)
|
||||||
|
|
||||||
def resetSlider(self, time, send=True):
|
def resetSlider(self, time, send=True):
|
||||||
|
@ -1964,7 +1953,6 @@ class PesterMemo(PesterConvo):
|
||||||
"Enter the chumhandle of the user you'd like to invite:",
|
"Enter the chumhandle of the user you'd like to invite:",
|
||||||
)
|
)
|
||||||
if ok:
|
if ok:
|
||||||
chum = str(chum)
|
|
||||||
self.mainwindow.inviteChum.emit(chum, self.channel)
|
self.mainwindow.inviteChum.emit(chum, self.channel)
|
||||||
self.invitechums = None
|
self.invitechums = None
|
||||||
|
|
||||||
|
@ -2040,7 +2028,7 @@ class PesterMemo(PesterConvo):
|
||||||
self.mainwindow.waitingMessages.messageAnswered(self.channel)
|
self.mainwindow.waitingMessages.messageAnswered(self.channel)
|
||||||
self.windowClosed.emit(self.title())
|
self.windowClosed.emit(self.title())
|
||||||
|
|
||||||
windowClosed = QtCore.pyqtSignal("QString")
|
windowClosed = QtCore.pyqtSignal(str)
|
||||||
|
|
||||||
|
|
||||||
timelist = [
|
timelist = [
|
||||||
|
|
83
menus.py
83
menus.py
|
@ -19,7 +19,6 @@ from version import _pcVersion
|
||||||
from convo import PesterInput, PesterText
|
from convo import PesterInput, PesterText
|
||||||
from parsetools import lexMessage
|
from parsetools import lexMessage
|
||||||
|
|
||||||
QString = str
|
|
||||||
_datadir = ostools.getDataDir()
|
_datadir = ostools.getDataDir()
|
||||||
# Logger
|
# Logger
|
||||||
PchumLog = logging.getLogger("pchumLogger")
|
PchumLog = logging.getLogger("pchumLogger")
|
||||||
|
@ -30,7 +29,7 @@ class PesterQuirkItem(QtWidgets.QTreeWidgetItem):
|
||||||
parent = None
|
parent = None
|
||||||
QtWidgets.QTreeWidgetItem.__init__(self, parent)
|
QtWidgets.QTreeWidgetItem.__init__(self, parent)
|
||||||
self.quirk = quirk
|
self.quirk = quirk
|
||||||
self.setText(0, str(quirk))
|
self.setText(0, str(quirk)) # Typecast required.
|
||||||
|
|
||||||
def update(self, quirk):
|
def update(self, quirk):
|
||||||
self.quirk = quirk
|
self.quirk = quirk
|
||||||
|
@ -236,7 +235,6 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
|
||||||
self, "Add Group", "Enter a name for the new quirk group:"
|
self, "Add Group", "Enter a name for the new quirk group:"
|
||||||
)
|
)
|
||||||
if ok:
|
if ok:
|
||||||
gname = str(gname)
|
|
||||||
if re.search(r"[^A-Za-z0-9_\s]", gname) is not None:
|
if re.search(r"[^A-Za-z0-9_\s]", gname) is not None:
|
||||||
msgbox = QtWidgets.QMessageBox()
|
msgbox = QtWidgets.QMessageBox()
|
||||||
msgbox.setInformativeText("THIS IS NOT A VALID GROUP NAME")
|
msgbox.setInformativeText("THIS IS NOT A VALID GROUP NAME")
|
||||||
|
@ -324,7 +322,7 @@ class QuirkTesterWindow(QtWidgets.QDialog):
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def sentMessage(self):
|
def sentMessage(self):
|
||||||
text = str(self.textInput.text())
|
text = self.textInput.text()
|
||||||
|
|
||||||
return parsetools.kxhandleInput(
|
return parsetools.kxhandleInput(
|
||||||
self,
|
self,
|
||||||
|
@ -597,8 +595,8 @@ class PesterQuirkTypes(QtWidgets.QDialog):
|
||||||
page.itemAt(3).layout().itemAt(0).widget().setCheckState(
|
page.itemAt(3).layout().itemAt(0).widget().setCheckState(
|
||||||
QtCore.Qt.CheckState(int(q["checkstate"]))
|
QtCore.Qt.CheckState(int(q["checkstate"]))
|
||||||
)
|
)
|
||||||
except (KeyError, ValueError) as e:
|
except (KeyError, ValueError):
|
||||||
print("KeyError: %s" % str(e))
|
PchumLog.exception("Exception setting replace quirk.")
|
||||||
elif q["type"] == "regexp":
|
elif q["type"] == "regexp":
|
||||||
page.itemAt(2).layout().itemAt(1).layout().itemAt(1).widget().setText(
|
page.itemAt(2).layout().itemAt(1).layout().itemAt(1).widget().setText(
|
||||||
q["from"]
|
q["from"]
|
||||||
|
@ -610,8 +608,8 @@ class PesterQuirkTypes(QtWidgets.QDialog):
|
||||||
page.itemAt(2).layout().itemAt(3).layout().itemAt(
|
page.itemAt(2).layout().itemAt(3).layout().itemAt(
|
||||||
0
|
0
|
||||||
).widget().setCheckState(QtCore.Qt.CheckState(int(q["checkstate"])))
|
).widget().setCheckState(QtCore.Qt.CheckState(int(q["checkstate"])))
|
||||||
except (KeyError, ValueError) as e:
|
except (KeyError, ValueError):
|
||||||
print("KeyError: %s" % str(e))
|
PchumLog.exception("Exception setting regexp quirk.")
|
||||||
elif q["type"] == "random":
|
elif q["type"] == "random":
|
||||||
self.regexp.setText(q["from"])
|
self.regexp.setText(q["from"])
|
||||||
for v in q["randomlist"]:
|
for v in q["randomlist"]:
|
||||||
|
@ -620,8 +618,8 @@ class PesterQuirkTypes(QtWidgets.QDialog):
|
||||||
page.itemAt(2).layout().itemAt(2).layout().itemAt(
|
page.itemAt(2).layout().itemAt(2).layout().itemAt(
|
||||||
0
|
0
|
||||||
).widget().setCheckState(QtCore.Qt.CheckState(int(q["checkstate"])))
|
).widget().setCheckState(QtCore.Qt.CheckState(int(q["checkstate"])))
|
||||||
except (KeyError, ValueError) as e:
|
except (KeyError, ValueError):
|
||||||
print("KeyError: %s" % str(e))
|
PchumLog.exception("Exception setting random quirk.")
|
||||||
elif q["type"] == "spelling":
|
elif q["type"] == "spelling":
|
||||||
self.slider.setValue(q["percentage"])
|
self.slider.setValue(q["percentage"])
|
||||||
try:
|
try:
|
||||||
|
@ -629,7 +627,7 @@ class PesterQuirkTypes(QtWidgets.QDialog):
|
||||||
QtCore.Qt.CheckState(int(q["checkstate"]))
|
QtCore.Qt.CheckState(int(q["checkstate"]))
|
||||||
)
|
)
|
||||||
except (KeyError, ValueError) as e:
|
except (KeyError, ValueError) as e:
|
||||||
print("KeyError: %s" % str(e))
|
PchumLog.exception("Exception setting spelling quirk.")
|
||||||
|
|
||||||
self.setLayout(layout_0)
|
self.setLayout(layout_0)
|
||||||
|
|
||||||
|
@ -668,11 +666,11 @@ class PesterQuirkTypes(QtWidgets.QDialog):
|
||||||
|
|
||||||
@QtCore.pyqtSlot(int)
|
@QtCore.pyqtSlot(int)
|
||||||
def printValue(self, value):
|
def printValue(self, value):
|
||||||
self.current.setText(str(value) + "%")
|
self.current.setText(f"{value}%")
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def addRandomString(self):
|
def addRandomString(self):
|
||||||
text = str(self.replaceinput.text())
|
text = self.replaceinput.text()
|
||||||
item = QtWidgets.QListWidgetItem(text, self.replacelist)
|
item = QtWidgets.QListWidgetItem(text, self.replacelist)
|
||||||
self.replaceinput.setText("")
|
self.replaceinput.setText("")
|
||||||
self.replaceinput.setFocus()
|
self.replaceinput.setFocus()
|
||||||
|
@ -816,10 +814,10 @@ class PesterChooseQuirks(QtWidgets.QDialog):
|
||||||
vdict["type"] = types[self.quirkadd.pages.currentIndex() - 1]
|
vdict["type"] = types[self.quirkadd.pages.currentIndex() - 1]
|
||||||
page = self.quirkadd.pages.currentWidget().layout()
|
page = self.quirkadd.pages.currentWidget().layout()
|
||||||
if vdict["type"] in ("prefix", "suffix"):
|
if vdict["type"] in ("prefix", "suffix"):
|
||||||
vdict["value"] = str(page.itemAt(1).layout().itemAt(1).widget().text())
|
vdict["value"] = page.itemAt(1).layout().itemAt(1).widget().text()
|
||||||
elif vdict["type"] == "replace":
|
elif vdict["type"] == "replace":
|
||||||
vdict["from"] = str(page.itemAt(1).layout().itemAt(1).widget().text())
|
vdict["from"] = page.itemAt(1).layout().itemAt(1).widget().text()
|
||||||
vdict["to"] = str(page.itemAt(2).layout().itemAt(1).widget().text())
|
vdict["to"] = page.itemAt(2).layout().itemAt(1).widget().text()
|
||||||
try:
|
try:
|
||||||
# PyQt6
|
# PyQt6
|
||||||
vdict["checkstate"] = str(
|
vdict["checkstate"] = str(
|
||||||
|
@ -831,10 +829,10 @@ class PesterChooseQuirks(QtWidgets.QDialog):
|
||||||
page.itemAt(3).layout().itemAt(0).widget().checkState()
|
page.itemAt(3).layout().itemAt(0).widget().checkState()
|
||||||
)
|
)
|
||||||
elif vdict["type"] == "regexp":
|
elif vdict["type"] == "regexp":
|
||||||
vdict["from"] = str(
|
vdict["from"] = (
|
||||||
page.itemAt(2).layout().itemAt(1).layout().itemAt(1).widget().text()
|
page.itemAt(2).layout().itemAt(1).layout().itemAt(1).widget().text()
|
||||||
)
|
)
|
||||||
vdict["to"] = str(
|
vdict["to"] = (
|
||||||
page.itemAt(2).layout().itemAt(2).layout().itemAt(1).widget().text()
|
page.itemAt(2).layout().itemAt(2).layout().itemAt(1).widget().text()
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
|
@ -1070,7 +1068,7 @@ class PesterChooseProfile(QtWidgets.QDialog):
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def validateProfile(self):
|
def validateProfile(self):
|
||||||
if not self.profileBox or self.profileBox.currentIndex() == 0:
|
if not self.profileBox or self.profileBox.currentIndex() == 0:
|
||||||
handle = str(self.chumHandle.text())
|
handle = self.chumHandle.text()
|
||||||
if not PesterProfile.checkLength(handle):
|
if not PesterProfile.checkLength(handle):
|
||||||
self.errorMsg.setText("PROFILE HANDLE IS TOO LONG")
|
self.errorMsg.setText("PROFILE HANDLE IS TOO LONG")
|
||||||
return
|
return
|
||||||
|
@ -1085,7 +1083,7 @@ class PesterChooseProfile(QtWidgets.QDialog):
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def deleteProfile(self):
|
def deleteProfile(self):
|
||||||
if self.profileBox and self.profileBox.currentIndex() > 0:
|
if self.profileBox and self.profileBox.currentIndex() > 0:
|
||||||
handle = str(self.profileBox.currentText())
|
handle = self.profileBox.currentText()
|
||||||
if handle == self.parent.profile().handle:
|
if handle == self.parent.profile().handle:
|
||||||
problem = QtWidgets.QMessageBox()
|
problem = QtWidgets.QMessageBox()
|
||||||
# karxi Will probably change this to its own name later.
|
# karxi Will probably change this to its own name later.
|
||||||
|
@ -1176,7 +1174,7 @@ class PesterMentions(QtWidgets.QDialog):
|
||||||
def addMention(self, mitem=None):
|
def addMention(self, mitem=None):
|
||||||
d = {"label": "Mention:", "inputname": "value"}
|
d = {"label": "Mention:", "inputname": "value"}
|
||||||
if mitem is not None:
|
if mitem is not None:
|
||||||
d["value"] = str(mitem.text())
|
d["value"] = mitem.text()
|
||||||
pdict = MultiTextDialog("ENTER MENTION", self, d).getText()
|
pdict = MultiTextDialog("ENTER MENTION", self, d).getText()
|
||||||
if pdict is None:
|
if pdict is None:
|
||||||
return
|
return
|
||||||
|
@ -1731,7 +1729,7 @@ class PesterOptions(QtWidgets.QDialog):
|
||||||
def addAutoJoin(self, mitem=None):
|
def addAutoJoin(self, mitem=None):
|
||||||
d = {"label": "Memo:", "inputname": "value"}
|
d = {"label": "Memo:", "inputname": "value"}
|
||||||
if mitem is not None:
|
if mitem is not None:
|
||||||
d["value"] = str(mitem.text())
|
d["value"] = mitem.text()
|
||||||
pdict = MultiTextDialog("ENTER MEMO", self, d).getText()
|
pdict = MultiTextDialog("ENTER MEMO", self, d).getText()
|
||||||
if pdict is None:
|
if pdict is None:
|
||||||
return
|
return
|
||||||
|
@ -1774,7 +1772,7 @@ class PesterOptions(QtWidgets.QDialog):
|
||||||
|
|
||||||
@QtCore.pyqtSlot(int)
|
@QtCore.pyqtSlot(int)
|
||||||
def printValue(self, v):
|
def printValue(self, v):
|
||||||
self.currentVol.setText(str(v) + "%")
|
self.currentVol.setText(f"{v}%")
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def openMentions(self):
|
def openMentions(self):
|
||||||
|
@ -1797,7 +1795,7 @@ class PesterOptions(QtWidgets.QDialog):
|
||||||
def updateMentions(self):
|
def updateMentions(self):
|
||||||
m = []
|
m = []
|
||||||
for i in range(self.mentionmenu.mentionlist.count()):
|
for i in range(self.mentionmenu.mentionlist.count()):
|
||||||
m.append(str(self.mentionmenu.mentionlist.item(i).text()))
|
m.append((self.mentionmenu.mentionlist.item(i).text()))
|
||||||
self.parent().userprofile.setMentions(m)
|
self.parent().userprofile.setMentions(m)
|
||||||
self.mentionmenu = None
|
self.mentionmenu = None
|
||||||
|
|
||||||
|
@ -1815,7 +1813,7 @@ class PesterUserlist(QtWidgets.QDialog):
|
||||||
self.searchbox = QtWidgets.QLineEdit(self)
|
self.searchbox = QtWidgets.QLineEdit(self)
|
||||||
# self.searchbox.setStyleSheet(theme["convo/input/style"]) # which style is better?
|
# self.searchbox.setStyleSheet(theme["convo/input/style"]) # which style is better?
|
||||||
self.searchbox.setPlaceholderText("Search")
|
self.searchbox.setPlaceholderText("Search")
|
||||||
self.searchbox.textChanged["QString"].connect(self.updateUsers)
|
self.searchbox.textChanged[str].connect(self.updateUsers)
|
||||||
|
|
||||||
self.label = QtWidgets.QLabel("USERLIST")
|
self.label = QtWidgets.QLabel("USERLIST")
|
||||||
self.userarea = RightClickList(self)
|
self.userarea = RightClickList(self)
|
||||||
|
@ -1847,9 +1845,7 @@ class PesterUserlist(QtWidgets.QDialog):
|
||||||
|
|
||||||
self.mainwindow.namesUpdated.connect(self.updateUsers)
|
self.mainwindow.namesUpdated.connect(self.updateUsers)
|
||||||
|
|
||||||
self.mainwindow.userPresentSignal["QString", "QString", "QString"].connect(
|
self.mainwindow.userPresentSignal[str, str, str].connect(self.updateUserPresent)
|
||||||
self.updateUserPresent
|
|
||||||
)
|
|
||||||
self.updateUsers()
|
self.updateUsers()
|
||||||
|
|
||||||
self.searchbox.setFocus()
|
self.searchbox.setFocus()
|
||||||
|
@ -1863,10 +1859,9 @@ class PesterUserlist(QtWidgets.QDialog):
|
||||||
return
|
return
|
||||||
self.userarea.clear()
|
self.userarea.clear()
|
||||||
for n in names:
|
for n in names:
|
||||||
if (
|
if (self.searchbox.text()) == "" or n.lower().find(
|
||||||
str(self.searchbox.text()) == ""
|
self.searchbox.text().lower()
|
||||||
or n.lower().find(str(self.searchbox.text()).lower()) != -1
|
) != -1:
|
||||||
):
|
|
||||||
# Strip channel membership prefixes
|
# Strip channel membership prefixes
|
||||||
n = n.strip("~").strip("@").strip("+").strip("&").strip("%")
|
n = n.strip("~").strip("@").strip("+").strip("&").strip("%")
|
||||||
item = QtWidgets.QListWidgetItem(n)
|
item = QtWidgets.QListWidgetItem(n)
|
||||||
|
@ -1876,20 +1871,18 @@ class PesterUserlist(QtWidgets.QDialog):
|
||||||
self.userarea.addItem(item)
|
self.userarea.addItem(item)
|
||||||
self.userarea.sortItems()
|
self.userarea.sortItems()
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString, QString)
|
@QtCore.pyqtSlot(str, str, str)
|
||||||
def updateUserPresent(self, handle, channel, update):
|
def updateUserPresent(self, handle, channel, update):
|
||||||
h = str(handle)
|
|
||||||
c = str(channel)
|
|
||||||
if update == "quit":
|
if update == "quit":
|
||||||
self.delUser(h)
|
self.delUser(handle)
|
||||||
elif update == "left" and c == "#pesterchum":
|
elif update == "left" and channel == "#pesterchum":
|
||||||
self.delUser(h)
|
self.delUser(handle)
|
||||||
elif update == "join" and c == "#pesterchum":
|
elif update == "join" and channel == "#pesterchum":
|
||||||
if (
|
if (
|
||||||
str(self.searchbox.text()) == ""
|
self.searchbox.text() == ""
|
||||||
or h.lower().find(str(self.searchbox.text()).lower()) != -1
|
or handle.lower().find(self.searchbox.text().lower()) != -1
|
||||||
):
|
):
|
||||||
self.addUser(h)
|
self.addUser(handle)
|
||||||
|
|
||||||
def addUser(self, name):
|
def addUser(self, name):
|
||||||
item = QtWidgets.QListWidgetItem(name)
|
item = QtWidgets.QListWidgetItem(name)
|
||||||
|
@ -1928,8 +1921,8 @@ class PesterUserlist(QtWidgets.QDialog):
|
||||||
return
|
return
|
||||||
self.pesterChum.emit(cur.text())
|
self.pesterChum.emit(cur.text())
|
||||||
|
|
||||||
addChum = QtCore.pyqtSignal("QString")
|
addChum = QtCore.pyqtSignal(str)
|
||||||
pesterChum = QtCore.pyqtSignal("QString")
|
pesterChum = QtCore.pyqtSignal(str)
|
||||||
|
|
||||||
|
|
||||||
class MemoListItem(QtWidgets.QTreeWidgetItem):
|
class MemoListItem(QtWidgets.QTreeWidgetItem):
|
||||||
|
@ -1939,7 +1932,7 @@ class MemoListItem(QtWidgets.QTreeWidgetItem):
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
column = self.treeWidget().sortColumn()
|
column = self.treeWidget().sortColumn()
|
||||||
if str(self.text(column)).isdigit() and str(other.text(column)).isdigit():
|
if (self.text(column)).isdigit() and (other.text(column)).isdigit():
|
||||||
return int(self.text(column)) < int(other.text(column))
|
return int(self.text(column)) < int(other.text(column))
|
||||||
return self.text(column) < other.text(column)
|
return self.text(column) < other.text(column)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ PchumLog = logging.getLogger("pchumLogger")
|
||||||
|
|
||||||
# I'll clean up the things that are no longer needed once the transition is
|
# I'll clean up the things that are no longer needed once the transition is
|
||||||
# actually finished.
|
# actually finished.
|
||||||
QString = str
|
|
||||||
|
|
||||||
_ctag_begin = re.compile(r"(?i)<c=(.*?)>")
|
_ctag_begin = re.compile(r"(?i)<c=(.*?)>")
|
||||||
# _gtag_begin = re.compile(r"(?i)<g[a-f]>")
|
# _gtag_begin = re.compile(r"(?i)<g[a-f]>")
|
||||||
|
@ -67,7 +66,7 @@ def lexer(string, objlist):
|
||||||
for oType, regexp in objlist:
|
for oType, regexp in objlist:
|
||||||
newstringlist = []
|
newstringlist = []
|
||||||
for stri, s in enumerate(stringlist):
|
for stri, s in enumerate(stringlist):
|
||||||
if type(s) not in [str, str]:
|
if not isinstance(s, str):
|
||||||
newstringlist.append(s)
|
newstringlist.append(s)
|
||||||
continue
|
continue
|
||||||
lasti = 0
|
lasti = 0
|
||||||
|
@ -269,9 +268,8 @@ class mecmd(lexercon.Chunk):
|
||||||
kxpclexer = lexercon.Pesterchum()
|
kxpclexer = lexercon.Pesterchum()
|
||||||
|
|
||||||
|
|
||||||
def kxlexMsg(string):
|
def kxlexMsg(msg: str):
|
||||||
# Do a bit of sanitization.
|
"""Do a bit of sanitization."""
|
||||||
msg = str(string)
|
|
||||||
# TODO: Let people paste line-by-line normally. Maybe have a mass-paste
|
# TODO: Let people paste line-by-line normally. Maybe have a mass-paste
|
||||||
# right-click option?
|
# right-click option?
|
||||||
msg = msg.replace("\n", " ").replace("\r", " ")
|
msg = msg.replace("\n", " ").replace("\r", " ")
|
||||||
|
@ -328,7 +326,7 @@ def balance(lexed):
|
||||||
balanced.append(colorEnd("</c>"))
|
balanced.append(colorEnd("</c>"))
|
||||||
if len(balanced) == 0:
|
if len(balanced) == 0:
|
||||||
balanced.append("")
|
balanced.append("")
|
||||||
if type(balanced[len(balanced) - 1]) not in [str, str]:
|
if not isinstance(balanced[len(balanced) - 1], str):
|
||||||
balanced.append("")
|
balanced.append("")
|
||||||
return balanced
|
return balanced
|
||||||
|
|
||||||
|
@ -337,12 +335,12 @@ def convertTags(lexed, format="html"):
|
||||||
if format not in ["html", "bbcode", "ctag", "text"]:
|
if format not in ["html", "bbcode", "ctag", "text"]:
|
||||||
raise ValueError("Color format not recognized")
|
raise ValueError("Color format not recognized")
|
||||||
|
|
||||||
if type(lexed) in [str, str]:
|
if isinstance(lexed, str):
|
||||||
lexed = lexMessage(lexed)
|
lexed = lexMessage(lexed)
|
||||||
escaped = ""
|
escaped = ""
|
||||||
# firststr = True
|
# firststr = True
|
||||||
for i, o in enumerate(lexed):
|
for i, o in enumerate(lexed):
|
||||||
if type(o) in [str, str]:
|
if isinstance(o, str):
|
||||||
if format == "html":
|
if format == "html":
|
||||||
escaped += (
|
escaped += (
|
||||||
o.replace("&", "&").replace(">", ">").replace("<", "<")
|
o.replace("&", "&").replace(">", ">").replace("<", "<")
|
||||||
|
@ -371,7 +369,7 @@ def _max_msg_len(mask=None, target=None, nick=None, ident=None):
|
||||||
|
|
||||||
if mask is not None:
|
if mask is not None:
|
||||||
# Since this will be included in what we send
|
# Since this will be included in what we send
|
||||||
limit -= len(str(mask))
|
limit -= len(mask)
|
||||||
else:
|
else:
|
||||||
# Since we should always be able to fetch this
|
# Since we should always be able to fetch this
|
||||||
# karxi: ... Which we can't, right now, unlike in the old script.
|
# karxi: ... Which we can't, right now, unlike in the old script.
|
||||||
|
@ -829,7 +827,7 @@ def kxhandleInput(ctx, text=None, flavor=None, irc_compatible=False):
|
||||||
# if ceased, rebegin
|
# if ceased, rebegin
|
||||||
if hasattr(ctx, "chumopen") and not ctx.chumopen:
|
if hasattr(ctx, "chumopen") and not ctx.chumopen:
|
||||||
if not irc_compatible:
|
if not irc_compatible:
|
||||||
ctx.mainwindow.newConvoStarted.emit(QString(ctx.title()), True)
|
ctx.mainwindow.newConvoStarted.emit(str(ctx.title()), True)
|
||||||
ctx.setChumOpen(True)
|
ctx.setChumOpen(True)
|
||||||
|
|
||||||
# Post-process and send the messages.
|
# Post-process and send the messages.
|
||||||
|
@ -997,9 +995,7 @@ def parseRegexpFunctions(to):
|
||||||
return parsed
|
return parsed
|
||||||
|
|
||||||
|
|
||||||
def img2smiley(string):
|
def img2smiley(string: str):
|
||||||
string = str(string)
|
|
||||||
|
|
||||||
def imagerep(mo):
|
def imagerep(mo):
|
||||||
return reverse_smiley[mo.group(1)]
|
return reverse_smiley[mo.group(1)]
|
||||||
|
|
||||||
|
|
302
pesterchum.py
302
pesterchum.py
|
@ -163,8 +163,6 @@ BOTNAMES.extend(SERVICES)
|
||||||
_CONSOLE = False
|
_CONSOLE = False
|
||||||
_CONSOLE_ENV = {}
|
_CONSOLE_ENV = {}
|
||||||
_CONSOLE_ENV["PAPP"] = None
|
_CONSOLE_ENV["PAPP"] = None
|
||||||
# Python 3
|
|
||||||
QString = str
|
|
||||||
# Command line arguments
|
# Command line arguments
|
||||||
_ARGUMENTS = parser.parse_args()
|
_ARGUMENTS = parser.parse_args()
|
||||||
|
|
||||||
|
@ -485,7 +483,7 @@ class chumArea(RightClickTree):
|
||||||
def getOptionsMenu(self):
|
def getOptionsMenu(self):
|
||||||
if not self.currentItem():
|
if not self.currentItem():
|
||||||
return None
|
return None
|
||||||
text = str(self.currentItem().text(0))
|
text = self.currentItem().text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
if text == "Chums":
|
if text == "Chums":
|
||||||
|
@ -537,11 +535,11 @@ class chumArea(RightClickTree):
|
||||||
else:
|
else:
|
||||||
event.ignore()
|
event.ignore()
|
||||||
return
|
return
|
||||||
thisitem = str(event.source().currentItem().text(0))
|
thisitem = event.source().currentItem().text(0)
|
||||||
if thisitem.rfind(" (") != -1:
|
if thisitem.rfind(" (") != -1:
|
||||||
thisitem = thisitem[0 : thisitem.rfind(" (")]
|
thisitem = thisitem[0 : thisitem.rfind(" (")]
|
||||||
# Drop item is a group
|
# Drop item is a group
|
||||||
thisitem = str(event.source().currentItem().text(0))
|
thisitem = event.source().currentItem().text(0)
|
||||||
if thisitem.rfind(" (") != -1:
|
if thisitem.rfind(" (") != -1:
|
||||||
thisitem = thisitem[0 : thisitem.rfind(" (")]
|
thisitem = thisitem[0 : thisitem.rfind(" (")]
|
||||||
if thisitem == "Chums" or thisitem in self.groups:
|
if thisitem == "Chums" or thisitem in self.groups:
|
||||||
|
@ -553,7 +551,7 @@ class chumArea(RightClickTree):
|
||||||
droppos = self.itemAt(event.pos())
|
droppos = self.itemAt(event.pos())
|
||||||
if not droppos:
|
if not droppos:
|
||||||
return
|
return
|
||||||
droppos = str(droppos.text(0))
|
droppos = droppos.text(0)
|
||||||
if droppos.rfind(" ") != -1:
|
if droppos.rfind(" ") != -1:
|
||||||
droppos = droppos[0 : droppos.rfind(" ")]
|
droppos = droppos[0 : droppos.rfind(" ")]
|
||||||
if droppos == "Chums" or droppos in self.groups:
|
if droppos == "Chums" or droppos in self.groups:
|
||||||
|
@ -575,10 +573,10 @@ class chumArea(RightClickTree):
|
||||||
|
|
||||||
gTemp = []
|
gTemp = []
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
text = str(self.topLevelItem(i).text(0))
|
text = self.topLevelItem(i).text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
gTemp.append([str(text), self.topLevelItem(i).isExpanded()])
|
gTemp.append([text, self.topLevelItem(i).isExpanded()])
|
||||||
self.mainwindow.config.saveGroups(gTemp)
|
self.mainwindow.config.saveGroups(gTemp)
|
||||||
# Drop item is a chum
|
# Drop item is a chum
|
||||||
else:
|
else:
|
||||||
|
@ -590,7 +588,7 @@ class chumArea(RightClickTree):
|
||||||
eventpos = event.pos()
|
eventpos = event.pos()
|
||||||
item = self.itemAt(eventpos)
|
item = self.itemAt(eventpos)
|
||||||
if item:
|
if item:
|
||||||
text = str(item.text(0))
|
text = item.text(0)
|
||||||
# Figure out which group to drop into
|
# Figure out which group to drop into
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
|
@ -598,7 +596,7 @@ class chumArea(RightClickTree):
|
||||||
group = text
|
group = text
|
||||||
gitem = item
|
gitem = item
|
||||||
else:
|
else:
|
||||||
ptext = str(item.parent().text(0))
|
ptext = item.parent().text(0)
|
||||||
if ptext.rfind(" ") != -1:
|
if ptext.rfind(" ") != -1:
|
||||||
ptext = ptext[0 : ptext.rfind(" ")]
|
ptext = ptext[0 : ptext.rfind(" ")]
|
||||||
group = ptext
|
group = ptext
|
||||||
|
@ -617,11 +615,11 @@ class chumArea(RightClickTree):
|
||||||
chums = self.mainwindow.config.chums()
|
chums = self.mainwindow.config.chums()
|
||||||
if item == gitem:
|
if item == gitem:
|
||||||
item = gitem.child(0)
|
item = gitem.child(0)
|
||||||
inPos = chums.index(str(item.text(0)))
|
inPos = chums.index(item.text(0))
|
||||||
if chums.index(thisitem) < inPos:
|
if chums.index(thisitem) < inPos:
|
||||||
inPos -= 1
|
inPos -= 1
|
||||||
chums.remove(thisitem)
|
chums.remove(thisitem)
|
||||||
chums.insert(inPos, str(thisitem))
|
chums.insert(inPos, thisitem)
|
||||||
|
|
||||||
self.mainwindow.config.setChums(chums)
|
self.mainwindow.config.setChums(chums)
|
||||||
else:
|
else:
|
||||||
|
@ -633,9 +631,9 @@ class chumArea(RightClickTree):
|
||||||
currentGroup = self.currentItem()
|
currentGroup = self.currentItem()
|
||||||
if currentGroup:
|
if currentGroup:
|
||||||
if currentGroup.parent():
|
if currentGroup.parent():
|
||||||
text = str(currentGroup.parent().text(0))
|
text = currentGroup.parent().text(0)
|
||||||
else:
|
else:
|
||||||
text = str(currentGroup.text(0))
|
text = currentGroup.text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
currentGroup = text
|
currentGroup = text
|
||||||
|
@ -703,7 +701,7 @@ class chumArea(RightClickTree):
|
||||||
return
|
return
|
||||||
curgroups = []
|
curgroups = []
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
text = str(self.topLevelItem(i).text(0))
|
text = self.topLevelItem(i).text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
curgroups.append(text)
|
curgroups.append(text)
|
||||||
|
@ -728,24 +726,24 @@ class chumArea(RightClickTree):
|
||||||
totals = {"Chums": 0}
|
totals = {"Chums": 0}
|
||||||
online = {"Chums": 0}
|
online = {"Chums": 0}
|
||||||
for g in self.groups:
|
for g in self.groups:
|
||||||
totals[str(g)] = 0
|
totals[g] = 0
|
||||||
online[str(g)] = 0
|
online[g] = 0
|
||||||
for c in self.chums:
|
for c in self.chums:
|
||||||
yes = c.mood.name() != "offline"
|
yes = c.mood.name() != "offline"
|
||||||
if c.group == "Chums":
|
if c.group == "Chums":
|
||||||
totals[str(c.group)] = totals[str(c.group)] + 1
|
totals[c.group] = totals[c.group] + 1
|
||||||
if yes:
|
if yes:
|
||||||
online[str(c.group)] = online[str(c.group)] + 1
|
online[c.group] = online[c.group] + 1
|
||||||
elif c.group in totals:
|
elif c.group in totals:
|
||||||
totals[str(c.group)] = totals[str(c.group)] + 1
|
totals[c.group] = totals[c.group] + 1
|
||||||
if yes:
|
if yes:
|
||||||
online[str(c.group)] = online[str(c.group)] + 1
|
online[c.group] = online[c.group] + 1
|
||||||
else:
|
else:
|
||||||
totals["Chums"] = totals["Chums"] + 1
|
totals["Chums"] = totals["Chums"] + 1
|
||||||
if yes:
|
if yes:
|
||||||
online["Chums"] = online["Chums"] + 1
|
online["Chums"] = online["Chums"] + 1
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
text = str(self.topLevelItem(i).text(0))
|
text = self.topLevelItem(i).text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
if text in online:
|
if text in online:
|
||||||
|
@ -755,7 +753,7 @@ class chumArea(RightClickTree):
|
||||||
|
|
||||||
def hideOnlineNumbers(self):
|
def hideOnlineNumbers(self):
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
text = str(self.topLevelItem(i).text(0))
|
text = self.topLevelItem(i).text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
self.topLevelItem(i).setText(0, "%s" % (text))
|
self.topLevelItem(i).setText(0, "%s" % (text))
|
||||||
|
@ -773,7 +771,7 @@ class chumArea(RightClickTree):
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def expandGroup(self):
|
def expandGroup(self):
|
||||||
item = self.currentItem()
|
item = self.currentItem()
|
||||||
text = str(item.text(0))
|
text = item.text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
|
|
||||||
|
@ -789,7 +787,7 @@ class chumArea(RightClickTree):
|
||||||
self.mainwindow.config.addGroup("Chums")
|
self.mainwindow.config.addGroup("Chums")
|
||||||
curgroups = []
|
curgroups = []
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
text = str(self.topLevelItem(i).text(0))
|
text = self.topLevelItem(i).text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
curgroups.append(text)
|
curgroups.append(text)
|
||||||
|
@ -812,7 +810,7 @@ class chumArea(RightClickTree):
|
||||||
]:
|
]:
|
||||||
child_1.setExpanded(True)
|
child_1.setExpanded(True)
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
text = str(self.topLevelItem(i).text(0))
|
text = self.topLevelItem(i).text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
if text == chumLabel.chum.group:
|
if text == chumLabel.chum.group:
|
||||||
|
@ -832,7 +830,7 @@ class chumArea(RightClickTree):
|
||||||
if fi > 0:
|
if fi > 0:
|
||||||
while not bestj:
|
while not bestj:
|
||||||
for j in range(self.topLevelItem(i).childCount()):
|
for j in range(self.topLevelItem(i).childCount()):
|
||||||
if chums[fi - c] == str(
|
if chums[fi - c] == (
|
||||||
self.topLevelItem(i).child(j).text(0)
|
self.topLevelItem(i).child(j).text(0)
|
||||||
):
|
):
|
||||||
bestj = j
|
bestj = j
|
||||||
|
@ -1065,7 +1063,6 @@ class chumArea(RightClickTree):
|
||||||
self, "Notes", "Enter your notes..."
|
self, "Notes", "Enter your notes..."
|
||||||
)
|
)
|
||||||
if ok:
|
if ok:
|
||||||
notes = str(notes)
|
|
||||||
self.mainwindow.chumdb.setNotes(currentChum.handle, notes)
|
self.mainwindow.chumdb.setNotes(currentChum.handle, notes)
|
||||||
currentChum.setToolTip(0, "{}: {}".format(currentChum.handle, notes))
|
currentChum.setToolTip(0, "{}: {}".format(currentChum.handle, notes))
|
||||||
|
|
||||||
|
@ -1078,7 +1075,6 @@ class chumArea(RightClickTree):
|
||||||
self, "Rename Group", "Enter a new name for the group:"
|
self, "Rename Group", "Enter a new name for the group:"
|
||||||
)
|
)
|
||||||
if ok:
|
if ok:
|
||||||
gname = str(gname)
|
|
||||||
if re.search(r"[^A-Za-z0-9_\s]", gname) is not None:
|
if re.search(r"[^A-Za-z0-9_\s]", gname) is not None:
|
||||||
msgbox = QtWidgets.QMessageBox()
|
msgbox = QtWidgets.QMessageBox()
|
||||||
msgbox.setStyleSheet(
|
msgbox.setStyleSheet(
|
||||||
|
@ -1096,7 +1092,7 @@ class chumArea(RightClickTree):
|
||||||
index = self.indexOfTopLevelItem(currentGroup)
|
index = self.indexOfTopLevelItem(currentGroup)
|
||||||
if index != -1:
|
if index != -1:
|
||||||
expanded = currentGroup.isExpanded()
|
expanded = currentGroup.isExpanded()
|
||||||
text = str(currentGroup.text(0))
|
text = currentGroup.text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
self.mainwindow.config.delGroup(text)
|
self.mainwindow.config.delGroup(text)
|
||||||
|
@ -1119,7 +1115,7 @@ class chumArea(RightClickTree):
|
||||||
currentGroup = self.currentItem()
|
currentGroup = self.currentItem()
|
||||||
if not currentGroup:
|
if not currentGroup:
|
||||||
return
|
return
|
||||||
text = str(currentGroup.text(0))
|
text = currentGroup.text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
self.mainwindow.config.delGroup(text)
|
self.mainwindow.config.delGroup(text)
|
||||||
|
@ -1143,7 +1139,7 @@ class chumArea(RightClickTree):
|
||||||
def moveToGroup(self, item):
|
def moveToGroup(self, item):
|
||||||
if not item:
|
if not item:
|
||||||
return
|
return
|
||||||
group = str(item.text())
|
group = item.text()
|
||||||
chumLabel = self.currentItem()
|
chumLabel = self.currentItem()
|
||||||
if not chumLabel:
|
if not chumLabel:
|
||||||
return
|
return
|
||||||
|
@ -1152,8 +1148,8 @@ class chumArea(RightClickTree):
|
||||||
self.takeItem(chumLabel)
|
self.takeItem(chumLabel)
|
||||||
self.addItem(chumLabel)
|
self.addItem(chumLabel)
|
||||||
|
|
||||||
removeChumSignal = QtCore.pyqtSignal("QString")
|
removeChumSignal = QtCore.pyqtSignal(str)
|
||||||
blockChumSignal = QtCore.pyqtSignal("QString")
|
blockChumSignal = QtCore.pyqtSignal(str)
|
||||||
|
|
||||||
|
|
||||||
class trollSlum(chumArea):
|
class trollSlum(chumArea):
|
||||||
|
@ -1211,7 +1207,7 @@ class trollSlum(chumArea):
|
||||||
# TypeError: connect() failed between triggered(bool) and unblockChumSignal()
|
# TypeError: connect() failed between triggered(bool) and unblockChumSignal()
|
||||||
# I'm not sure why this was here in the first place-
|
# I'm not sure why this was here in the first place-
|
||||||
# Does removing it break anything else...?
|
# Does removing it break anything else...?
|
||||||
# unblockChumSignal = QtCore.pyqtSignal('QString')
|
# unblockChumSignal = QtCore.pyqtSignal(str)
|
||||||
|
|
||||||
|
|
||||||
class TrollSlumWindow(QtWidgets.QFrame):
|
class TrollSlumWindow(QtWidgets.QFrame):
|
||||||
|
@ -1282,7 +1278,6 @@ class TrollSlumWindow(QtWidgets.QFrame):
|
||||||
self, "Add Troll", "Enter Troll Handle:"
|
self, "Add Troll", "Enter Troll Handle:"
|
||||||
)
|
)
|
||||||
if ok:
|
if ok:
|
||||||
handle = str(handle)
|
|
||||||
if not (
|
if not (
|
||||||
PesterProfile.checkLength(handle)
|
PesterProfile.checkLength(handle)
|
||||||
and PesterProfile.checkValid(handle)[0]
|
and PesterProfile.checkValid(handle)[0]
|
||||||
|
@ -1295,13 +1290,13 @@ class TrollSlumWindow(QtWidgets.QFrame):
|
||||||
self.blockChumSignal.emit(handle)
|
self.blockChumSignal.emit(handle)
|
||||||
self.addtrolldialog = None
|
self.addtrolldialog = None
|
||||||
|
|
||||||
blockChumSignal = QtCore.pyqtSignal("QString")
|
blockChumSignal = QtCore.pyqtSignal(str)
|
||||||
unblockChumSignal = QtCore.pyqtSignal("QString")
|
unblockChumSignal = QtCore.pyqtSignal(str)
|
||||||
|
|
||||||
|
|
||||||
class PesterWindow(MovingWindow):
|
class PesterWindow(MovingWindow):
|
||||||
disconnectIRC = QtCore.pyqtSignal()
|
disconnectIRC = QtCore.pyqtSignal()
|
||||||
sendMessage = QtCore.pyqtSignal("QString", "QString")
|
sendMessage = QtCore.pyqtSignal(str, str)
|
||||||
|
|
||||||
def __init__(self, options, parent=None, app=None):
|
def __init__(self, options, parent=None, app=None):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
|
@ -1596,8 +1591,8 @@ class PesterWindow(MovingWindow):
|
||||||
self.chumList.itemActivated[QtWidgets.QTreeWidgetItem, int].connect(
|
self.chumList.itemActivated[QtWidgets.QTreeWidgetItem, int].connect(
|
||||||
self.pesterSelectedChum
|
self.pesterSelectedChum
|
||||||
)
|
)
|
||||||
self.chumList.removeChumSignal["QString"].connect(self.removeChum)
|
self.chumList.removeChumSignal[str].connect(self.removeChum)
|
||||||
self.chumList.blockChumSignal["QString"].connect(self.blockChum)
|
self.chumList.blockChumSignal[str].connect(self.blockChum)
|
||||||
|
|
||||||
self.addChumButton = QtWidgets.QPushButton(
|
self.addChumButton = QtWidgets.QPushButton(
|
||||||
self.theme["main/addchum/text"], self
|
self.theme["main/addchum/text"], self
|
||||||
|
@ -1662,7 +1657,7 @@ class PesterWindow(MovingWindow):
|
||||||
# if not ostools.isOSXLeopard():
|
# if not ostools.isOSXLeopard():
|
||||||
# QtCore.QTimer.singleShot(1000, self.mspacheck)
|
# QtCore.QTimer.singleShot(1000, self.mspacheck)
|
||||||
|
|
||||||
self.pcUpdate["QString", "QString"].connect(self.updateMsg)
|
self.pcUpdate[str, str].connect(self.updateMsg)
|
||||||
|
|
||||||
self.mychumhandleLabel.adjustSize() # Required so "CHUMHANDLE:" regardless of style-sheet.
|
self.mychumhandleLabel.adjustSize() # Required so "CHUMHANDLE:" regardless of style-sheet.
|
||||||
self.moodsLabel.adjustSize() # Required so "MOOD:" regardless of style-sheet.
|
self.moodsLabel.adjustSize() # Required so "MOOD:" regardless of style-sheet.
|
||||||
|
@ -1707,7 +1702,7 @@ class PesterWindow(MovingWindow):
|
||||||
# We probably tried to interact with a call not available on this kernel.
|
# We probably tried to interact with a call not available on this kernel.
|
||||||
PchumLog.exception("")
|
PchumLog.exception("")
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def updateMsg(self, ver, url):
|
def updateMsg(self, ver, url):
|
||||||
if not hasattr(self, "updatemenu"):
|
if not hasattr(self, "updatemenu"):
|
||||||
self.updatemenu = None
|
self.updatemenu = None
|
||||||
|
@ -2027,18 +2022,19 @@ class PesterWindow(MovingWindow):
|
||||||
self.tabconvo.show()
|
self.tabconvo.show()
|
||||||
else:
|
else:
|
||||||
convoWindow = PesterConvo(chum, initiated, self)
|
convoWindow = PesterConvo(chum, initiated, self)
|
||||||
convoWindow.messageSent["QString", "QString"].connect(
|
convoWindow.messageSent[str, str].connect(self.sendMessage[str, str])
|
||||||
self.sendMessage["QString", "QString"]
|
convoWindow.windowClosed[str].connect(self.closeConvo)
|
||||||
)
|
|
||||||
convoWindow.windowClosed["QString"].connect(self.closeConvo)
|
|
||||||
self.convos[chum.handle] = convoWindow
|
self.convos[chum.handle] = convoWindow
|
||||||
if chum.handle.upper() in BOTNAMES or self.config.irc_compatibility_mode():
|
if chum.handle.upper() in BOTNAMES:
|
||||||
convoWindow.toggleQuirks(True)
|
convoWindow.toggleQuirks(True)
|
||||||
convoWindow.quirksOff.setChecked(True)
|
convoWindow.quirksOff.setChecked(True)
|
||||||
if str(chum.handle).upper() in CUSTOMBOTS:
|
if (
|
||||||
self.newConvoStarted.emit(QString(chum.handle), initiated)
|
not self.config.irc_compatibility_mode()
|
||||||
|
or chum.handle.upper() in CUSTOMBOTS
|
||||||
|
):
|
||||||
|
self.newConvoStarted.emit(chum.handle, initiated)
|
||||||
else:
|
else:
|
||||||
self.newConvoStarted.emit(QString(chum.handle), initiated)
|
self.newConvoStarted.emit(chum.handle, initiated)
|
||||||
convoWindow.show()
|
convoWindow.show()
|
||||||
|
|
||||||
def createTabWindow(self):
|
def createTabWindow(self):
|
||||||
|
@ -2134,17 +2130,13 @@ class PesterWindow(MovingWindow):
|
||||||
else:
|
else:
|
||||||
memoWindow = PesterMemo(channel, timestr, self, None)
|
memoWindow = PesterMemo(channel, timestr, self, None)
|
||||||
# connect signals
|
# connect signals
|
||||||
self.inviteOnlyChan["QString"].connect(memoWindow.closeInviteOnly)
|
self.inviteOnlyChan[str].connect(memoWindow.closeInviteOnly)
|
||||||
self.forbiddenChan["QString", "QString"].connect(memoWindow.closeForbidden)
|
self.forbiddenChan[str, str].connect(memoWindow.closeForbidden)
|
||||||
memoWindow.messageSent["QString", "QString"].connect(
|
memoWindow.messageSent[str, str].connect(self.sendMessage[str, str])
|
||||||
self.sendMessage["QString", "QString"]
|
memoWindow.windowClosed[str].connect(self.closeMemo)
|
||||||
)
|
self.namesUpdated[str].connect(memoWindow.namesUpdated)
|
||||||
memoWindow.windowClosed["QString"].connect(self.closeMemo)
|
self.modesUpdated[str, str].connect(memoWindow.modesUpdated)
|
||||||
self.namesUpdated["QString"].connect(memoWindow.namesUpdated)
|
self.userPresentSignal[str, str, str].connect(memoWindow.userPresentChange)
|
||||||
self.modesUpdated["QString", "QString"].connect(memoWindow.modesUpdated)
|
|
||||||
self.userPresentSignal["QString", "QString", "QString"].connect(
|
|
||||||
memoWindow.userPresentChange
|
|
||||||
)
|
|
||||||
# chat client send memo open
|
# chat client send memo open
|
||||||
self.memos[channel] = memoWindow
|
self.memos[channel] = memoWindow
|
||||||
self.joinChannel.emit(channel) # race condition?
|
self.joinChannel.emit(channel) # race condition?
|
||||||
|
@ -2593,7 +2585,7 @@ class PesterWindow(MovingWindow):
|
||||||
def pesterSelectedChum(self):
|
def pesterSelectedChum(self):
|
||||||
curChum = self.chumList.currentItem()
|
curChum = self.chumList.currentItem()
|
||||||
if curChum:
|
if curChum:
|
||||||
text = str(curChum.text(0))
|
text = curChum.text(0)
|
||||||
if text.rfind(" (") != -1:
|
if text.rfind(" (") != -1:
|
||||||
text = text[0 : text.rfind(" (")]
|
text = text[0 : text.rfind(" (")]
|
||||||
if text not in self.chumList.groups and text != "Chums":
|
if text not in self.chumList.groups and text != "Chums":
|
||||||
|
@ -2608,9 +2600,9 @@ class PesterWindow(MovingWindow):
|
||||||
chum.color = color
|
chum.color = color
|
||||||
self.newConversation(chum)
|
self.newConversation(chum)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def closeConvo(self, handle):
|
def closeConvo(self, handle):
|
||||||
h = str(handle)
|
h = handle
|
||||||
try:
|
try:
|
||||||
chum = self.convos[h].chum
|
chum = self.convos[h].chum
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -2633,9 +2625,9 @@ class PesterWindow(MovingWindow):
|
||||||
self.chatlog.finish(h)
|
self.chatlog.finish(h)
|
||||||
del self.convos[h]
|
del self.convos[h]
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def closeMemo(self, channel):
|
def closeMemo(self, channel):
|
||||||
c = str(channel)
|
c = channel
|
||||||
self.chatlog.finish(c)
|
self.chatlog.finish(c)
|
||||||
self.leftChannel.emit(channel)
|
self.leftChannel.emit(channel)
|
||||||
try:
|
try:
|
||||||
|
@ -2656,31 +2648,30 @@ class PesterWindow(MovingWindow):
|
||||||
del self.tabmemo
|
del self.tabmemo
|
||||||
self.tabmemo = None
|
self.tabmemo = None
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, Mood)
|
@QtCore.pyqtSlot(str, Mood)
|
||||||
def updateMoodSlot(self, handle, mood):
|
def updateMoodSlot(self, handle, mood):
|
||||||
h = str(handle)
|
h = handle
|
||||||
self.updateMood(h, mood)
|
self.updateMood(h, mood)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QtGui.QColor)
|
@QtCore.pyqtSlot(str, QtGui.QColor)
|
||||||
def updateColorSlot(self, handle, color):
|
def updateColorSlot(self, handle, color):
|
||||||
PchumLog.debug("updateColorSlot(%s, %s)", handle, color)
|
PchumLog.debug("updateColorSlot(%s, %s)", handle, color)
|
||||||
self.changeColor(handle, color)
|
self.changeColor(handle, color)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def deliverMessage(self, handle, msg):
|
def deliverMessage(self, handle, msg):
|
||||||
h = str(handle)
|
h = handle
|
||||||
m = str(msg)
|
m = msg
|
||||||
self.newMessage(h, m)
|
self.newMessage(h, m)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString, QString)
|
@QtCore.pyqtSlot(str, str, str)
|
||||||
def deliverMemo(self, chan, handle, msg):
|
def deliverMemo(self, chan, handle, msg):
|
||||||
(c, h, m) = (str(chan), str(handle), str(msg))
|
self.newMemoMsg(chan, handle, msg)
|
||||||
self.newMemoMsg(c, h, m)
|
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def deliverNotice(self, handle, msg):
|
def deliverNotice(self, handle, msg):
|
||||||
h = str(handle)
|
h = handle
|
||||||
m = str(msg)
|
m = msg
|
||||||
if h.upper() == "NICKSERV" and m.startswith(
|
if h.upper() == "NICKSERV" and m.startswith(
|
||||||
"Your nickname is now being changed to"
|
"Your nickname is now being changed to"
|
||||||
):
|
):
|
||||||
|
@ -2710,7 +2701,7 @@ class PesterWindow(MovingWindow):
|
||||||
t = self.tm.Toast("%s:" % h, m)
|
t = self.tm.Toast("%s:" % h, m)
|
||||||
t.show()
|
t.show()
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def deliverInvite(self, handle, channel):
|
def deliverInvite(self, handle, channel):
|
||||||
msgbox = QtWidgets.QMessageBox()
|
msgbox = QtWidgets.QMessageBox()
|
||||||
msgbox.setText("You're invited!")
|
msgbox.setText("You're invited!")
|
||||||
|
@ -2739,44 +2730,41 @@ class PesterWindow(MovingWindow):
|
||||||
if ret == QtWidgets.QMessageBox.StandardButton.Ok:
|
if ret == QtWidgets.QMessageBox.StandardButton.Ok:
|
||||||
self.newMemo(str(channel), "+0:00")
|
self.newMemo(str(channel), "+0:00")
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def chanInviteOnly(self, channel):
|
def chanInviteOnly(self, channel):
|
||||||
self.inviteOnlyChan.emit(channel)
|
self.inviteOnlyChan.emit(channel)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def cannotSendToChan(self, channel, msg):
|
def cannotSendToChan(self, channel, msg):
|
||||||
self.deliverMemo(channel, "ChanServ", msg)
|
self.deliverMemo(channel, "ChanServ", msg)
|
||||||
|
|
||||||
# Unused and redefined.
|
# Unused and redefined.
|
||||||
# @QtCore.pyqtSlot(QString, QString)
|
# @QtCore.pyqtSlot(str, str)
|
||||||
# def modesUpdated(self, channel, modes):
|
# def modesUpdated(self, channel, modes):
|
||||||
# self.modesUpdated.emit(channel, modes)
|
# self.modesUpdated.emit(channel, modes)
|
||||||
@QtCore.pyqtSlot(QString, QString, QString)
|
@QtCore.pyqtSlot(str, str, str)
|
||||||
def timeCommand(self, chan, handle, command):
|
def timeCommand(self, chan, handle, command):
|
||||||
(c, h, cmd) = (str(chan), str(handle), str(command))
|
if self.memos[chan]:
|
||||||
if self.memos[c]:
|
self.memos[chan].timeUpdate(handle, command)
|
||||||
self.memos[c].timeUpdate(h, cmd)
|
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString, QString)
|
@QtCore.pyqtSlot(str, str, str)
|
||||||
def quirkDisable(self, channel, msg, op):
|
def quirkDisable(self, channel, msg, op):
|
||||||
(c, msg, op) = (str(channel), str(msg), str(op))
|
if channel not in self.memos:
|
||||||
if c not in self.memos:
|
|
||||||
return
|
return
|
||||||
memo = self.memos[c]
|
memo = self.memos[channel]
|
||||||
memo.quirkDisable(op, msg)
|
memo.quirkDisable(op, msg)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, PesterList)
|
@QtCore.pyqtSlot(str, PesterList)
|
||||||
def updateNames(self, channel, names):
|
def updateNames(self, channel, names):
|
||||||
c = str(channel)
|
|
||||||
# update name DB
|
# update name DB
|
||||||
self.namesdb[c] = names
|
self.namesdb[channel] = names
|
||||||
# warn interested party of names
|
# warn interested party of names
|
||||||
self.namesUpdated.emit(c)
|
self.namesUpdated.emit(channel)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString, QString)
|
@QtCore.pyqtSlot(str, str, str)
|
||||||
def userPresentUpdate(self, handle, channel, update):
|
def userPresentUpdate(self, handle, channel, update):
|
||||||
c = str(channel)
|
c = channel
|
||||||
n = str(handle)
|
n = handle
|
||||||
# print("c=%s\nn=%s\nupdate=%s\n" % (c, n, update))
|
# print("c=%s\nn=%s\nupdate=%s\n" % (c, n, update))
|
||||||
if update == "nick":
|
if update == "nick":
|
||||||
l = n.split(":")
|
l = n.split(":")
|
||||||
|
@ -2831,12 +2819,11 @@ class PesterWindow(MovingWindow):
|
||||||
available_groups = [g[0] for g in self.config.getGroups()]
|
available_groups = [g[0] for g in self.config.getGroups()]
|
||||||
self.addchumdialog = AddChumDialog(available_groups, self)
|
self.addchumdialog = AddChumDialog(available_groups, self)
|
||||||
ok = self.addchumdialog.exec()
|
ok = self.addchumdialog.exec()
|
||||||
handle = str(self.addchumdialog.chumBox.text()).strip()
|
handle = (self.addchumdialog.chumBox.text()).strip()
|
||||||
newgroup = str(self.addchumdialog.newgroup.text()).strip()
|
newgroup = (self.addchumdialog.newgroup.text()).strip()
|
||||||
selectedGroup = self.addchumdialog.groupBox.currentText()
|
selectedGroup = self.addchumdialog.groupBox.currentText()
|
||||||
group = newgroup if newgroup else selectedGroup
|
group = newgroup if newgroup else selectedGroup
|
||||||
if ok:
|
if ok:
|
||||||
handle = str(handle)
|
|
||||||
if handle in [h.handle for h in self.chumList.chums]:
|
if handle in [h.handle for h in self.chumList.chums]:
|
||||||
self.addchumdialog = None
|
self.addchumdialog = None
|
||||||
return
|
return
|
||||||
|
@ -2861,7 +2848,7 @@ class PesterWindow(MovingWindow):
|
||||||
self.addChum(chum)
|
self.addChum(chum)
|
||||||
self.addchumdialog = None
|
self.addchumdialog = None
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def removeChum(self, chumlisting):
|
def removeChum(self, chumlisting):
|
||||||
self.config.removeChum(chumlisting)
|
self.config.removeChum(chumlisting)
|
||||||
|
|
||||||
|
@ -2874,9 +2861,9 @@ class PesterWindow(MovingWindow):
|
||||||
if ok:
|
if ok:
|
||||||
self.sendMessage.emit("REPORT {} {}".format(handle, reason), "calSprite")
|
self.sendMessage.emit("REPORT {} {}".format(handle, reason), "calSprite")
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def blockChum(self, handle):
|
def blockChum(self, handle):
|
||||||
h = str(handle)
|
h = handle
|
||||||
self.config.addBlocklist(h)
|
self.config.addBlocklist(h)
|
||||||
self.config.removeChum(h)
|
self.config.removeChum(h)
|
||||||
if h in self.convos:
|
if h in self.convos:
|
||||||
|
@ -2897,9 +2884,9 @@ class PesterWindow(MovingWindow):
|
||||||
if not self.config.irc_compatibility_mode():
|
if not self.config.irc_compatibility_mode():
|
||||||
self.blockedChum.emit(handle)
|
self.blockedChum.emit(handle)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def unblockChum(self, handle):
|
def unblockChum(self, handle):
|
||||||
h = str(handle)
|
h = handle
|
||||||
self.config.delBlocklist(h)
|
self.config.delBlocklist(h)
|
||||||
if h in self.convos:
|
if h in self.convos:
|
||||||
convo = self.convos[h]
|
convo = self.convos[h]
|
||||||
|
@ -3056,25 +3043,25 @@ class PesterWindow(MovingWindow):
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def joinSelectedMemo(self):
|
def joinSelectedMemo(self):
|
||||||
time = str(self.memochooser.timeinput.text())
|
time = self.memochooser.timeinput.text()
|
||||||
secret = self.memochooser.secretChannel.isChecked()
|
secret = self.memochooser.secretChannel.isChecked()
|
||||||
invite = self.memochooser.inviteChannel.isChecked()
|
invite = self.memochooser.inviteChannel.isChecked()
|
||||||
|
|
||||||
# Join the ones on the list first
|
# Join the ones on the list first
|
||||||
for SelectedMemo in self.memochooser.SelectedMemos():
|
for SelectedMemo in self.memochooser.SelectedMemos():
|
||||||
channel = "#" + str(SelectedMemo.target)
|
channel = f"#{SelectedMemo.target}"
|
||||||
self.newMemo(channel, time)
|
self.newMemo(channel, time)
|
||||||
|
|
||||||
if self.memochooser.newmemoname():
|
if self.memochooser.newmemoname():
|
||||||
newmemo = self.memochooser.newmemoname()
|
newmemo = self.memochooser.newmemoname()
|
||||||
channel = str(newmemo).replace(" ", "_")
|
channel = newmemo.replace(" ", "_")
|
||||||
channel = re.sub(r"[^A-Za-z0-9#_\,]", "", channel)
|
channel = re.sub(r"[^A-Za-z0-9#_\,]", "", channel)
|
||||||
# Allow us to join more than one with this.
|
# Allow us to join more than one with this.
|
||||||
chans = channel.split(",")
|
chans = channel.split(",")
|
||||||
# Filter out empty entries.
|
# Filter out empty entries.
|
||||||
chans = [_f for _f in chans if _f]
|
chans = [_f for _f in chans if _f]
|
||||||
for c in chans:
|
for c in chans:
|
||||||
c = "#" + c
|
c = f"#{c}"
|
||||||
# We should really change this code to only make the memo once
|
# We should really change this code to only make the memo once
|
||||||
# the server has confirmed that we've joined....
|
# the server has confirmed that we've joined....
|
||||||
self.newMemo(c, time, secret=secret, invite=invite)
|
self.newMemo(c, time, secret=secret, invite=invite)
|
||||||
|
@ -3098,21 +3085,19 @@ class PesterWindow(MovingWindow):
|
||||||
self.allusers = PesterUserlist(self.config, self.theme, self)
|
self.allusers = PesterUserlist(self.config, self.theme, self)
|
||||||
self.allusers.accepted.connect(self.userListClose)
|
self.allusers.accepted.connect(self.userListClose)
|
||||||
self.allusers.rejected.connect(self.userListClose)
|
self.allusers.rejected.connect(self.userListClose)
|
||||||
self.allusers.addChum["QString"].connect(self.userListAdd)
|
self.allusers.addChum[str].connect(self.userListAdd)
|
||||||
self.allusers.pesterChum["QString"].connect(self.userListPester)
|
self.allusers.pesterChum[str].connect(self.userListPester)
|
||||||
self.requestNames.emit("#pesterchum")
|
self.requestNames.emit("#pesterchum")
|
||||||
self.allusers.show()
|
self.allusers.show()
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def userListAdd(self, handle):
|
def userListAdd(self, handle):
|
||||||
h = str(handle)
|
chum = PesterProfile(handle, chumdb=self.chumdb)
|
||||||
chum = PesterProfile(h, chumdb=self.chumdb)
|
|
||||||
self.addChum(chum)
|
self.addChum(chum)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def userListPester(self, handle):
|
def userListPester(self, handle):
|
||||||
h = str(handle)
|
self.newConversation(handle)
|
||||||
self.newConversation(h)
|
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def userListClose(self):
|
def userListClose(self):
|
||||||
|
@ -3133,7 +3118,7 @@ class PesterWindow(MovingWindow):
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def updateQuirks(self):
|
def updateQuirks(self):
|
||||||
for i in range(self.quirkmenu.quirkList.topLevelItemCount()):
|
for i in range(self.quirkmenu.quirkList.topLevelItemCount()):
|
||||||
curgroup = str(self.quirkmenu.quirkList.topLevelItem(i).text(0))
|
curgroup = self.quirkmenu.quirkList.topLevelItem(i).text(0)
|
||||||
for j in range(self.quirkmenu.quirkList.topLevelItem(i).childCount()):
|
for j in range(self.quirkmenu.quirkList.topLevelItem(i).childCount()):
|
||||||
item = self.quirkmenu.quirkList.topLevelItem(i).child(j)
|
item = self.quirkmenu.quirkList.topLevelItem(i).child(j)
|
||||||
item.quirk.quirk["on"] = item.quirk.on = (
|
item.quirk.quirk["on"] = item.quirk.on = (
|
||||||
|
@ -3162,7 +3147,7 @@ class PesterWindow(MovingWindow):
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
if ok:
|
if ok:
|
||||||
self.newConversation(str(chum))
|
self.newConversation(chum)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
|
@ -3194,7 +3179,6 @@ class PesterWindow(MovingWindow):
|
||||||
self, "Add Group", "Enter a name for the new group:"
|
self, "Add Group", "Enter a name for the new group:"
|
||||||
)
|
)
|
||||||
if ok:
|
if ok:
|
||||||
gname = str(gname)
|
|
||||||
if re.search(r"[^A-Za-z0-9_\s]", gname) is not None:
|
if re.search(r"[^A-Za-z0-9_\s]", gname) is not None:
|
||||||
msgbox = QtWidgets.QMessageBox()
|
msgbox = QtWidgets.QMessageBox()
|
||||||
msgbox.setInformativeText("THIS IS NOT A VALID GROUP NAME")
|
msgbox.setInformativeText("THIS IS NOT A VALID GROUP NAME")
|
||||||
|
@ -3335,7 +3319,7 @@ class PesterWindow(MovingWindow):
|
||||||
# timestamps
|
# timestamps
|
||||||
timestampsetting = self.optionmenu.timestampcheck.isChecked()
|
timestampsetting = self.optionmenu.timestampcheck.isChecked()
|
||||||
self.config.set("showTimeStamps", timestampsetting)
|
self.config.set("showTimeStamps", timestampsetting)
|
||||||
timeformatsetting = str(self.optionmenu.timestampBox.currentText())
|
timeformatsetting = self.optionmenu.timestampBox.currentText()
|
||||||
if timeformatsetting == "12 hour":
|
if timeformatsetting == "12 hour":
|
||||||
self.config.set("time12Format", True)
|
self.config.set("time12Format", True)
|
||||||
else:
|
else:
|
||||||
|
@ -3445,7 +3429,7 @@ class PesterWindow(MovingWindow):
|
||||||
self.config.set("blink", blinksetting)
|
self.config.set("blink", blinksetting)
|
||||||
# toast notifications
|
# toast notifications
|
||||||
self.tm.setEnabled(self.optionmenu.notifycheck.isChecked())
|
self.tm.setEnabled(self.optionmenu.notifycheck.isChecked())
|
||||||
self.tm.setCurrentType(str(self.optionmenu.notifyOptions.currentText()))
|
self.tm.setCurrentType(self.optionmenu.notifyOptions.currentText())
|
||||||
notifysetting = 0
|
notifysetting = 0
|
||||||
if self.optionmenu.notifySigninCheck.isChecked():
|
if self.optionmenu.notifySigninCheck.isChecked():
|
||||||
notifysetting |= self.config.SIGNIN
|
notifysetting |= self.config.SIGNIN
|
||||||
|
@ -3478,11 +3462,11 @@ class PesterWindow(MovingWindow):
|
||||||
autoidentify = self.optionmenu.autonickserv.isChecked()
|
autoidentify = self.optionmenu.autonickserv.isChecked()
|
||||||
nickservpass = self.optionmenu.nickservpass.text()
|
nickservpass = self.optionmenu.nickservpass.text()
|
||||||
self.userprofile.setAutoIdentify(autoidentify)
|
self.userprofile.setAutoIdentify(autoidentify)
|
||||||
self.userprofile.setNickServPass(str(nickservpass))
|
self.userprofile.setNickServPass(nickservpass)
|
||||||
# auto join memos
|
# auto join memos
|
||||||
autojoins = []
|
autojoins = []
|
||||||
for i in range(self.optionmenu.autojoinlist.count()):
|
for i in range(self.optionmenu.autojoinlist.count()):
|
||||||
autojoins.append(str(self.optionmenu.autojoinlist.item(i).text()))
|
autojoins.append(self.optionmenu.autojoinlist.item(i).text())
|
||||||
self.userprofile.setAutoJoins(autojoins)
|
self.userprofile.setAutoJoins(autojoins)
|
||||||
# advanced
|
# advanced
|
||||||
## user mode
|
## user mode
|
||||||
|
@ -3517,7 +3501,7 @@ class PesterWindow(MovingWindow):
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def themeSelected(self, override=False):
|
def themeSelected(self, override=False):
|
||||||
if not override:
|
if not override:
|
||||||
themename = str(self.optionmenu.themeBox.currentText())
|
themename = self.optionmenu.themeBox.currentText()
|
||||||
else:
|
else:
|
||||||
themename = override
|
themename = override
|
||||||
if override or themename != self.theme.name:
|
if override or themename != self.theme.name:
|
||||||
|
@ -3543,7 +3527,7 @@ class PesterWindow(MovingWindow):
|
||||||
self.chooseprofile.profileBox
|
self.chooseprofile.profileBox
|
||||||
and self.chooseprofile.profileBox.currentIndex() > 0
|
and self.chooseprofile.profileBox.currentIndex() > 0
|
||||||
):
|
):
|
||||||
handle = str(self.chooseprofile.profileBox.currentText())
|
handle = self.chooseprofile.profileBox.currentText()
|
||||||
if handle == self.profile().handle:
|
if handle == self.profile().handle:
|
||||||
self.chooseprofile = None
|
self.chooseprofile = None
|
||||||
return
|
return
|
||||||
|
@ -3586,7 +3570,7 @@ class PesterWindow(MovingWindow):
|
||||||
msgBox.exec()
|
msgBox.exec()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
handle = str(self.chooseprofile.chumHandle.text())
|
handle = self.chooseprofile.chumHandle.text()
|
||||||
if handle == self.profile().handle:
|
if handle == self.profile().handle:
|
||||||
self.chooseprofile = None
|
self.chooseprofile = None
|
||||||
return
|
return
|
||||||
|
@ -3613,8 +3597,8 @@ class PesterWindow(MovingWindow):
|
||||||
return
|
return
|
||||||
trolls = [PesterProfile(h) for h in self.config.getBlocklist()]
|
trolls = [PesterProfile(h) for h in self.config.getBlocklist()]
|
||||||
self.trollslum = TrollSlumWindow(trolls, self)
|
self.trollslum = TrollSlumWindow(trolls, self)
|
||||||
self.trollslum.blockChumSignal["QString"].connect(self.blockChum)
|
self.trollslum.blockChumSignal[str].connect(self.blockChum)
|
||||||
self.trollslum.unblockChumSignal["QString"].connect(self.unblockChum)
|
self.trollslum.unblockChumSignal[str].connect(self.unblockChum)
|
||||||
self.moodsRequest.emit(PesterList(trolls))
|
self.moodsRequest.emit(PesterList(trolls))
|
||||||
self.trollslum.show()
|
self.trollslum.show()
|
||||||
|
|
||||||
|
@ -3724,7 +3708,7 @@ class PesterWindow(MovingWindow):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def nickCollision(self, handle, tmphandle):
|
def nickCollision(self, handle, tmphandle):
|
||||||
if hasattr(self, "loadingscreen"):
|
if hasattr(self, "loadingscreen"):
|
||||||
if self.loadingscreen is not None:
|
if self.loadingscreen is not None:
|
||||||
|
@ -3744,10 +3728,10 @@ class PesterWindow(MovingWindow):
|
||||||
if not hasattr(self, "chooseprofile"):
|
if not hasattr(self, "chooseprofile"):
|
||||||
self.chooseprofile = None
|
self.chooseprofile = None
|
||||||
if not self.chooseprofile:
|
if not self.chooseprofile:
|
||||||
h = str(handle)
|
h = handle
|
||||||
self.changeProfile(collision=h)
|
self.changeProfile(collision=h)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def getSvsnickedOn(self, oldhandle, newhandle):
|
def getSvsnickedOn(self, oldhandle, newhandle):
|
||||||
if hasattr(self, "loadingscreen"):
|
if hasattr(self, "loadingscreen"):
|
||||||
if self.loadingscreen is not None:
|
if self.loadingscreen is not None:
|
||||||
|
@ -3765,7 +3749,7 @@ class PesterWindow(MovingWindow):
|
||||||
if not self.chooseprofile:
|
if not self.chooseprofile:
|
||||||
self.changeProfile(svsnick=(oldhandle, newhandle))
|
self.changeProfile(svsnick=(oldhandle, newhandle))
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString)
|
@QtCore.pyqtSlot(str)
|
||||||
def myHandleChanged(self, handle):
|
def myHandleChanged(self, handle):
|
||||||
# Update nick in channels
|
# Update nick in channels
|
||||||
for memo in self.memos.keys():
|
for memo in self.memos.keys():
|
||||||
|
@ -3800,7 +3784,7 @@ class PesterWindow(MovingWindow):
|
||||||
# msg.setStyleSheet("QMessageBox{" + self.theme["main/defaultwindow/style"] + "}")
|
# msg.setStyleSheet("QMessageBox{" + self.theme["main/defaultwindow/style"] + "}")
|
||||||
msg.exec()
|
msg.exec()
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QString, QString)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def forbiddenchannel(self, channel, reason):
|
def forbiddenchannel(self, channel, reason):
|
||||||
self.forbiddenChan.emit(channel, reason)
|
self.forbiddenChan.emit(channel, reason)
|
||||||
|
|
||||||
|
@ -4215,41 +4199,41 @@ class PesterWindow(MovingWindow):
|
||||||
if ret == QtWidgets.QMessageBox.StandardButton.Yes:
|
if ret == QtWidgets.QMessageBox.StandardButton.Yes:
|
||||||
self.parent.restartIRC(verify_hostname=False)
|
self.parent.restartIRC(verify_hostname=False)
|
||||||
|
|
||||||
pcUpdate = QtCore.pyqtSignal("QString", "QString")
|
pcUpdate = QtCore.pyqtSignal(str, str)
|
||||||
closeToTraySignal = QtCore.pyqtSignal()
|
closeToTraySignal = QtCore.pyqtSignal()
|
||||||
newConvoStarted = QtCore.pyqtSignal("QString", bool, name="newConvoStarted")
|
newConvoStarted = QtCore.pyqtSignal(str, bool, name="newConvoStarted")
|
||||||
sendMessage = QtCore.pyqtSignal("QString", "QString")
|
sendMessage = QtCore.pyqtSignal(str, str)
|
||||||
sendNotice = QtCore.pyqtSignal("QString", "QString")
|
sendNotice = QtCore.pyqtSignal(str, str)
|
||||||
sendCTCP = QtCore.pyqtSignal("QString", "QString")
|
sendCTCP = QtCore.pyqtSignal(str, str)
|
||||||
convoClosed = QtCore.pyqtSignal("QString")
|
convoClosed = QtCore.pyqtSignal(str)
|
||||||
profileChanged = QtCore.pyqtSignal()
|
profileChanged = QtCore.pyqtSignal()
|
||||||
animationSetting = QtCore.pyqtSignal(bool)
|
animationSetting = QtCore.pyqtSignal(bool)
|
||||||
moodRequest = QtCore.pyqtSignal(PesterProfile)
|
moodRequest = QtCore.pyqtSignal(PesterProfile)
|
||||||
moodsRequest = QtCore.pyqtSignal(PesterList)
|
moodsRequest = QtCore.pyqtSignal(PesterList)
|
||||||
moodUpdated = QtCore.pyqtSignal()
|
moodUpdated = QtCore.pyqtSignal()
|
||||||
requestChannelList = QtCore.pyqtSignal()
|
requestChannelList = QtCore.pyqtSignal()
|
||||||
requestNames = QtCore.pyqtSignal("QString")
|
requestNames = QtCore.pyqtSignal(str)
|
||||||
namesUpdated = QtCore.pyqtSignal("QString")
|
namesUpdated = QtCore.pyqtSignal(str)
|
||||||
modesUpdated = QtCore.pyqtSignal("QString", "QString")
|
modesUpdated = QtCore.pyqtSignal(str, str)
|
||||||
userPresentSignal = QtCore.pyqtSignal("QString", "QString", "QString")
|
userPresentSignal = QtCore.pyqtSignal(str, str, str)
|
||||||
mycolorUpdated = QtCore.pyqtSignal()
|
mycolorUpdated = QtCore.pyqtSignal()
|
||||||
trayIconSignal = QtCore.pyqtSignal(int)
|
trayIconSignal = QtCore.pyqtSignal(int)
|
||||||
blockedChum = QtCore.pyqtSignal("QString")
|
blockedChum = QtCore.pyqtSignal(str)
|
||||||
unblockedChum = QtCore.pyqtSignal("QString")
|
unblockedChum = QtCore.pyqtSignal(str)
|
||||||
kickUser = QtCore.pyqtSignal("QString", "QString", "QString")
|
kickUser = QtCore.pyqtSignal(str, str, str)
|
||||||
joinChannel = QtCore.pyqtSignal("QString")
|
joinChannel = QtCore.pyqtSignal(str)
|
||||||
leftChannel = QtCore.pyqtSignal("QString")
|
leftChannel = QtCore.pyqtSignal(str)
|
||||||
setChannelMode = QtCore.pyqtSignal("QString", "QString", "QString")
|
setChannelMode = QtCore.pyqtSignal(str, str, str)
|
||||||
channelNames = QtCore.pyqtSignal("QString")
|
channelNames = QtCore.pyqtSignal(str)
|
||||||
inviteChum = QtCore.pyqtSignal("QString", "QString")
|
inviteChum = QtCore.pyqtSignal(str, str)
|
||||||
inviteOnlyChan = QtCore.pyqtSignal("QString")
|
inviteOnlyChan = QtCore.pyqtSignal(str)
|
||||||
forbiddenChan = QtCore.pyqtSignal("QString", "QString")
|
forbiddenChan = QtCore.pyqtSignal(str, str)
|
||||||
closeSignal = QtCore.pyqtSignal()
|
closeSignal = QtCore.pyqtSignal()
|
||||||
disconnectIRC = QtCore.pyqtSignal()
|
disconnectIRC = QtCore.pyqtSignal()
|
||||||
gainAttention = QtCore.pyqtSignal(QtWidgets.QWidget)
|
gainAttention = QtCore.pyqtSignal(QtWidgets.QWidget)
|
||||||
pingServer = QtCore.pyqtSignal()
|
pingServer = QtCore.pyqtSignal()
|
||||||
setAway = QtCore.pyqtSignal(bool)
|
setAway = QtCore.pyqtSignal(bool)
|
||||||
killSomeQuirks = QtCore.pyqtSignal("QString", "QString")
|
killSomeQuirks = QtCore.pyqtSignal(str, str)
|
||||||
|
|
||||||
|
|
||||||
class PesterTray(QtWidgets.QSystemTrayIcon):
|
class PesterTray(QtWidgets.QSystemTrayIcon):
|
||||||
|
@ -4607,7 +4591,7 @@ class MainProgram(QtCore.QObject):
|
||||||
traceback.print_tb(tb, file=f)
|
traceback.print_tb(tb, file=f)
|
||||||
f.close()
|
f.close()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
print(e)
|
||||||
|
|
||||||
# Show msgbox
|
# Show msgbox
|
||||||
msgbox = QtWidgets.QMessageBox()
|
msgbox = QtWidgets.QMessageBox()
|
||||||
|
@ -4617,7 +4601,7 @@ class MainProgram(QtCore.QObject):
|
||||||
"QMessageBox{" + self.widget.theme["main/defaultwindow/style"] + "}"
|
"QMessageBox{" + self.widget.theme["main/defaultwindow/style"] + "}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
print(e)
|
||||||
msgbox.setStyleSheet(
|
msgbox.setStyleSheet(
|
||||||
"background-color: red; color: black; font-size: x-large;"
|
"background-color: red; color: black; font-size: x-large;"
|
||||||
)
|
)
|
||||||
|
@ -4627,7 +4611,7 @@ class MainProgram(QtCore.QObject):
|
||||||
)
|
)
|
||||||
msgbox.exec()
|
msgbox.exec()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("failed to process uncaught except: " + str(e))
|
print(f"Failed to process uncaught except: {e}")
|
||||||
PchumLog.exception("app error")
|
PchumLog.exception("app error")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
18
pytwmn.py
18
pytwmn.py
|
@ -54,8 +54,8 @@ def init(host="127.0.0.1", port=None):
|
||||||
|
|
||||||
class Notification:
|
class Notification:
|
||||||
def __init__(self, title="", msg="", icon=""):
|
def __init__(self, title="", msg="", icon=""):
|
||||||
self.title = str(title)
|
self.title = title
|
||||||
self.msg = str(msg)
|
self.msg = msg
|
||||||
if icon.startswith("file://"):
|
if icon.startswith("file://"):
|
||||||
icon = icon[7:]
|
icon = icon[7:]
|
||||||
self.icon = icon
|
self.icon = icon
|
||||||
|
@ -68,16 +68,16 @@ class Notification:
|
||||||
try:
|
try:
|
||||||
if self.time is None:
|
if self.time is None:
|
||||||
s.send(
|
s.send(
|
||||||
"<root><title>" + self.title + "</title>"
|
f"<root><title>{self.title}</title>"
|
||||||
"<content>" + self.msg + "</content>"
|
f"<content>{self.msg}</content>"
|
||||||
"<icon>" + self.icon + "</icon></root>"
|
f"<icon>{self.icon}</icon></root>"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
s.send(
|
s.send(
|
||||||
"<root><title>" + self.title + "</title>"
|
f"<root><title>{self.title}</title>"
|
||||||
"<content>" + self.msg + "</content>"
|
f"<content>{self.msg}</content>"
|
||||||
"<icon>" + self.icon + "</icon>"
|
f"<icon>{self.icon}</icon>"
|
||||||
"<duration>" + str(self.time) + "</duration></root>"
|
f"<duration>{self.time}</duration></root>"
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
raise TwmnError(TwmnError.NO_TWMND)
|
raise TwmnError(TwmnError.NO_TWMND)
|
||||||
|
|
|
@ -77,6 +77,6 @@ class RandomHandler(QtCore.QObject):
|
||||||
msgbox.setInformativeText("Try again later :(")
|
msgbox.setInformativeText("Try again later :(")
|
||||||
msgbox.exec()
|
msgbox.exec()
|
||||||
return
|
return
|
||||||
name = str(l[1])
|
name = l[1]
|
||||||
PchumLog.info("Random Encounter name is: %s", name)
|
PchumLog.info("Random Encounter name is: %s", name)
|
||||||
self.mainwindow.newConversation(name)
|
self.mainwindow.newConversation(name)
|
||||||
|
|
4
toast.py
4
toast.py
|
@ -303,7 +303,7 @@ class PesterToast(QtWidgets.QWidget, DefaultToast):
|
||||||
self.msg.setText(
|
self.msg.setText(
|
||||||
PesterToast.wrapText(
|
PesterToast.wrapText(
|
||||||
self.msg.font(),
|
self.msg.font(),
|
||||||
str(self.msg.text()),
|
self.msg.text(),
|
||||||
self.parent().theme["toasts/width"],
|
self.parent().theme["toasts/width"],
|
||||||
self.parent().theme["toasts/content/style"],
|
self.parent().theme["toasts/content/style"],
|
||||||
)
|
)
|
||||||
|
@ -328,7 +328,7 @@ class PesterToast(QtWidgets.QWidget, DefaultToast):
|
||||||
def done(self):
|
def done(self):
|
||||||
QtWidgets.QWidget.hide(self)
|
QtWidgets.QWidget.hide(self)
|
||||||
t = self.machine.toasts[0]
|
t = self.machine.toasts[0]
|
||||||
if t.title == str(self.title.text()) and t.msg == str(self.content):
|
if t.title == self.title.text() and t.msg == self.content:
|
||||||
self.machine.toasts.pop(0)
|
self.machine.toasts.pop(0)
|
||||||
self.machine.displaying = False
|
self.machine.displaying = False
|
||||||
if self.machine.on:
|
if self.machine.on:
|
||||||
|
|
|
@ -621,7 +621,7 @@ class userProfile:
|
||||||
self.chat = user
|
self.chat = user
|
||||||
self.userprofile = {
|
self.userprofile = {
|
||||||
"handle": user.handle,
|
"handle": user.handle,
|
||||||
"color": str(user.color.name()),
|
"color": user.color.name(),
|
||||||
"quirks": [],
|
"quirks": [],
|
||||||
"theme": "pesterchum",
|
"theme": "pesterchum",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue