Subversion Repositories basico

Rev

Rev 229 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 229 Rev 233
1
#!/usr/bin/python
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
2
# -*- coding: utf-8 -*-
3
# File: sapnoteview.py
3
# File: sapnoteview.py
4
# Author: Tomás Vírseda
4
# Author: Tomás Vírseda
5
# License: GPL v3
5
# License: GPL v3
6
# Description: SAPNoteView GTK.TreeView widget
6
# Description: SAPNoteView GTK.TreeView widget
7
7
8
from enum import IntEnum
8
from enum import IntEnum
9
import traceback as tb
9
import traceback as tb
10
from cgi import escape
10
from cgi import escape
11
11
12
import gi
12
import gi
13
gi.require_version('Gdk', '3.0')
13
gi.require_version('Gdk', '3.0')
14
gi.require_version('Gtk', '3.0')
14
gi.require_version('Gtk', '3.0')
15
from gi.repository import Gdk
15
from gi.repository import Gdk
16
from gi.repository import Gio
16
from gi.repository import Gio
17
from gi.repository import Gtk
17
from gi.repository import Gtk
18
from gi.repository import Pango
18
from gi.repository import Pango
19
from gi.repository.GdkPixbuf import Pixbuf
19
from gi.repository.GdkPixbuf import Pixbuf
20
from gi.repository import Pango
20
from gi.repository import Pango
21
from datetime import datetime
21
from datetime import datetime
22
from dateutil import parser as dateparser
22
from dateutil import parser as dateparser
23
23
24
from .service import Service
-
 
-
 
24
from basico.core.service import Service
25
25
26
class Column(IntEnum):
26
class Column(IntEnum):
27
    rowtype = 0
27
    rowtype = 0
28
    checkbox = 1
28
    checkbox = 1
29
    icon = 2
29
    icon = 2
30
    component = 3
30
    component = 3
31
    category = 4
31
    category = 4
32
    type = 5
32
    type = 5
33
    id = 6
33
    id = 6
34
    title = 7
34
    title = 7
35
    priority = 8
35
    priority = 8
36
    language = 9
36
    language = 9
37
    released = 10
37
    released = 10
38
38
39
39
40
class SAPNoteView(Gtk.TreeView, Service):
40
class SAPNoteView(Gtk.TreeView, Service):
41
    def __init__(self, app):
41
    def __init__(self, app):
42
        Gtk.TreeView.__init__(self)
42
        Gtk.TreeView.__init__(self)
43
        self.app = app
43
        self.app = app
44
44
45
        self.get_services()
45
        self.get_services()
46
        self.toggled = 0
46
        self.toggled = 0
47
        self.selected = set()
47
        self.selected = set()
48
        self.count = 0
48
        self.count = 0
49
49
50
50
51
        # Setup treeview and model
51
        # Setup treeview and model
52
        Gtk.TreeView.__init__(self)
52
        Gtk.TreeView.__init__(self)
53
        self.model = Gtk.TreeStore(
53
        self.model = Gtk.TreeStore(
54
            str,            # RowType@RowId
54
            str,            # RowType@RowId
55
            bool,           # CheckBox
55
            bool,           # CheckBox
56
            Pixbuf,         # Icon
56
            Pixbuf,         # Icon
57
            str,            # Component key
57
            str,            # Component key
58
            str,            # Category
58
            str,            # Category
59
            str,            # Type
59
            str,            # Type
60
            str,            # SAP Note Id
60
            str,            # SAP Note Id
61
            str,            # Title
61
            str,            # Title
62
            str,            # Priority
62
            str,            # Priority
63
            str,            # Language
63
            str,            # Language
64
            str             # Release date
64
            str             # Release date
65
        )
65
        )
66
        self.set_model(self.model)
66
        self.set_model(self.model)
67
67
68
        # Setup columns
68
        # Setup columns
69
        # RowType
69
        # RowType
70
        self.renderer_rowtype = Gtk.CellRendererText()
70
        self.renderer_rowtype = Gtk.CellRendererText()
71
        self.column_rowtype = Gtk.TreeViewColumn('', self.renderer_rowtype, text=Column.rowtype.value)
71
        self.column_rowtype = Gtk.TreeViewColumn('', self.renderer_rowtype, text=Column.rowtype.value)
72
        self.column_rowtype.set_visible(False)
72
        self.column_rowtype.set_visible(False)
73
        self.column_rowtype.set_expand(False)
73
        self.column_rowtype.set_expand(False)
