I've made my application for Ubuntu App Showdown. When I start it from terminal using quickly run it works well. I've packaged it with quickly package and installed locally. Unfortunately it does not start. I think it's a problem with linking to css file inside my python code, but I don't know how should I link properly, so it will work after install.
Output from terminal when starting installed app:
michal@michal-Inspiron-530-11:~$ easy-stopwatch
/usr/lib/python2.7/dist-packages/gi/overrides/Gtk.py:391: Warning: g_object_set_property: construct property "type" for object `Window' can't be set after construction
Gtk.Window.__init__(self, type=type, **kwds)
(easy-stopwatch:10446): Gtk-CRITICAL **: gtk_css_section_get_file: assertion `section != NULL' failed
(easy-stopwatch:10446): Gtk-CRITICAL **: gtk_css_section_get_end_position: assertion `section != NULL' failed
(easy-stopwatch:10446): Gtk-CRITICAL **: gtk_css_section_get_end_line: assertion `section != NULL' failed
Traceback (most recent call last):
File "/usr/bin/easy-stopwatch", line 33, in <module>
easy_stopwatch.main()
File "/usr/lib/python2.7/dist-packages/easy_stopwatch/__init__.py", line 33, in main
window = EasyStopwatchWindow.EasyStopwatchWindow()
File "/usr/lib/python2.7/dist-packages/easy_stopwatch_lib/Window.py", line 35, in __new__
new_object.finish_initializing(builder)
File "/usr/lib/python2.7/dist-packages/easy_stopwatch/EasyStopwatchWindow.py", line 56, in finish_initializing
css_provider.load_from_path('data/ui/gtk-style.css')
File "/usr/lib/python2.7/dist-packages/gi/types.py", line 43, in function
return info.invoke(*args, **kwargs)
gi._glib.GError: <unknown>:1:0: Failed to import: Error opening file: No such file or directory
michal@michal-Inspiron-530-11:~$
Part of my python code:
# Styling via CSS file
screen = Gdk.Screen.get_default()
css_provider = Gtk.CssProvider()
css_provider.load_from_path('data/ui/gtk-style.css')
style_context = Gtk.StyleContext()
style_context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
-------------EDIT----------------
After some searching I realized that quickly package does not make app to install in /opt but quickly package --extras does. After installing in /opt I've edited my python file so the link to css file looks like this:
css_provider.load_from_path('/opt/extras.ubuntu.com/easy-stopwatch/share/easy-stopwatch/ui/gtk-style.css')
After that my app works. I'm not sure if I can do that in the code I'd like to submit to Ubuntu App Showdown.
