Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 358 → Rev 359

/branches/BR-0.4/basico/data/res/user_agents.txt
File deleted
\ No newline at end of file
/branches/BR-0.4/basico/data/res/extensions.json
File deleted
\ No newline at end of file
/branches/BR-0.4/basico/services/srv_utils.py
21,6 → 21,7
import webbrowser
import feedparser
from datetime import datetime
from gi.repository import Gio
from basico.core.mod_env import GPATH, LPATH, FILE
from basico.core.mod_srv import Service
 
34,7 → 35,6
Missing method docstring (missing-docstring)
"""
self.get_services()
self.load_extensions()
 
 
def get_services(self):
42,14 → 42,8
Missing method docstring (missing-docstring)
"""
self.srvdtb = self.get_service('DB')
 
 
def load_extensions(self):
with open(FILE['EXT'], 'r') as fext:
self.extensions = json.load(fext)
self.log.debug("%d extensions loaded", len(self.extensions))
 
 
def get_file_metadata(self, path):
self.log.debug("Getting metadata from: %s", path)
metadata = {}
57,12 → 51,12
metadata['Basename'] = escape(self.get_file_basename(path))
metadata['Extension'] = escape(self.get_file_extension(path))
metadata['Size'] = self.get_file_size(path)
metadata['Description'] = escape(self.get_file_description(metadata['Extension']))
metadata['Mimetype'] = escape(self.get_file_mimetype(metadata['Extension']))
metadata['Mimetype'] = escape(self.get_file_mimetype(path))
metadata['Description'] = escape(self.get_file_description(metadata['Mimetype']))
metadata['Doctype'] = escape(self.get_file_doctype(metadata['Mimetype']))
return metadata
 
 
def get_file_size(self, path):
# Get size in bytes
size = os.stat(path)[ST_SIZE]
101,14 → 95,9
return title
 
def get_file_mimetype(self, ext):
try:
mimetype, description = self.extensions[ext]
self.log.debug("\tMimetype: %s", mimetype)
return mimetype
except Exception as warning:
self.log.warning(warning)
return 'application/x-other'
def get_file_mimetype(self, path):
mimetype, val = Gio.content_type_guess('filename=%s' % path, data=None)
return mimetype
 
 
def get_file_doctype(self, mimetype):
118,14 → 107,9
return doctype
 
 
def get_file_description(self, ext):
try:
filetype, description = self.extensions[ext]
self.log.debug("\tDescription: %s", description)
return description
except Exception as warning:
self.log.error(warning)
return 'Unknow file type'
def get_file_description(self, mimetype):
description = Gio.content_type_get_description(mimetype)
return description
 
 
def get_disk_usage(self, path):
/branches/BR-0.4/basico/widgets/wdg_visor_annotations.py
357,7 → 357,7
self.treeview.set_level_indentation(10)
self.treeview.connect('button_press_event', self.right_click)
 
 
self.treeview.modify_font(Pango.FontDescription('Monospace 9'))
# DOC: In order to have a Gtk.Widged with sorting and filtering
# capabilities, you have to filter the model first, and use this
/branches/BR-0.4/basico/widgets/wdg_visor_attachments.py
137,37 → 137,38
# ~ self.column_icon.set_widget(widget)
self.column_icon.set_visible(True)
self.column_icon.set_expand(False)
# ~ self.column_icon.set_clickable(False)
# ~ self.column_icon.set_sort_indicator(True)
self.column_icon.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_icon.set_expand(False)
self.column_icon.set_clickable(True)
self.column_icon.set_sort_indicator(True)
self.column_icon.set_sort_column_id(10)
self.treeview.append_column(self.column_icon)
 
# SAP Note Id
self.renderer_sid = Gtk.CellRendererText()
self.renderer_sid.set_property('xalign', 1.0)
self.renderer_sid.set_property('height', 36)
self.renderer_sid.set_property('background', '#F0E3E3')
self.column_sid = Gtk.TreeViewColumn('SAP Note', self.renderer_sid, markup=2)
# ~ widget = get_column_header_widget('SAP Note', 'basico-sid')
# ~ self.column_sid.set_widget(widget)
self.column_sid.set_visible(True)
self.column_sid.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_sid.set_expand(False)
self.column_sid.set_clickable(True)
self.column_sid.set_sort_indicator(True)
self.column_sid.set_sort_column_id(2)
self.treeview.append_column(self.column_sid)
 
