Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/infoslicer/widgets/Reading_View.py
blob: 55609c9bfe2c5ac2384eb3898b38f57fcb038c7a (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
# Copyright (C) IBM Corporation 2008 
import pygtk
pygtk.require('2.0')
import gtk
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):
        gtk.VBox.__init__(self)
        
        self.articlewindow = gtk.ScrolledWindow()
        self.articlewindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.pack_start(self.articlewindow)
        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()