Skip to content

Commit

Permalink
Removed unnecessary semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
mthuurne committed Jul 14, 2014
1 parent 69134ca commit c7410da
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 45 deletions.
28 changes: 14 additions & 14 deletions passageframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def error():
if tag != '' and tag not in TiddlyWiki.SPECIAL_TAGS:
self.widget.passage.tags.append(tag)
if tag == "StoryIncludes" and self.widget.parent.parent.autobuildmenuitem.IsChecked():
self.widget.parent.parent.autoBuildStart();
self.widget.parent.parent.autoBuildStart()

self.SetTitle(self.title())

Expand Down Expand Up @@ -376,7 +376,7 @@ def offerAssistance(self):
for img in externalimages:
if not check:
dialog = wx.MessageDialog(self, 'Do you want to import the image files linked\nin this passage into the story file?', 'Import Images', \
wx.ICON_QUESTION | wx.YES_NO | wx.CANCEL | wx.YES_DEFAULT);
wx.ICON_QUESTION | wx.YES_NO | wx.CANCEL | wx.YES_DEFAULT)
check = dialog.ShowModal()
if check == wx.ID_NO:
break
Expand Down Expand Up @@ -605,21 +605,21 @@ def setCodeLexer(self, css = False):
monoFont = wx.Font(self.app.config.ReadInt('monospaceFontSize'), wx.MODERN, wx.NORMAL, \
wx.NORMAL, False, self.app.config.Read('monospaceFontFace'))
body = self.bodyInput
body.StyleSetFont(wx.stc.STC_STYLE_DEFAULT, monoFont);
body.StyleSetFont(wx.stc.STC_STYLE_DEFAULT, monoFont)
body.StyleClearAll()
if css:
for i in range(1,17):
body.StyleSetFont(i, monoFont)
body.StyleSetForeground(wx.stc.STC_CSS_IMPORTANT, TweeStyler.MACRO_COLOR);
body.StyleSetForeground(wx.stc.STC_CSS_COMMENT, TweeStyler.COMMENT_COLOR);
body.StyleSetForeground(wx.stc.STC_CSS_ATTRIBUTE, TweeStyler.GOOD_LINK_COLOR);
body.StyleSetForeground(wx.stc.STC_CSS_CLASS, TweeStyler.MARKUP_COLOR);
body.StyleSetForeground(wx.stc.STC_CSS_ID, TweeStyler.MARKUP_COLOR);
body.StyleSetForeground(wx.stc.STC_CSS_TAG, TweeStyler.PARAM_BOOL_COLOR);
body.StyleSetForeground(wx.stc.STC_CSS_PSEUDOCLASS, TweeStyler.EXTERNAL_COLOR);
body.StyleSetForeground(wx.stc.STC_CSS_UNKNOWN_PSEUDOCLASS, TweeStyler.EXTERNAL_COLOR);
body.StyleSetForeground(wx.stc.STC_CSS_DIRECTIVE, TweeStyler.PARAM_VAR_COLOR);
body.StyleSetForeground(wx.stc.STC_CSS_UNKNOWN_IDENTIFIER, TweeStyler.GOOD_LINK_COLOR);
body.StyleSetForeground(wx.stc.STC_CSS_IMPORTANT, TweeStyler.MACRO_COLOR)
body.StyleSetForeground(wx.stc.STC_CSS_COMMENT, TweeStyler.COMMENT_COLOR)
body.StyleSetForeground(wx.stc.STC_CSS_ATTRIBUTE, TweeStyler.GOOD_LINK_COLOR)
body.StyleSetForeground(wx.stc.STC_CSS_CLASS, TweeStyler.MARKUP_COLOR)
body.StyleSetForeground(wx.stc.STC_CSS_ID, TweeStyler.MARKUP_COLOR)
body.StyleSetForeground(wx.stc.STC_CSS_TAG, TweeStyler.PARAM_BOOL_COLOR)
body.StyleSetForeground(wx.stc.STC_CSS_PSEUDOCLASS, TweeStyler.EXTERNAL_COLOR)
body.StyleSetForeground(wx.stc.STC_CSS_UNKNOWN_PSEUDOCLASS, TweeStyler.EXTERNAL_COLOR)
body.StyleSetForeground(wx.stc.STC_CSS_DIRECTIVE, TweeStyler.PARAM_VAR_COLOR)
body.StyleSetForeground(wx.stc.STC_CSS_UNKNOWN_IDENTIFIER, TweeStyler.GOOD_LINK_COLOR)

