Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 367 → Rev 368

/branches/BR-0.4/basico/data/icons/basico-copy-paste.svg
0,0 → 1,137
<?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="svg604"
sodipodi:version="0.32"
width="90"
height="90"
sodipodi:docbase="/home/tweenk/GNUtoon/actions"
sodipodi:docname="edit-paste.svg"
inkscape:version="0.45.1"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.0">
<metadata
id="metadata23">
<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="defs606">
<linearGradient
id="linearGradient671">
<stop
style="stop-color:#7fa8e3;stop-opacity:0.741176;"
offset="0.000000"
id="stop672" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1.000000"
id="stop673" />
</linearGradient>
<linearGradient
id="linearGradient612">
<stop
style="stop-color:#955801;stop-opacity:0.4471;"
offset="0"
id="stop613" />
<stop
style="stop-color:#000500;stop-opacity:0;"
offset="1"
id="stop614" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient612"
id="linearGradient615"
x1="36.216915"
y1="12.409"
x2="37.964546"
y2="72.903305"
gradientUnits="userSpaceOnUse"
spreadMethod="pad"
gradientTransform="matrix(0.965046,0,0,0.965046,1.429245,2.065384)" />
<linearGradient
xlink:href="#linearGradient671"
id="linearGradient710"
x1="36.216915"
y1="12.409"
x2="37.964546"
y2="72.903305"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.965046,0,0,0.965046,1.429245,2.065384)" />
</defs>
<sodipodi:namedview
id="base"
inkscape:zoom="5.0416667"
inkscape:cx="26.936261"
inkscape:cy="-2.4793388"
inkscape:window-width="874"
inkscape:window-height="723"
inkscape:window-x="140"
inkscape:window-y="6"
inkscape:current-layer="svg604"
width="90px"
height="90px" />
<path
style="fill:#000000;fill-opacity:0.3;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 65.484243,7.70488 C 62.707011,6.835973 25.021617,12.416944 20.880977,13.13327 C 15.820569,13.853533 12.989025,15.942426 11.682873,18.772763 C 9.155049,22.367786 14.398042,73.989307 15.904953,79.450093 C 16.332286,84.854917 21.2188,86.850781 24.138011,86.899051 C 25.016564,86.729518 32.130804,85.341322 36.894726,84.426118 C 38.311743,85.88053 40.242321,86.604202 41.659644,86.627632 C 44.335896,86.111218 77.655486,79.822417 81.045627,78.605677 C 84.435855,77.388919 85.100163,73.679329 84.69471,71.036089 C 83.845197,68.779453 78.319542,30.510496 78.48222,28.634338 C 78.32403,25.184517 76.579341,24.617629 74.38077,23.929733 C 74.158698,23.860256 72.697941,24.024635 71.968152,24.050364 C 71.557971,20.770904 70.601157,14.138207 70.641213,13.676109 C 70.441401,9.318234 68.261589,8.573846 65.484243,7.70488 z "
id="path845" />
<path
style="fill:#7e0000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 19.163695,84.730744 C 16.244476,84.682453 11.350433,82.668361 10.923106,77.26354 C 9.416179,71.802754 4.177643,20.18895 6.705465,16.593919 C 8.011615,13.76359 10.855861,11.685876 15.916293,10.965604 C 20.056914,10.249275 57.720546,4.651058 60.497787,5.519966 C 63.275115,6.388932 65.462877,7.123717 65.662671,11.481585 C 65.457261,13.851593 72.452817,62.192614 73.526037,65.043235 C 74.038131,68.38222 73.197516,73.048252 68.914956,74.585293 C 64.632462,76.122304 22.544371,84.078385 19.163695,84.730744 z "
id="path609"
sodipodi:nodetypes="ccccccccc" />
<path
style="fill:#ffd056;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 22.536254,79.005913 C 19.706032,79.428064 15.77473,80.310568 15.305148,75.938731 C 13.34976,65.589502 8.866389,24.573092 12.060997,17.907493 C 12.774515,16.340092 16.648445,14.212559 25.448361,13.324397 C 35.448546,12.188016 55.9674,10.459925 58.126656,10.572179 C 60.285804,10.684462 60.946359,10.408248 61.416,14.78019 C 61.225269,19.428262 67.739037,55.788637 68.123838,62.226331 C 68.423256,66.796369 68.938533,68.738083 66.296562,69.842896"
id="path608"
sodipodi:nodetypes="cccccccs" />
<path
style="fill:url(#linearGradient615);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 12.769062,24.096744 C 12.769062,24.096744 13.023603,17.894319 20.3505,16.659175 C 27.67739,15.42406 56.695059,11.214212 57.386457,13.363472 C 58.077825,15.512719 58.933803,29.480161 59.147289,30.610087 C 59.360778,31.739974 34.796856,41.402449 28.051731,50.623822 C 21.306592,59.845174 16.582658,67.306945 16.582658,67.306945 C 16.582658,67.306945 12.720182,34.785028 12.769062,24.096744 z "
id="path636" />
<path
style="fill:#4e4e4e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 25.524291,5.707662 C 25.524291,5.707662 40.093392,3.186085 40.933917,3.746435 C 41.774448,4.306784 41.774439,8.789588 42.614964,9.349937 C 43.455489,9.910286 47.658117,9.069758 48.218469,10.190457 C 48.778815,11.311156 49.339161,16.074135 49.339161,16.074135 L 22.442375,20.27676 C 22.442375,20.27676 18.800094,15.51378 21.601848,13.832736 C 24.403601,12.151682 26.645001,12.992209 26.645001,11.591335 C 26.645001,10.190457 25.524291,5.707662 25.524291,5.707662 z "
id="path674" />
<path
style="fill:#a4a4a4;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 26.990179,6.552765 C 26.990179,6.552765 39.291282,4.371429 40.000968,4.856162 C 40.710654,5.340907 40.430475,10.059373 41.140161,10.544116 C 41.849844,11.028859 45.678411,9.461216 46.151535,10.430693 C 46.624647,11.40018 46.537407,13.279088 46.817589,14.960142 L 24.668198,18.595697 C 23.827681,17.474997 21.873103,15.596099 24.238692,14.141879 C 26.604305,12.68765 29.057127,12.85441 29.057127,11.642552 C 29.057127,10.430693 26.990179,6.552765 26.990179,6.552765 z "
id="path675"
sodipodi:nodetypes="ccccccccc" />
<path
style="fill:#f8f8f8;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 45.136536,11.591335 L 45.416706,14.673263 L 26.925172,17.475006 C 26.925172,17.475006 44.296017,14.953435 45.136536,11.591335 z "
id="path676" />
<path
style="fill:#656565;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 28.326044,7.10854 L 30.287271,11.030985 C 30.287271,11.030985 23.563065,14.112908 23.563065,15.233608 C 23.563065,16.354307 25.524291,18.035361 25.524291,18.035361 L 27.485518,17.475006 C 27.485518,17.475006 25.244117,16.074135 26.364818,14.953435 C 27.485518,13.832736 33.649368,12.992199 32.52867,10.750806 C 31.407969,8.509409 28.886389,6.828361 28.326044,7.10854 z "
id="path677" />
<path
style="fill:#3d4e67;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 37.719636,84.905014 C 35.4087,84.866785 31.534428,83.272375 31.196163,78.99376 C 30.003228,74.670853 25.856257,33.811912 27.857349,30.965989 C 28.891341,28.725419 31.142919,27.080641 35.148897,26.510452 C 38.426739,25.94339 68.242311,21.511682 70.440879,22.199529 C 72.639534,22.887434 74.371362,23.469107 74.529552,26.918918 C 74.36697,28.795085 79.904853,67.063192 80.754462,69.319831 C 81.159732,71.963068 80.494353,75.656824 77.104122,76.873594 C 73.713978,78.090325 40.395867,84.388588 37.719636,84.905014 z "
id="path703"
sodipodi:nodetypes="ccccccccc" />
<path
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 40.389438,80.373073 C 38.148966,80.707261 35.036826,81.405877 34.66509,77.945005 C 33.117165,69.75226 29.568,37.282519 32.096937,32.005843 C 32.661777,30.765043 35.728485,29.080826 42.694755,28.377741 C 50.611179,27.478153 66.854496,26.110141 68.563785,26.199003 C 70.273104,26.287893 70.79595,26.069233 71.167722,29.530189 C 71.01675,33.209722 76.173276,61.993627 76.477866,67.089877 C 76.714938,70.707655 77.122767,72.244774 75.031386,73.119376"
id="path704"
sodipodi:nodetypes="cccccccs" />
<path
style="fill:url(#linearGradient710);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 32.657463,36.905437 C 32.657463,36.905437 32.858964,31.995412 38.65914,31.017646 C 44.459313,30.039889 67.43052,26.707255 67.977807,28.408671 C 68.525097,30.110077 69.202791,41.167096 69.371712,42.061576 C 69.540798,42.956029 50.095287,50.605117 44.755653,57.905014 C 39.416004,65.20489 35.676411,71.111845 35.676411,71.111845 C 35.676411,71.111845 32.618766,45.366574 32.657463,36.905437 z "
id="path705" />
</svg>
/branches/BR-0.4/basico/services/srv_attachment.py
105,9 → 105,9
return '0000000000'
 
 
def get_metadata_from_aid(self, aid=None):
if aid is not None:
ATTACHMENT_FILE_METADATA = LPATH['ATTACHMENTS'] + aid + '.json'
def get_metadata_from_tid(self, tid=None):
if tid is not None:
ATTACHMENT_FILE_METADATA = LPATH['ATTACHMENTS'] + tid + '.json'
with open(ATTACHMENT_FILE_METADATA, 'r') as fa:
attachment = json.load(fa)
return attachment
124,6 → 124,9
else:
return None
 
