Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 363 → Rev 364

/branches/BR-0.4/basico/basico.py
22,7 → 22,7
from basico.services.srv_uif import UIFuncs
from basico.services.srv_callbacks import Callback
from basico.services.srv_notify import Notification
from basico.services.srv_db import Database
from basico.services.srv_database import Database
from basico.services.srv_driver import SeleniumDriver
from basico.services.srv_collections import Collections
from basico.services.srv_annotations import Annotation
/branches/BR-0.4/basico/core/mod_win.py
263,7 → 263,7
mainbox.set_hexpand(True)
paned = self.srvgui.add_widget('gtk_hpaned', Gtk.HPaned())
paned.set_property('margin-bottom', 6)
paned.set_wide_handle(True)
paned.set_wide_handle(False)
paned.set_position(300)
 
# (Build first menuview)
293,7 → 293,7
vpaned = self.srvgui.add_widget('gtk_vpaned_visor', Gtk.VPaned())
vpaned.set_property('margin-bottom', 6)
vpaned.set_wide_handle(True)
vpaned.set_position(600)
vpaned.set_position(0)
box = Gtk.VBox()
box.set_hexpand(True)
/branches/BR-0.4/basico/data/icons/basico-preview.svg
0,0 → 1,158
<?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://creativecommons.org/ns#"
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="svg683"
sodipodi:version="0.32"
width="72pt"
height="72pt"
xml:space="preserve"
sodipodi:docbase="/home/tweenk/dev/GartoonRedux/scalable/apps"
sodipodi:docname="gnome-eyes-applet.svg"
inkscape:version="0.46+devel"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<metadata
id="metadata9">
<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="defs685"><linearGradient
id="linearGradient1853">
<stop
offset="0.0000000"
style="stop-color:#000000;stop-opacity:1.0000000;"
id="stop1855" />
<stop
offset="1.0000000"
style="stop-color:#3b91cd;stop-opacity:0.98969072;"
id="stop1854" />
</linearGradient><linearGradient
id="linearGradient1840">
<stop
offset="0.0000000"
style="stop-color:#ffb700;stop-opacity:1.0000000;"
id="stop1842" />
<stop
offset="1.0000000"
style="stop-color:#ffd58f;stop-opacity:0.0000000;"
id="stop1841" />
</linearGradient><defs
id="defs3">
<sodipodi:namedview
id="namedview909" />
<defs
id="defs550">
<linearGradient
x1="0.0000000"
y1="0.0000000"
x2="1.0000000"
y2="0.0000000"
id="linearGradient632"
gradientUnits="objectBoundingBox"
spreadMethod="pad"
xlink:href="#linearGradient1840" />
<linearGradient
x1="0.0000000"
y1="0.0000000"
x2="1.0000000"
y2="0.0000000"
id="linearGradient556"
gradientUnits="objectBoundingBox"
spreadMethod="pad"
xlink:href="#linearGradient1853" />
<linearGradient
id="linearGradient559"
xlink:href="#linearGradient632"
x1="60.644615"
y1="19.295689"
x2="35.370575"
y2="69.142799"
gradientUnits="userSpaceOnUse"
spreadMethod="pad" />
<linearGradient
xlink:href="#linearGradient632"
id="linearGradient631"
x1="85.637657"
y1="17.443844"
x2="73.916298"
y2="54.628181"
gradientUnits="userSpaceOnUse"
spreadMethod="pad"
gradientTransform="scale(0.740666,1.350136)" />
</defs>
</defs></defs>
<sodipodi:namedview
id="base"
inkscape:zoom="2.5208333"
inkscape:cx="48.456705"
inkscape:cy="48.849742"
inkscape:window-width="795"
inkscape:window-height="724"
inkscape:window-x="52"
inkscape:window-y="9"
inkscape:current-layer="svg683"
showgrid="false" />
<path
style="opacity:1;color:#000000;fill:#000000;fill-opacity:0.29357796;fill-rule:evenodd;stroke:none;stroke-width:1.64835155;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 6.9362529,63.149154 c -7.10455536,6.851744 -1.9734876,12.561532 5.5257651,14.845446 7.499253,2.283914 24.07655,1.522611 29.997012,-1.141957 5.920463,-2.664567 8.683346,-5.329134 14.209111,-3.425872 5.525766,1.903262 24.865944,0.380651 28.023524,-5.709787 3.157581,-6.090438 -1.184093,-11.800226 -7.499253,-11.800226 -6.315161,0 -55.257653,0.380654 -70.2561591,7.232396 z"
id="path2187" /><path
sodipodi:type="arc"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.875;stroke-miterlimit:4;stroke-opacity:1"
id="path1167"
sodipodi:cx="36.446281"
sodipodi:cy="34.214874"
sodipodi:rx="11.652892"
sodipodi:ry="11.652892"
d="m 48.099174,34.214874 a 11.652892,11.652892 0 1 1 -23.305785,0 11.652892,11.652892 0 1 1 23.305785,0 z"
transform="matrix(1.6868962,0,0,2.1226674,3.6940744,-32.728678)" />
<path
sodipodi:type="arc"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.875;stroke-miterlimit:4;stroke-opacity:1"
id="path1789"
sodipodi:cx="36.446281"
sodipodi:cy="34.214874"
sodipodi:rx="11.652892"
sodipodi:ry="11.652892"
d="m 48.099174,34.214874 a 11.652892,11.652892 0 1 1 -23.305785,0 11.652892,11.652892 0 1 1 23.305785,0 z"
transform="matrix(1.9858665,0,0,2.4988699,-42.752573,-40.863853)" />
<path
sodipodi:type="arc"
style="fill:#000000;fill-opacity:1;stroke:none"
id="path1806"
sodipodi:cx="44.132233"
sodipodi:cy="43.140495"
sodipodi:rx="4.9586778"
sodipodi:ry="5.2066116"
d="m 49.09091,43.140495 a 4.9586778,5.2066116 0 1 1 -9.917355,0 4.9586778,5.2066116 0 1 1 9.917355,0 z"
transform="matrix(1.6954298,0,0,1.6954298,-42.036912,-27.34553)" />
<path
sodipodi:type="arc"
style="fill:#000000;fill-opacity:1;stroke:none"
id="path1805"
sodipodi:cx="44.132233"
sodipodi:cy="43.140495"
sodipodi:rx="4.9586778"
sodipodi:ry="5.2066116"
d="m 49.09091,43.140495 a 4.9586778,5.2066116 0 1 1 -9.917355,0 4.9586778,5.2066116 0 1 1 9.917355,0 z"
transform="matrix(1.6954298,0,0,1.6954298,-8.3793552,-32.73916)" />
</svg>
/branches/BR-0.4/basico/services/srv_callbacks.py
915,6 → 915,7
 
 
def gui_attachment_add_to_annotation(self, button):
widget_annotation = self.srvgui.get_widget('widget_annotation')
visor_attachemnts = self.srvgui.get_widget('visor_attachments')
visor_annotations = self.srvgui.get_widget('visor_annotations')
aid = widget_annotation.get_aid_from_widget()
/branches/BR-0.4/basico/services/srv_driver.py
55,6 → 55,9
GECKO_INSTALL_DIR = LPATH['DRIVERS']
os.environ["PATH"] += os.pathsep + GECKO_INSTALL_DIR
 
