Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 42 lines (40 sloc) 1.391 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/PyRoom/basic_edit.py b/PyRoom/basic_edit.py
index b764828..4abcdd4 100644
--- a/PyRoom/basic_edit.py
+++ b/PyRoom/basic_edit.py
@@ -28,6 +28,7 @@ within this file
 import gtk
 import os
 import urllib
+from arithmetic import ParserGTK
 
 from pyroom_error import PyroomError
 from gui import GUI
@@ -49,6 +50,7 @@ _('Control-Shift-S: Save current buffer as'),
 _('Control-W: Close buffer and exit if it was the last buffer'),
 _('Control-Y: Redo last typing'),
 _('Control-Z: Undo last typing'),
+_('Control-T: do arithmetic operations'),
 _('Control-Page Up: Switch to previous buffer'),
 _('Control-Page Down: Switch to next buffer'), ])
 
@@ -113,6 +115,7 @@ def make_accel_group(edit_instance):
         'p': edit_instance.preferences.show,
         'q': edit_instance.dialog_quit,
         's': edit_instance.save_file,
+ 't': edit_instance.calculate,
         'w': edit_instance.close_dialog,
         'y': edit_instance.redo,
         'z': edit_instance.undo,
@@ -789,3 +792,13 @@ continue editing your document.")
         """cleanup before quitting"""
         autosave.stop_autosave(self)
         state['gui'].quit()
+
+ def calculate(self):
+ """Perform arithmetic operations"""
+
+ # get the buffer
+ buf = self.buffers[self.current]
+
+ # parse and update the buffer
+ parser = ParserGTK()
+ parser.parse( buf )
Something went wrong with that request. Please try again.