74
        self.column_rowtype.set_clickable(False)
74
        self.column_rowtype.set_clickable(False)
75
        self.column_rowtype.set_sort_indicator(False)
75
        self.column_rowtype.set_sort_indicator(False)
76
        self.append_column(self.column_rowtype)
76
        self.append_column(self.column_rowtype)
77
77
78
        # Checkbox
78
        # Checkbox
79
        self.renderer_checkbox = Gtk.CellRendererToggle()
79
        self.renderer_checkbox = Gtk.CellRendererToggle()
80
        #~ self.renderer_checkbox.connect("toggled", self.on_cell_toggled)
80
        #~ self.renderer_checkbox.connect("toggled", self.on_cell_toggled)
81
        self.column_checkbox = Gtk.TreeViewColumn('', self.renderer_checkbox, active=1)
81
        self.column_checkbox = Gtk.TreeViewColumn('', self.renderer_checkbox, active=1)
82
        self.column_checkbox.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
82
        self.column_checkbox.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
83
        self.column_checkbox.set_visible(False)
83
        self.column_checkbox.set_visible(False)
84
        self.column_checkbox.set_expand(False)
84
        self.column_checkbox.set_expand(False)
85
        self.column_checkbox.set_clickable(False)
85
        self.column_checkbox.set_clickable(False)
86
        self.column_checkbox.set_sort_indicator(False)
86
        self.column_checkbox.set_sort_indicator(False)
87
        self.append_column(self.column_checkbox)
87
        self.append_column(self.column_checkbox)
88
        #~ self.column_checkbox.set_cell_data_func(self.renderer_checkbox, self.cell_data_func)
88
        #~ self.column_checkbox.set_cell_data_func(self.renderer_checkbox, self.cell_data_func)
89
89
90
        # Icon
90
        # Icon
91
        self.renderer_icon = Gtk.CellRendererPixbuf()
91
        self.renderer_icon = Gtk.CellRendererPixbuf()
92
        self.renderer_icon.set_alignment(0.0, 0.5)
92
        self.renderer_icon.set_alignment(0.0, 0.5)
93
        self.column_icon = Gtk.TreeViewColumn('', self.renderer_icon, pixbuf=2)
93
        self.column_icon = Gtk.TreeViewColumn('', self.renderer_icon, pixbuf=2)
94
        self.column_icon.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
94
        self.column_icon.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
95
        self.column_icon.set_visible(False)
95
        self.column_icon.set_visible(False)
96
        self.column_icon.set_expand(False)
96
        self.column_icon.set_expand(False)
97
        self.column_icon.set_clickable(False)
97
        self.column_icon.set_clickable(False)
98
        self.column_icon.set_sort_indicator(False)
98
        self.column_icon.set_sort_indicator(False)
99
        self.append_column(self.column_icon)
99
        self.append_column(self.column_icon)
100
100
101
        # Component key
101
        # Component key
102
        self.renderer_compkey = Gtk.CellRendererText()
102
        self.renderer_compkey = Gtk.CellRendererText()
103
        # ~ self.renderer_compkey.set_editable(True)
103
        # ~ self.renderer_compkey.set_editable(True)
104
        #~ self.renderer_compkey.set_property('background', 'Lemon Chiffon')
104
        #~ self.renderer_compkey.set_property('background', 'Lemon Chiffon')
105
        self.column_component = Gtk.TreeViewColumn('SAP Notes', self.renderer_compkey, markup=3)
105
        self.column_component = Gtk.TreeViewColumn('SAP Notes', self.renderer_compkey, markup=3)
106
        self.column_component.set_visible(True)
106
        self.column_component.set_visible(True)
107
        self.column_component.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
107
        self.column_component.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
108
        self.column_component.set_clickable(True)
108
        self.column_component.set_clickable(True)
109
        self.column_component.set_sort_indicator(True)
109
        self.column_component.set_sort_indicator(True)
110
        self.column_component.set_sort_column_id(3)
110
        self.column_component.set_sort_column_id(3)
111
        self.column_component.set_sort_order(Gtk.SortType.ASCENDING)
111
        self.column_component.set_sort_order(Gtk.SortType.ASCENDING)
112
        self.column_component.set_expand(True)
112
        self.column_component.set_expand(True)
113
        self.append_column(self.column_component)
113
        self.append_column(self.column_component)
114
        expander_column = self.column_component
114
        expander_column = self.column_component
115
115
116
        # Category
116
        # Category
117
        self.renderer_cat = Gtk.CellRendererText()