# Asciidoctor installed?
ASCIIDOCTOR = utils.which('asciidoctor')
 
# Then, look for Geckodriver
GECKODRIVER = utils.which('geckodriver')
 
/branches/BR-0.4/basico/services/srv_uif.py
271,3 → 271,9
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(text, -1)
 
 
def get_toolbar_separator(self, draw=False, expand=False):
tool = Gtk.SeparatorToolItem.new()
tool.set_draw(draw)
tool.set_expand(expand)
return tool
/branches/BR-0.4/basico/services/srv_utils.py
268,6 → 268,7
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
self.log.debug("%s installed in: %s", fname, program)
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
274,6 → 275,7
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):
self.log.debug("%s installed in: %s", path, program)
return exe_file
 
return None
/branches/BR-0.4/basico/widgets/wdg_annot.py
20,6 → 20,7
from gi.repository import GtkSource
from basico.core.mod_env import LPATH, ATYPES
from basico.core.mod_wdg import BasicoWidget
from basico.widgets.wdg_browser import BasicoBrowser
 
 
class AnnotationToolbar(BasicoWidget, Gtk.HBox):
35,12 → 36,12
self.pack_start(self.tool_bar, False, True, 0)
self.tool_bar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
self.tool_bar.set_property('margin-bottom', 0)
 
