Commit 90d69638 authored by Cage, Marshall Andrew's avatar Cage, Marshall Andrew
Browse files

Fix spelling

parent bd2cd980
......@@ -13,7 +13,7 @@ class Profile():
self.name = "New Profile"
# Section Titles map to indicies in "sections"
# Section Titles map to indices in "sections"
self.sectionTitles = {}
self.sections = []
self.context = None
......@@ -466,7 +466,7 @@ class DateContext(Context):
return {
"name" : cd.toString("MMMM"),
"long" : cd.toString("MMMM"),
"abreviation" : cd.toString("MMM"),
"abbreviation" : cd.toString("MMM"),
"short" : cd.toString("MMM"),
"number" : cd.toString("M"),
}[format.lower()]
......@@ -483,7 +483,7 @@ class DateContext(Context):
return {
"name" : cd.toString("dddd"),
"long" : cd.toString("dddd"),
"abreviation" : cd.toString("ddd"),
"abbreviation" : cd.toString("ddd"),
"short" : cd.toString("ddd"),
"number" : cd.toString("d"),
}[format.lower()]
......
......@@ -11,7 +11,8 @@ except ImportError:
pass
class Document(QTextDocument):
realHtml = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>'
realHtml = ('<html><head><meta http-equiv="Content-Type"'
'content="text/html; charset=utf-8"/></head><body>')
def __init__(self,title="Untitled Document"):
super(Document,self).__init__()
self.title = title
......@@ -54,17 +55,6 @@ class Document(QTextDocument):
def getTitle(self):
return self.title
# def odfExport(document,title=''):
# path = QFileDialog.getSaveFileName(
# None,"Export Report",title+'.odf',
# "Open Document Format (*.odf)"
# )
# if path is None or path[0] == '':
# return
# writer = QTextDocumentWriter(path[0],b"ODF")
# writer.write(document)
def textExport(document,title=''):
path = QFileDialog.getSaveFileName(
None,"Export Report",title+'.txt',
......
......@@ -5,7 +5,7 @@ from ui.logindialog import Ui_LoginDialog
from . import arcclasses as ARCC
class PluginSelectDialog(QDialog):
# This is bad. If another object want's to be the parent, what will happen?
# This is bad. If another object wants to be the parent, what will happen?
# But at the same time, this needs to be relatively static due to it being
# needed by different parts of the program. Maybe have instances tied to
# the ARCTool and just have things find that? WHAT SHOULD I DO. Oh well, it
......
......@@ -354,7 +354,7 @@ class ARCTool(QMainWindow):
print("Missing section details")
return
# As a matter of course, these indicies correspond to those in sections
# As a matter of course, these indices correspond to those in sections
plugins = []
for s in sections:
section = re.search(
......@@ -389,7 +389,7 @@ class ARCTool(QMainWindow):
# Construct a dictionary of key -> (value, prop, type)
# or key -> value
if options:
# ummm should escap xml so this can't get tricked
# ummm should escape xml so this can't get tricked
# print(options)
numOpts = len(re.findall("<\s*opt",options))
numExt = len(re.findall("<\s*extra",options))
......@@ -401,7 +401,7 @@ class ARCTool(QMainWindow):
properties = re.findall("property\s*=\s*\"(\w+)",options)
types = re.findall("type\s*=\s*\"(\w+)",options)
# print(keys, values)
# Make sure to unescape quotes, BTW
# Make sure to un-escape quotes, BTW
options = dict(
[
(keys[x],
......@@ -430,7 +430,7 @@ class ARCTool(QMainWindow):
if plugins[x][0] != "None":
m = self.packageNames[plugins[x][1]].newPlugin(plugins[x][0])
if m is None:
# Should disable section, but keep the plugin assossciation
# Should disable section, but keep the plugin association
continue
# print("Set %s to %s" %(sections[x][0],plugins[x][0]))
# Options
......
......@@ -262,7 +262,7 @@ class Plugin(arcclasses.Plugin):
plc.removeSelectedText()
go = plc.movePosition(plc.NextBlock)
# print('pleasantries forgone')
print(doc.toHtml().count(chr(29)))
# print(doc.toHtml().count(chr(29)))
if self.igSpace:
......
......@@ -21,7 +21,7 @@ class EmailFilterLogicValidator(QtGui.QValidator):
(?:^|(?<=\ ))and(?=\W)|
(?:^|(?<=\ ))or(?=\W)|
(?<!^not)(?<!\ not)
(?<!\(not)(?<!\()(?<!!)\ +(?!\))''',str)\
(?<!\(not)(?<!\()(?<!!)\ +(?!\))''',str)
if x != '']
ops = re.findall('''(?ix)&{1,2}|\|{1,2}|(?:^|(?<=\ ))and(?=\W)|
(?:^|(?<=\ ))or(?=\W)''',str)
......@@ -176,7 +176,7 @@ class EmailFilterTable(QtWidgets.QTableWidget):
# No symbols, only ors and nots (and labels and p'rens)
pat = [x for x in re.split('''(?ix)[&|]{1,2}|(?:^|(?<=\ ))and(?=\W)|
(?:^|(?<=\ ))or(?=\W)|(?<!^not)(?<!\ not)
(?<!\(not)(?<!\()(?<!!)\ +(?!\))''',logic)\
(?<!\(not)(?<!\()(?<!!)\ +(?!\))''',logic)
if x != '']
labels = re.findall('(\w+) *(?:\)+)?(?=,|$)',','.join(pat))
......@@ -202,7 +202,7 @@ class EmailFilterTable(QtWidgets.QTableWidget):
# print(split)
parts = [p for p in\
re.split('|'.join(['(?:^|(?<= |\())%s(?:$|(?= |\)))' %(x) for x in\
re.split('|'.join(['(?:^|(?<= |\())%s(?:$|(?= |\)))' %(x) for x in
set(labels)]),' '.join(split)) if p != None and p != '']
# print(pat)
......@@ -258,6 +258,7 @@ class EmailFilterTable(QtWidgets.QTableWidget):
self.filters[f].setValue(filters[f][2][1:-1].replace('\\"','"'))
class EmailFilter():
# Criterion and their types
_crit = [
('ANSWERED','bool'),('BCC','string'),('BEFORE','date'),
('BODY','string'),('CC','string'),('DELETED','bool'),
......@@ -269,6 +270,7 @@ class EmailFilter():
('SUBJECT','string'),('TEXT','string'),('TO','string'),
('UID','string')
]
# Criterion with proper casing
_critNice = [
'Answered','BCC','Before','Body','CC','Deleted',
'Draft','Flagged','From','Keyword','Larger','New',
......@@ -276,6 +278,7 @@ class EmailFilter():
'Sent Since','Since','Smaller','Subject','Text','To',
'UID'
]
# Possible labels
_ops = {
'string' : ('contains', 0),
'bool' : ('is', 1),
......@@ -299,6 +302,7 @@ class EmailFilter():
]
self.widgets[0].setValidator(self._validator)
self.widgets[1].addItems(self._critNice)
# String
self.widgets[3].addWidget(QtWidgets.QLineEdit())
self.widgets[3].widget(0).textChanged.connect(
......
......@@ -445,9 +445,9 @@ class Plugin(arcclasses.Plugin):
brush = QBrush(QColor('#00e34b'))
highlight.setBackground(brush)
for s in set:
print('e')
# print('e')
cursor.setPosition(s[0])
print('f')
# print('f')
cursor.setPosition(s[1],cursor.KeepAnchor)
cursor.mergeCharFormat(highlight)
cursor.endEditBlock()
......@@ -458,7 +458,7 @@ class Plugin(arcclasses.Plugin):
item = GlobItem()
for message in self.groups[g]:
doc = QTextDocument()
print('message in', g)
# print('message in', g)
body = ''
for part in message.walk():
typ = part.get_content_type()
......@@ -487,11 +487,11 @@ class Plugin(arcclasses.Plugin):
curs = []
for p in self.groups[g][message]:
curs.append(QTextCursor(doc))
print(p,doc.characterCount())
print('g')
# print(p,doc.characterCount())
# print('g')
curs[-1].setPosition(p[0])
print('h')
# print('h')
curs[-1].setPosition(p[1],curs[-1].KeepAnchor)
if curs[-1].selectedText() == '':
......@@ -565,7 +565,7 @@ class Plugin(arcclasses.Plugin):
)
# print('find $%s$: %s' %(group, 'FAIL' if cur.isNull()
# else 'OK'))
print('loop', len(self.groups))
# print('loop', len(self.groups))
text, ok, perc = self.items[group].getText(ref)
# print('find starting at %d: %s %f' %(i,text,perc))
while not cur.isNull():
......
......@@ -34,7 +34,7 @@ class Glob(object):
self.dev = 0.0 # Deviation (stdev/mean)
self.num = '0'*12 # Unique number, independent of text. 96 bits
if len(curs) > 0:
print(curs)
# print(curs)
self.setValue(*curs)
def __str__(self):
......@@ -243,15 +243,15 @@ class GlobItem():
sum( 1 for g in self.globs if g.cla == 1),
sum( 1 for g in self.globs if g.cla == 2))
self.cla = cou.index(max(cou))
print('class for glob set to',self.sub)
# print('class for glob set to',self.sub)
cou = ( sum( 1 for g in self.globs if g.sub == 0),
sum( 1 for g in self.globs if g.sub == 1),
sum( 1 for g in self.globs if g.sub == 2))
self.sub = cou.index(max(cou))
print('sub for glob set to',self.sub)
# print('sub for glob set to',self.sub)
print([g.cov for g in self.globs])
# print([g.cov for g in self.globs])
self.cov = sum(g.cov for g in self.globs)/len(self.globs)
self.cov = (self.cov,sqrt(
sum((g.cov-self.cov)**2 for g in self.globs)/len(self.globs)))
......@@ -282,12 +282,12 @@ class GlobItem():
sta = self.sta[1][0]*cha # get start relative to this doc
if (sta >= self.sta[0][0]-self.sta[0][1] and
sta <= self.sta[0][0]+self.sta[0][1]):
print('aaa')
# print('aaa')
cur.setPosition(sta) # use relative if within expectations
cer += .1
else:
# use hard start. doesn't boost confidence
print('b')
# print('b')
cur.setPosition(self.sta[0][0])
inb = cur.blockNumber() # cursor's starting block
cur.movePosition(cur.StartOfWord)
......@@ -295,14 +295,14 @@ class GlobItem():
end = self.end[1][0]*cha
if (end >= self.end[0][0]-self.end[0][1] and
end <= self.end[0][0]+self.end[0][1]):
print('c')
# print('c')
cur.setPosition(end,cur.KeepAnchor)
cer += .1
else:
print('e')
# print('e')
cur.setPosition(self.end[0][0],cur.KeepAnchor)
cur.movePosition(cur.EndOfWord,cur.KeepAnchor)
print('flag a')
# print('flag a')
# Match word count based on line sub classification
if self.cla == 0:
print("I'm a line")
......@@ -339,7 +339,7 @@ class GlobItem():
cur.movePosition(cur.EndOfBlock,cur.KeepAnchor)
# print('d')
print('flag b')
# print('flag b')
text = cur.selectedText() # go ahead and grab the text
# check coverage, word count, line count and deviation,
......
......@@ -49,9 +49,11 @@ class Plugin(arcclasses.Plugin):
def storeOptions(self):
self.options["prefix"] = (self.widget.prefix.text(), "text")
self.options["suffix"] = (self.widget.suffix.text(), "text")
self.options["styleBox"] = (self.widget.styleBox.currentIndex(), "currentIndex")
self.options["styleBox"] = (self.widget.styleBox.currentIndex(),
"currentIndex")
# for i in range(self.items):
self.extras["list"] = '||'.join(self.widget.list.item(i).text().replace('|',' |') for i in range(self.items))
self.extras["list"] = '||'.join(self.widget.list.item(i).text()
.replace('|',' |') for i in range(self.items))
#override
def generate(self):
......@@ -93,4 +95,5 @@ class Plugin(arcclasses.Plugin):
def styleChanged(self,index):
self.widget.fixWidget.setEnabled(index > 2)
s = ['...','1','a','A','i','I']
self.widget.label.setText(s[max(self.widget.styleBox.currentIndex()-2,0)])
\ No newline at end of file
self.widget.label.setText(
s[max(self.widget.styleBox.currentIndex()-2,0)])
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment