Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 378 → Rev 379

/branches/BR-0.4/basico/core/mod_srv.py
70,7 → 70,7
except Exception as error:
self.log.debug (self.get_traceback())
 
self.log.debug("Module %s started" , logname)
# ~ self.log.debug("Module %s started" , logname)
 
 
def end(self):
/branches/BR-0.4/basico/data/icons/basico-edit.svg
0,0 → 1,224
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
<svg
id="svg604"
sodipodi:version="0.32"
width="72pt"
height="72pt"
sodipodi:docbase="/home/zeus/images/icons/gartoon/svg"
sodipodi:docname="/home/zeus/images/icons/gartoon/svg/gedit-icon.svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs
id="defs606">
<linearGradient
id="linearGradient612">
<stop
style="stop-color:#7fa8e3;stop-opacity:0.741176;"
offset="0.000000"
id="stop613" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1.000000"
id="stop614" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient612"
id="linearGradient615"
x1="50.6438866"
y1="5.36792946"
x2="35.7520943"
y2="68.0443573"
gradientUnits="userSpaceOnUse"
spreadMethod="pad" />
</defs>
<sodipodi:namedview
id="base" />
<path
style="fill:#000000;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:0.301471;"
d="M 12.8163 74.753 C 10.3856 73.6481 7.07107 70.1126 8.83884 65.2512 C 9.72267 59.948 25.6326 13.1021 29.1682 10.8924 C 31.3778 8.90368 34.582 8.13026 39.1119 9.34561 C 42.8684 10.2295 76.6769 19.0684 78.6656 20.8361 C 80.6544 22.6039 82.2012 24.0402 80.6544 27.9072 C 79.5496 29.8959 66.4017 74.532 66.1808 77.4047 C 65.2969 80.4983 62.7558 84.2548 58.5573 84.0338 C 54.3589 83.8128 15.9099 75.4159 12.8163 74.753 z "
id="path794"
sodipodi:nodetypes="ccccccccc"
transform="matrix(1.114903,0.000000,0.000000,1.114903,-5.305332,-3.889256)" />
<path
style="fill:#3d4e67;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 12.8163 74.753 C 10.3856 73.6481 7.07107 70.1126 8.83884 65.2512 C 9.72267 59.948 25.6326 13.1021 29.1682 10.8924 C 31.3778 8.90368 34.582 8.13026 39.1119 9.34561 C 42.8684 10.2295 76.6769 19.0684 78.6656 20.8361 C 80.6544 22.6039 82.2012 24.0402 80.6544 27.9072 C 79.5496 29.8959 66.4017 74.532 66.1808 77.4047 C 65.2969 80.4983 62.7558 84.2548 58.5573 84.0338 C 54.3589 83.8128 15.9099 75.4159 12.8163 74.753 z "
id="path609"
sodipodi:nodetypes="ccccccccc"
transform="matrix(1.114903,0.000000,0.000000,1.114903,-8.162471,-8.460684)" />
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 17.8987 70.9965 C 15.3576 70.3336 11.7114 69.6706 13.0373 65.6932 C 15.468 55.9705 27.8424 18.6264 33.1456 13.986 C 34.361 12.8811 38.4489 12.4392 46.1829 14.8699 C 55.0218 17.5215 72.9204 23.4877 74.6882 24.3716 C 76.4559 25.2555 77.1189 25.2555 75.793 29.233 C 73.8043 33.2105 64.9655 67.24 62.7557 72.9852 C 61.209 77.0732 60.8775 78.9514 58.2258 78.9514 "
id="path608"
sodipodi:nodetypes="cccccccs"
transform="matrix(1.114903,0.000000,0.000000,1.114903,-8.162471,-8.460684)" />
<path
style="fill:url(#linearGradient615);fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 28.75 13.75 C 28.75 13.75 31.875 7.49995 39.6875 9.37495 C 47.5 11.25 78.125 19.375 77.8125 21.875 C 77.5 24.375 71.875 39.0625 71.5625 40.3125 C 71.25 41.5625 42.5 40.9375 31.5625 47.5 C 20.625 54.0625 12.5 59.6875 12.5 59.6875 C 12.5 59.6875 23.75 24.6875 28.75 13.75 z "
id="path636"
transform="matrix(0.946780,0.000000,0.000000,0.946780,-0.480566,0.409517)" />
<path
style="fill:none;fill-rule:evenodd;stroke:#42667e;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 29.2429 15.8991 L 69.8423 26.6877 "
id="path671"
transform="translate(1.135645,0.851736)" />
<path
style="fill:none;fill-rule:evenodd;stroke:#42667e;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 27.8233 19.306 L 67.8549 30.9464 "
id="path672"
transform="matrix(0.999855,-1.703691e-2,1.703691e-2,0.999855,-0.705041,5.077353)" />
<path
style="fill:none;fill-rule:evenodd;stroke:#42667e;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 29.2429 15.8991 L 69.8423 26.6877 "
id="path673"
transform="translate(-5.394323,17.03470)" />
<path
style="fill:none;fill-rule:evenodd;stroke:#42667e;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 29.2429 15.8991 L 69.8423 26.6877 "
id="path675"
transform="translate(-11.35647,34.06940)" />
<path
style="fill:none;fill-rule:evenodd;stroke:#42667e;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 27.8233 19.306 L 67.8549 30.9464 "
id="path676"
transform="matrix(0.999855,-1.703691e-2,1.703691e-2,0.999855,-13.19715,38.29502)" />
<path
style="fill:none;fill-rule:evenodd;stroke:#42667e;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 27.8233 19.306 L 67.8549 30.9464 "
id="path674"
transform="matrix(0.999855,-1.703691e-2,1.703691e-2,0.999855,-7.235008,21.26032)" />
<path
style="font-size:12;fill:none;fill-rule:evenodd;stroke-width:2.875;stroke:#4f4f4f;stroke-opacity:1;stroke-dasharray:none;stroke-linecap:round;"
d="M 44.8581 15.0473 C 41.4103 15.0473 39.7476 12.4989 39.7476 8.65931 C 39.7476 4.81969 42.5459 1.70347 45.9937 1.70347 C 49.4415 1.70347 50.5362 2.83231 50.5362 6.67192 "
id="path667"
sodipodi:nodetypes="cccc"
transform="matrix(0.948718,0.000000,0.000000,1.000000,4.011168,0.567827)" />
<path
style="font-size:12;fill:none;fill-rule:evenodd;stroke-width:0.625;stroke:#c2c2c2;stroke-opacity:1;stroke-dasharray:none;stroke-linecap:round;"
d="M 44.8581 14.7634 C 41.4103 14.7634 39.4637 12.4989 39.4637 8.65931 C 39.4637 4.81969 42.262 0.851736 45.7098 0.851736 C 49.1576 0.851736 50.5362 2.83231 50.5362 6.67192 "
id="path668"
sodipodi:nodetypes="cccc"
transform="matrix(0.948718,0.000000,0.000000,1.000000,4.011168,0.567827)" />
<path
style="font-size:12;fill:none;fill-rule:evenodd;stroke-width:2.875;stroke:#4f4f4f;stroke-opacity:1;stroke-dasharray:none;stroke-linecap:round;"
d="M 44.8581 15.0473 C 41.4103 15.0473 39.7476 12.4989 39.7476 8.65931 C 39.7476 4.81969 42.5459 1.70347 45.9937 1.70347 C 49.4415 1.70347 50.5362 2.83231 50.5362 6.67192 "
id="path669"
sodipodi:nodetypes="cccc"
transform="matrix(0.948718,0.000000,0.000000,1.000000,14.79981,2.555208)" />
<path
style="font-size:12;fill:none;fill-rule:evenodd;stroke-width:0.625;stroke:#c2c2c2;stroke-opacity:1;stroke-dasharray:none;stroke-linecap:round;"
d="M 44.8581 14.7634 C 41.4103 14.7634 39.4637 12.4989 39.4637 8.65931 C 39.4637 4.81969 42.262 0.851736 45.7098 0.851736 C 49.1576 0.851736 50.5362 2.83231 50.5362 6.67192 "
id="path670"
sodipodi:nodetypes="cccc"
transform="matrix(0.948718,0.000000,0.000000,1.000000,14.79981,2.555208)" />
<g
id="g677"
transform="matrix(0.698410,0.000000,0.000000,0.698410,31.40380,0.671206)">
<defs
id="defs611">
<linearGradient
id="linearGradient626">
<stop
style="stop-color:#b5772d;stop-opacity:1;"
offset="0.000000"
id="stop627" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1.000000"
id="stop628" />
</linearGradient>
<linearGradient
id="linearGradient619">
<stop
style="stop-color:#770000;stop-opacity:1;"
offset="0.000000"
id="stop620" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1.000000"
id="stop621" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient619"
id="linearGradient622"
x1="66.3316956"
y1="23.2124691"
x2="63.4654961"
y2="20.9627991"
gradientUnits="userSpaceOnUse"
spreadMethod="pad"
gradientTransform="scale(1.004516,0.995504)" />
<linearGradient
xlink:href="#linearGradient626"
id="linearGradient625"
x1="56.3276138"
y1="43.3772469"
x2="51.6545258"
y2="39.7629089"
gradientUnits="userSpaceOnUse"
spreadMethod="pad"
gradientTransform="scale(0.912664,1.095694)" />
</defs>
<sodipodi:namedview
id="namedview687" />
<path
style="fill:#000000;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:0.283186;"
d="M 9.33685 82.1156 C 17.9129 79.7641 30.9112 77.5637 40.1097 71.8924 C 56.9851 62.0714 66.0118 41.6332 76.4551 25.5877 C 77.285 12.3086 64.1128 5.96872 59.1331 8.87345 C 46.4766 25.4722 37.5548 43.5235 23.4458 55.9725 C 19.0886 66.5542 9.12934 82.738 9.33685 82.1156 z "
id="path632"
sodipodi:nodetypes="cccccc"
transform="translate(3.814559,2.934275)" />
<path
style="fill:#000000;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 9.33685 82.1156 C 17.9129 79.7641 28.5638 74.9228 37.7623 69.2516 C 54.6377 59.4306 64.2512 38.4055 74.6945 22.36 C 75.5244 9.08092 64.1128 5.96872 59.1331 8.87345 C 46.4766 25.4722 37.5548 43.5235 23.4458 55.9725 C 19.0886 66.5542 9.12934 82.738 9.33685 82.1156 z "
id="path617"
sodipodi:nodetypes="cccccc" />
<path
style="fill:#be6d6d;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 71.9972 20.9076 C 70.2682 23.3974 68.5391 25.8872 66.8101 28.377 C 64.5278 22.9824 61.8305 20.2851 54.9835 19.6627 C 57.1967 16.9654 59.4098 14.2681 61.623 11.5708 C 67.1559 10.9483 71.4439 15.7205 71.9972 20.9076 z "
id="path613"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#ffbc24;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 54.776 20.9076 C 60.1706 20.5618 63.9053 24.5732 65.9801 29.207 C 57.5424 42.8318 50.5571 56.2492 36.3098 66.9692 C 36.3098 66.9692 32.7826 56.8024 27.5955 58.0474 C 34.0275 50.7854 48.9664 30.037 54.776 20.9076 z "
id="path614"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#e9dbb9;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 27.0767 58.6698 C 31.7451 58.4277 35.6873 63.9953 34.6499 67.3842 C 32.6442 68.9057 29.3937 70.4273 27.388 71.9488 C 27.0422 69.1824 25.244 67.0384 21.3709 67.3842 C 23.0999 64.4102 25.3477 61.6438 27.0767 58.6698 z "
id="path615"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#586f93;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 21.7859 66.9692 C 25.3477 66.1393 26.8347 69.6665 27.5955 71.7414 L 14.3164 77.7584 L 21.7859 66.9692 z "
id="path616"
sodipodi:nodetypes="cccc" />
<path
style="fill:url(#linearGradient622);fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 71.9972 20.9076 C 70.2682 23.3974 68.5391 25.8872 66.8101 28.377 C 64.5278 22.9824 61.8305 20.2851 54.9835 19.6627 C 57.1967 16.9654 59.4098 14.2681 61.623 11.5708 C 67.1559 10.9483 71.4439 15.7205 71.9972 20.9076 z "
id="path618"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 62.8679 12.1932 L 57.4733 19.0402 L 60.3781 20.0776 L 65.7727 13.6456 L 62.8679 12.1932 z "
id="path623"
sodipodi:nodetypes="ccccc" />
<path
style="fill:url(#linearGradient625);fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 54.776 20.9076 C 60.1706 20.5618 63.9053 24.5732 65.9801 29.207 C 57.5424 42.8318 50.5571 56.2492 36.3098 66.9692 C 36.3098 66.9692 32.7826 56.8024 27.5955 58.0474 C 34.0275 50.7854 48.9664 30.037 54.776 20.9076 z "
id="path624"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 29.6703 56.18 C 30.9152 56.9408 32.1601 57.7015 33.405 58.4623 C 42.5344 47.6039 46.6841 36.5381 58.9257 24.6423 C 57.7499 23.8815 56.5742 23.1208 55.3984 22.36 C 48.0673 35.0857 39.6987 47.3965 29.6703 56.18 z "
id="path630"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#9c7850;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;"
d="M 34.7538 67.2805 C 34.9612 65.1019 34.4425 63.5457 33.3013 61.7821 C 31.7798 65.171 29.4283 67.6262 26.1431 68.4216 C 25.4169 69.044 27.388 70.3927 27.5955 71.6376 C 29.4629 70.4964 34.7538 67.9029 34.7538 67.2805 z "
id="path631"
sodipodi:nodetypes="ccccc" />
</g>
</svg>
/branches/BR-0.4/basico/services/srv_bnr.py
91,6 → 91,32
return bckname
 
 
def backup_annotations(self, bck_file, aids):
# Do a reorg before a new backup
# ~ self.reorg()
 
