Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 392 → Rev 393

/branches/BR-0.4/basico/basico.py
10,6 → 10,7
import os
import sys
import signal
import shutil
from gi.repository import GObject
from basico.core.mod_env import APP, LPATH, GPATH, FILE
from basico.core.mod_log import get_logger
48,6 → 49,7
self.setup_logging()
self.setup_services()
self.setup_splash()
self.setup_post()
 
 
def get_splash(self):
123,6 → 125,12
raise
 
 
def setup_post(self):
if not os.path.exists(FILE['L_SAP_PRODUCTS']):
shutil.copy(FILE['G_SAP_PRODUCTS'], FILE['L_SAP_PRODUCTS'])
self.log.debug("SAP Products file copied to local database resources directory")
 
 
def get_service(self, name):
"""
Get/Start a registered service
/branches/BR-0.4/basico/core/mod_env.py
64,6 → 64,7
GPATH['DOC'] = GPATH['SHARE'] + 'docs' + SEP
GPATH['RES'] = GPATH['DATA'] + 'res' + SEP
GPATH['CSS'] = GPATH['RES'] + 'css' + SEP
GPATH['SAP'] = GPATH['RES'] + 'sap' + SEP
GPATH['SPLASH'] = GPATH['RES'] + 'splash' + SEP
GPATH['SELENIUM'] = GPATH['RES'] + 'selenium' + SEP
GPATH['DRIVERS'] = GPATH['SELENIUM'] + 'drivers' + SEP
82,6 → 83,7
FILE['CREDITS'] = GPATH['DOC'] + 'CREDITS'
FILE['HELP_INDEX'] = GPATH['HELP_HTML'] + 'index.html'
FILE['SPLASH'] = GPATH['SPLASH'] + 'basico-splash-400x250.png'
 
FILE['G_SAP_PRODUCTS'] = GPATH['SAP'] + 'products.txt'
FILE['L_SAP_PRODUCTS'] = LPATH['RESOURCES'] + 'products.txt'
# Annotations
ATYPES = ['Bookmark', 'Email', 'Fixme', 'Incident', 'Meeting', 'Note', 'Procedure', 'Snippet', 'Template', 'Todo']
/branches/BR-0.4/basico/data/icons/basico-scope.svg
0,0 → 1,128
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg652"
sodipodi:version="0.32"
width="90"
height="90"
sodipodi:docbase="/home/tweenk/GNUtoon/stock/generic"
sodipodi:docname="stock_book_blue.svg"
inkscape:version="0.45.1"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.0">
<metadata
id="metadata20">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs654">
<linearGradient
id="linearGradient666">
<stop
style="stop-color:#a6d7ff;stop-opacity:1;"
offset="0.000000"
id="stop667" />
<stop
style="stop-color:#ffffff;stop-opacity:0.396078;"
offset="1.000000"
id="stop668" />
</linearGradient>
<linearGradient
id="linearGradient660">
<stop
style="stop-color:#3882d2;stop-opacity:1;"
offset="0.000000"
id="stop661" />
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1.000000"
id="stop662" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient660"
id="linearGradient663"
x1="24.872091"
y1="97.850601"
x2="54.929543"
y2="95.556686"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.187319,0,0,0.819318,0.2492747,-0.963041)"
spreadMethod="pad" />
<linearGradient
xlink:href="#linearGradient666"
id="linearGradient665"
x1="77.360474"
y1="65.408142"
x2="55.602474"
y2="83.43174"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.187319,0,0,0.819318,0.2492747,-0.963041)"
spreadMethod="pad" />
</defs>
<sodipodi:namedview
id="base"
inkscape:zoom="5.3666667"
inkscape:cx="45"
inkscape:cy="45"
inkscape:window-width="1014"
inkscape:window-height="695"
inkscape:window-x="0"
inkscape:window-y="34"
inkscape:current-layer="svg652"
width="90px"
height="90px" />
<path
style="fill:#00043b;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 79.583936,15.2881 C 85.328684,18.48049 86.657333,38.948206 86.265212,43.757503 L 53.390777,80.560837 L 10.083995,66.986683 L 3.6298877,64.22947 L 10.174982,57.589615 L 4.8652487,35.359522 C 5.7386987,34.314259 36.649412,10.997542 38.833271,8.83381 C 41.772665,9.389719 78.053642,15.095272 79.583936,15.2881 z "
id="path690"
sodipodi:nodetypes="ccccccccc" />
<path
style="font-size:12px;fill:#558ada;fill-opacity:1;fill-rule:evenodd;stroke-width:1pt"
d="M 51.614549,75.754174 L 54.236468,71.8327 L 14.624753,60.183883 L 17.466644,55.614136 L 7.5858497,63.008521 L 51.614549,75.754174 z "
id="path680"
sodipodi:nodetypes="cccccc" />
<path
style="font-size:12px;fill:url(#linearGradient663);fill-rule:evenodd;stroke-width:1pt"
d="M 51.67286,47.0029 L 57.405494,67.742656 L 53.563553,72.512455 L 14.640929,60.222643 L 10.877624,37.846912 L 51.67286,47.0029 z "
id="path681"
sodipodi:nodetypes="cccccc" />
<path
style="font-size:12px;fill:url(#linearGradient665);fill-rule:evenodd;stroke-width:1pt"
d="M 50.825654,47.144926 L 57.405494,67.742656 L 53.563553,72.512455 L 14.754593,60.178972 L 10.68623,37.659184 L 50.825654,47.144926 z "
id="path682"
sodipodi:nodetypes="cccccc" />
<path
style="font-size:12px;fill:#31baff;fill-opacity:1;fill-rule:evenodd;stroke-width:1pt"
d="M 79.056077,17.688193 L 48.794264,48.109039 L 8.7533837,38.241076 L 38.998454,12.541858 L 79.056077,17.688193 z "
id="path683"
sodipodi:nodetypes="ccccc" />
<path
style="font-size:12px;fill:#558ada;fill-opacity:1;fill-rule:evenodd;stroke-width:1pt"
d="M 78.193121,17.542522 C 82.225496,22.625392 85.166582,38.505979 82.258859,43.720906 L 52.809422,73.915378 C 54.156656,69.133993 52.335251,52.231585 47.787662,47.664793 L 78.193121,17.542522 z "
id="path684"
sodipodi:nodetypes="ccccc" />
<path
style="font-size:12px;fill:none;fill-rule:evenodd;stroke:#000008;stroke-width:1.00061524;stroke-opacity:1"
d="M 52.41494,63.550171 L 22.388117,56.000905"
id="path685" />
<path
style="font-size:12px;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.00061524;stroke-opacity:1"
d="M 52.605002,68.131156 L 23.995133,60.22546"
id="path686"
sodipodi:nodetypes="cc" />
</svg>
/branches/BR-0.4/basico/data/res/sap/products.txt
0,0 → 1,91
eCATT
Engineering Construction & Operations (EC&O)
Enterprise Central Component (ECC)
OpenUI5
SAP Advanced Business Application Programming (ABAP)
SAP Advanced Planner and Optimizer (APO)
SAP Analytics
SAP Anywhere
SAP Apparel and Footwear Solution (AFS)
SAP Ariba
SAP Auto-ID Infrastructure
SAP Banking
SAP Business Information Warehouse (BW)
SAP Business Intelligence (BI)
SAP Business Objects (BO)
SAP Business One
SAP Business Partner Screening
SAP Catalog Content Management
SAP CCMS
SAP Central Process Scheduling
SAP Composite Application Framework
SAP Concur
SAP Converged Cloud
SAP Convergent Charging (CC)
SAP Customer Relationship Management (CRM)
SAP Environment Health Safety Management (EHSM)
SAP Enterprise Buyer Professional (EBP)
SAP Enterprise Learning
SAP Enterprise Resource Planning (ERP)
SAP Enterprise Services Architecture
SAP Exchange Infrastructure (XI)
SAP Extended Warehouse Management (EWM)
SAP Fieldglass
SAP Financial Services Network (FSN)
SAP Fiori
SAP for Healthcare (ISH)
SAP for Insurance (SAP for Insurance)
SAP for Media (ISM)
SAP for Oil & Gas (IS Oil & Gas)
SAP for Public Sector (IS PSCD)
SAP for Retail
SAP for Telecommunications (IST)
SAP for Utilities (ISU)
SAP Governance, Risk and Compliance (GRC)
SAP HANA
SAP Human Resource Management Systems (HRMS)
SAP Hybris
SAP Incentive and Commission Management (ICM)
SAP Internet Transaction Server (ITS)
SAP IS Airlines & Defense
SAP IT Operations Analytics (ITOA)
SAP Jam
SAP Knowledge Warehouse (KW)
SAP Manufacturing
SAP Master Data Governance (MDG)
SAP Master Data Management (MDM)
SAP NetWeaver Application Server (Web AS)
SAP NetWeaver Development Infrastructure
SAP NetWeaver Identity Management
SAP NetWeaver Platform
SAP NetWeaver Portal
SAP NetWeaver Single Sign-On
SAP NetWeaver Visual Composer
SAP Portal (EP)
SAP PRD2 (P2)
SAP Product Lifecycle Management (PLM)
SAP Profitability and Cost Management (PCM)
SAP R/2
SAP R/3
SAP Rapid Deployment Solutions (RDS)
SAP S/4HANA
SAP S/4HANA Cloud
SAP Sales Cloud
SAP Service and Asset Management
SAP Shipping Services Network (SSN)
SAP Solution Composer
SAP Solution Manager (SM)
SAP Solutions for mobile business
SAP Strategic Enterprise Management (SEM)
SAP SuccessFactors
SAP Supplier Relationship Management (SRM)
SAP Supply Chain Management (SCM)
SAP Supply Chain Management (SCM)
SAP Supply Chain Performance Management (SCPM)
SAP Supply Network Collaboration (SNC)
SAP Sustainability Performance Management (SUPM)
SAP Test Data Migration Server (TDMS)
SAP Training and Event Management (TEM)
SAP xApps
SAP GUI
Sybase ASE
/branches/BR-0.4/basico/services/srv_callbacks.py
51,38 → 51,41
return
 
if visible_stack_name == 'visor-sapnotes':
# ~ self.srvuif.set_widget_visibility('gtk_button_menu_views', True)
self.srvuif.set_widget_visibility('gtk_label_total_notes', True)
visor_sapnotes = self.srvgui.get_widget('visor_sapnotes')
visible_filter = visor_sapnotes.get_visible_filter()
visor_sapnotes.update_total_sapnotes_count()
# ~ paned.set_position(400)
# ~ notebook_viewmenu.set_current_page(0)
elif visible_stack_name == 'visor-annotations':
# ~ self.srvuif.set_widget_visibility('gtk_button_menu_views', False)
self.srvuif.set_widget_visibility('gtk_label_total_notes', True)
visor_annotations = self.srvgui.get_widget('visor_annotations')
visor_annotations.populate()
# ~ paned.set_position(400)
# ~ notebook_viewmenu.set_current_page(1)
else:
# ~ self.srvuif.set_widget_visibility('gtk_button_menu_views', False)
self.srvuif.set_widget_visibility('gtk_label_total_notes', True)
visor_attachments = self.srvgui.get_widget('visor_attachments')
visor_attachments.populate()
# ~ paned.set_position(0)
# ~ notebook_viewmenu.set_current_page(2)
 
 
def gui_show_visor_sapnotes(self):
notebook = self.srvgui.get_widget('gtk_notebook_visor')
notebook.set_current_page(0)
stack_main = self.srvgui.get_widget('gtk_stack_main')
stack_main.set_visible_child_name('dashboard')
stack_visors = self.srvgui.get_widget('gtk_stack_visors')
stack_visors.set_visible_child_name('visor-sapnotes')
 
 
def gui_show_visor_annotations(self):
notebook = self.srvgui.get_widget('gtk_notebook_visor')
notebook.set_current_page(1)
stack_main = self.srvgui.get_widget('gtk_stack_main')
stack_main.set_visible_child_name('dashboard')
stack_visors = self.srvgui.get_widget('gtk_stack_visors')
stack_visors.set_visible_child_name('visor-annotations')
 
 
def gui_show_visor_attachments(self):
stack_main = self.srvgui.get_widget('gtk_stack_main')
stack_main.set_visible_child_name('dashboard')
stack_visors = self.srvgui.get_widget('gtk_stack_visors')
stack_visors.set_visible_child_name('visor-attachments')
 
 
def action_search(self, entry):
stack_visors = self.srvgui.get_widget('gtk_stack_visors')
visor_sapnotes = self.srvgui.get_widget('visor_sapnotes')
543,7 → 546,7
selection.select_path("0")
 
 
def gui_filter_visor(self, entry):
def gui_filter_visor(self, entry=None):
stack_visors = self.srvgui.get_widget('gtk_stack_visors')
visible_stack_name = stack_visors.get_visible_child_name()
 
/branches/BR-0.4/basico/widgets/wdg_annot.py
18,7 → 18,7
from gi.repository import Pango
from gi.repository.GdkPixbuf import Pixbuf
from gi.repository import GtkSource
from basico.core.mod_env import LPATH, ATYPES
from basico.core.mod_env import LPATH, ATYPES, FILE
from basico.core.mod_wdg import BasicoWidget
from basico.widgets.wdg_browser import BasicoBrowser
 
131,37 → 131,7
tool = self.srvuif.get_toolbar_separator(False, False)
self.toolbar.insert(tool, -1)
 
# Scope combobox entry
tool = Gtk.ToolItem()
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
 
completion = Gtk.EntryCompletion()
completion.set_match_func(self.completion_match_func)
completion_model = Gtk.ListStore(str)
completion.set_model(completion_model)
completion.set_text_column(0)
completion.set_inline_completion(True)
completion.set_inline_selection(True)
scope = self.srvgui.add_widget('gtk_entry_annotation_scope', Gtk.Entry())
scope.set_completion(completion)
scope.connect('activate', self.scope_activated)
 
max_width = 0
for title in self.srvclt.get_collections_name():
if len(title) > max_width:
max_width = len(title)
completion_model.append([title])
 
scope.set_width_chars(max_width)
scope.set_placeholder_text('Scope')
 
vbox.pack_start(scope, True, True, 0)
tool.add(vbox)
self.toolbar.insert(tool, -1)
 
 
# Tags entry
 
# Attachment button
tool = self.srvgui.add_widget('gtk_button_annotation_toolbar_attachment', Gtk.ToolButton())
tool.set_tooltip_markup('<b>Attach file(s) to this annotation</b>')
245,25 → 215,6
self.toolbar.set_hexpand(True)
 
 
def completion_match_func(self, completion, key, iter):
model = completion.get_model()
text = model.get_value(iter, 0)
if key.upper() in text.upper():
return True
return False
 
 
def scope_activated(self, entry):
scope_text = entry.get_text()
cid = self.srvclt.get_cid_by_name(scope_text)
if cid is None:
for title in self.srvclt.get_collections_name():
if scope_text.upper() in title.upper():
entry.set_text(title)
else:
entry.set_text(scope_text)
 
 
def get_services(self):
self.srvgui = self.get_service("GUI")
self.srvclb = self.get_service('Callbacks')
434,7 → 385,7
 
# Text
scroller = Gtk.ScrolledWindow()
scroller.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS)
scroller.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scroller.set_shadow_type(Gtk.ShadowType.IN)
scroller.set_hexpand(True)
scroller.set_vexpand(True)
454,19 → 405,90
scroller.add(a_text)
vboxl.pack_start(scroller, True, True, 3)
 
# Scope entry
hbox_scope = Gtk.HBox()
# ~ vbox_scope = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
 
completion = Gtk.EntryCompletion()
completion.set_match_func(self.completion_match_func)
completion_model = Gtk.ListStore(str)
completion.set_model(completion_model)
completion.set_text_column(0)
completion.set_inline_completion(True)
completion.set_inline_selection(True)
scope = self.srvgui.add_widget('gtk_entry_annotation_scope', Gtk.Entry())
scope.set_completion(completion)
scope.connect('activate', self.scope_activated)
 
max_width = 0
for title in self.srvclt.get_collections_name():
if len(title) > max_width:
max_width = len(title)
completion_model.append([title])
 
scope.set_width_chars(max_width)
scope.set_placeholder_text('Scope')
 
## Separator
separator = Gtk.SeparatorToolItem.new()
separator.set_draw(False)
separator.set_expand(False)
 
hbox_scope.pack_start(scope, False, False, 0)
hbox_scope.pack_start(separator, True, True, 0)
 
 
# SAP Products entry
hbox_product = Gtk.HBox()
completion = Gtk.EntryCompletion()
completion.set_match_func(self.completion_match_func)
completion_model = Gtk.ListStore(str)
completion.set_model(completion_model)
completion.set_text_column(0)
completion.set_inline_completion(True)
completion.set_inline_selection(True)
product = self.srvgui.add_widget('gtk_entry_annotation_product', Gtk.Entry())
product.set_completion(completion)
product.connect('activate', self.product_activated)
 
lproducts = open(FILE['L_SAP_PRODUCTS'], 'r').readlines()
max_width = 0
for title in lproducts:
if len(title) > max_width:
max_width = len(title)
completion_model.append([title.strip()])
 
product.set_width_chars(max_width)
product.set_placeholder_text('Product')
 
## Separator
separator = Gtk.SeparatorToolItem.new()
separator.set_draw(False)
separator.set_expand(True)
 
hbox_product.pack_start(product, False, False, 0)
hbox_product.pack_start(separator, True, True, 0)
vboxl.pack_start(hbox_scope, False, False, 3)
vboxl.pack_start(hbox_product, False, False, 3)
# ~ hbox_scope.pack_start(vbox_product, False, False, 0)
# ~ vboxl.pack_start(hbox_scope, True, True, 3)
 
# Tags entry
 
# Url
hbox = Gtk.HBox()
hbox_url = Gtk.HBox()
 
## url entry
a_link = self.srvgui.add_widget('gtk_entry_annotation_link', Gtk.Entry())
a_link.set_width_chars(80)
a_link.set_placeholder_text("Type a url here...")
hbox.pack_start(a_link, True, True, 3)
hbox_url.pack_start(a_link, False, False, 0)
 
## url button
a_link_button = self.srvgui.add_widget('gtk_link_button_annotation_link', Gtk.LinkButton())
a_link_button.set_relief(Gtk.ReliefStyle.NORMAL)
a_link_button.set_label('Visit')
hbox.pack_start(a_link_button, False, False, 3)
hbox_url.pack_start(a_link_button, False, False, 0)
 
# url type
a_link_type_model = Gtk.ListStore(str)
484,12 → 506,12
renderer_text = Gtk.CellRendererText()
a_link_type.pack_start(renderer_text, True)
a_link_type.add_attribute(renderer_text, "text", 0)
hbox.pack_start(a_link_type, False, False, 0)
vboxl.pack_start(hbox, False, False, 3)
hbox_url.pack_start(a_link_type, False, False, 0)
vboxl.pack_start(hbox_url, False, False, 3)
 
mhbox.pack_start(vboxl, True, True, 6)
mhbox.pack_start(vboxl, True, True, 0)
mhbox.pack_start(vboxr, False, False, 0)
vbox.pack_start(mhbox, True, True, 3)
vbox.pack_start(mhbox, True, True, 0)
return vbox
 
 
663,10 → 685,12
aid = self.get_aid_from_widget()
self.log.debug("Previewing aid: %s", aid)
if len(aid) == 0:
raise
return
 
atype = self.srvant.get_metadata_value(aid, 'Type')
if atype is None:
raise
return
 
browser = self.srvgui.get_widget('annotation_browser')
684,3 → 708,25
stack_annotation = self.srvgui.get_widget('stack_annotation')
self.set_visible_stack('editor')
# ~ self.log.debug("Load preview from %s", target)
 
 
def completion_match_func(self, completion, key, iter):
model = completion.get_model()
text = model.get_value(iter, 0)
if key.upper() in text.upper():
return True
return False
 
 
def scope_activated(self, entry):
scope_text = entry.get_text()
cid = self.srvclt.get_cid_by_name(scope_text)
if cid is None:
for title in self.srvclt.get_collections_name():
if scope_text.upper() in title.upper():
entry.set_text(title)
else:
entry.set_text(scope_text)
 
def product_activated(self, entry):
pass
/branches/BR-0.4/basico/widgets/wdg_visor_annotations.py
22,6 → 22,7
from gi.repository import Gtk
from gi.repository.GdkPixbuf import Pixbuf
from gi.repository import Pango
from gi.repository import GObject
 
from basico.core.mod_env import LPATH, ATYPES
from basico.core.mod_wdg import BasicoWidget
87,12 → 88,11
# ~ separator = Gtk.Separator(orientation = Gtk.Orientation.VERTICAL)
# ~ self.pack_start(separator, False, False, 3)
vbox_main.set_hexpand(False)
vbox_main.set_property('margin-top', 6)
# ~ vbox_main.set_property('margin-top', 6)
vbox_main.set_property('margin-left', 6)
vbox_main.set_property('margin-right', 6)
vbox_main.set_property('margin-bottom', 3)
 
 
def create_panel_elem_button(icon, title):
button = self.srvgui.add_widget('gtk_togglebutton_%s' % title, Gtk.ToggleButton())
button.set_relief(Gtk.ReliefStyle.NONE)
107,10 → 107,44
 
return button
 
# Separator
separator = Gtk.Separator()
vbox_main.pack_start(separator, False, False, 6)
 
# Scope filter
hbox_scope = Gtk.HBox()
label = Gtk.Label()
label.set_markup("<big><b>Scope </b></big>")
label.set_xalign(0.0)
model = Gtk.ListStore(str)
scope = Gtk.ComboBox.new_with_model(model)
signal = scope.connect('changed', self.scope_changed)
self.srvgui.add_signal('gtk_combobox_filter_scope', 'changed', signal)
self.srvgui.add_widget('gtk_combobox_filter_scope', scope)
renderer = Gtk.CellRendererText()
scope.pack_start(renderer, True)
scope.add_attribute(renderer, "markup", 0)
hbox_scope.pack_start(label, False, False, 0)
hbox_scope.pack_start(scope, True, True, 0)
vbox_main.pack_start(hbox_scope, False, False, 6)
 
# Product combobox
model = Gtk.ListStore(str)
 
product = Gtk.ComboBox.new_with_model(model)
self.srvgui.add_widget('gtk_combobox_filter_product', product)
renderer = Gtk.CellRendererText()
product.pack_start(renderer, True)
product.add_attribute(renderer, "markup", 0)
hbox = Gtk.HBox()
hbox.pack_start(product, True, True, 0)
vbox_main.pack_start(hbox, False, False, 6)
 
hbox_main = Gtk.HBox()
hbox_main.set_homogeneous(True)
vbox_main.pack_start(hbox_main, False, False, 0)
 
# Separator
separator = Gtk.Separator()
vbox_main.pack_start(separator, False, False, 6)
 
181,8 → 215,10
# ~ separator = Gtk.Separator()
# ~ vbox_main.pack_start(separator, False, False, 6)
 
 
return vbox_main
 
 
def set_visible_categories(self, togglebutton):
types = self.srvgui.get_widget('gtk_togglebutton_types')
revealer = self.srvgui.get_widget('gtk_revealer_annotations_categories')
246,17 → 282,16
 
# Setup model
self.model = Gtk.ListStore(
int, # key
str, # Annotation Id
Pixbuf, # Icon
int, # checkbox
str, # sid
str, # title
str, # component
str, # category
str, # type
str, # Scope
str, # Product
str, # priority
str, # last update
str, # Annotation Id (extra key)
str, # Timestamp updated
str, # Annotation created
str, # Timestamp created
349,7 → 384,7
self.column_component = Gtk.TreeViewColumn('Component', self.renderer_component, markup=5)
widget = get_column_header_widget('Component', 'basico-component')
self.column_component.set_widget(widget)
self.column_component.set_visible(True)
self.column_component.set_visible(False)
self.column_component.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
self.column_component.set_expand(False)
self.column_component.set_clickable(True)
357,19 → 392,19
self.column_component.set_sort_column_id(5)
self.treeview.append_column(self.column_component)
 
# SAP Note Category
self.renderer_category = Gtk.CellRendererText()
self.renderer_category.set_property('background', '#E3F1E3')
self.column_category = Gtk.TreeViewColumn('Category', self.renderer_category, markup=6)
# Annotation Scope
self.renderer_scope = Gtk.CellRendererText()
self.renderer_scope.set_property('background', '#E3F1E3')
self.column_scope = Gtk.TreeViewColumn('Category', self.renderer_scope, markup=6)
widget = get_column_header_widget('Category', 'basico-category')
self.column_category.set_widget(widget)
self.column_category.set_visible(False)
self.column_category.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_category.set_expand(False)
self.column_category.set_clickable(True)
self.column_category.set_sort_indicator(True)
self.column_category.set_sort_column_id(6)
self.treeview.append_column(self.column_category)
self.column_scope.set_widget(widget)
self.column_scope.set_visible(True)
self.column_scope.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_scope.set_expand(False)
self.column_scope.set_clickable(True)
self.column_scope.set_sort_indicator(True)
self.column_scope.set_sort_column_id(6)
self.treeview.append_column(self.column_scope)
 
# SAP Note Type
self.renderer_type = Gtk.CellRendererText()
409,28 → 444,19
self.column_updated.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_updated.set_clickable(True)
self.column_updated.set_sort_indicator(True)
self.column_updated.set_sort_column_id(11)
self.column_updated.set_sort_column_id(10)
self.column_updated.set_sort_order(Gtk.SortType.DESCENDING)
self.model.set_sort_column_id(11, Gtk.SortType.DESCENDING)
self.treeview.append_column(self.column_updated)
 
# Annotation Id
self.renderer_annotation = Gtk.CellRendererText()
self.column_annotation = Gtk.TreeViewColumn('Annotation Id', self.renderer_annotation, markup=10)
self.column_annotation.set_visible(False)
self.column_annotation.set_expand(False)
self.column_annotation.set_clickable(False)
self.column_annotation.set_sort_indicator(True)
self.treeview.append_column(self.column_annotation)
 
# Timestamp updated
self.renderer_timestamp_updated = Gtk.CellRendererText()
self.column_timestamp_updated = Gtk.TreeViewColumn('Timestamp updated', self.renderer_timestamp_updated, text=11)
self.column_timestamp_updated = Gtk.TreeViewColumn('Timestamp updated', self.renderer_timestamp_updated, text=10)
self.column_timestamp_updated.set_visible(False)
self.column_timestamp_updated.set_expand(False)
self.column_timestamp_updated.set_clickable(False)
self.column_timestamp_updated.set_sort_indicator(True)
self.column_timestamp_updated.set_sort_column_id(11)
self.column_timestamp_updated.set_sort_column_id(10)
self.column_timestamp_updated.set_sort_order(Gtk.SortType.ASCENDING)
self.treeview.append_column(self.column_timestamp_updated)
 
437,7 → 463,7
# Annotation Created On
self.renderer_created = Gtk.CellRendererText()
self.renderer_created.set_property('background', '#FFE6D1')
self.column_created = Gtk.TreeViewColumn('Created', self.renderer_created, markup=12)
self.column_created = Gtk.TreeViewColumn('Created', self.renderer_created, markup=11)
widget = get_column_header_widget('Created', 'basico-chronologic')
self.column_created.set_widget(widget)
self.column_created.set_visible(True)
445,7 → 471,7
self.column_created.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_created.set_clickable(True)
self.column_created.set_sort_indicator(True)
self.column_created.set_sort_column_id(13)
self.column_created.set_sort_column_id(12)
self.column_created.set_sort_order(Gtk.SortType.DESCENDING)
self.model.set_sort_column_id(11, Gtk.SortType.DESCENDING)
self.treeview.append_column(self.column_created)
452,12 → 478,12
 
# Timestamp
self.renderer_timestamp_created = Gtk.CellRendererText()
self.column_timestamp_created = Gtk.TreeViewColumn('Timestamp created', self.renderer_timestamp_created, text=13)
self.column_timestamp_created = Gtk.TreeViewColumn('Timestamp created', self.renderer_timestamp_created, text=12)
self.column_timestamp_created.set_visible(False)
self.column_timestamp_created.set_expand(False)
self.column_timestamp_created.set_clickable(False)
self.column_timestamp_created.set_sort_indicator(True)
self.column_timestamp_created.set_sort_column_id(11)
self.column_timestamp_created.set_sort_column_id(12)
self.column_timestamp_created.set_sort_order(Gtk.SortType.ASCENDING)
self.treeview.append_column(self.column_timestamp_created)
 
524,11 → 550,20
entry = self.srvgui.get_widget('gtk_entry_filter_visor')
text = self.srvutl.clean_html(entry.get_text())
title = model.get(itr, 4)[0]
scope = model.get(itr, 6)[0]
match = text.upper() in title.upper()
 
cmb_scope = self.srvgui.get_widget('gtk_combobox_filter_scope')
scope_filter = self.srvuif.get_combobox_text(cmb_scope, 0)
if scope_filter == scope or scope_filter == 'All' or scope_filter == '':
match = match and True
else:
match = match and False
 
return match
 
 
 
def update_total_annotations_count(self):
statusbar = self.srvgui.get_widget('widget_statusbar')
lblnotescount = self.srvgui.get_widget('gtk_label_total_notes')
574,12 → 609,14
selected = []
 
def get_selected_sapnotes(model, path, itr):
aid = self.sorted_model.get(itr, 10)[0]
aid = self.sorted_model.get(itr, 0)[0]
checked = self.sorted_model.get(itr, 2)[0]
if checked:
selected.append(str(aid))
 
self.sorted_model.foreach(get_selected_sapnotes)
for aid in selected:
self.log.debug(self.srvant.get_title(aid))
return selected
 
 
589,7 → 626,7
if treeiter is not None:
component = model[treeiter][5]
if component == 'Annotation':
aid = model[treeiter][10]
aid = model[treeiter][0]
is_valid = self.srvant.is_valid(aid)
if is_valid:
widget_annotation = self.srvgui.get_widget('widget_annotation')
617,7 → 654,7
model[path][2] = not model[path][2]
 
 
def get_node(self, key, icon, checkbox, sid, title, component, category='', sntype='', priority='', updated='', aid='', ts_updated='', created='', ts_created=''):
def get_node(self, key, icon, checkbox, sid, title, component, scope='', sntype='', priority='', updated='', ts_updated='', created='', ts_created=''):
# Add completion entries
completion = self.srvgui.get_widget('gtk_entrycompletion_visor')
completion_model = completion.get_model()
631,11 → 668,10
node.append(sid)
node.append(title)
node.append(component)
node.append(category)
node.append(scope)
node.append(sntype)
node.append(priority)
node.append(updated)
node.append(aid) # Extra key for annotations id (aid)
node.append(ts_updated)
node.append(created)
node.append(ts_created)
657,9 → 693,9
 
def populate(self, annotations=None):
self.column_sid.set_visible(False)
self.column_checkbox.set_visible(True)
self.column_category.set_visible(True)
self.column_component.set_visible(False)
# ~ self.column_checkbox.set_visible(True)
# ~ self.column_category.set_visible(True)
# ~ self.column_component.set_visible(False)
completion = self.srvgui.get_widget('gtk_entrycompletion_visor')
completion_model = completion.get_model()
completion_model.clear()
681,11 → 717,18
dcats = {}
snpids = {}
nodes = []
bag = set()
 
for fname in annotations:
try:
with open(fname, 'r') as fa:
try:
annotation = json.load(fa)
# Get Scopes
try:
scope = annotation['Scope']
except:
scope = ''
# ~ self.log.debug("Annotation: %s", annotation['Title'])
category = annotation['Category']
atype = annotation['Type']
715,24 → 758,28
except:
annotation['Priority'] = 'Normal'
 
node = self.get_node( 0,
node = self.get_node( annotation['AID'],
icon,
False,
str(int(sid)),
title,
annotation['Component'],
annotation['Category'],
scope,
annotation['Type'],
annotation['Priority'],
self.srvutl.fuzzy_date_from_timestamp(annotation['Timestamp']),
annotation['AID'],
annotation['Timestamp'],
self.srvutl.fuzzy_date_from_timestamp(annotation['Created']),
annotation['Created']
)
nodes.append(node)
# ~ if scope_filter == 'All' or scope_filter == '':
# ~ nodes.append(node)
# ~ bag.add(fname)
# ~ else:
# ~ if scope_filter == scope:
# ~ bag.add(fname)
 
 
except Exception as error:
self.log.error(error)
self.log.error(self.get_traceback())
747,8 → 794,9
 
self.treeview.set_model(self.sorted_model)
self.sort_by_timestamp()
# ~ self.set_bag(bag)
self.update_panel_values()
self.update_total_annotations_count()
# ~ self.log.debug("Visor updated")
 
 
def show_widgets(self):
770,7 → 818,7
if treeiter is not None:
component = model[treeiter][5]
if component == 'Annotation':
aid = model[treeiter][10]
aid = model[treeiter][0]
is_valid = self.srvant.is_valid(aid)
if is_valid:
# ~ fullscreen_annotation = self.srvgui.get_widget('gtk_togglebutton_maximize_annotation_widget')
803,7 → 851,7
model = treeview.get_model()
treeiter = model.get_iter(path)
component = model[treeiter][5]
aid = model[treeiter][10]
aid = model[treeiter][0]
# ~ toolbar = self.srvgui.get_widget('visortoolbar')
popover = self.srvgui.add_widget('gtk_popover_visor_row', Gtk.Popover.new(treeview))
# ~ popover.set_position(Gtk.PositionType.TOP)
938,3 → 986,30
category = self.srvgui.get_widget('gtk_togglebutton_inbox')
category.set_active(True)
 
 
def update_panel_values(self):
scopes = set()
def get_values(model, path, itr):
scope = self.sorted_model.get(itr, 6)[0]
scopes.add(scope)
self.sorted_model.foreach(get_values)
 
cmb_scope = self.srvgui.get_widget('gtk_combobox_filter_scope')
signal = self.srvgui.get_signal('gtk_combobox_filter_scope', 'changed')
GObject.signal_handler_block(cmb_scope, signal)
model = cmb_scope.get_model()
model.clear()
first = model.append(['All'])
lscopes = list(scopes)
lscopes.sort()
for item in lscopes:
if len(item) > 0:
model.append([item])
cmb_scope.set_active_iter(first)
GObject.signal_handler_unblock(cmb_scope, signal)
 
 
def scope_changed(self, *args):
visible_filter = self.get_visible_filter()
visible_filter.refilter()
self.update_total_annotations_count()
/branches/BR-0.4/setup.py
48,6 → 48,10
[
'basico/data/res/splash/basico-splash-400x250.png',
]),
('basico/data/res/sap',
[
'basico/data/res/sap/products.txt',
]),
('basico/data/tpl', ['basico/data/tpl/report.html']),
('basico/data/icons',
[
119,6 → 123,7
'basico/data/icons/basico-refresh.svg',
'basico/data/icons/basico-restore.svg',
'basico/data/icons/basico-sapnote.svg',
'basico/data/icons/basico-scope.svg',
'basico/data/icons/basico-select.svg',
'basico/data/icons/basico-settings.svg',
'basico/data/icons/basico-sid.svg',