117
        self.renderer_cat = Gtk.CellRendererText()
118
        self.column_cat = Gtk.TreeViewColumn('Category', self.renderer_cat, markup=4)
118
        self.column_cat = Gtk.TreeViewColumn('Category', self.renderer_cat, markup=4)
119
        self.column_cat.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
119
        self.column_cat.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
120
        self.column_cat.set_visible(False)
120
        self.column_cat.set_visible(False)
121
        self.column_cat.set_expand(False)
121
        self.column_cat.set_expand(False)
122
        self.column_cat.set_clickable(True)
122
        self.column_cat.set_clickable(True)
123
        self.column_cat.set_sort_indicator(True)
123
        self.column_cat.set_sort_indicator(True)
124
        self.column_cat.set_sort_column_id(4)
124
        self.column_cat.set_sort_column_id(4)
125
        self.column_cat.set_sort_order(Gtk.SortType.ASCENDING)
125
        self.column_cat.set_sort_order(Gtk.SortType.ASCENDING)
126
        self.append_column(self.column_cat)
126
        self.append_column(self.column_cat)
127
127
128
        # Type
128
        # Type
129
        self.renderer_sntype = Gtk.CellRendererText()
129
        self.renderer_sntype = Gtk.CellRendererText()
130
        self.column_sntype = Gtk.TreeViewColumn('Type', self.renderer_sntype, markup=5)
130
        self.column_sntype = Gtk.TreeViewColumn('Type', self.renderer_sntype, markup=5)
131
        self.column_sntype.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
131
        self.column_sntype.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
132
        self.column_sntype.set_visible(False)
132
        self.column_sntype.set_visible(False)
133
        self.column_sntype.set_expand(False)
133
        self.column_sntype.set_expand(False)
134
        self.column_sntype.set_clickable(True)
134
        self.column_sntype.set_clickable(True)
135
        self.column_sntype.set_sort_indicator(True)
135
        self.column_sntype.set_sort_indicator(True)
136
        self.column_sntype.set_sort_column_id(5)
136
        self.column_sntype.set_sort_column_id(5)
137
        self.column_sntype.set_sort_order(Gtk.SortType.ASCENDING)
137
        self.column_sntype.set_sort_order(Gtk.SortType.ASCENDING)
138
        self.append_column(self.column_sntype)
138
        self.append_column(self.column_sntype)
139
139
140
        # SAP Note Id
140
        # SAP Note Id
141
        self.renderer_sid = Gtk.CellRendererText()
141
        self.renderer_sid = Gtk.CellRendererText()
142
        self.renderer_sid.set_alignment(1.0, 0.5)
142
        self.renderer_sid.set_alignment(1.0, 0.5)
143
        self.column_sid = Gtk.TreeViewColumn('SAP Note', self.renderer_sid, markup=6)
143
        self.column_sid = Gtk.TreeViewColumn('SAP Note', self.renderer_sid, markup=6)
144
        self.column_sid.set_visible(False)
144
        self.column_sid.set_visible(False)
145
        self.column_sid.set_expand(False)
145
        self.column_sid.set_expand(False)
146
        self.column_sid.set_clickable(True)
146
        self.column_sid.set_clickable(True)
147
        self.column_sid.set_sort_indicator(True)
147
        self.column_sid.set_sort_indicator(True)
148
        self.column_sid.set_sort_column_id(6)
148
        self.column_sid.set_sort_column_id(6)
149
        self.column_sid.set_sort_order(Gtk.SortType.ASCENDING)
149
        self.column_sid.set_sort_order(Gtk.SortType.ASCENDING)
150
        self.append_column(self.column_sid)
150
        self.append_column(self.column_sid)
151
151
152
        # Title
152
        # Title
153
        self.renderer_title = Gtk.CellRendererText()
153
        self.renderer_title = Gtk.CellRendererText()
154
        self.renderer_title.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
154
        self.renderer_title.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
155
        self.column_title = Gtk.TreeViewColumn('Title', self.renderer_title, markup=7)
155
        self.column_title = Gtk.TreeViewColumn('Title', self.renderer_title, markup=7)
156
        self.column_title.set_visible(False)
156
        self.column_title.set_visible(False)
157
        self.column_title.set_expand(True)
157
        self.column_title.set_expand(True)
158
        self.column_title.set_clickable(True)
158
        self.column_title.set_clickable(True)
159
        self.column_title.set_sort_indicator(True)
159
        self.column_title.set_sort_indicator(True)
160
        self.column_title.set_sort_column_id(7)
160
        self.column_title.set_sort_column_id(7)
161
        self.column_title.set_sort_order(Gtk.SortType.ASCENDING)
161
        self.column_title.set_sort_order(Gtk.SortType.ASCENDING)
162
        self.append_column(self.column_title)
162
        self.append_column(self.column_title)
163
163
164
        # Priority
164
        # Priority
165
        self.renderer_priority = Gtk.CellRendererText()
165
        self.renderer_priority = Gtk.CellRendererText()
166
        self.column_priority = Gtk.TreeViewColumn('Priority', self.renderer_priority, markup=8)
166
        self.column_priority = Gtk.TreeViewColumn('Priority', self.renderer_priority, markup=8)
167
        self.column_priority.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
167
        self.column_priority.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
168
        self.column_priority.set_visible(True)
168
        self.column_priority.set_visible(True)
169
        self.column_priority.set_expand(False)
169
        self.column_priority.set_expand(False)
170
        self.column_priority.set_clickable(True)
170
        self.column_priority.set_clickable(True)
171
        self.column_priority.set_sort_indicator(True)
171
        self.column_priority.set_sort_indicator(True)
172
        self.column_priority.set_sort_column_id(8)
172
        self.column_priority.set_sort_column_id(8)
173
        self.column_priority.set_sort_order(Gtk.SortType.ASCENDING)
173
        self.column_priority.set_sort_order(Gtk.SortType.ASCENDING)
174
        self.append_column(self.column_priority)
174
        self.append_column(self.column_priority)
175
175
176
        # Language
176
        # Language
177
        self.renderer_lang = Gtk.CellRendererText()
177
        self.renderer_lang = Gtk.CellRendererText()
178
        self.column_lang = Gtk.TreeViewColumn('Language', self.renderer_lang, markup=9)
178
        self.column_lang = Gtk.TreeViewColumn('Language', self.renderer_lang, markup=9)
179
        self.column_lang.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
179
        self.column_lang.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
180
        self.column_lang.set_visible(False)
180
        self.column_lang.set_visible(False)
181
        self.column_lang.set_expand(False)
181
        self.column_lang.set_expand(False)
182
        self.column_lang.set_clickable(True)
182
        self.column_lang.set_clickable(True)
183
        self.column_lang.set_sort_indicator(True)
183
        self.column_lang.set_sort_indicator(True)
184
        self.column_lang.set_sort_column_id(9)
184
        self.column_lang.set_sort_column_id(9)
185
        self.column_lang.set_sort_order(Gtk.SortType.ASCENDING)
185
        self.column_lang.set_sort_order(Gtk.SortType.ASCENDING)
186
        self.append_column(self.column_lang)
186
        self.append_column(self.column_lang)
187
187
188
        # Release date
188
        # Release date
189
        self.renderer_reldate = Gtk.CellRendererText()
189
        self.renderer_reldate = Gtk.CellRendererText()
190
        self.column_rel = Gtk.TreeViewColumn('Released on', self.renderer_reldate, markup=10)
190
        self.column_rel = Gtk.TreeViewColumn('Released on', self.renderer_reldate, markup=10)
191
        self.column_rel.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
191
        self.column_rel.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
192
        self.column_rel.set_visible(False)
192
        self.column_rel.set_visible(False)
193
        self.column_rel.set_expand(False)
193
        self.column_rel.set_expand(False)
194
        self.column_rel.set_clickable(True)
194
        self.column_rel.set_clickable(True)
195
        self.column_rel.set_sort_indicator(True)
195
        self.column_rel.set_sort_indicator(True)
196
        self.column_rel.set_sort_column_id(10)
196
        self.column_rel.set_sort_column_id(10)
197
        self.column_rel.set_sort_order(Gtk.SortType.ASCENDING)
197
        self.column_rel.set_sort_order(Gtk.SortType.ASCENDING)
198
        self.append_column(self.column_rel)
198
        self.append_column(self.column_rel)
199
199
200
        # TreeView common
200
        # TreeView common
201
        #~ self.set_level_indentation(6)
201
        #~ self.set_level_indentation(6)
202
        self.set_can_focus(True)
202
        self.set_can_focus(True)
203
        self.set_headers_visible(False)
203
        self.set_headers_visible(False)
204
        self.set_enable_search(True)
204
        self.set_enable_search(True)
205
        self.set_hover_selection(False)
205
        self.set_hover_selection(False)