def get_metadata_value(self, tid, key):
metadata = self.get_metadata_from_tid(tid)
return metadata[key]
 
def is_valid(self, aid):
ATTACHMENT_FILE_METADATA = LPATH['ATTACHMENTS'] + aid + '.json'
/branches/BR-0.4/basico/services/srv_callbacks.py
1024,3 → 1024,5
dialog.destroy()
return filenames
def copy_text_to_clipboard(self, widget, text):
self.srvuif.copy_text_to_clipboard(text)
/branches/BR-0.4/basico/services/srv_uif.py
263,7 → 263,7
clipboard.set_text(text, -1)
 
msg = "%d SAP Notes copied to the clipboard" % (len(bag))
self.srvuif.statusbar_msg(msg)
self.statusbar_msg(msg)
self.log.debug(msg)
 
 
270,6 → 270,8
def copy_text_to_clipboard(self, text):
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(text, -1)
msg = "Copied '%s' to clipboard" % text
self.statusbar_msg(msg)
 
 
def get_toolbar_separator(self, draw=False, expand=False):
299,3 → 301,17
"""Convert list row integer to a :class:`Gtk.TreePath`."""
if row is None: return None
return Gtk.TreePath.new_from_string(str(row))
 
 
def select_folder(self, folder=None):
window = self.srvgui.get_window()
dialog = Gtk.FileChooserDialog("Please, choose a folder", window, Gtk.FileChooserAction.SELECT_FOLDER, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, "Select", Gtk.ResponseType.OK))
response = dialog.run()
if response == Gtk.ResponseType.OK:
folder = folder = dialog.get_filename()
else:
folder = None
dialog.destroy()
return folder
 
