First code to handle SVG objects
This commit is contained in:
@@ -26,7 +26,8 @@ import configparser
|
|||||||
os.environ["NO_AT_BRIDGE"] = "1" # fix dbus warnings
|
os.environ["NO_AT_BRIDGE"] = "1" # fix dbus warnings
|
||||||
import gi
|
import gi
|
||||||
gi.require_version("Gtk", "3.0")
|
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 database
|
||||||
from yms import gtkutils
|
from yms import gtkutils
|
||||||
@@ -36,7 +37,8 @@ cfg = {
|
|||||||
'host': 'localhost',
|
'host': 'localhost',
|
||||||
'db': 'yms',
|
'db': 'yms',
|
||||||
'user': 'yms',
|
'user': 'yms',
|
||||||
'docpath': '/var/local/yms'
|
'docpath': '/var/local/yms',
|
||||||
|
'shapedir': 'webgui/shapes'
|
||||||
}
|
}
|
||||||
|
|
||||||
class Frontend():
|
class Frontend():
|
||||||
@@ -70,7 +72,17 @@ class Frontend():
|
|||||||
db.cur.execute("SELECT vid, vesselname, model FROM vessel ORDER BY vid")
|
db.cur.execute("SELECT vid, vesselname, model FROM vessel ORDER BY vid")
|
||||||
for row in db.cur.fetchall():
|
for row in db.cur.fetchall():
|
||||||
print(row)
|
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):
|
def run(self):
|
||||||
self.label['vessel'].set_text(self.vname)
|
self.label['vessel'].set_text(self.vname)
|
||||||
|
|||||||
Reference in New Issue
Block a user