-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
34 lines (30 loc) · 1.09 KB
/
__init__.py
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
from zim.actions import action
from zim.plugins import PluginClass, WindowExtension, extends
class HorizontalRule(PluginClass):
plugin_info = {
'name': _('Horizontal Rule'), # T: plugin name
'description': _('`<Ctrl> + <Shift> + R` Short cut for insert horizontal rule..'), # T: plugin description
'author': 'Viacheslav Wolf',
'help': 'Plugins:Horizontal Rule',
}
@extends('MainWindow')
class MainWindowExtension(WindowExtension):
uimanager_xml = '''
<ui>
<menubar name='menubar'>
<menu action='insert_menu'>
<placeholder name='plugin_items'>
<menuitem action='insert_hr'/>
</placeholder>
</menu>
</menubar>
</ui>
'''
@action(
_('Horizontal Rule'),
readonly=True,
accelerator='<Control><Shift>R'
) # T: menu item
def insert_hr(self):
buffer = self.window.pageview.view.get_buffer()
buffer.insert_at_cursor("\n________________________________________________\n")