Subversion Repositories basico

Rev

Rev 232 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
232 t00m 1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
# File: listreview.py
4
# Author: Tomás Vírseda
5
# License: GPL v3
6
# Description: ListReview widgets
7
 
8
from os.path import sep as SEP
9
from cgi import escape
10
import gi
11
gi.require_version('Gtk', '3.0')
12
gi.require_version('Gdk', '3.0')
13
from gi.repository import Gtk
14
from gi.repository import Gdk
15
from gi.repository import Pango
16
 
233 t00m 17
from basico.core.env import ROOT, USER_DIR, APP, LPATH, GPATH, FILE
18
from basico.core.service import Service
232 t00m 19
 
20
 
21
class ListReview(Gtk.ScrolledWindow, Service):
22
    def __init__(self, app):
23
        Gtk.ScrolledWindow.__init__(self)
24
        self.app = app
25
 
26
        self.get_services()
27
 
28
        self.setup()
29
 
30
 
31
    def get_services(self):
32
        """Load services to be used in this class
33
        """
34
        self.gui = self.app.get_service("GUI")
35
 
36
 
37
    def setup(self):
38
        self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
39
        self.set_shadow_type(Gtk.ShadowType.IN)
40
        viewport = Gtk.Viewport()
41
        self.treeview = Gtk.TreeView()
42
        viewport.add(self.treeview)
43
        self.add(viewport)
44
 
45
        # Setup model
46
        self.model = Gtk.ListStore(
47
            str,        # SAP Note ID
48
            str,        # Title
49
            str         # RC
50
        )
51
        self.treeview.set_model(self.model)
52
 
53
        # Setup columns
54
        # SAP Note Id
55
        self.renderer_sid = Gtk.CellRendererText()
56
        self.column_sid = Gtk.TreeViewColumn('SAP Note', self.renderer_sid, markup=0)
57
        self.column_sid.set_visible(True)
58
        self.column_sid.set_expand(False)
59
        self.column_sid.set_clickable(False)
60
        self.column_sid.set_sort_indicator(False)
61
        self.treeview.append_column(self.column_sid)
62
 
63
        # SAP Note Title
64
        self.renderer_title = Gtk.CellRendererText()
65
        self.column_title = Gtk.TreeViewColumn('Title', self.renderer_title, markup=1)
66
        self.column_title.set_visible(True)
67
        self.column_title.set_expand(True)
68
        self.column_title.set_clickable(False)
69
        self.column_title.set_sort_indicator(False)
70
        self.treeview.append_column(self.column_title)
71
 
72
        # SAP Note RC
73
        self.renderer_rc = Gtk.CellRendererText()
74
        self.column_rc = Gtk.TreeViewColumn('RC', self.renderer_rc, markup=2)
75
        self.column_rc.set_visible(False)
76
        self.column_rc.set_expand(False)
77
        self.column_rc.set_clickable(False)
78
        self.column_rc.set_sort_indicator(False)
79
        self.treeview.append_column(self.column_rc)
80
 
81
        # TreeView common
82
        self.treeview.set_can_focus(False)
83
        self.treeview.set_headers_visible(True)
84
        self.treeview.set_enable_search(False)
85
        self.treeview.set_hover_selection(False)
86
        self.treeview.set_grid_lines(Gtk.TreeViewGridLines.HORIZONTAL)
87
        self.treeview.modify_font(Pango.FontDescription('Monospace 10'))
88
 
89
        # Selection
90
        self.selection = self.treeview.get_selection()
91
        self.selection.set_mode(Gtk.SelectionMode.NONE)
92
 
93
        # ~ viewport.add(self.treeview)
94
        # ~ scrolledwindow.add(viewport)
95
        # ~ vbox.pack_start(scrolledwindow, True, True, 0)
96
        # ~ self.add(vbox)
97
        self.show_all()
98
 
99
    def update(self, sid, value):
100
        pass
101
 
102
 
103
 
104
 
105
 
106
 
107
 
108
 
109
 
110
 
111
 
112
 
113
 
114