Skip to content

Commit

Permalink
Insert UUID at cursor.
Browse files Browse the repository at this point in the history
  • Loading branch information
andialbrecht committed Jan 9, 2017
1 parent f23c149 commit 6191326
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rsr/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@
'description': 'Closes the current editor',
'shortcut': '<Ctrl>W',
'callback': 'editor.close',
},
'insert_uuid': {
'label': 'Insert UUID',
'description': 'Inserts a new UUID at cursor',
'callback': 'editor.insert_uuid',
'shortcut': '<Alt><Shift>u'
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions rsr/worksheet/editor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import uuid

import cairo
from gi.repository import Gtk, GtkSource, Pango, GObject, Gdk

Expand Down Expand Up @@ -217,6 +219,9 @@ def jump_prev(self):
def close(self):
self.worksheet.win.docview.close_current_editor()

def insert_uuid(self):
self.buffer.insert_at_cursor(str(uuid.uuid4()))

def get_parsed_statement(self):
return self._parsed

Expand Down

0 comments on commit 6191326

Please sign in to comment.