From ddbca70e1867ec66cf6af68d985675ac867e0b78 Mon Sep 17 00:00:00 2001 From: Gary Martin Date: Sun, 25 Nov 2012 18:51:53 +0000 Subject: Tidy up comment indentation --- diff --git a/calculate.py b/calculate.py index 0c9e861..6b79e90 100644 --- a/calculate.py +++ b/calculate.py @@ -113,7 +113,7 @@ class Equation: if l[2].startswith(""): l[2] = SVGImage(data=base64.b64decode(l[2][5:])) -# Should figure out how to use MathLib directly in a non-hacky way + # Should figure out how to use MathLib directly in a non-hacky way else: try: l[2] = Decimal(l[2]) @@ -484,8 +484,8 @@ class Calculate(ShareableActivity): res = RuntimeError(_('Can not assign label: will cause recursion'), lastpos) -# If parsing went ok, see if we have to replace the previous answer -# to get a (more) exact result + # If parsing went ok, see if we have to replace the previous answer + # to get a (more) exact result if self.ans_inserted and not isinstance(res, ParserError) \ and not isinstance(res, SVGImage): ansvar = self.format_insert_ans() @@ -562,9 +562,9 @@ class Calculate(ShareableActivity): self.clear() return True -########################################## -# Journal functions -########################################## + ########################################## + # Journal functions + ########################################## def write_file(self, file_path): """Write journal entries, Calculate Journal Version (cjv) 1.0""" @@ -580,7 +580,7 @@ class Calculate(ShareableActivity): sel = (pos, pos) f.write("%s;%d;%d;%d\n" % (self.text_entry.get_text(), pos, sel[0], sel[1])) -# In reverse order + # In reverse order for eq in self.old_eqs: f.write(str(eq)) @@ -623,9 +623,9 @@ class Calculate(ShareableActivity): _logger.error('Unable to read journal entry, unknown version (%s)', version) return False -########################################## -# User interaction functions -########################################## + ########################################## + # User interaction functions + ########################################## def remove_character(self, dir): pos = self.text_entry.get_position() @@ -670,7 +670,7 @@ class Calculate(ShareableActivity): def tab_complete(self): -# Get start of variable name + # Get start of variable name str = self.text_entry.get_text() if len(str) == 0: return @@ -688,17 +688,17 @@ class Calculate(ShareableActivity): partial_name = str[start_ofs:end_ofs] _logger.debug('tab-completing %s...', partial_name) -# Lookup matching variables + # Lookup matching variables vars = self.parser.get_names(start=partial_name) if len(vars) == 0: return False -# Nothing selected, select first match + # Nothing selected, select first match if len(sel) == 0: name = vars[0] self.text_entry.set_text(str[:start_ofs] + name + str[end_ofs:]) -# Select next matching variable + # Select next matching variable else: full_name = str[start_ofs:sel[1]] if full_name not in vars: @@ -712,10 +712,10 @@ class Calculate(ShareableActivity): self.select_reason = self.SELECT_TAB return True -# Selection related functions + # Selection related functions def expand_selection(self, dir): -# _logger.info('Expanding selection in dir %d', dir) + #_logger.info('Expanding selection in dir %d', dir) sel = self.text_entry.get_selection_bounds() slen = len(self.text_entry.get_text()) pos = self.text_entry.get_position() @@ -723,7 +723,8 @@ class Calculate(ShareableActivity): sel = (pos, pos) if dir < 0: newpos = max(0, sel[0] + dir) - self.text_entry.set_position(newpos) # apparently no such thing as a cursor position during select + # apparently no such thing as a cursor position during select + self.text_entry.set_position(newpos) self.text_entry.select_region(newpos, sel[1]) elif dir > 0: newpos = min(sel[1] + dir, slen) @@ -734,7 +735,7 @@ class Calculate(ShareableActivity): def text_copy(self): str = self.text_entry.get_text() sel = self.text_entry.get_selection_bounds() - # _logger.info('text_copy, sel: %r, str: %s', sel, str) + #_logger.info('text_copy, sel: %r, str: %s', sel, str) if len(sel) == 2: (start, end) = sel self.clipboard.set_text(str[start:end]) @@ -801,12 +802,12 @@ class Calculate(ShareableActivity): def add_text(self, input_str): self.button_pressed(self.TYPE_TEXT, input_str) -# This function should be split up properly + # This function should be split up properly def button_pressed(self, str_type, input_str): sel = self.text_entry.get_selection_bounds() pos = self.text_entry.get_position() -# If selection by tab completion just manipulate end + # If selection by tab completion just manipulate end if len(sel) == 2 and self.select_reason != self.SELECT_SELECT: pos = sel[1] sel = () diff --git a/layout.py b/layout.py index ec25ffb..c967527 100644 --- a/layout.py +++ b/layout.py @@ -52,7 +52,7 @@ class CalcLayout: equ_sym = self._parent.ml.equ_sym self.button_data = [ -# [x, y, width, label, bgcol, cb] + # [x, y, width, label, bgcol, cb] [0, 0, 2, 1, u'\u2190', self.col_gray3, lambda w: self._parent.move_left()], [2, 0, 2, 1, u'\u2192', self.col_gray3, lambda w: self._parent.move_right()], [4, 0, 2, 1, u'\u232B', self.col_gray3, lambda w: self._parent.remove_character(-1)], @@ -87,7 +87,7 @@ class CalcLayout: def create_dialog(self): """Setup most of the dialog.""" -# Toolbar + # Toolbar toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self._parent) @@ -137,7 +137,7 @@ class CalcLayout: toolbar_box.show_all() self._parent.set_toolbar_box(toolbar_box) -# Some layout constants + # Some layout constants self.input_font = Pango.FontDescription('sans bold 12') self.button_font = Pango.FontDescription('sans bold 16') self.col_white = self.create_color(1.00, 1.00, 1.00) @@ -147,13 +147,13 @@ class CalcLayout: self.col_black = self.create_color(0.00, 0.00, 0.00) self.col_red = self.create_color(1.00, 0.00, 0.00) -# Big - Table, 16 rows, 10 columns, homogeneously divided + # Big - Table, 16 rows, 10 columns, homogeneously divided self.grid = Gtk.Table(26, 11, True) self.grid.set_border_width(0) self.grid.set_row_spacings(0) self.grid.set_col_spacings(4) -# Left part: container and input + # Left part: container and input vc1 = Gtk.VBox(False, 0) hc1 = Gtk.HBox(False, 10) eb = Gtk.EventBox() @@ -188,7 +188,7 @@ class CalcLayout: vc1.pack_start(eb2, expand=True, fill=True, padding=0) self.grid.attach(vc1, 0, 7, 0, 6) -# Left part: buttons + # Left part: buttons self.pad = Gtk.Table(9, 6, True) self.pad.set_row_spacings(12) self.pad.set_col_spacings(12) @@ -205,7 +205,7 @@ class CalcLayout: eb.modify_bg(Gtk.StateType.NORMAL, self.col_black) self.grid.attach(eb, 0, 7, 6, 26) -# Right part: container and equation button + # Right part: container and equation button hc2 = Gtk.HBox() combo = ComboBox() combo.append_item(0, _('All equations')) @@ -217,7 +217,7 @@ class CalcLayout: hc2.set_border_width(6) self.grid.attach(hc2, 7, 11, 0, 2) -# Right part: last equation + # Right part: last equation self.last_eq = Gtk.TextView() self.last_eq.set_editable(False) self.last_eq.set_wrap_mode(Gtk.WrapMode.WORD_CHAR) @@ -241,7 +241,7 @@ class CalcLayout: self.grid.attach(self.last_eq, 7, 11, 2, 7) -# Right part: history + # Right part: history scrolled_window = Gtk.ScrolledWindow() scrolled_window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) -- cgit v0.9.1