# Document Type
self.renderer_doctype = Gtk.CellRendererText()
self.renderer_doctype.set_property('background', '#FFEEAF')
self.column_doctype = Gtk.TreeViewColumn('Document type', self.renderer_doctype, text=3)
self.column_doctype.set_visible(True)
self.column_doctype = Gtk.TreeViewColumn('Document type', self.renderer_doctype, markup=2)
self.column_doctype.set_visible(False)
self.column_doctype.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_doctype.set_expand(False)
self.column_doctype.set_clickable(True)
self.column_doctype.set_sort_indicator(True)
self.column_doctype.set_sort_column_id(3)
self.column_doctype.set_sort_column_id(2)
self.treeview.append_column(self.column_doctype)
 
# Description
self.renderer_description = Gtk.CellRendererText()
self.renderer_description.set_property('background', '#E3E3F0')
self.column_description = Gtk.TreeViewColumn('Description', self.renderer_description, markup=3)
# ~ widget = get_column_header_widget('Description', 'basico-component')
# ~ self.column_description.set_widget(widget)
self.column_description.set_visible(True)
self.column_description.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
self.column_description.set_expand(False)
self.column_description.set_clickable(True)
self.column_description.set_sort_indicator(True)
self.column_description.set_sort_column_id(3)
self.treeview.append_column(self.column_description)
# Attachment Title
self.renderer_title = Gtk.CellRendererText()
184,20 → 185,22
self.column_title.set_sort_column_id(4)
self.treeview.append_column(self.column_title)
 
# Description
self.renderer_description = Gtk.CellRendererText()
self.renderer_description.set_property('background', '#E3E3F0')
self.column_description = Gtk.TreeViewColumn('Description', self.renderer_description, markup=5)
# ~ widget = get_column_header_widget('Description', 'basico-component')
# ~ self.column_description.set_widget(widget)
self.column_description.set_visible(True)
self.column_description.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
self.column_description.set_expand(False)
self.column_description.set_clickable(True)
self.column_description.set_sort_indicator(True)
self.column_description.set_sort_column_id(5)
self.treeview.append_column(self.column_description)
 
# SAP Note Id
self.renderer_sid = Gtk.CellRendererText()
self.renderer_sid.set_property('xalign', 1.0)
self.renderer_sid.set_property('height', 36)
self.renderer_sid.set_property('background', '#F0E3E3')
self.column_sid = Gtk.TreeViewColumn('SAP Note', self.renderer_sid, markup=5)
# ~ widget = get_column_header_widget('SAP Note', 'basico-sid')
# ~ self.column_sid.set_widget(widget)
self.column_sid.set_visible(True)
self.column_sid.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_sid.set_expand(False)
self.column_sid.set_clickable(True)
self.column_sid.set_sort_indicator(True)
self.column_sid.set_sort_column_id(5)
self.treeview.append_column(self.column_sid)
# Added
self.renderer_added = Gtk.CellRendererText()
self.renderer_added.set_property('background', '#E3F1E3')
412,13 → 415,13
sid = str(int(sid))
if sid == '0':
sid = ''
self.log.debug("SID: %s", sid)
self.log.debug("Description: %s", metadata['Description'])
node = self.get_node( metadata['TID'],
self.srvicm.find_mime_type_pixbuf(metadata['Mimetype']),
sid,
metadata['Doctype'],
metadata['Description'],
metadata['Title'],
metadata['Description'],
sid,
self.srvutl.fuzzy_date_from_timestamp(metadata['Created']),
metadata['Created'],
str(self.srvutl.get_human_sizes(int(metadata['Size']))),
/branches/BR-0.4/setup.py
34,7 → 34,6
data_files = [
('share/applications', ['basico/data/desktop/basico.desktop']),
('share/icons', ['basico/data/icons/basico-component.svg']),
('basico/data/res', ['basico/data/res/extensions.json']),
('basico/data/res/selenium/drivers',
[
'basico/data/res/selenium/drivers/geckodriver',