206
        self.set_grid_lines(Gtk.TreeViewGridLines.NONE)
206
        self.set_grid_lines(Gtk.TreeViewGridLines.NONE)
207
        self.set_search_entry(self.gui.get_widget('stySearchInfo'))
207
        self.set_search_entry(self.gui.get_widget('stySearchInfo'))
208
        self.set_search_column(3)
208
        self.set_search_column(3)
209
        #~ self.set_row_separator_func(self.row_separator_func)
209
        #~ self.set_row_separator_func(self.row_separator_func)
210
210
211
        # Selection
211
        # Selection
212
        self.selection = self.get_selection()
212
        self.selection = self.get_selection()
213
        #~ self.selection.set_select_function(self.select_function)
213
        #~ self.selection.set_select_function(self.select_function)
214
        self.selection.set_mode(Gtk.SelectionMode.SINGLE)
214
        self.selection.set_mode(Gtk.SelectionMode.SINGLE)
215
215
216
        # Font
216
        # Font
217
        font_desc = Pango.FontDescription('Monospace 10')
217
        font_desc = Pango.FontDescription('Monospace 10')
218
        if font_desc:
218
        if font_desc:
219
            self.modify_font(font_desc)
219
            self.modify_font(font_desc)
220
220
221
        # Go live
221
        # Go live
222
        # FIXME: right click not working
222
        # FIXME: right click not working
223
        #~ self.connect('button_press_event', self.right_click)
223
        #~ self.connect('button_press_event', self.right_click)
224
        #~ self.connect('row-activated', self.double_click)
224
        #~ self.connect('row-activated', self.double_click)
225
        #~ self.connect('cursor-changed', self.row_changed)
225
        #~ self.connect('cursor-changed', self.row_changed)
226
        #~ self.sig_selection_changed = self.selection.connect('changed', self.row_changed) #self.selection_changed)
226
        #~ self.sig_selection_changed = self.selection.connect('changed', self.row_changed) #self.selection_changed)
227
227
228
        # Custom method to be implemented.
228
        # Custom method to be implemented.
229
        self.prepare()
229
        self.prepare()
230
        self.show_all()
230
        self.show_all()
231
231
232
232
233
    def get_renderer_compkey(self):
233
    def get_renderer_compkey(self):
234
        return self.renderer_compkey
234
        return self.renderer_compkey
235
235
236
236
237
    def get_services(self):
237
    def get_services(self):
238
        self.gui = self.app.get_service("GUI")
238
        self.gui = self.app.get_service("GUI")
239
        self.cb = self.app.get_service('Callbacks')
239
        self.cb = self.app.get_service('Callbacks')
240
        self.sap = self.app.get_service('SAP')
240
        self.sap = self.app.get_service('SAP')
241
        self.im = self.app.get_service('IM')
241
        self.im = self.app.get_service('IM')
242
        self.settings = self.app.get_service('Settings')
242
        self.settings = self.app.get_service('Settings')
243
        self.db = self.app.get_service('DB')
243
        self.db = self.app.get_service('DB')
244
        self.annot = self.app.get_service('Annotation')
244
        self.annot = self.app.get_service('Annotation')
245
245
246
246
247
    def get_node(self, key, checkbox, icon, component, cat='', sntype='', sid='', title='', priority='', lang='', rel=''):
247
    def get_node(self, key, checkbox, icon, component, cat='', sntype='', sid='', title='', priority='', lang='', rel=''):
248
        node = []
248
        node = []
249
        node.append(key)
249
        node.append(key)
250
        node.append(checkbox)
250
        node.append(checkbox)
251
        node.append(icon)
251
        node.append(icon)
252
        node.append(component)
252
        node.append(component)
253
        node.append(cat)
253
        node.append(cat)
254
        node.append(sntype)
254
        node.append(sntype)
255
        node.append(sid)
255
        node.append(sid)
256
        node.append(title)
256
        node.append(title)
257
        node.append(priority)
257
        node.append(priority)
258
        node.append(lang)
258
        node.append(lang)
259
        node.append(rel)
259
        node.append(rel)
260
        return node
260
        return node
261
261
262
262
263
    def get_node_date_year(self, date, token_date):
263
    def get_node_date_year(self, date, token_date):
264
        title = "%s" % token_date
264
        title = "%s" % token_date
265
        return self.get_node('date-year@%s' % token_date, 0, None, title)
265
        return self.get_node('date-year@%s' % token_date, 0, None, title)
