Color via metadata draft
This commit is contained in:
parent
b549645a50
commit
a3d047350b
4 changed files with 87 additions and 42 deletions
|
@ -1,6 +1,14 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
(This document uses YYYY-MM-DD)
|
(This document uses YYYY-MM-DD)
|
||||||
|
|
||||||
|
## [v2.4.3] - 2022-09-01
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Support for color via IRCv3 metadata draft.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Error when setting quirk with PyQt5.
|
||||||
|
|
||||||
## [v2.4.2] - 2022-08-14
|
## [v2.4.2] - 2022-08-14
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
23
irc.py
23
irc.py
|
@ -413,9 +413,15 @@ class PesterHandler(DefaultCommandHandler):
|
||||||
def metadata(self, target, nick, key, visibility, value):
|
def metadata(self, target, nick, key, visibility, value):
|
||||||
# The format of the METADATA server notication is:
|
# The format of the METADATA server notication is:
|
||||||
# METADATA <Target> <Key> <Visibility> <Value>
|
# METADATA <Target> <Key> <Visibility> <Value>
|
||||||
if key == "mood":
|
if key.lower() == "mood":
|
||||||
mood = Mood(int(value))
|
try:
|
||||||
self.parent.moodUpdated.emit(nick, mood)
|
mood = Mood(int(value))
|
||||||
|
self.parent.moodUpdated.emit(nick, mood)
|
||||||
|
except ValueError:
|
||||||
|
PchumLog.warning("Invalid mood value, %s, %s" % (nick, mood))
|
||||||
|
elif key.lower() == "color":
|
||||||
|
color = QtGui.QColor(value) # Invalid color becomes rgb 0,0,0
|
||||||
|
self.parent.colorUpdated.emit(nick, color)
|
||||||
|
|
||||||
def tagmsg(self, prefix, tags, *args):
|
def tagmsg(self, prefix, tags, *args):
|
||||||
PchumLog.info('TAGMSG: %s %s %s' % (prefix, tags, str(args)))
|
PchumLog.info('TAGMSG: %s %s %s' % (prefix, tags, str(args)))
|
||||||
|
@ -555,17 +561,22 @@ class PesterHandler(DefaultCommandHandler):
|
||||||
self.parent.setConnected()
|
self.parent.setConnected()
|
||||||
#mychumhandle = self.mainwindow.profile().handle
|
#mychumhandle = self.mainwindow.profile().handle
|
||||||
mymood = self.mainwindow.profile().mood.value()
|
mymood = self.mainwindow.profile().mood.value()
|
||||||
|
color = self.mainwindow.profile().color
|
||||||
if not self.mainwindow.config.lowBandwidth():
|
if not self.mainwindow.config.lowBandwidth():
|
||||||
|
# Negotiate capabilities
|
||||||
|
helpers.cap(self.client, "REQ", "message-tags")
|
||||||
|
helpers.cap(self.client, "REQ", "draft/metadata-notify-2") # <--- Not required in the unreal5 module implementation
|
||||||
|
helpers.cap(self.client, "REQ", "pesterchum-tag") # <--- Currently not using this
|
||||||
time.sleep(0.413 + 0.097) # <--- somehow, this actually helps.
|
time.sleep(0.413 + 0.097) # <--- somehow, this actually helps.
|
||||||
helpers.join(self.client, "#pesterchum")
|
helpers.join(self.client, "#pesterchum")
|
||||||
# Moods via metadata
|
# Moods via metadata
|
||||||
helpers.metadata(self.client, '*', 'sub', 'mood')
|
helpers.metadata(self.client, '*', 'sub', 'mood')
|
||||||
helpers.metadata(self.client, '*', "set", "mood", str(mymood))
|
helpers.metadata(self.client, '*', "set", "mood", str(mymood))
|
||||||
|
# Color via metadata
|
||||||
|
helpers.metadata(self.client, '*', 'sub', 'color')
|
||||||
|
helpers.metadata(self.client, '*', "set", "color", str(color.name()))
|
||||||
# Backwards compatible moods
|
# Backwards compatible moods
|
||||||
helpers.msg(self.client, "#pesterchum", "MOOD >%d" % (mymood))
|
helpers.msg(self.client, "#pesterchum", "MOOD >%d" % (mymood))
|
||||||
# Negotiate Pesterchum message tags
|
|
||||||
helpers.cap(self.client, "REQ", "message-tags")
|
|
||||||
helpers.cap(self.client, "REQ", "pesterchum-tag")
|
|
||||||
|
|
||||||
def erroneusnickname(self, *args):
|
def erroneusnickname(self, *args):
|
||||||
# Server is not allowing us to connect.
|
# Server is not allowing us to connect.
|
||||||
|
|
94
menus.py
94
menus.py
|
@ -81,7 +81,9 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
|
||||||
else:
|
else:
|
||||||
child_1 = QtWidgets.QTreeWidgetItem([item.quirk.group])
|
child_1 = QtWidgets.QTreeWidgetItem([item.quirk.group])
|
||||||
self.addTopLevelItem(child_1)
|
self.addTopLevelItem(child_1)
|
||||||
child_1.setFlags(child_1.flags() | QtCore.Qt.ItemFlag.ItemIsUserCheckable | QtCore.Qt.ItemFlag.ItemIsEnabled)
|
child_1.setFlags(child_1.flags()
|
||||||
|
| QtCore.Qt.ItemFlag.ItemIsUserCheckable
|
||||||
|
| QtCore.Qt.ItemFlag.ItemIsEnabled)
|
||||||
child_1.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.ChildIndicatorPolicy.DontShowIndicatorWhenChildless)
|
child_1.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.ChildIndicatorPolicy.DontShowIndicatorWhenChildless)
|
||||||
child_1.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
|
child_1.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
|
||||||
child_1.setExpanded(True)
|
child_1.setExpanded(True)
|
||||||
|
@ -95,7 +97,8 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def upShiftQuirk(self):
|
def upShiftQuirk(self):
|
||||||
found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchFlag.MatchExactly)
|
found = self.findItems(self.currentItem().text(0),
|
||||||
|
QtCore.Qt.MatchFlag.MatchExactly)
|
||||||
if len(found): # group
|
if len(found): # group
|
||||||
i = self.indexOfTopLevelItem(found[0])
|
i = self.indexOfTopLevelItem(found[0])
|
||||||
if i > 0:
|
if i > 0:
|
||||||
|
@ -105,7 +108,9 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
|
||||||
shifted_item.setExpanded(expand)
|
shifted_item.setExpanded(expand)
|
||||||
self.setCurrentItem(shifted_item)
|
self.setCurrentItem(shifted_item)
|
||||||
else: # quirk
|
else: # quirk
|
||||||
found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchFlag.MatchExactly | QtCore.Qt.MatchFlag.MatchRecursive)
|
found = self.findItems(self.currentItem().text(0),
|
||||||
|
QtCore.Qt.MatchFlag.MatchExactly
|
||||||
|
| QtCore.Qt.MatchFlag.MatchRecursive)
|
||||||
for f in found:
|
for f in found:
|
||||||
if not f.isSelected(): continue
|
if not f.isSelected(): continue
|
||||||
if not f.parent(): continue
|
if not f.parent(): continue
|
||||||
|
@ -125,7 +130,8 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def downShiftQuirk(self):
|
def downShiftQuirk(self):
|
||||||
found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchFlag.MatchExactly)
|
found = self.findItems(self.currentItem().text(0),
|
||||||
|
QtCore.Qt.MatchFlag.MatchExactly)
|
||||||
if len(found): # group
|
if len(found): # group
|
||||||
i = self.indexOfTopLevelItem(found[0])
|
i = self.indexOfTopLevelItem(found[0])
|
||||||
if i < self.topLevelItemCount()-1 and i >= 0:
|
if i < self.topLevelItemCount()-1 and i >= 0:
|
||||||
|
@ -135,7 +141,9 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
|
||||||
shifted_item.setExpanded(expand)
|
shifted_item.setExpanded(expand)
|
||||||
self.setCurrentItem(shifted_item)
|
self.setCurrentItem(shifted_item)
|
||||||
else: # quirk
|
else: # quirk
|
||||||
found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchFlag.MatchExactly | QtCore.Qt.MatchFlag.MatchRecursive)
|
found = self.findItems(self.currentItem().text(0),
|
||||||
|
QtCore.Qt.MatchFlag.MatchExactly
|
||||||
|
| QtCore.Qt.MatchFlag.MatchRecursive)
|
||||||
for f in found:
|
for f in found:
|
||||||
if not f.isSelected(): continue
|
if not f.isSelected(): continue
|
||||||
if not f.parent(): continue
|
if not f.parent(): continue
|
||||||
|
@ -156,7 +164,9 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def removeCurrent(self):
|
def removeCurrent(self):
|
||||||
i = self.currentItem()
|
i = self.currentItem()
|
||||||
found = self.findItems(i.text(0), QtCore.Qt.MatchFlag.MatchExactly | QtCore.Qt.MatchFlag.MatchRecursive)
|
found = self.findItems(i.text(0),
|
||||||
|
QtCore.Qt.MatchFlag.MatchExactly
|
||||||
|
| QtCore.Qt.MatchFlag.MatchRecursive)
|
||||||
for f in found:
|
for f in found:
|
||||||
if not f.isSelected(): continue
|
if not f.isSelected(): continue
|
||||||
if not f.parent(): # group
|
if not f.parent(): # group
|
||||||
|
@ -165,7 +175,8 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
|
||||||
msgbox.setObjectName("delquirkwarning")
|
msgbox.setObjectName("delquirkwarning")
|
||||||
msgbox.setWindowTitle("WARNING!")
|
msgbox.setWindowTitle("WARNING!")
|
||||||
msgbox.setInformativeText("Are you sure you want to delete the quirk group: %s" % (f.text(0)))
|
msgbox.setInformativeText("Are you sure you want to delete the quirk group: %s" % (f.text(0)))
|
||||||
msgbox.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel)
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok
|
||||||
|
| QtWidgets.QMessageBox.StandardButton.Cancel)
|
||||||
# Find the Cancel button and make it default
|
# Find the Cancel button and make it default
|
||||||
for b in msgbox.buttons():
|
for b in msgbox.buttons():
|
||||||
if msgbox.buttonRole(b) == QtWidgets.QMessageBox.ButtonRole.RejectRole:
|
if msgbox.buttonRole(b) == QtWidgets.QMessageBox.ButtonRole.RejectRole:
|
||||||
|
@ -207,7 +218,9 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
|
||||||
return
|
return
|
||||||
child_1 = QtWidgets.QTreeWidgetItem([gname])
|
child_1 = QtWidgets.QTreeWidgetItem([gname])
|
||||||
self.addTopLevelItem(child_1)
|
self.addTopLevelItem(child_1)
|
||||||
child_1.setFlags(child_1.flags() | QtCore.Qt.ItemFlag.ItemIsUserCheckable | QtCore.Qt.ItemFlag.ItemIsEnabled)
|
child_1.setFlags(child_1.flags()
|
||||||
|
| QtCore.Qt.ItemFlag.ItemIsUserCheckable
|
||||||
|
| QtCore.Qt.ItemFlag.ItemIsEnabled)
|
||||||
child_1.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.ChildIndicatorPolicy.DontShowIndicatorWhenChildless)
|
child_1.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.ChildIndicatorPolicy.DontShowIndicatorWhenChildless)
|
||||||
child_1.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
|
child_1.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
|
||||||
child_1.setExpanded(True)
|
child_1.setExpanded(True)
|
||||||
|
@ -715,7 +728,7 @@ class PesterChooseQuirks(QtWidgets.QDialog):
|
||||||
self.quirkadd.show()
|
self.quirkadd.show()
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def addQuirk(self):
|
def addQuirk(self):
|
||||||
types = ["prefix","suffix","replace","regexp","random","spelling"]
|
types = ["prefix", "suffix", "replace", "regexp", "random", "spelling"]
|
||||||
vdict = {}
|
vdict = {}
|
||||||
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()
|
||||||
|
@ -937,7 +950,8 @@ class PesterChooseProfile(QtWidgets.QDialog):
|
||||||
msgbox.setStyleSheet(self.theme["main/defaultwindow/style"])
|
msgbox.setStyleSheet(self.theme["main/defaultwindow/style"])
|
||||||
msgbox.setWindowTitle("WARNING!")
|
msgbox.setWindowTitle("WARNING!")
|
||||||
msgbox.setInformativeText("Are you sure you want to delete the profile: %s" % (handle))
|
msgbox.setInformativeText("Are you sure you want to delete the profile: %s" % (handle))
|
||||||
msgbox.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel)
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok
|
||||||
|
| QtWidgets.QMessageBox.StandardButton.Cancel)
|
||||||
ret = msgbox.exec()
|
ret = msgbox.exec()
|
||||||
if ret == QtWidgets.QMessageBox.StandardButton.Ok:
|
if ret == QtWidgets.QMessageBox.StandardButton.Ok:
|
||||||
try:
|
try:
|
||||||
|
@ -1045,7 +1059,15 @@ class PesterOptions(QtWidgets.QDialog):
|
||||||
|
|
||||||
self.tabs = QtWidgets.QButtonGroup(self)
|
self.tabs = QtWidgets.QButtonGroup(self)
|
||||||
self.tabs.buttonClicked.connect(self.changePage) # Verify working
|
self.tabs.buttonClicked.connect(self.changePage) # Verify working
|
||||||
self.tabNames = ["Chum List", "Conversations", "Interface", "Sound", "Notifications", "Logging", "Idle/Updates", "Theme", "Connection"]
|
self.tabNames = ["Chum List",
|
||||||
|
"Conversations",
|
||||||
|
"Interface",
|
||||||
|
"Sound",
|
||||||
|
"Notifications",
|
||||||
|
"Logging",
|
||||||
|
"Idle/Updates",
|
||||||
|
"Theme",
|
||||||
|
"Connection"]
|
||||||
if parent.advanced: self.tabNames.append("Advanced")
|
if parent.advanced: self.tabNames.append("Advanced")
|
||||||
for t in self.tabNames:
|
for t in self.tabNames:
|
||||||
button = QtWidgets.QPushButton(t)
|
button = QtWidgets.QPushButton(t)
|
||||||
|
@ -1059,7 +1081,7 @@ class PesterOptions(QtWidgets.QDialog):
|
||||||
if self.config.lowBandwidth():
|
if self.config.lowBandwidth():
|
||||||
self.bandwidthcheck.setChecked(True)
|
self.bandwidthcheck.setChecked(True)
|
||||||
bandwidthLabel = QtWidgets.QLabel("(Stops you for receiving the flood of MOODS,\n"
|
bandwidthLabel = QtWidgets.QLabel("(Stops you for receiving the flood of MOODS,\n"
|
||||||
" though stops chumlist from working properly)")
|
" though stops chumlist from working properly)")
|
||||||
font = bandwidthLabel.font()
|
font = bandwidthLabel.font()
|
||||||
font.setPointSize(8)
|
font.setPointSize(8)
|
||||||
bandwidthLabel.setFont(font)
|
bandwidthLabel.setFont(font)
|
||||||
|
@ -1507,7 +1529,8 @@ class PesterOptions(QtWidgets.QDialog):
|
||||||
return
|
return
|
||||||
pdict["value"] = "#" + pdict["value"]
|
pdict["value"] = "#" + pdict["value"]
|
||||||
if mitem is None:
|
if mitem is None:
|
||||||
items = self.autojoinlist.findItems(pdict["value"], QtCore.Qt.MatchFlag.MatchFixedString)
|
items = self.autojoinlist.findItems(pdict["value"],
|
||||||
|
QtCore.Qt.MatchFlag.MatchFixedString)
|
||||||
if len(items) == 0:
|
if len(items) == 0:
|
||||||
self.autojoinlist.addItem(pdict["value"])
|
self.autojoinlist.addItem(pdict["value"])
|
||||||
else:
|
else:
|
||||||
|
@ -1782,8 +1805,10 @@ class LoadingScreen(QtWidgets.QDialog):
|
||||||
tryAgain = QtCore.pyqtSignal()
|
tryAgain = QtCore.pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QtWidgets.QDialog.__init__(self, parent, (QtCore.Qt.WindowType.CustomizeWindowHint |
|
QtWidgets.QDialog.__init__(self,
|
||||||
QtCore.Qt.WindowType.FramelessWindowHint))
|
parent,
|
||||||
|
QtCore.Qt.WindowType.CustomizeWindowHint
|
||||||
|
| QtCore.Qt.WindowType.FramelessWindowHint)
|
||||||
self.mainwindow = parent
|
self.mainwindow = parent
|
||||||
self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])
|
self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])
|
||||||
|
|
||||||
|
@ -1839,25 +1864,26 @@ class AboutPesterchum(QtWidgets.QDialog):
|
||||||
self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])
|
self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])
|
||||||
|
|
||||||
self.title = QtWidgets.QLabel("P3ST3RCHUM %s" % (_pcVersion))
|
self.title = QtWidgets.QLabel("P3ST3RCHUM %s" % (_pcVersion))
|
||||||
self.credits = QtWidgets.QLabel("Programming by:\n\
|
self.credits = QtWidgets.QLabel("Programming by:"
|
||||||
illuminatedwax (ghostDunk)\n\
|
"\n illuminatedwax (ghostDunk)"
|
||||||
Kiooeht (evacipatedBox)\n\
|
"\n Kiooeht (evacipatedBox)"
|
||||||
Lexi (lexicalNuance)\n\
|
"\n Lexi (lexicalNuance)"
|
||||||
oakwhiz\n\
|
"\n oakwhiz"
|
||||||
alGore\n\
|
"\n alGore"
|
||||||
Cerxi (binaryCabalist)\n\
|
"\n Cerxi (binaryCabalist)"
|
||||||
Arcane (arcaneAgilmente)\n\
|
"\n Arcane (arcaneAgilmente)"
|
||||||
karxi (Midna)\n\
|
"\n karxi (Midna)"
|
||||||
Shou :)\n\
|
"\n Shou/Dpeta 🐱"
|
||||||
\n\
|
"\n"
|
||||||
Art by:\n\
|
"\nArt by:"
|
||||||
Grimlive (aquaMarinist)\n\
|
"\n Grimlive (aquaMarinist)"
|
||||||
Cerxi (binaryCabalist)\n\
|
"\n Cerxi (binaryCabalist)"
|
||||||
\n\
|
"\n cubicSimulation"
|
||||||
Special Thanks:\n\
|
"\n"
|
||||||
ABT\n\
|
"\nSpecial Thanks:"
|
||||||
gamblingGenocider\n\
|
"\n ABT"
|
||||||
Eco-Mono")
|
"\n gamblingGenocider"
|
||||||
|
"\n Eco-Mono")
|
||||||
|
|
||||||
self.ok = QtWidgets.QPushButton("OK", self)
|
self.ok = QtWidgets.QPushButton("OK", self)
|
||||||
self.ok.clicked.connect(self.reject)
|
self.ok.clicked.connect(self.reject)
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
_pcVersion = "Alt. v2.4.2"
|
_pcVersion = "Alt. v2.4.3"
|
||||||
buildVersion = "v2.4.2"
|
buildVersion = "v2.4.3"
|
||||||
|
|
Loading…
Reference in a new issue