blob: 3c40757d31476b79453fd4c6b135ebfe899b785f (
plain)
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
43
44
45
46
47
48
49
50
|
# Copyright (C) IBM Corporation 2008
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import GObject
from Readonly_Textbox import Readonly_Textbox
import logging
logger = logging.getLogger('infoslicer')
elogger = logging.getLogger('infoslicer::except')
class Reading_View( Gtk.VBox ):
"""
Created by Jonathan Mace
This class wraps a Readonly_Textbox in a scrollable window, and adds
a combobox.
The combobox is populated, externally, with the names of
articles which can be selected.
If an article is selected in the combobox, the readonly_textbox will
be set to display the newly selected article.
"""
def __init__(self):
GObject.GObject.__init__(self)
self.articlewindow = Gtk.ScrolledWindow()
self.articlewindow.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self.pack_start(self.articlewindow, True, True, 0)
self.articlewindow.show()
self.textbox = Readonly_Textbox()
self.articlewindow.add(self.textbox)
self.textbox.show()
def set_sentence_selection_mode(self):
self.textbox.set_mode(0)
def set_paragraph_selection_mode(self):
self.textbox.set_mode(1)
def set_section_selection_mode(self):
self.textbox.set_mode(2)
def set_full_edit_mode(self):
self.textbox.set_mode(3)
def clear_contents(self):
self.textbox.clear()
|