for i in [wx.stc.STC_CSS_CLASS, wx.stc.STC_CSS_ID, wx.stc.STC_CSS_TAG,
wx.stc.STC_CSS_PSEUDOCLASS, wx.stc.STC_CSS_OPERATOR, wx.stc.STC_CSS_IMPORTANT,
Expand Down Expand Up @@ -1084,7 +1084,7 @@ def replaceImage(self, event = None):

def saveImage(self, event = None):
"""Saves the base64 image as a file."""
t = self.widget.passage.text;
t = self.widget.passage.text
# Get the extension
extension = images.GetImageType(t)
dialog = wx.FileDialog(self, 'Save Image', os.getcwd(), self.widget.passage.title + extension, \
Expand Down
8 changes: 4 additions & 4 deletions passagewidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def findSpace(self):

while self.intersectsAny() and turns < 99*griddivision:
"""Move in an Ulam spiral pattern: n spaces left, n spaces up, n+1 spaces right, n+1 spaces down"""
self.pos[int(math.floor((turns*2) % 2))] += self.parent.GRID_SPACING * griddivision * int(math.copysign(1, turns % 2 - 1));
self.pos[int(math.floor((turns*2) % 2))] += self.parent.GRID_SPACING * griddivision * int(math.copysign(1, turns % 2 - 1))
movecount -= 1
if movecount <= 0:
turns += 0.5
Expand Down Expand Up @@ -729,11 +729,11 @@ def dim(c, dim, flat=flat):
height = size.height - titleBarHeight

# choose smaller of vertical and horizontal scale factor, to preserve aspect ratio
scale = min(width/float(self.bitmap.GetWidth()), height/float(self.bitmap.GetHeight()));
scale = min(width/float(self.bitmap.GetWidth()), height/float(self.bitmap.GetHeight()))

img = self.bitmap.ConvertToImage();
img = self.bitmap.ConvertToImage()
if scale != 1:
img = img.Scale(scale*self.bitmap.GetWidth(),scale*self.bitmap.GetHeight());
img = img.Scale(scale*self.bitmap.GetWidth(),scale*self.bitmap.GetHeight())

# offset image horizontally or vertically, to centre after scaling
offsetWidth = (width - img.GetWidth())/2
Expand Down
8 changes: 4 additions & 4 deletions statisticsdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ def count(widget, counts):
counts['links'] += len(widget.passage.links)
counts['brokenLinks'] += len(widget.getBrokenLinks())
# Find variables
iterator = re.finditer(tweeregex.MACRO_REGEX + "|" + tweeregex.LINK_REGEX, widget.passage.text, re.U|re.I);
iterator = re.finditer(tweeregex.MACRO_REGEX + "|" + tweeregex.LINK_REGEX, widget.passage.text, re.U|re.I)
for p in iterator:
iterator2 = re.finditer(tweeregex.MACRO_PARAMS_REGEX, p.group(0), re.U|re.I)
for p2 in iterator2:
if p2.group(4):
variables.add(p2.group(4));
variables.add(p2.group(4))
# Find tags
for a in widget.passage.tags:
if a not in TiddlyWiki.INFO_TAGS:
Expand All @@ -113,13 +113,13 @@ def count(widget, counts):
self.variablesCount.SetLabel(str(len(variables)))

if len(variables):
text = ', '.join(sorted(variables));
text = ', '.join(sorted(variables))
variablesCtrl = wx.TextCtrl(panel, -1, size=(StatisticsDialog.MIN_WIDTH*.9, 60), style=wx.TE_MULTILINE|wx.TE_READONLY)
variablesCtrl.AppendText(text)
self.panelSizer.Add(variablesCtrl, flag = wx.ALIGN_CENTER)

if len(tags):
text = ', '.join(sorted(tags));
text = ', '.join(sorted(tags))
tagsCtrl = wx.TextCtrl(panel, -1, size=(StatisticsDialog.MIN_WIDTH*.9, 60), style=wx.TE_MULTILINE|wx.TE_READONLY)
tagsCtrl.AppendText(text)
self.panelSizer.Add(wx.StaticText(panel, label = str(len(tags)) + " Tags"), flag = wx.ALIGN_CENTER)
Expand Down
12 changes: 6 additions & 6 deletions storyframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def revert(self, event=None):
if (dialog.ShowModal() == wx.ID_YES):
self.Destroy()
self.app.open(self.saveDestination)
self.dirty = False;
self.dirty = False
self.checkClose(None)

def checkClose(self, event):
Expand All @@ -478,7 +478,7 @@ def checkCloseDo(self, event, byMenu):
message = 'Do you want to save the changes to ' + title + ' before closing?'
dialog = wx.MessageDialog(self, message, 'Unsaved Changes', \
wx.ICON_WARNING | wx.YES_NO | wx.CANCEL | wx.YES_DEFAULT)
result = dialog.ShowModal();
result = dialog.ShowModal()
if (result == wx.ID_CANCEL):
event.Veto()
return
Expand Down Expand Up @@ -601,8 +601,8 @@ def importSource(self, path, html=False):
dialog = wx.MessageDialog(self, 'There is already a passage titled "' + t \
+ '" in this story. Replace it with the imported passage?',
'Passage Title Conflict', \
wx.ICON_WARNING | wx.YES_NO | wx.CANCEL | wx.YES_DEFAULT);
check = dialog.ShowModal();
wx.ICON_WARNING | wx.YES_NO | wx.CANCEL | wx.YES_DEFAULT)
check = dialog.ShowModal()
if check == wx.ID_YES:
removedWidgets.append(t)
elif check == wx.ID_CANCEL:
Expand Down Expand Up @@ -654,7 +654,7 @@ def importImageURL(self, url, showdialog=True):
file = urlfile.read().encode('base64').replace('\n', '')

# Now that the file's read, check the info
maintype = urlfile.info().getmaintype();
maintype = urlfile.info().getmaintype()
if maintype != "image":
self.app.displayError("importing from the web: The server served " + maintype + " instead of an image",
stacktrace=False)
Expand Down Expand Up @@ -1016,7 +1016,7 @@ def autoBuild(self, event=None):
"""
if self.autobuildmenuitem.IsChecked():
self.autobuildtimer.Start(5000)
self.autoBuildStart();
self.autoBuildStart()
else:
self.autobuildtimer.Stop()

Expand Down
6 changes: 3 additions & 3 deletions storypanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, parent, app, id = wx.ID_ANY, state = None):
if (state):
self.scale = state['scale']
for widget in state['widgets']:
pw = PassageWidget(self, self.app, state = widget);
pw = PassageWidget(self, self.app, state = widget)
self.widgetDict[pw.passage.title] = pw
if ('snapping' in state):
self.snapping = state['snapping']
Expand Down Expand Up @@ -986,7 +986,7 @@ def tooltipShow(self):
if self.tooltipplace != None and self.trackinghover and not self.draggingWidgets:
m = wx.GetMousePosition()
p = self.tooltipplace.passage
length = len(p.text);
length = len(p.text)
if p.isImage():
mimeType = "unknown"
mimeTypeRE = re.search(r"data:image/([^;]*);",p.text)
Expand Down Expand Up @@ -1156,7 +1156,7 @@ def OnData(self, x, y, d):
elif type == wx.DF_FILENAME:

imageRegex = r'\.(?:jpe?g|png|gif|webp|svg)$'
files = self.filedrop.GetFilenames();
files = self.filedrop.GetFilenames()

# Check if dropped files contains multiple images,
# so the correct dialogs are displayed
Expand Down
8 changes: 4 additions & 4 deletions tiddlywiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def insertEngine(app, output, filename, label, extra = ''):
bodyEncoders = []

rot13 = 'obfuscate' in self.storysettings and \
self.storysettings['obfuscate'] != 'off';
self.storysettings['obfuscate'] != 'off'
# In case it was set to "swap" (legacy 1.4.1 file),
# alter and remove old properties.
if rot13:
Expand Down Expand Up @@ -274,7 +274,7 @@ def addHtml(self, source):
divs = re.search(r'<div\s+id=(["\']?)store(?:A|-a)rea\1(?:\s+data-size=(["\']?)\d+\2)?(?:\s+hidden)?\s*>(.*)</div>', source,
re.DOTALL)
if divs:
divs = divs.group(3);
divs = divs.group(3)
# HTML may be obfuscated.
obfuscatekey = ''
storysettings_re = r'[^>]*\stiddler=["\']?StorySettings["\']?[^>]*>.*?</div>'
Expand Down Expand Up @@ -433,7 +433,7 @@ def decode_obfuscate_swap(text):
if title:
self.title = title.group(1)
if obfuscatekey:
self.title = decode_obfuscate_swap(self.title);
self.title = decode_obfuscate_swap(self.title)

# tags

Expand All @@ -442,7 +442,7 @@ def decode_obfuscate_swap(text):
tags = tags_re.search(source)
if tags and tags.group(1) != '':
if obfuscatekey:
self.tags = decode_obfuscate_swap(tags.group(1)).split(' ');
self.tags = decode_obfuscate_swap(tags.group(1)).split(' ')
else: self.tags = tags.group(1).split(' ')

# creation date
Expand Down
20 changes: 10 additions & 10 deletions tweelexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ def applyMacroStyle(pos, m):
styleStack = []
styleStart = pos
inSilence = False
macroNestStack = []; # macro nesting
macroNestStack = [] # macro nesting
header = self.getHeader()

self.applyStyle(0, len(text), self.DEFAULT);
self.applyStyle(0, len(text), self.DEFAULT)

iterator = re.finditer(re.compile(tweeregex.COMBINED_REGEX, re.U|re.I), text[pos:]);
iterator = re.finditer(re.compile(tweeregex.COMBINED_REGEX, re.U|re.I), text[pos:])

for p in iterator:
prev = pos+1
Expand Down Expand Up @@ -148,7 +148,7 @@ def applyMacroStyle(pos, m):

#link
elif nextToken == self.GOOD_LINK:
length = m.end(0);
length = m.end(0)
self.applyStyle(styleStart, pos-styleStart, style)

# check for prettylinks
Expand Down Expand Up @@ -187,19 +187,19 @@ def applyMacroStyle(pos, m):
styled = True
macroNestStack.append((i,pos, m))
if i=="silently":
inSilence = True;
inSilence = True
styleStack.append(style)
style = self.SILENT
elif header.isEndTag(name, i):
if macroNestStack and macroNestStack[-1][0] == i:
# Re-style open macro
macroStart,macroMatch = macroNestStack.pop()[1:];
macroStart,macroMatch = macroNestStack.pop()[1:]
applyMacroStyle(macroStart,macroMatch)
else:
styled = True
self.applyStyle(pos, length, self.BAD_MACRO)
if i=="silently":
inSilence = False;
inSilence = False
style = styleStack.pop() if styleStack else self.DEFAULT

if not styled:
Expand All @@ -209,7 +209,7 @@ def applyMacroStyle(pos, m):

# image (cannot have interior markup)
elif nextToken == self.IMAGE:
length = m.end(0);
length = m.end(0)
self.applyStyle(styleStart, pos-styleStart, style)
# Check for linked images
if m.group(5):
Expand Down Expand Up @@ -246,7 +246,7 @@ def applyMacroStyle(pos, m):

# others
elif nextToken in [self.HTML, self.HTML_BLOCK, self.COMMENT, self.MONO]:
length = m.end(0);
length = m.end(0)
self.applyStyle(styleStart, pos-styleStart, style)
self.applyStyle(pos, length, nextToken)
pos += length-1
Expand All @@ -257,7 +257,7 @@ def applyMacroStyle(pos, m):

# Fix up unmatched macros
while macroNestStack:
macroStart,macroMatch = macroNestStack.pop()[1:];
macroStart,macroMatch = macroNestStack.pop()[1:]
self.applyStyle(macroStart, macroMatch.end(0), self.BAD_MACRO)

@staticmethod
Expand Down

0 comments on commit c7410da

Please sign in to comment.