# Task Category button
tool = Gtk.ToolItem()
a_category_model = Gtk.ListStore(Pixbuf, str)
a_category = Gtk.ComboBox.new_with_model(a_category_model)
a_category.set_tooltip_markup('<b>Choose a category</b>')
self.srvgui.add_widget('gtk_combobox_annotation_category', a_category)
renderer = Gtk.CellRendererPixbuf()
61,24 → 62,19
a_category.set_active_iter(active)
hbox = Gtk.HBox()
label = Gtk.Label()
label.set_xalign(0.0)
label.set_markup('<b>Category</b>')
hbox.pack_start(label, False, False, 3)
hbox.pack_start(a_category, False, False, 0)
tool.add(hbox)
self.tool_bar.insert(tool, -1)
 
# Separator
tool = Gtk.SeparatorToolItem.new()
tool.set_draw(False)
tool.set_expand(False)
tool = self.srvuif.get_toolbar_separator(False, False)
self.tool_bar.insert(tool, -1)
 
# Task Type button
# Annotation Type button
tool = Gtk.ToolItem()
a_type_model = Gtk.ListStore(Pixbuf, str)
a_type = Gtk.ComboBox.new_with_model(a_type_model)
a_type.set_tooltip_markup('<b>Choose a type</b>')
self.srvgui.add_widget('gtk_combobox_annotation_type', a_type)
renderer = Gtk.CellRendererPixbuf()
a_type.pack_start(renderer, False)
91,18 → 87,12
active = self.srvgui.add_widget('annotation_type_%s' % item.title(), a_type_model.append([icon, '%s' % item.title()]))
a_type.set_active_iter(active)
hbox = Gtk.HBox()
label = Gtk.Label()
label.set_xalign(0.0)
label.set_markup('<b>Type</b>')
hbox.pack_start(label, False, False, 6)
hbox.pack_start(a_type, False, False, 0)
tool.add(hbox)
self.tool_bar.insert(tool, -1)
 
# Separator
tool = Gtk.SeparatorToolItem.new()
tool.set_draw(False)
tool.set_expand(False)
tool = self.srvuif.get_toolbar_separator(False, False)
self.tool_bar.insert(tool, -1)
 
# Task Priority button
109,6 → 99,7
tool = Gtk.ToolItem()
a_priority_model = Gtk.ListStore(Pixbuf, str)
a_priority = Gtk.ComboBox.new_with_model(a_priority_model)
a_priority.set_tooltip_markup('<b>Choose a priority</b>')
self.srvgui.add_widget('gtk_combobox_annotation_priority', a_priority)
renderer = Gtk.CellRendererPixbuf()
130,32 → 121,24
a_priority.set_active_iter(active)
hbox = Gtk.HBox()
label = Gtk.Label()
label.set_xalign(0.0)
label.set_markup('<b>Priority</b>')
hbox.pack_start(label, False, False, 6)
hbox.pack_start(a_priority, False, False, 0)
tool.add(hbox)
self.tool_bar.insert(tool, -1)
# Separator
tool = Gtk.SeparatorToolItem.new()
tool.set_draw(True)
tool.set_expand(False)
tool = self.srvuif.get_toolbar_separator(False, False)
self.tool_bar.insert(tool, -1)
 
# Attachment button
tool = Gtk.ToolButton()
tool.set_tooltip_markup('<b>Attach file(s) to this annotation</b>')
tool.set_icon_name('basico-attachment')
tool.set_tooltip_markup('<b>Attach any document to this annotation</b>')
popover = self.srvgui.add_widget('gtk_button_annotation_toolbar_attachment', Gtk.Popover.new(tool))
tool.connect('clicked', self.srvclb.gui_attachment_add_to_annotation)
self.tool_bar.insert(tool, -1)
 
# Separator
tool = Gtk.SeparatorToolItem.new()
tool.set_draw(False)
tool.set_expand(True)
tool = self.srvuif.get_toolbar_separator(False, True)
self.tool_bar.insert(tool, -1)
# Title
188,7 → 171,22
a_wdg_human_timestamp.modify_font(Pango.FontDescription('Monospace 10'))
a_wdg_human_timestamp.set_xalign(0.5)
tool.add(a_wdg_human_timestamp)
tool.set_no_show_all(True)
tool.hide()
self.tool_bar.insert(tool, -1)
 
