Updated black run
This commit is contained in:
parent
3855ef20f5
commit
f3cacb849b
13 changed files with 33 additions and 30 deletions
4
convo.py
4
convo.py
|
@ -235,6 +235,7 @@ class PesterTabWindow(QtWidgets.QFrame):
|
||||||
i, QtGui.QColor(self.mainwindow.theme["%s/tabs/newmsgcolor" % (self.type)])
|
i, QtGui.QColor(self.mainwindow.theme["%s/tabs/newmsgcolor" % (self.type)])
|
||||||
)
|
)
|
||||||
convo = self.convos[handle]
|
convo = self.convos[handle]
|
||||||
|
|
||||||
# Create a function for the icon to use
|
# Create a function for the icon to use
|
||||||
# TODO: Let us disable this.
|
# TODO: Let us disable this.
|
||||||
def func():
|
def func():
|
||||||
|
@ -286,7 +287,7 @@ class PesterTabWindow(QtWidgets.QFrame):
|
||||||
del self.convos[handle]
|
del self.convos[handle]
|
||||||
del self.tabIndices[handle]
|
del self.tabIndices[handle]
|
||||||
self.tabs.removeTab(i)
|
self.tabs.removeTab(i)
|
||||||
for (h, j) in self.tabIndices.items():
|
for h, j in self.tabIndices.items():
|
||||||
if j > i:
|
if j > i:
|
||||||
self.tabIndices[h] = j - 1
|
self.tabIndices[h] = j - 1
|
||||||
self.layout.removeWidget(convo)
|
self.layout.removeWidget(convo)
|
||||||
|
@ -954,6 +955,7 @@ class PesterConvo(QtWidgets.QFrame):
|
||||||
else:
|
else:
|
||||||
self.newmessage = True
|
self.newmessage = True
|
||||||
self.setWindowTitle(title + "*")
|
self.setWindowTitle(title + "*")
|
||||||
|
|
||||||
# karxi: The order of execution here is a bit unclear...I'm not
|
# karxi: The order of execution here is a bit unclear...I'm not
|
||||||
# entirely sure how much of this directly affects what we see.
|
# entirely sure how much of this directly affects what we see.
|
||||||
def func():
|
def func():
|
||||||
|
|
|
@ -146,7 +146,7 @@ class pesterQuirks:
|
||||||
# suffix = [q for q in self.quirklist if q.type == "suffix"]
|
# suffix = [q for q in self.quirklist if q.type == "suffix"]
|
||||||
|
|
||||||
newlist = []
|
newlist = []
|
||||||
for (i, o) in enumerate(lexed):
|
for i, o in enumerate(lexed):
|
||||||
if type(o) not in [str, str]:
|
if type(o) not in [str, str]:
|
||||||
if i == 0:
|
if i == 0:
|
||||||
string = " "
|
string = " "
|
||||||
|
|
|
@ -119,7 +119,7 @@ class MultiTextDialog(QtWidgets.QDialog):
|
||||||
r = self.exec()
|
r = self.exec()
|
||||||
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] = str(widget.text())
|
||||||
return retval
|
return retval
|
||||||
else:
|
else:
|
||||||
|
|
3
irc.py
3
irc.py
|
@ -916,8 +916,7 @@ class PesterIRC(QtCore.QThread):
|
||||||
modes.append("{}{}".format(cur, l))
|
modes.append("{}{}".format(cur, l))
|
||||||
PchumLog.debug("handles=%s", handles)
|
PchumLog.debug("handles=%s", handles)
|
||||||
PchumLog.debug("enumerate(modes) = " + str(list(enumerate(modes))))
|
PchumLog.debug("enumerate(modes) = " + str(list(enumerate(modes))))
|
||||||
for (i, m) in enumerate(modes):
|
for i, m in enumerate(modes):
|
||||||
|
|
||||||
# Server-set usermodes don't need to be passed.
|
# Server-set usermodes don't need to be passed.
|
||||||
if (handles == [""]) & (
|
if (handles == [""]) & (
|
||||||
("x" in m) | ("z" in m) | ("o" in m) | ("x" in m)
|
("x" in m) | ("z" in m) | ("o" in m) | ("x" in m)
|
||||||
|
|
|
@ -78,7 +78,7 @@ class PesterLogUserSelect(QtWidgets.QDialog):
|
||||||
self.chumsBox.setStyleSheet(self.theme["main/chums/style"])
|
self.chumsBox.setStyleSheet(self.theme["main/chums/style"])
|
||||||
self.chumsBox.optionsMenu = QtWidgets.QMenu(self)
|
self.chumsBox.optionsMenu = QtWidgets.QMenu(self)
|
||||||
|
|
||||||
for (_, t) in enumerate(chumMemoList):
|
for _, t in enumerate(chumMemoList):
|
||||||
item = QtWidgets.QListWidgetItem(t)
|
item = QtWidgets.QListWidgetItem(t)
|
||||||
item.setForeground(
|
item.setForeground(
|
||||||
QtGui.QBrush(QtGui.QColor(self.theme["main/chums/userlistcolor"]))
|
QtGui.QBrush(QtGui.QColor(self.theme["main/chums/userlistcolor"]))
|
||||||
|
@ -244,7 +244,7 @@ class PesterLogViewer(QtWidgets.QDialog):
|
||||||
child_1 = None
|
child_1 = None
|
||||||
last = ["", ""]
|
last = ["", ""]
|
||||||
# blackbrush = QtGui.QBrush(QtCore.Qt.GlobalColor.black)
|
# blackbrush = QtGui.QBrush(QtCore.Qt.GlobalColor.black)
|
||||||
for (i, l) in enumerate(self.logList):
|
for i, l in enumerate(self.logList):
|
||||||
my = self.fileToMonthYear(l)
|
my = self.fileToMonthYear(l)
|
||||||
if my[0] != last[0]:
|
if my[0] != last[0]:
|
||||||
child_1 = QtWidgets.QTreeWidgetItem(["{} {}".format(my[0], my[1])])
|
child_1 = QtWidgets.QTreeWidgetItem(["{} {}".format(my[0], my[1])])
|
||||||
|
|
10
menus.py
10
menus.py
|
@ -576,7 +576,7 @@ class PesterQuirkTypes(QtWidgets.QDialog):
|
||||||
|
|
||||||
if quirk:
|
if quirk:
|
||||||
types = ["prefix", "suffix", "replace", "regexp", "random", "spelling"]
|
types = ["prefix", "suffix", "replace", "regexp", "random", "spelling"]
|
||||||
for (i, r) in enumerate(self.radios):
|
for i, r in enumerate(self.radios):
|
||||||
if i == types.index(quirk.quirk.type):
|
if i == types.index(quirk.quirk.type):
|
||||||
r.setChecked(True)
|
r.setChecked(True)
|
||||||
self.changePage(types.index(quirk.quirk.type) + 1)
|
self.changePage(types.index(quirk.quirk.type) + 1)
|
||||||
|
@ -648,7 +648,7 @@ class PesterQuirkTypes(QtWidgets.QDialog):
|
||||||
return
|
return
|
||||||
cur = self.pages.currentIndex()
|
cur = self.pages.currentIndex()
|
||||||
if cur == 0:
|
if cur == 0:
|
||||||
for (i, r) in enumerate(self.radios):
|
for i, r in enumerate(self.radios):
|
||||||
if r.isChecked():
|
if r.isChecked():
|
||||||
self.changePage(i + 1)
|
self.changePage(i + 1)
|
||||||
else:
|
else:
|
||||||
|
@ -933,7 +933,7 @@ class PesterChooseTheme(QtWidgets.QDialog):
|
||||||
|
|
||||||
avail_themes = config.availableThemes()
|
avail_themes = config.availableThemes()
|
||||||
self.themeBox = QtWidgets.QComboBox(self)
|
self.themeBox = QtWidgets.QComboBox(self)
|
||||||
for (i, t) in enumerate(avail_themes):
|
for i, t in enumerate(avail_themes):
|
||||||
self.themeBox.addItem(t)
|
self.themeBox.addItem(t)
|
||||||
if t == theme.name:
|
if t == theme.name:
|
||||||
self.themeBox.setCurrentIndex(i)
|
self.themeBox.setCurrentIndex(i)
|
||||||
|
@ -1416,7 +1416,7 @@ class PesterOptions(QtWidgets.QDialog):
|
||||||
avail_themes = self.config.availableThemes()
|
avail_themes = self.config.availableThemes()
|
||||||
self.themeBox = QtWidgets.QComboBox(self)
|
self.themeBox = QtWidgets.QComboBox(self)
|
||||||
notheme = theme.name not in avail_themes
|
notheme = theme.name not in avail_themes
|
||||||
for (i, t) in enumerate(avail_themes):
|
for i, t in enumerate(avail_themes):
|
||||||
self.themeBox.addItem(t)
|
self.themeBox.addItem(t)
|
||||||
if (not notheme and t == theme.name) or (notheme and t == "pesterchum"):
|
if (not notheme and t == theme.name) or (notheme and t == "pesterchum"):
|
||||||
self.themeBox.setCurrentIndex(i)
|
self.themeBox.setCurrentIndex(i)
|
||||||
|
@ -1454,7 +1454,7 @@ class PesterOptions(QtWidgets.QDialog):
|
||||||
types = self.parent().tm.availableTypes()
|
types = self.parent().tm.availableTypes()
|
||||||
cur = self.parent().tm.currentType()
|
cur = self.parent().tm.currentType()
|
||||||
self.notifyOptions.addItems(types)
|
self.notifyOptions.addItems(types)
|
||||||
for (i, t) in enumerate(types):
|
for i, t in enumerate(types):
|
||||||
if t == cur:
|
if t == cur:
|
||||||
self.notifyOptions.setCurrentIndex(i)
|
self.notifyOptions.setCurrentIndex(i)
|
||||||
break
|
break
|
||||||
|
|
|
@ -7,8 +7,8 @@ kbloc = [
|
||||||
[x for x in "zxcvbnm,.>/?"],
|
[x for x in "zxcvbnm,.>/?"],
|
||||||
]
|
]
|
||||||
kbdict = {}
|
kbdict = {}
|
||||||
for (i, l) in enumerate(kbloc):
|
for i, l in enumerate(kbloc):
|
||||||
for (j, k) in enumerate(l):
|
for j, k in enumerate(l):
|
||||||
kbdict[k] = (i, j)
|
kbdict[k] = (i, j)
|
||||||
|
|
||||||
sounddict = {
|
sounddict = {
|
||||||
|
|
|
@ -64,9 +64,9 @@ def reloadQuirkFunctions():
|
||||||
def lexer(string, objlist):
|
def lexer(string, objlist):
|
||||||
"""objlist is a list: [(objecttype, re),...] list is in order of preference"""
|
"""objlist is a list: [(objecttype, re),...] list is in order of preference"""
|
||||||
stringlist = [string]
|
stringlist = [string]
|
||||||
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 type(s) not in [str, str]:
|
||||||
newstringlist.append(s)
|
newstringlist.append(s)
|
||||||
continue
|
continue
|
||||||
|
@ -339,7 +339,7 @@ def convertTags(lexed, format="html"):
|
||||||
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 type(o) in [str, str]:
|
||||||
if format == "html":
|
if format == "html":
|
||||||
escaped += (
|
escaped += (
|
||||||
|
|
|
@ -2971,7 +2971,7 @@ class PesterWindow(MovingWindow):
|
||||||
# Tell everyone we're in a chat with that we just went idle.
|
# Tell everyone we're in a chat with that we just went idle.
|
||||||
sysColor = QtGui.QColor(self.theme["convo/systemMsgColor"])
|
sysColor = QtGui.QColor(self.theme["convo/systemMsgColor"])
|
||||||
verb = self.theme["convo/text/idle"]
|
verb = self.theme["convo/text/idle"]
|
||||||
for (h, convo) in self.convos.items():
|
for h, convo in self.convos.items():
|
||||||
# karxi: There's an irritating issue here involving a lack of
|
# karxi: There's an irritating issue here involving a lack of
|
||||||
# consideration for case-sensitivity.
|
# consideration for case-sensitivity.
|
||||||
# This fix is a little sloppy, and I need to look into what it
|
# This fix is a little sloppy, and I need to look into what it
|
||||||
|
@ -3051,7 +3051,6 @@ class PesterWindow(MovingWindow):
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def joinSelectedMemo(self):
|
def joinSelectedMemo(self):
|
||||||
|
|
||||||
time = str(self.memochooser.timeinput.text())
|
time = str(self.memochooser.timeinput.text())
|
||||||
secret = self.memochooser.secretChannel.isChecked()
|
secret = self.memochooser.secretChannel.isChecked()
|
||||||
invite = self.memochooser.inviteChannel.isChecked()
|
invite = self.memochooser.inviteChannel.isChecked()
|
||||||
|
@ -3246,7 +3245,7 @@ class PesterWindow(MovingWindow):
|
||||||
# combine
|
# combine
|
||||||
self.createTabWindow()
|
self.createTabWindow()
|
||||||
newconvos = {}
|
newconvos = {}
|
||||||
for (h, c) in self.convos.items():
|
for h, c in self.convos.items():
|
||||||
c.setParent(self.tabconvo)
|
c.setParent(self.tabconvo)
|
||||||
self.tabconvo.addChat(c)
|
self.tabconvo.addChat(c)
|
||||||
self.tabconvo.show()
|
self.tabconvo.show()
|
||||||
|
@ -3276,7 +3275,7 @@ class PesterWindow(MovingWindow):
|
||||||
# combine
|
# combine
|
||||||
newmemos = {}
|
newmemos = {}
|
||||||
self.createMemoTabWindow()
|
self.createMemoTabWindow()
|
||||||
for (h, m) in self.memos.items():
|
for h, m in self.memos.items():
|
||||||
m.setParent(self.tabmemo)
|
m.setParent(self.tabmemo)
|
||||||
self.tabmemo.addChat(m)
|
self.tabmemo.addChat(m)
|
||||||
self.tabmemo.show()
|
self.tabmemo.show()
|
||||||
|
@ -4293,7 +4292,7 @@ class MainProgram(QtCore.QObject):
|
||||||
for k in Mood.moodcats:
|
for k in Mood.moodcats:
|
||||||
moodCategories[k] = moodMenu.addMenu(k.upper())
|
moodCategories[k] = moodMenu.addMenu(k.upper())
|
||||||
self.moodactions = {}
|
self.moodactions = {}
|
||||||
for (i, m) in enumerate(Mood.moods):
|
for i, m in enumerate(Mood.moods):
|
||||||
maction = QAction(m.upper(), self)
|
maction = QAction(m.upper(), self)
|
||||||
mobj = PesterMoodAction(i, self.widget.moods.updateMood)
|
mobj = PesterMoodAction(i, self.widget.moods.updateMood)
|
||||||
maction.triggered.connect(mobj.updateMood)
|
maction.triggered.connect(mobj.updateMood)
|
||||||
|
|
|
@ -27,6 +27,7 @@ class Color:
|
||||||
# The threshold at which to consider two colors noticeably different, even
|
# The threshold at which to consider two colors noticeably different, even
|
||||||
# if only barely
|
# if only barely
|
||||||
jnd = 2.3
|
jnd = 2.3
|
||||||
|
|
||||||
# TODO: Either subclass (this is probably best) or add a .native_type; in
|
# TODO: Either subclass (this is probably best) or add a .native_type; in
|
||||||
# the case of the former, just make sure each type is geared towards using
|
# the case of the former, just make sure each type is geared towards using
|
||||||
# a certain kind of color space as a starting point, e.g. RGB, XYZ, HSV,
|
# a certain kind of color space as a starting point, e.g. RGB, XYZ, HSV,
|
||||||
|
|
10
profile.py
10
profile.py
|
@ -64,7 +64,7 @@ class PesterLog:
|
||||||
if handle not in self.convos:
|
if handle not in self.convos:
|
||||||
log_time = datetime.now().strftime("%Y-%m-%d.%H.%M")
|
log_time = datetime.now().strftime("%Y-%m-%d.%H.%M")
|
||||||
self.convos[handle] = {}
|
self.convos[handle] = {}
|
||||||
for (format, t) in modes.items():
|
for format, t in modes.items():
|
||||||
if not os.path.exists(
|
if not os.path.exists(
|
||||||
"{}/{}/{}/{}".format(self.logpath, self.handle, handle, format)
|
"{}/{}/{}/{}".format(self.logpath, self.handle, handle, format)
|
||||||
):
|
):
|
||||||
|
@ -81,7 +81,7 @@ class PesterLog:
|
||||||
)
|
)
|
||||||
self.convos[handle][format] = fp
|
self.convos[handle][format] = fp
|
||||||
|
|
||||||
for (format, t) in modes.items():
|
for format, t in modes.items():
|
||||||
f = self.convos[handle][format]
|
f = self.convos[handle][format]
|
||||||
f.write(t + "\r\n")
|
f.write(t + "\r\n")
|
||||||
# flush + fsync force a write,
|
# flush + fsync force a write,
|
||||||
|
@ -737,7 +737,7 @@ class userProfile:
|
||||||
def setMentions(self, mentions):
|
def setMentions(self, mentions):
|
||||||
i = None
|
i = None
|
||||||
try:
|
try:
|
||||||
for (i, m) in enumerate(mentions):
|
for i, m in enumerate(mentions):
|
||||||
re.compile(m)
|
re.compile(m)
|
||||||
except re.error as e:
|
except re.error as e:
|
||||||
PchumLog.error("#{} Not a valid regular expression: {}".format(i, e))
|
PchumLog.error("#{} Not a valid regular expression: {}".format(i, e))
|
||||||
|
@ -835,7 +835,7 @@ class PesterProfileDB(dict):
|
||||||
json.dump(chumdict, fp)
|
json.dump(chumdict, fp)
|
||||||
|
|
||||||
u = []
|
u = []
|
||||||
for (handle, c) in chumdict.items():
|
for handle, c in chumdict.items():
|
||||||
options = dict()
|
options = dict()
|
||||||
if "group" in c:
|
if "group" in c:
|
||||||
options["group"] = c["group"]
|
options["group"] = c["group"]
|
||||||
|
@ -960,7 +960,7 @@ class pesterTheme(dict):
|
||||||
return v
|
return v
|
||||||
|
|
||||||
def pathHook(self, d):
|
def pathHook(self, d):
|
||||||
for (k, v) in d.items():
|
for k, v in d.items():
|
||||||
if isinstance(v, str):
|
if isinstance(v, str):
|
||||||
s = Template(v)
|
s = Template(v)
|
||||||
d[k] = s.safe_substitute(path=self.path)
|
d[k] = s.safe_substitute(path=self.path)
|
||||||
|
|
|
@ -102,14 +102,16 @@ class SendIRC:
|
||||||
def join(self, channel, key=""):
|
def join(self, channel, key=""):
|
||||||
"""Send JOIN command to join a channel/memo.
|
"""Send JOIN command to join a channel/memo.
|
||||||
|
|
||||||
Keys or joining multiple channels is possible in the specification, but unused."""
|
Keys or joining multiple channels is possible in the specification, but unused.
|
||||||
|
"""
|
||||||
channel_and_key = " ".join([channel, key]).strip()
|
channel_and_key = " ".join([channel, key]).strip()
|
||||||
self.send("JOIN", channel_and_key)
|
self.send("JOIN", channel_and_key)
|
||||||
|
|
||||||
def part(self, channel):
|
def part(self, channel):
|
||||||
"""Send PART command to leave a channel/memo.
|
"""Send PART command to leave a channel/memo.
|
||||||
|
|
||||||
Providing a reason or leaving multiple channels is possible in the specification."""
|
Providing a reason or leaving multiple channels is possible in the specification.
|
||||||
|
"""
|
||||||
self.send("PART", channel)
|
self.send("PART", channel)
|
||||||
|
|
||||||
def notice(self, target, text):
|
def notice(self, target, text):
|
||||||
|
|
2
toast.py
2
toast.py
|
@ -103,7 +103,7 @@ class ToastMachine:
|
||||||
def realShow(self):
|
def realShow(self):
|
||||||
self.machine.displaying = True
|
self.machine.displaying = True
|
||||||
t = None
|
t = None
|
||||||
for (k, v) in self.machine.types.items():
|
for k, v in self.machine.types.items():
|
||||||
if self.machine.type == k:
|
if self.machine.type == k:
|
||||||
try:
|
try:
|
||||||
args = inspect.getargspec(v.__init__).args
|
args = inspect.getargspec(v.__init__).args
|
||||||
|
|
Loading…
Reference in a new issue