/branches/BR-0.4/basico/widgets/wdg_browser.py
28,10 → 28,10
 
settings = self.webview.get_settings()
settings.set_property('enable-developer-extras', False)
settings.set_property('enable-default-context-menu', False)
settings.set_property('enable-default-context-menu', True)
settings.set_property('default-encoding', 'utf-8')
settings.set_property('enable-private-browsing', False)
settings.set_property('enable-html5-local-storage', False)
settings.set_property('enable-html5-local-storage', True)
 
# disable plugins, like Adobe Flash and Java
settings.set_property('enable-plugins', True)
/branches/BR-0.4/basico/widgets/wdg_visor_annotations.py
597,6 → 597,8
annotation['Created']
)
nodes.append(node)
 
 
except Exception as error:
self.log.error(error)
self.log.error(self.get_traceback())
697,7 → 699,7
button.connect('clicked', self.srvclb.action_annotation_delete)
box.pack_start(button, False, False, 0)
 
# Popover button "Duplicate annotation"
# Popover button "Jump to SAP Note"
if sid != '0000000000':
# Jump to SAP Note
button = get_popover_button("Jump to SAP Note %d" % int(sid), 'basico-jump-sapnote')
/branches/BR-0.4/basico/widgets/wdg_visor_attachments.py
13,6 → 13,7
import glob
import json
import html
import shutil
import gi
gi.require_version('Gdk', '3.0')
gi.require_version('Gtk', '3.0')
70,7 → 71,7
 
 
def sort_by_timestamp(self):
self.sorted_model.set_sort_column_id(2, Gtk.SortType.DESCENDING)
self.sorted_model.set_sort_column_id(7, Gtk.SortType.DESCENDING)
 
 
def setup_visor(self):
257,7 → 258,7
self.treeview.set_grid_lines(Gtk.TreeViewGridLines.NONE)
self.treeview.set_enable_tree_lines(True)
self.treeview.set_level_indentation(10)
self.treeview.connect('button_press_event', self.right_click)
self.treeview.connect('button_press_event', self.row_right_click)
# DOC: In order to have a Gtk.Widged with sorting and filtering
# capabilities, you have to filter the model first, and use this
449,7 → 450,7
self.srvuif.set_widget_visibility('gtk_label_total_notes', True)
 
 
def right_click(self, treeview, event, data=None):
def row_right_click(self, treeview, event, data=None):
if event.button == 3:
rect = Gdk.Rectangle()
rect.x = x = int(event.x)
459,20 → 460,20
path,col,cellx,celly = pthinfo
model = treeview.get_model()
treeiter = model.get_iter(path)
component = model[treeiter][5]
aid = model[treeiter][10]
tid = 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)
popover.set_pointing_to(rect)
box = self.build_popover(aid, popover, component)
box = self.build_popover(tid, popover)
if box is not None:
popover.add(box)
self.srvclb.gui_show_popover(None, popover)
 
 
def build_popover(self, aid, popover, component):
sid = self.srvatc.get_sid(aid)
def build_popover(self, tid, popover):
sid = self.srvatc.get_sid(tid)
self.log.debug("%s -> %s", tid, sid)
 