# copy database structure to a temp directory except annotations
with TemporaryDirectory(dir=LPATH['TMP']) as TEMPORARY_DIRECTORY:
SOURCE_DIRECTORY = LPATH['DB']
self.log.debug("Copying database structure to a temp directory:")
self.log.debug("From: %s", SOURCE_DIRECTORY)
self.log.debug(" To: %s", TEMPORARY_DIRECTORY)
shutil.rmtree(TEMPORARY_DIRECTORY)
shutil.copytree(SOURCE_DIRECTORY, TEMPORARY_DIRECTORY)
self.log.debug("Contents copied successfully")
 
if not backup_annotations:
self.log.debug("Deleting annotations directory in temporary foleder:")
TEMPORARY_ANNOTATION_DIRECTORY = TEMPORARY_DIRECTORY + SEP + 'annotations'
self.log.debug(TEMPORARY_ANNOTATION_DIRECTORY)
shutil.rmtree(TEMPORARY_ANNOTATION_DIRECTORY)
self.log.debug("Annotations deleted successfully")
 
# create backup from temporary directory
bckname = self.srvutl.zip(bck_file, TEMPORARY_DIRECTORY)
self.log.info("Database successfully backed up in: %s" % bckname)
return bckname
 
def test(self, bckfile=None):
self.log.info("Testing backup: %s", bckfile)
try:
160,7 → 186,7
fimpcols = tmpdir + SEP + "collections" + SEP + "collections.json"
with open(fimpcols, 'r') as fp:
# Get collections from backup
impcols = json.load(fp)
impcols = json.load(fp)
# Add imported collections to database
for cid in impcols:
self.srvclt.create(impcols[cid], cid, batch=True)
/branches/BR-0.4/basico/services/srv_callbacks.py
377,6 → 377,7
 
 
def gui_show_popover(self, button, popover):
self.srvgui.set_key_value('LAST_POPOVER', popover)
if popover.get_visible():
popover.hide()
else:
/branches/BR-0.4/basico/services/srv_uif.py
245,13 → 245,10
 
 
def grab_focus(self):
visor_sapnotes = self.srvgui.get_widget('visor_sapnotes')
visor_annotations = self.srvgui.get_widget('visor_annotations')
popover = self.srvgui.get_key_value('LAST_POPOVER')
popover.popdown()
 
