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)])
|
||||
)
|
||||
convo = self.convos[handle]
|
||||
|
||||
# Create a function for the icon to use
|
||||
# TODO: Let us disable this.
|
||||
def func():
|
||||
|
@ -286,7 +287,7 @@ class PesterTabWindow(QtWidgets.QFrame):
|
|||
del self.convos[handle]
|
||||
del self.tabIndices[handle]
|
||||
self.tabs.removeTab(i)
|
||||
for (h, j) in self.tabIndices.items():
|
||||
for h, j in self.tabIndices.items():
|
||||
if j > i:
|
||||
self.tabIndices[h] = j - 1
|
||||
self.layout.removeWidget(convo)
|
||||
|
@ -954,6 +955,7 @@ class PesterConvo(QtWidgets.QFrame):
|
|||
else:
|
||||
self.newmessage = True
|
||||
self.setWindowTitle(title + "*")
|
||||
|
||||
# karxi: The order of execution here is a bit unclear...I'm not
|
||||
# entirely sure how much of this directly affects what we see.
|
||||
def func():
|
||||
|
|
|
@ -146,7 +146,7 @@ class pesterQuirks:
|
|||
# suffix = [q for q in self.quirklist if q.type == "suffix"]
|
||||
|
||||
newlist = []
|
||||
for (i, o) in enumerate(lexed):
|
||||
for i, o in enumerate(lexed):
|
||||
if type(o) not in [str, str]:
|
||||
if i == 0:
|
||||
string = " "
|
||||
|
|
|
@ -119,7 +119,7 @@ class MultiTextDialog(QtWidgets.QDialog):
|
|||
r = self.exec()
|
||||
if r == QtWidgets.QDialog.DialogCode.Accepted:
|
||||
retval = {}
|
||||
for (name, widget) in self.inputs.items():
|
||||
for name, widget in self.inputs.items():
|
||||
retval[name] = str(widget.text())
|
||||
return retval
|
||||
else:
|
||||
|
|
3
irc.py
3
irc.py
|
@ -916,8 +916,7 @@ class PesterIRC(QtCore.QThread):
|
|||
modes.append("{}{}".format(cur, l))
|
||||
PchumLog.debug("handles=%s", handles)
|
||||
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.
|
||||
if (handles == [""]) & (
|
||||
("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.optionsMenu = QtWidgets.QMenu(self)
|
||||
|
||||
for (_, t) in enumerate(chumMemoList):
|
||||
for _, t in enumerate(chumMemoList):
|
||||
item = QtWidgets.QListWidgetItem(t)
|
||||
item.setForeground(
|
||||
QtGui.QBrush(QtGui.QColor(self.theme["main/chums/userlistcolor"]))
|
||||
|
@ -244,7 +244,7 @@ class PesterLogViewer(QtWidgets.QDialog):
|
|||
child_1 = None
|
||||
last = ["", ""]
|
||||
# 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)
|
||||
if my[0] != last[0]:
|
||||
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:
|
||||
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):
|
||||
r.setChecked(True)
|
||||
self.changePage(types.index(quirk.quirk.type) + 1)
|
||||
|
@ -648,7 +648,7 @@ class PesterQuirkTypes(QtWidgets.QDialog):
|
|||
return
|
||||
cur = self.pages.currentIndex()
|
||||
if cur == 0:
|
||||
for (i, r) in enumerate(self.radios):
|
||||
for i, r in enumerate(self.radios):
|
||||
if r.isChecked():
|
||||
self.changePage(i + 1)
|
||||
else:
|
||||
|
@ -933,7 +933,7 @@ class PesterChooseTheme(QtWidgets.QDialog):
|
|||
|
||||
avail_themes = config.availableThemes()
|
||||
self.themeBox = QtWidgets.QComboBox(self)
|
||||
for (i, t) in enumerate(avail_themes):
|
||||
for i, t in enumerate(avail_themes):
|
||||
self.themeBox.addItem(t)
|
||||
if t == theme.name:
|
||||
self.themeBox.setCurrentIndex(i)
|
||||
|
@ -1416,7 +1416,7 @@ class PesterOptions(QtWidgets.QDialog):
|
|||
avail_themes = self.config.availableThemes()
|
||||
self.themeBox = QtWidgets.QComboBox(self)
|
||||
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)
|
||||
if (not notheme and t == theme.name) or (notheme and t == "pesterchum"):
|
||||
self.themeBox.setCurrentIndex(i)
|
||||
|
@ -1454,7 +1454,7 @@ class PesterOptions(QtWidgets.QDialog):
|
|||
types = self.parent().tm.availableTypes()
|
||||
cur = self.parent().tm.currentType()
|
||||
self.notifyOptions.addItems(types)
|
||||
for (i, t) in enumerate(types):
|
||||
for i, t in enumerate(types):
|
||||
if t == cur:
|
||||
self.notifyOptions.setCurrentIndex(i)
|
||||
break
|
||||
|
|
|
@ -7,8 +7,8 @@ kbloc = [
|
|||
[x for x in "zxcvbnm,.>/?"],
|
||||
]
|
||||
kbdict = {}
|
||||
for (i, l) in enumerate(kbloc):
|
||||
for (j, k) in enumerate(l):
|
||||
for i, l in enumerate(kbloc):
|
||||
for j, k in enumerate(l):
|
||||
kbdict[k] = (i, j)
|
||||
|
||||
sounddict = {
|
||||
|
|
|
@ -64,9 +64,9 @@ def reloadQuirkFunctions():
|
|||
def lexer(string, objlist):
|
||||
"""objlist is a list: [(objecttype, re),...] list is in order of preference"""
|
||||
stringlist = [string]
|
||||
for (oType, regexp) in objlist:
|
||||
for oType, regexp in objlist:
|
||||
newstringlist = []
|
||||
for (stri, s) in enumerate(stringlist):
|
||||
for stri, s in enumerate(stringlist):
|
||||
if type(s) not in [str, str]:
|
||||
newstringlist.append(s)
|
||||
continue
|
||||
|
@ -339,7 +339,7 @@ def convertTags(lexed, format="html"):
|
|||
lexed = lexMessage(lexed)
|
||||
escaped = ""
|
||||
# firststr = True
|
||||
for (i, o) in enumerate(lexed):
|
||||
for i, o in enumerate(lexed):
|
||||
if type(o) in [str, str]:
|
||||
if format == "html":
|
||||
escaped += (
|
||||
|
|
|
@ -2971,7 +2971,7 @@ class PesterWindow(MovingWindow):
|
|||
# Tell everyone we're in a chat with that we just went idle.
|
||||
sysColor = QtGui.QColor(self.theme["convo/systemMsgColor"])
|
||||
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
|
||||
# consideration for case-sensitivity.
|
||||
# This fix is a little sloppy, and I need to look into what it
|
||||
|
@ -3051,7 +3051,6 @@ class PesterWindow(MovingWindow):
|
|||
|
||||
@QtCore.pyqtSlot()
|
||||
def joinSelectedMemo(self):
|
||||
|
||||
time = str(self.memochooser.timeinput.text())
|
||||
secret = self.memochooser.secretChannel.isChecked()
|
||||
invite = self.memochooser.inviteChannel.isChecked()
|
||||
|
@ -3246,7 +3245,7 @@ class PesterWindow(MovingWindow):
|
|||
# combine
|
||||
self.createTabWindow()
|
||||
newconvos = {}
|
||||
for (h, c) in self.convos.items():
|
||||
for h, c in self.convos.items():
|
||||
c.setParent(self.tabconvo)
|
||||
self.tabconvo.addChat(c)
|
||||
self.tabconvo.show()
|
||||
|
@ -3276,7 +3275,7 @@ class PesterWindow(MovingWindow):
|
|||
# combine
|
||||
newmemos = {}
|
||||
self.createMemoTabWindow()
|
||||
for (h, m) in self.memos.items():
|
||||
for h, m in self.memos.items():
|
||||
m.setParent(self.tabmemo)
|
||||
self.tabmemo.addChat(m)
|
||||
self.tabmemo.show()
|
||||
|
@ -4293,7 +4292,7 @@ class MainProgram(QtCore.QObject):
|
|||
for k in Mood.moodcats:
|
||||
moodCategories[k] = moodMenu.addMenu(k.upper())
|
||||
self.moodactions = {}
|
||||
for (i, m) in enumerate(Mood.moods):
|
||||
for i, m in enumerate(Mood.moods):
|
||||
maction = QAction(m.upper(), self)
|
||||
mobj = PesterMoodAction(i, self.widget.moods.updateMood)
|
||||
maction.triggered.connect(mobj.updateMood)
|
||||
|
|
|
@ -27,6 +27,7 @@ class Color:
|
|||
# The threshold at which to consider two colors noticeably different, even
|
||||
# if only barely
|
||||
jnd = 2.3
|
||||
|
||||
# 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
|
||||
# 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:
|
||||
log_time = datetime.now().strftime("%Y-%m-%d.%H.%M")
|
||||
self.convos[handle] = {}
|
||||
for (format, t) in modes.items():
|
||||
for format, t in modes.items():
|
||||
if not os.path.exists(
|
||||
"{}/{}/{}/{}".format(self.logpath, self.handle, handle, format)
|
||||
):
|
||||
|
@ -81,7 +81,7 @@ class PesterLog:
|
|||
)
|
||||
self.convos[handle][format] = fp
|
||||
|
||||
for (format, t) in modes.items():
|
||||
for format, t in modes.items():
|
||||
f = self.convos[handle][format]
|
||||
f.write(t + "\r\n")
|
||||
# flush + fsync force a write,
|
||||
|
@ -737,7 +737,7 @@ class userProfile:
|
|||
def setMentions(self, mentions):
|
||||
i = None
|
||||
try:
|
||||
for (i, m) in enumerate(mentions):
|
||||
for i, m in enumerate(mentions):
|
||||
re.compile(m)
|
||||
except re.error as e:
|
||||
PchumLog.error("#{} Not a valid regular expression: {}".format(i, e))
|
||||
|
@ -835,7 +835,7 @@ class PesterProfileDB(dict):
|
|||
json.dump(chumdict, fp)
|
||||
|
||||
u = []
|
||||
for (handle, c) in chumdict.items():
|
||||
for handle, c in chumdict.items():
|
||||
options = dict()
|
||||
if "group" in c:
|
||||
options["group"] = c["group"]
|
||||
|
@ -960,7 +960,7 @@ class pesterTheme(dict):
|
|||
return v
|
||||
|
||||
def pathHook(self, d):
|
||||
for (k, v) in d.items():
|
||||
for k, v in d.items():
|
||||
if isinstance(v, str):
|
||||
s = Template(v)
|
||||
d[k] = s.safe_substitute(path=self.path)
|
||||
|
|
|
@ -102,14 +102,16 @@ class SendIRC:
|
|||
def join(self, channel, key=""):
|
||||
"""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()
|
||||
self.send("JOIN", channel_and_key)
|
||||
|
||||
def part(self, channel):
|
||||
"""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)
|
||||
|
||||
def notice(self, target, text):
|
||||
|
|
2
toast.py
2
toast.py
|
@ -103,7 +103,7 @@ class ToastMachine:
|
|||
def realShow(self):
|
||||
self.machine.displaying = True
|
||||
t = None
|
||||
for (k, v) in self.machine.types.items():
|
||||
for k, v in self.machine.types.items():
|
||||
if self.machine.type == k:
|
||||
try:
|
||||
args = inspect.getargspec(v.__init__).args
|
||||
|
|
Loading…
Reference in a new issue