def do_show_build_window(self, build_close_callback): self.state = BUILDING self.build_successful = False self.uid, self.gid = [int(x) for x in self.options.build_for.split(':', 2)] f = open(os.path.join(LOG_FILE), 'w') print >>f, "I: live-magic respawned as root" f.close() # Set initial titles and state self.view.set_build_status_change(initial=True) # Show window self.view.do_show_window_build(build_close_callback) # Start pulsing gobject.timeout_add(80, self.do_pulse_cb) # Fork command cmd = [find_resource('live-magic-builder')] self.pid = self.view.vte_terminal.fork_command(cmd[0], cmd, [], os.getcwd()) if self.pid < 0: self.view.set_build_titles(_("Error creating Debian Live system!"), \ "Could not fork the build process!") self.view.set_build_status_change(initial=False)
def gain_superuser(): global _ title = _("Enter your password to continue") text = _("Debian Live Magic requires superuser capabilities to build your Debian Live system.") for num in range(3): cmd = ['gksu', '--disable-grab', '--preserve-env', '--message', '<big><b>%s</b></big>\n\n%s' % (title, text), '--', utils.find_resource('live-magic'), '--build-for', '%d:%d' % (os.geteuid(), os.getegid()), ] p = subprocess.Popen(cmd) os.waitpid(p.pid, 0) # If build-log.txt exists, we had a successful build if os.path.exists(os.path.join(self.model.dir, 'build-log.txt')): gobject.timeout_add(0, lambda: gtk.main_quit()) return # If the build directory does not exist, we cancelled the build if not os.path.exists(self.model.dir): break self.view.do_undim_wizard() os.chdir('..') try: if not existed_before: shutil.rmtree(self.model.dir) except: # Tree may not exist if we cancelled build pass
def __init__(self, controller): self.controller = controller self.xml = gtk.glade.XML(find_resource("live-magic.glade")) self.xml.signal_autoconnect(self.controller) Main.__init__(self) Build.__init__(self) Wizard.__init__(self)
def __init__(self, controller): self.controller = controller self.xml = gtk.glade.XML(find_resource('live-magic.glade')) self.xml.signal_autoconnect(self.controller) Main.__init__(self) Build.__init__(self) Wizard.__init__(self)
def do_show_about_dialog(self): about = gtk.AboutDialog() about.set_name(_("Debian Live Magic")) about.set_comments(_("GUI tool to build Debian Live systems.")) about.set_copyright("Copyright (C) 2007-2010 Chris Lamb <*****@*****.**>") about.set_website("http://live.debian.net/") about.set_website_label(_("Debian Live homepage")) about.set_license(file(find_resource('GPL-3')).read()) try: credits = file(find_resource('translator-credits.txt')).read() about.set_translator_credits(credits) except ValueError: pass logo = gtk.gdk.pixbuf_new_from_file(find_resource('debian_openlogo-nd-100.png')) about.set_logo(logo) self.asst.set_sensitive(False) about.run() about.destroy() self.asst.set_sensitive(True)
def do_show_about_dialog(self): about = gtk.AboutDialog() about.set_name(_("Debian Live Magic")) about.set_comments(_("GUI tool to build Debian Live systems.")) about.set_copyright( "Copyright (C) 2007-2008 Chris Lamb <*****@*****.**>") about.set_website("http://debian-live.alioth.debian.org/") about.set_website_label(_("Debian Live homepage")) about.set_license(file(find_resource('GPL-3')).read()) try: credits = file(find_resource('translator-credits.txt')).read() about.set_translator_credits(credits) except ValueError: pass logo = gtk.gdk.pixbuf_new_from_file( find_resource('debian_openlogo-nd-100.png')) about.set_logo(logo) self.asst.set_sensitive(False) about.run() about.destroy() self.asst.set_sensitive(True)
def init_gettext(): try: locale_dir = [find_resource('mo')] except ValueError: # Fall back to /usr/share/locale locale_dir = [] try: locale.setlocale(locale.LC_ALL, '') except locale.Error: pass for module in gettext, gtk.glade: module.bindtextdomain('live-magic', *locale_dir) module.textdomain('live-magic') __builtin__._ = gettext.gettext
def gain_superuser(): global _ title = _("Enter your password to continue") text = _( "Debian Live Magic requires superuser capabilities to build your Debian Live system." ) for num in range(3): cmd = [ 'gksu', '--disable-grab', '--preserve-env', '--message', '<big><b>%s</b></big>\n\n%s' % (title, text), '--', utils.find_resource('live-magic'), '--build-for', '%d:%d' % (os.geteuid(), os.getegid()), ] p = subprocess.Popen(cmd) os.waitpid(p.pid, 0) # If build-log.txt exists, we had a successful build if os.path.exists(os.path.join(self.model.dir, 'build-log.txt')): gobject.timeout_add(0, lambda: gtk.main_quit()) return # If the build directory does not exist, we cancelled the build if not os.path.exists(self.model.dir): break self.view.do_undim_wizard() os.chdir('..') try: if not existed_before: shutil.rmtree(self.model.dir) except: # Tree may not exist if we cancelled build pass
def get_keyboard_layouts(self): for line in open(find_resource('keyboard-layouts.txt')): yield line.strip().split('\t', 2)