diff -Nru calcool-12.04/bin/calcool calcool-12.06/bin/calcool --- calcool-12.04/bin/calcool 2012-04-18 15:45:13.000000000 +0000 +++ calcool-12.06/bin/calcool 2012-06-25 16:21:47.000000000 +0000 @@ -119,16 +119,23 @@ rows = text.split('\n') otxt = [] computed_values = [] - for r in rows: + def expand_lines(line): + return re.sub('line(\d+)', lambda m: 'line%010d'%int(m.groups(0)[0]), line) + def resolve_row(r, line): #if r not in self._results: try: r_ = r + r_ = expand_lines(r_) + match = re.compile('line(\d+)').findall(r) + match = filter(lambda l: int(l) <= len(rows), match) if match: for l in match: l = int(l) - if l < len(rows): - r_ = r_.replace('line%s' % l, '(%s)' % rows[l-1]) + assert(l!=line) + value = '(%s)' % expand_lines(rows[l-1]) + r_ = r_.replace('line%010d' % l, value) + r_ = resolve_row(r_, line) #print r, r_ result = str(eval(r_, {"__builtins__":None}, safe_dict)) @@ -138,7 +145,10 @@ computed_values.append((offset, offset+len(result)+1)) except: result = r - otxt.append(result) + return result + + for i, r in enumerate(rows): + otxt.append(resolve_row(r, i+1)) output = self.builder.get_object('output').get_buffer() output.set_text('\n'.join(otxt)) @@ -165,6 +175,15 @@ buff.set_text("") self.update_output() + def load_file(self, filename): + with open(filename) as f: + text = f.read().decode('utf-8') + #set the UI to display the string + buff = self.builder.get_object("input").get_buffer() + buff.set_text(text) + self.update_output() + self.filename = filename + def open_file(self, widget, data=None): dialog = gtk.FileChooserDialog(title=None,action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK)) @@ -185,14 +204,10 @@ response = dialog.run() if response == gtk.RESPONSE_OK: filename = dialog.get_filename() - with open(filename) as f: - text = f.read().decode('utf-8') - #set the UI to display the string - buff = self.builder.get_object("input").get_buffer() - buff.set_text(text) - self.update_output() - self.filename = filename - dialog.destroy() + dialog.destroy() + self.load_file(filename) + else: + dialog.destroy() def save_file(self, widget, data=None): @@ -270,6 +285,8 @@ #run the application window = NewCalcoolWindow() window.show() + if args: + window.load_file(args[0]) gtk.main() def save_file(self, widget, data=None): print "save" Binary files /tmp/LeO3R3QtKj/calcool-12.04/bin/.calcool.swp and /tmp/HXFNUBSWSq/calcool-12.06/bin/.calcool.swp differ diff -Nru calcool-12.04/data/ui/AboutCalcoolDialog.ui calcool-12.06/data/ui/AboutCalcoolDialog.ui --- calcool-12.04/data/ui/AboutCalcoolDialog.ui 2012-04-18 15:45:13.000000000 +0000 +++ calcool-12.06/data/ui/AboutCalcoolDialog.ui 2012-06-25 16:21:47.000000000 +0000 @@ -8,7 +8,7 @@ normal False Calcool - 12.04 + 12.06 Calcool allows you to do calculations in a document, on the right you have the result for each line. If you ever used bc and wanted to edit a previous diff -Nru calcool-12.04/debian/changelog calcool-12.06/debian/changelog --- calcool-12.04/debian/changelog 2012-04-18 15:45:23.000000000 +0000 +++ calcool-12.06/debian/changelog 2012-06-25 16:21:55.000000000 +0000 @@ -1,3 +1,9 @@ +calcool (12.06) precise; urgency=low + + * resolved lines in lines + + -- Jan Gerber Mon, 25 Jun 2012 18:21:55 +0200 + calcool (12.04) precise; urgency=low * new release diff -Nru calcool-12.04/.quickly calcool-12.06/.quickly --- calcool-12.04/.quickly 2012-04-18 15:44:50.000000000 +0000 +++ calcool-12.06/.quickly 2012-06-25 16:21:41.000000000 +0000 @@ -1,4 +1,4 @@ project = calcool template = ubuntu-application lp_id = calcool -version = 12.03 +version = 12.06 diff -Nru calcool-12.04/setup.py calcool-12.06/setup.py --- calcool-12.04/setup.py 2012-04-18 15:45:13.000000000 +0000 +++ calcool-12.06/setup.py 2012-06-25 16:21:47.000000000 +0000 @@ -93,7 +93,7 @@ DistUtilsExtra.auto.setup( name='calcool', - version='12.04', + version='12.06', license='GPL-3', author='j^', author_email='j@mailb.org',