def get_popover_button(text, icon_name):
button = Gtk.Button()
487,25 → 488,38
button.add(hbox)
return button
 
if component == 'Annotation':
box = Gtk.Box(spacing = 3, orientation="vertical")
box = Gtk.Box(spacing = 3, orientation="vertical")
 
# Popover button "Delete annotation"
button = get_popover_button("<b>Delete</b> annotation", 'basico-delete')
# ~ # Popover button "Delete annotation"
# ~ button = get_popover_button("<b>Delete</b> annotation", 'basico-delete')
# ~ button.show_all()
# ~ button.connect('clicked', self.srvclb.action_annotation_delete)
# ~ box.pack_start(button, False, False, 0)
 
# Copy identifier to clipboard
button = get_popover_button("<b>Copy identifier</b> to clipboard", 'basico-copy-paste')
button.show_all()
button.connect('clicked', self.srvclb.copy_text_to_clipboard, tid)
box.pack_start(button, False, False, 0)
 
if sid != '0000000000':
# Jump to SAP Note
button = get_popover_button("Jump to <b>SAP Note %d</b>" % int(sid), 'basico-jump-sapnote')
button.show_all()
button.connect('clicked', self.srvclb.action_annotation_delete)
button.connect('clicked', self.srvclb.gui_jump_to_sapnote, sid)
box.pack_start(button, False, False, 0)
# Separator
separator = Gtk.Separator(orientation = Gtk.Orientation.HORIZONTAL)
box.pack_start(separator, True, True, 0)
 
# Popover button "Duplicate annotation"
if sid != '0000000000':
# Jump to SAP Note
button = get_popover_button("Jump to SAP Note %d" % int(sid), 'basico-jump-sapnote')
button.show_all()
button.connect('clicked', self.srvclb.gui_jump_to_sapnote, sid)
box.pack_start(button, False, False, 0)
else:
pass
return box
# Download to PC
button = get_popover_button("<b>Download attachment</b> to PC", 'basico-backup')
button.show_all()
button.connect('clicked', self.download, tid)
box.pack_start(button, False, False, 0)
return box
 
 
def connect_menuview_signals(self):
530,3 → 544,15
category = self.srvgui.get_widget('gtk_togglebutton_inbox')
category.set_active(True)
 
 
def download(self, widget, tid):
filename = self.srvatc.get_metadata_value(tid, 'Title')
target_folder = self.srvuif.select_folder()
if target_folder is not None:
source = LPATH['ATTACHMENTS'] + tid
target = os.path.join(target_folder, filename)
shutil.copy(source, target)
msg = "Attachment downloaded to %s" % (target)
self.log.debug(msg)
self.srvuif.statusbar_msg(msg)
 
/branches/BR-0.4/setup.py
84,6 → 84,7
'basico/data/icons/basico-clipboard.svg',
'basico/data/icons/basico-comments.svg',
'basico/data/icons/basico-component.svg',
'basico/data/icons/basico-copy-paste.svg',
'basico/data/icons/basico-dashboard.svg',
'basico/data/icons/basico-drafts.svg',
'basico/data/icons/basico-delete.svg',