visor_sapnotes.grab_focus()
visor_annotations.grab_focus()
 
 
def action_collection_copy_to_clipboard(self, button):
self.srvdtb = self.get_service('DB')
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
/branches/BR-0.4/basico/widgets/wdg_visor_annotations.py
686,7 → 686,7
aid = model[treeiter][10]
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_position(Gtk.PositionType.TOP)
popover.set_pointing_to(rect)
box = self.build_popover(aid, popover, component)
if box is not None:
733,7 → 733,6
button.connect('clicked', self.select_all, None)
box.pack_start(button, False, False, 0)
 
# Popover button "Delete annotation"
if len(self.rows_toggled()) > 0:
separator = Gtk.Separator(orientation = Gtk.Orientation.HORIZONTAL)
box.pack_start(separator, False, False, 0)
748,15 → 747,33
# ~ button.connect('clicked', self.srvclb.action_annotation_backup)
box.pack_start(button, False, False, 0)
 
# 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')
else:
separator = Gtk.Separator(orientation = Gtk.Orientation.HORIZONTAL)
box.pack_start(separator, False, False, 0)
 
# 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')
button.show_all()
button.connect('clicked', self.srvclb.gui_jump_to_sapnote, sid)
box.pack_start(button, False, False, 0)
 
button = get_popover_button("Preview annotation", 'basico-preview')
button.show_all()
button.connect('clicked', self.srvclb.gui_jump_to_sapnote, sid)
# ~ button.connect('clicked', self.srvclb.duplicate_sapnote, aid)
box.pack_start(button, False, False, 0)
else:
pass
 
button = get_popover_button("Edit annotation", 'basico-edit')
button.show_all()
# ~ button.connect('clicked', self.srvclb.duplicate_sapnote, aid)
box.pack_start(button, False, False, 0)
 
button = get_popover_button("Duplicate annotation", 'basico-copy-paste')
button.show_all()
# ~ button.connect('clicked', self.srvclb.duplicate_sapnote, aid)
box.pack_start(button, False, False, 0)
 
return box
 
 
771,9 → 788,9
 
model = self.sorted_model.get_model()
model.foreach(check_row)
self.srvuif.grab_focus()
 
 
 
def connect_menuview_signals(self):
# Categories
button = self.srvgui.get_widget('gtk_togglebutton_categories')
/branches/BR-0.4/setup.py
57,6 → 57,7
'basico/data/icons/basico-add.svg',
'basico/data/icons/basico-annotation.svg',
'basico/data/icons/basico-annotation-type-bookmark.svg',
'basico/data/icons/basico-edit.svg',
'basico/data/icons/basico-annotation-type-note.svg',
'basico/data/icons/basico-annotation-type-fixme.svg',
'basico/data/icons/basico-annotation-type-incident.svg',