# Annotation Stack Switcher
tool = Gtk.ToolItem()
stack_switcher = self.srvgui.add_widget('stack_switcher_annotation', Gtk.StackSwitcher())
stack_switcher.set_property('icon-size', 3)
stack = self.srvgui.add_widget('stack_annotation', Gtk.Stack())
stack_switcher.set_stack(stack)
tool.add(stack_switcher)
self.tool_bar.insert(tool, -1)
 
# Separator
tool = self.srvuif.get_toolbar_separator(False, False)
self.tool_bar.insert(tool, -1)
# Maximize toggle button
tool = Gtk.ToolItem()
267,8 → 265,8
# Annotation Header
container = self.srvgui.get_widget('gtk_vbox_annotation_container')
header = Gtk.VBox()
separator = Gtk.Separator()
# ~ header.pack_start(separator, False, False, 0)
 
# Editor's toolbar
toolbar = AnnotationToolbar(self.app, self.sid)
header.pack_start(toolbar, False, False, 0)
hbox = Gtk.HBox()
293,6 → 291,40
 
 
def __setup_body(self):
stack_switcher = self.srvgui.get_widget('stack_switcher_annotation')
stack_annotation = self.srvgui.get_widget('stack_annotation')
stack_annotation.connect('notify::visible-child', self.stack_changed)
self.container_body.add(stack_annotation)
 
# Add Annotation editor stack
editor = self.annotation_editor()
stack_annotation.add_titled(editor, "editor", "Edit annotation")
stack_annotation.child_set_property (editor, "icon-name", "basico-drafts")
# Add Annotation preview stack
preview = self.annotation_preview()
stack_annotation.add_titled(preview, "preview", "Preview annotation")
stack_annotation.child_set_property (preview, "icon-name", "basico-preview")
 
stack_annotation.set_visible_child(editor)
stack_annotation.set_visible_child_full('editor', Gtk.StackTransitionType.CROSSFADE)
 
 
def stack_changed(self, stack, GParamObject):
stack_name = stack.get_visible_child_name()
if stack_name == 'preview':
browser = self.srvgui.get_widget('annotation_browser')
self.log.debug("Execute asciidoc for current annotation: %s", self.sid)
# ~ browser.load_url('https://www.meneame.net')
self.log.debug("Load preview")
 
def annotation_preview(self):
browser = self.srvgui.add_widget('annotation_browser', BasicoBrowser(self.app))
return browser
 
def annotation_editor(self):
vbox = Gtk.VBox()
 
# Hidden metadata
377,7 → 409,8
mhbox.pack_start(vboxl, True, True, 6)
mhbox.pack_start(vboxr, False, False, 0)
vbox.pack_start(mhbox, True, True, 3)
self.container_body.add(vbox)
return vbox
 
 
def __setup_footer(self):
/branches/BR-0.4/basico/widgets/wdg_browser.py
14,11 → 14,16
from gi.repository import Gtk
from gi.repository import WebKit
 
from basico.core.mod_wdg import BasicoWidget
 
class BasicoBrowser(Gtk.VBox):
def __init__(self, *args, **kwargs):
super(BasicoBrowser, self).__init__(*args, **kwargs)
 
class BasicoBrowser(BasicoWidget, Gtk.VBox):
def __init__(self, app):
# ~ def __init__(self, *args, **kwargs):
super().__init__(app, __class__.__name__)
# ~ super(BasicoBrowser, self).__init__(*args, **kwargs)
Gtk.VBox.__init__(self)
self.app = app
self.webview = WebKit.WebView()
 
settings = self.webview.get_settings()
39,6 → 44,7
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add(self.webview)
scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scrolled_window.set_shadow_type(Gtk.ShadowType.IN)
scrolled_window.set_hexpand(True)
scrolled_window.set_vexpand(True)
self.pack_start(scrolled_window, True, True, 0)
/branches/BR-0.4/setup.py
100,6 → 100,7
'basico/data/icons/basico-jump-sapnote.svg',
'basico/data/icons/basico-logviewer.svg',
'basico/data/icons/basico-menu-system.svg',
'basico/data/icons/basico-preview.svg',
'basico/data/icons/basico-priority.svg',
'basico/data/icons/basico-annotation-priority-high.svg',
'basico/data/icons/basico-annotation-priority-normal.svg',