Skip to content
This repository has been archived by the owner on Aug 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #135 from mgedmin/run-from-source
Browse files Browse the repository at this point in the history
Detect the UI file location from many possible places
  • Loading branch information
mhsabbagh committed Jun 11, 2019
2 parents e91de9d + d10bcd8 commit 03b7cb6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions green-recorder
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ gi.require_version('Gtk','3.0')

from gi.repository import Gtk, Gdk, GLib, AppIndicator3 as appindicator
from pydbus import SessionBus
import subprocess, signal, threading, datetime, urllib, gettext, locale, os, ConfigParser
import subprocess, signal, threading, datetime, urllib, gettext, locale, os, ConfigParser, sys

# Configuration
confDir = os.path.join(GLib.get_user_config_dir(), 'green-recorder/')
Expand Down Expand Up @@ -331,10 +331,18 @@ def showabout(self):

# Import the glade file and its widgets.
builder = Gtk.Builder()
try:
builder.add_from_file("/usr/share/green-recorder/ui.glade")
except:
builder.add_from_file("/usr/local/share/green-recorder/ui.glade")
possible_ui_file_locations = [
"/usr/share/green-recorder/ui.glade",
"/usr/local/share/green-recorder/ui.glade",
os.path.join(os.path.dirname(__file__), "ui", "ui.glade"),
]
for filename in possible_ui_file_locations:
if os.path.exists(filename):
builder.add_from_file(filename)
break
else:
sys.exit("Did not find ui.glade. Tried\n %s"
% "\n ".join(possible_ui_file_locations))

# Create pointers.
window = builder.get_object("window1")
Expand Down

0 comments on commit 03b7cb6

Please sign in to comment.