266
266
267
267
268
    def get_node_date_month(self, date, token_date):
268
    def get_node_date_month(self, date, token_date):
269
        title = "%s" % date.strftime("%B")
269
        title = "%s" % date.strftime("%B")
270
        return self.get_node('date-month@%s' % token_date, 0, None, title)
270
        return self.get_node('date-month@%s' % token_date, 0, None, title)
271
271
272
272
273
    def get_node_date_day(self, date, token_date):
273
    def get_node_date_day(self, date, token_date):
274
        title = "%s" % date.strftime("%d - %A")
274
        title = "%s" % date.strftime("%d - %A")
275
        return self.get_node('date-day@%s' % token_date, 0, None, title)
275
        return self.get_node('date-day@%s' % token_date, 0, None, title)
276
276
277
277
278
    def get_node_priority(self, priority):
278
    def get_node_priority(self, priority):
279
        icon = None
279
        icon = None
280
        if len(priority) == 0:
280
        if len(priority) == 0:
281
            title = "No priority assigned"
281
            title = "No priority assigned"
282
        else:
282
        else:
283
            title = "%s" % priority
283
            title = "%s" % priority
284
284
285
        return self.get_node('priority@%s' % priority, 0, icon, title)
285
        return self.get_node('priority@%s' % priority, 0, icon, title)
286
286
287
287
288
    def get_node_collection(self, collection_id, collection_name, icon=None):
288
    def get_node_collection(self, collection_id, collection_name, icon=None):
289
        icon = None
289
        icon = None
290
        return self.get_node('collection@%s' % collection_id, 0, icon, collection_name)
290
        return self.get_node('collection@%s' % collection_id, 0, icon, collection_name)
291
291
292
292
293
    def get_node_type(self, sntype):
293
    def get_node_type(self, sntype):
294
        icon = self.im.get_icon('basico-type', 32, 32)
294
        icon = self.im.get_icon('basico-type', 32, 32)
295
        if len(sntype) == 0:
295
        if len(sntype) == 0:
296
            title = "SAP Note type not found"
296
            title = "SAP Note type not found"
297
        else:
297
        else:
298
            title = "%s" % sntype
298
            title = "%s" % sntype
299
        return self.get_node('type@%s' % sntype, 0, icon, title)
299
        return self.get_node('type@%s' % sntype, 0, icon, title)
300
300
301
301
302
    def get_node_category(self, category=''):
302
    def get_node_category(self, category=''):
303
        icon = None
303
        icon = None
304
        if len(category) == 0:
304
        if len(category) == 0:
305
            catname = "No category assigned"
305
            catname = "No category assigned"
306
        else:
306
        else:
307
            catname = "%s" % category
307
            catname = "%s" % category
308
        return self.get_node('category@%s' % catname, 0, icon, catname)
308
        return self.get_node('category@%s' % catname, 0, icon, catname)
309
309
310
310
311
    def get_node_component(self, compkey, comptxt):
311
    def get_node_component(self, compkey, comptxt):
312
        icon = self.im.get_icon('basico-component', 32, 32)
312
        icon = self.im.get_icon('basico-component', 32, 32)
313
        node = []
313
        node = []
314
        count = len(self.db.get_notes_by_node("componentkey", compkey))
314
        count = len(self.db.get_notes_by_node("componentkey", compkey))
315
        component = "%s" % (compkey)
315
        component = "%s" % (compkey)
316
        return self.get_node('componentkey@%s' % compkey, 0, icon, component)
316
        return self.get_node('componentkey@%s' % compkey, 0, icon, component)
317
317
318
318
319
    def get_node_component_desc(self, compkey, comptxt):
319
    def get_node_component_desc(self, compkey, comptxt):
320
        icon = self.im.get_icon('basico-description', 32, 32)
320
        icon = self.im.get_icon('basico-description', 32, 32)
321
        node = []
321
        node = []
322
        count = len(self.db.get_notes_by_node("componentkey", compkey))
322
        count = len(self.db.get_notes_by_node("componentkey", compkey))
323
        if len(comptxt) == 0:
323
        if len(comptxt) == 0:
324
            component = "%s" % (compkey)
324
            component = "%s" % (compkey)
325
        else:
325
        else:
326
            component = "%s" % (comptxt)
326
            component = "%s" % (comptxt)
327
        return self.get_node('componentkey@%s' % compkey, 0, icon, component)
327
        return self.get_node('componentkey@%s' % compkey, 0, icon, component)
328
328
329
329
330
330
331
331
332
 
332