First code to handle SVG objects

This commit is contained in:
2026-07-16 22:19:55 +02:00
parent a92ff1a5de
commit d66f74817b
+15 -3
View File
@@ -26,7 +26,8 @@ import configparser
os.environ["NO_AT_BRIDGE"] = "1" # fix dbus warnings
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GLib, Gtk
gi.require_version('Rsvg', '2.0')
from gi.repository import GLib, Gtk, Rsvg
from yms import database
from yms import gtkutils
@@ -36,7 +37,8 @@ cfg = {
'host': 'localhost',
'db': 'yms',
'user': 'yms',
'docpath': '/var/local/yms'
'docpath': '/var/local/yms',
'shapedir': 'webgui/shapes'
}
class Frontend():
@@ -70,7 +72,17 @@ class Frontend():
db.cur.execute("SELECT vid, vesselname, model FROM vessel ORDER BY vid")
for row in db.cur.fetchall():
print(row)
#print(type(self.combo['vessel']))
print(type(self.combo['vessel']))
# load shape of vessel if available
handle = Rsvg.Handle()
self._svg = handle.new_from_file(os.path.join(sys.path[0], cfg['shapedir'], "elizabethan29.svg"))
#viewport = Rsvg.Rectangle()
#viewport.x = 0
#viewport.y = 0
#viewport.width = 320
#viewport.height = 240
#self._svg.render_document(ctx, viewport)
def run(self):
self.label['vessel'].set_text(self.vname)