diff --git a/coretk/coretk/coreclient.py b/coretk/coretk/coreclient.py index 5b6f0fd9..2e009425 100644 --- a/coretk/coretk/coreclient.py +++ b/coretk/coretk/coreclient.py @@ -335,6 +335,9 @@ class CoreClient: shape_config["color"], shape_config["border"], shape_config["width"], + shape_config["bold"], + shape_config["italic"], + shape_config["underline"], ) shape = Shape( self.app, self.app.canvas, shape_type, *coords, data=data diff --git a/coretk/coretk/data/xmls/sample1.xml b/coretk/coretk/data/xmls/sample1.xml index 0d5dd02d..8c61b7de 100644 --- a/coretk/coretk/data/xmls/sample1.xml +++ b/coretk/coretk/data/xmls/sample1.xml @@ -1,5 +1,5 @@ - + @@ -37,7 +37,7 @@ - + @@ -53,24 +53,30 @@ - - + + - - + + + + + + + + - + @@ -83,12 +89,6 @@ - - - - - - @@ -113,26 +113,30 @@ + + + + - - - - - - - - - - + + + + + + + + + + @@ -145,10 +149,6 @@ - - - - @@ -1063,6 +1063,164 @@ bootquagga /sbin/sysctl -w net.ipv4.conf.eth1.forwarding=1 /sbin/sysctl -w net.ipv4.conf.eth1.send_redirects=0 /sbin/sysctl -w net.ipv4.conf.eth1.rp_filter=0 + + + + + + /usr/local/etc/quagga + /var/run/quagga + + + sh quaggaboot.sh zebra + + + pidof zebra + + + killall zebra + + + interface eth0 + ip address 10.0.0.8/32 + ipv6 address a::8/128 + ipv6 ospf6 instance-id 65 + ipv6 ospf6 hello-interval 2 + ipv6 ospf6 dead-interval 6 + ipv6 ospf6 retransmit-interval 5 + ipv6 ospf6 network manet-designated-router + ipv6 ospf6 diffhellos + ipv6 ospf6 adjacencyconnectivity uniconnected + ipv6 ospf6 lsafullness mincostlsa +! +router ospf6 + router-id 10.0.0.8 + interface eth0 area 0.0.0.0 +! + + #!/bin/sh +# auto-generated by zebra service (quagga.py) +QUAGGA_CONF=/usr/local/etc/quagga/Quagga.conf +QUAGGA_SBIN_SEARCH="/usr/local/sbin /usr/sbin /usr/lib/quagga" +QUAGGA_BIN_SEARCH="/usr/local/bin /usr/bin /usr/lib/quagga" +QUAGGA_STATE_DIR=/var/run/quagga + +searchforprog() +{ + prog=$1 + searchpath=$@ + ret= + for p in $searchpath; do + if [ -x $p/$prog ]; then + ret=$p + break + fi + done + echo $ret +} + +confcheck() +{ + CONF_DIR=`dirname $QUAGGA_CONF` + # if /etc/quagga exists, point /etc/quagga/Quagga.conf -> CONF_DIR + if [ "$CONF_DIR" != "/etc/quagga" ] && [ -d /etc/quagga ] && [ ! -e /etc/quagga/Quagga.conf ]; then + ln -s $CONF_DIR/Quagga.conf /etc/quagga/Quagga.conf + fi + # if /etc/quagga exists, point /etc/quagga/vtysh.conf -> CONF_DIR + if [ "$CONF_DIR" != "/etc/quagga" ] && [ -d /etc/quagga ] && [ ! -e /etc/quagga/vtysh.conf ]; then + ln -s $CONF_DIR/vtysh.conf /etc/quagga/vtysh.conf + fi +} + +bootdaemon() +{ + QUAGGA_SBIN_DIR=$(searchforprog $1 $QUAGGA_SBIN_SEARCH) + if [ "z$QUAGGA_SBIN_DIR" = "z" ]; then + echo "ERROR: Quagga's '$1' daemon not found in search path:" + echo " $QUAGGA_SBIN_SEARCH" + return 1 + fi + + flags="" + + if [ "$1" = "xpimd" ] && \ + grep -E -q '^[[:space:]]*router[[:space:]]+pim6[[:space:]]*$' $QUAGGA_CONF; then + flags="$flags -6" + fi + + $QUAGGA_SBIN_DIR/$1 $flags -d + if [ "$?" != "0" ]; then + echo "ERROR: Quagga's '$1' daemon failed to start!:" + return 1 + fi +} + +bootquagga() +{ + QUAGGA_BIN_DIR=$(searchforprog 'vtysh' $QUAGGA_BIN_SEARCH) + if [ "z$QUAGGA_BIN_DIR" = "z" ]; then + echo "ERROR: Quagga's 'vtysh' program not found in search path:" + echo " $QUAGGA_BIN_SEARCH" + return 1 + fi + + # fix /var/run/quagga permissions + id -u quagga 2>/dev/null >/dev/null + if [ "$?" = "0" ]; then + chown quagga $QUAGGA_STATE_DIR + fi + + bootdaemon "zebra" + for r in rip ripng ospf6 ospf bgp babel; do + if grep -q "^router \<${r}\>" $QUAGGA_CONF; then + bootdaemon "${r}d" + fi + done + + if grep -E -q '^[[:space:]]*router[[:space:]]+pim6?[[:space:]]*$' $QUAGGA_CONF; then + bootdaemon "xpimd" + fi + + $QUAGGA_BIN_DIR/vtysh -b +} + +if [ "$1" != "zebra" ]; then + echo "WARNING: '$1': all Quagga daemons are launched by the 'zebra' service!" + exit 1 +fi +confcheck +bootquagga + + service integrated-vtysh-config + + + + + + pidof ospf6d + + + killall ospf6d + + + + + sh ipforward.sh + + + #!/bin/sh +# auto-generated by IPForward service (utility.py) +/sbin/sysctl -w net.ipv4.conf.all.forwarding=1 +/sbin/sysctl -w net.ipv4.conf.default.forwarding=1 +/sbin/sysctl -w net.ipv6.conf.all.forwarding=1 +/sbin/sysctl -w net.ipv6.conf.default.forwarding=1 +/sbin/sysctl -w net.ipv4.conf.all.send_redirects=0 +/sbin/sysctl -w net.ipv4.conf.default.send_redirects=0 +/sbin/sysctl -w net.ipv4.conf.all.rp_filter=0 +/sbin/sysctl -w net.ipv4.conf.default.rp_filter=0 +/sbin/sysctl -w net.ipv4.conf.eth0.forwarding=1 +/sbin/sysctl -w net.ipv4.conf.eth0.send_redirects=0 +/sbin/sysctl -w net.ipv4.conf.eth0.rp_filter=0 @@ -1224,161 +1382,15 @@ bootquagga - - - /usr/local/etc/quagga - /var/run/quagga - + - sh quaggaboot.sh zebra - - - pidof zebra - - - killall zebra - - - interface eth0 - ip address 10.0.0.8/32 - ipv6 address a::8/128 - ipv6 ospf6 instance-id 65 - ipv6 ospf6 hello-interval 2 - ipv6 ospf6 dead-interval 6 - ipv6 ospf6 retransmit-interval 5 - ipv6 ospf6 network manet-designated-router - ipv6 ospf6 diffhellos - ipv6 ospf6 adjacencyconnectivity uniconnected - ipv6 ospf6 lsafullness mincostlsa -! -router ospf6 - router-id 10.0.0.8 - interface eth0 area 0.0.0.0 -! - - #!/bin/sh -# auto-generated by zebra service (quagga.py) -QUAGGA_CONF=/usr/local/etc/quagga/Quagga.conf -QUAGGA_SBIN_SEARCH="/usr/local/sbin /usr/sbin /usr/lib/quagga" -QUAGGA_BIN_SEARCH="/usr/local/bin /usr/bin /usr/lib/quagga" -QUAGGA_STATE_DIR=/var/run/quagga - -searchforprog() -{ - prog=$1 - searchpath=$@ - ret= - for p in $searchpath; do - if [ -x $p/$prog ]; then - ret=$p - break - fi - done - echo $ret -} - -confcheck() -{ - CONF_DIR=`dirname $QUAGGA_CONF` - # if /etc/quagga exists, point /etc/quagga/Quagga.conf -> CONF_DIR - if [ "$CONF_DIR" != "/etc/quagga" ] && [ -d /etc/quagga ] && [ ! -e /etc/quagga/Quagga.conf ]; then - ln -s $CONF_DIR/Quagga.conf /etc/quagga/Quagga.conf - fi - # if /etc/quagga exists, point /etc/quagga/vtysh.conf -> CONF_DIR - if [ "$CONF_DIR" != "/etc/quagga" ] && [ -d /etc/quagga ] && [ ! -e /etc/quagga/vtysh.conf ]; then - ln -s $CONF_DIR/vtysh.conf /etc/quagga/vtysh.conf - fi -} - -bootdaemon() -{ - QUAGGA_SBIN_DIR=$(searchforprog $1 $QUAGGA_SBIN_SEARCH) - if [ "z$QUAGGA_SBIN_DIR" = "z" ]; then - echo "ERROR: Quagga's '$1' daemon not found in search path:" - echo " $QUAGGA_SBIN_SEARCH" - return 1 - fi - - flags="" - - if [ "$1" = "xpimd" ] && \ - grep -E -q '^[[:space:]]*router[[:space:]]+pim6[[:space:]]*$' $QUAGGA_CONF; then - flags="$flags -6" - fi - - $QUAGGA_SBIN_DIR/$1 $flags -d - if [ "$?" != "0" ]; then - echo "ERROR: Quagga's '$1' daemon failed to start!:" - return 1 - fi -} - -bootquagga() -{ - QUAGGA_BIN_DIR=$(searchforprog 'vtysh' $QUAGGA_BIN_SEARCH) - if [ "z$QUAGGA_BIN_DIR" = "z" ]; then - echo "ERROR: Quagga's 'vtysh' program not found in search path:" - echo " $QUAGGA_BIN_SEARCH" - return 1 - fi - - # fix /var/run/quagga permissions - id -u quagga 2>/dev/null >/dev/null - if [ "$?" = "0" ]; then - chown quagga $QUAGGA_STATE_DIR - fi - - bootdaemon "zebra" - for r in rip ripng ospf6 ospf bgp babel; do - if grep -q "^router \<${r}\>" $QUAGGA_CONF; then - bootdaemon "${r}d" - fi - done - - if grep -E -q '^[[:space:]]*router[[:space:]]+pim6?[[:space:]]*$' $QUAGGA_CONF; then - bootdaemon "xpimd" - fi - - $QUAGGA_BIN_DIR/vtysh -b -} - -if [ "$1" != "zebra" ]; then - echo "WARNING: '$1': all Quagga daemons are launched by the 'zebra' service!" - exit 1 -fi -confcheck -bootquagga - - service integrated-vtysh-config - - - - - - pidof ospf6d - - - killall ospf6d - - - - - sh ipforward.sh + sh defaultroute.sh - #!/bin/sh -# auto-generated by IPForward service (utility.py) -/sbin/sysctl -w net.ipv4.conf.all.forwarding=1 -/sbin/sysctl -w net.ipv4.conf.default.forwarding=1 -/sbin/sysctl -w net.ipv6.conf.all.forwarding=1 -/sbin/sysctl -w net.ipv6.conf.default.forwarding=1 -/sbin/sysctl -w net.ipv4.conf.all.send_redirects=0 -/sbin/sysctl -w net.ipv4.conf.default.send_redirects=0 -/sbin/sysctl -w net.ipv4.conf.all.rp_filter=0 -/sbin/sysctl -w net.ipv4.conf.default.rp_filter=0 -/sbin/sysctl -w net.ipv4.conf.eth0.forwarding=1 -/sbin/sysctl -w net.ipv4.conf.eth0.send_redirects=0 -/sbin/sysctl -w net.ipv4.conf.eth0.rp_filter=0 + #!/bin/sh +# auto-generated by DefaultRoute service (utility.py) +ip route add default via 10.0.1.1 +ip route add default via a:1::1 @@ -1549,18 +1561,6 @@ bootquagga # auto-generated by DefaultRoute service (utility.py) ip route add default via 10.0.1.1 ip route add default via a:1::1 - - - - - - sh defaultroute.sh - - - #!/bin/sh -# auto-generated by DefaultRoute service (utility.py) -ip route add default via 10.0.1.1 -ip route add default via a:1::1 @@ -1842,8 +1842,8 @@ bootquagga - + diff --git a/coretk/coretk/dialogs/shapemod.py b/coretk/coretk/dialogs/shapemod.py index 04a617c8..0410a8ae 100644 --- a/coretk/coretk/dialogs/shapemod.py +++ b/coretk/coretk/dialogs/shapemod.py @@ -33,9 +33,9 @@ class ShapeDialog(Dialog): self.fill_color = fill_color self.border_color = data.border_color self.border_width = tk.IntVar(value=0) - self.bold = tk.IntVar(value=data.bold) - self.italic = tk.IntVar(value=data.italic) - self.underline = tk.IntVar(value=data.underline) + self.bold = tk.BooleanVar(value=data.bold) + self.italic = tk.BooleanVar(value=data.italic) + self.underline = tk.BooleanVar(value=data.underline) self.top.columnconfigure(0, weight=1) self.draw() @@ -162,11 +162,11 @@ class ShapeDialog(Dialog): """ size = int(self.font_size.get()) text_font = [self.font.get(), size] - if self.bold.get() == 1: + if self.bold.get(): text_font.append("bold") - if self.italic.get() == 1: + if self.italic.get(): text_font.append("italic") - if self.underline.get() == 1: + if self.underline.get(): text_font.append("underline") return text_font diff --git a/coretk/coretk/graph/shape.py b/coretk/coretk/graph/shape.py index 8188b8c2..22c676db 100644 --- a/coretk/coretk/graph/shape.py +++ b/coretk/coretk/graph/shape.py @@ -1,5 +1,4 @@ import logging -from tkinter.font import Font from coretk.dialogs.shapemod import ShapeDialog from coretk.graph.shapeutils import ShapeType @@ -17,9 +16,9 @@ class AnnotationData: fill_color="", border_color="#000000", border_width=1, - bold=0, - italic=0, - underline=0, + bold=False, + italic=False, + underline=False, ): self.text = text self.font = font @@ -92,7 +91,7 @@ class Shape: ) self.draw_shape_text() elif self.shape_type == ShapeType.TEXT: - font = Font(family=self.shape_data.font, size=self.shape_data.font_size) + font = self.get_font() self.id = self.canvas.create_text( self.x1, self.y1, @@ -105,11 +104,21 @@ class Shape: logging.error("unknown shape type: %s", self.shape_type) self.created = True + def get_font(self): + font = [self.shape_data.font, self.shape_data.font_size] + if self.shape_data.bold: + font.append("bold") + if self.shape_data.italic: + font.append("italic") + if self.shape_data.underline: + font.append("underline") + return font + def draw_shape_text(self): if self.shape_data.text: x = (self.x1 + self.x2) / 2 y = self.y1 + 1.5 * self.shape_data.font_size - font = Font(family=self.shape_data.font, size=self.shape_data.font_size) + font = self.get_font() self.text_id = self.canvas.create_text( x, y, @@ -155,4 +164,7 @@ class Shape: "color": self.shape_data.fill_color, "border": self.shape_data.border_color, "width": self.shape_data.border_width, + "bold": self.shape_data.bold, + "italic": self.shape_data.italic, + "underline": self.shape_data.underline, } diff --git a/daemon/core/xml/corexml.py b/daemon/core/xml/corexml.py index 96a5a6a5..9ba63395 100644 --- a/daemon/core/xml/corexml.py +++ b/daemon/core/xml/corexml.py @@ -117,15 +117,21 @@ class NodeElement: def add_position(self): x = self.node.position.x + if x is not None: + x = int(x) y = self.node.position.y + if y is not None: + y = int(y) z = self.node.position.z + if z is not None: + z = int(z) lat, lon, alt = None, None, None if x is not None and y is not None: lat, lon, alt = self.session.location.getgeo(x, y, z) position = etree.SubElement(self.element, "position") - add_attribute(position, "x", int(x)) - add_attribute(position, "y", int(y)) - add_attribute(position, "z", int(z)) + add_attribute(position, "x", x) + add_attribute(position, "y", y) + add_attribute(position, "z", z) add_attribute(position, "lat", lat) add_attribute(position, "lon", lon) add_attribute(position, "alt", alt)