def __init__(self, guiexec): Uipi.__init__(self, backend=guiexec, cwd=base_dir) self.stagetext = None # Build the main window self.widget("Window", "larchin:", title="larchin", size="750_450", icon="images/larchin-icon.png", closesignal="$$$uiclose$$$") # - Header self.widget("Label", "larchin:i", image="images/larchin80.png") self.widget("Label", "larchin:h", html='<h1><span ' 'style="color:#c55500;">%s</span></h1>' % _("<i>larch</i> Installer")) self.widget("Button", "^larchin:showlog", text=_("View Log"), tt=_("This button switches to the log viewer")) self.widget("Button", "^larchin:docs", text=_("Help"), tt=_("This button switches to the documentation viewer")) self.widget("Button", "^larchin:cancel", text=_("Cancel"), tt=_("Stop the current action")) # self.widget("Button", "^larchin:quit", text=_("Quit"), # tt=_("Stop the current action and quit the program")) self.widget("Label", "larchin:stageheader", align="center") # - Main widget self.widget("Stack", "larchin:tabs", pages=["tab:main", "tab:progress", "tab:log", "tab:doc", "tab:edit"]) self.widget("Stack", "larchin:stack", pages=[ "page:welcome", "page:disks", "page:autopart", "page:manupart", "page:install", "page:passwd", "page:grub", "page:done" ]) # - Footer self.widget("Button", "^&-larchin:goback", text=_("Go Back"), tt=_("Return to previous stage")) self.widget("Button", "^&-larchin:forward", text=_("OK"), tt=_("Execute any operations pending on this page and continue to next")) self.layout("larchin:", ["*VBOX*", ["*HBOX*", "larchin:i", ["*VBOX*", ["*HBOX*", "larchin:h", "*SPACE", "larchin:showlog", "larchin:docs",], # "larchin:cancel", "larchin:quit"], "larchin:stageheader"]], "larchin:tabs", ]) self.layout("tab:main", ["*VBOX*", "larchin:stack", ["*HBOX*", "&-larchin:goback", "*SPACE", "&-larchin:forward"] ]) self.setDisableWidgets("larchin:", ("&-larchin:forward", "&-larchin:goback", "larchin:stack"))
def sendsignal(self, sig, *args): #debug("SIG:" + sig + "---" + repr(args)) if sig.endswith("-"): # This is to suppress appending to the pagehistory (used by # the 'Go Back' feature. Remove the '-'. sig = sig[:-1] elif sig.endswith("!"): # It is a page switch, and needs an extra argument command.pagehistory.append(sig) args = (True,) + (args) Uipi.sendsignal(self, sig, *args)
def unbusy(self, ok=True): # Override Uipi method # 'ok' is not used here, but might be in the console interface self.command("larchin:cancel.enable", False) Uipi.unbusy(self)
def busy(self): # Override Uipi method self.command("larchin:cancel.enable", True) Uipi.busy(self)
def unbusy(self, ok=True): # 'ok' is only used by the console interface Uipi.unbusy(self)
def __init__(self, guiexec): if guiexec and os.path.isfile(base_dir + "/" + guiexec): guiexec = base_dir + "/" + guiexec Uipi.__init__(self, backend=guiexec, cwd=base_dir)
/usr/sbin/sudopw (assuming that is where this script is installed), and call sudo with the -A option. For example: export SUDO_ASKPASS=/usr/sbin/sudopw sudo -A env Of course you also need to set up your /etc/sudoers file so that the user concerned is allowed to execute the desired programs (see the man pages for sudo and sudoers). """ from uipi import Uipi import sys def done(okpw): global ecode if okpw[0]: print okpw[1] ecode = 0 else: ecode = 1 ui = Uipi() ui.addslot("done", done) okpw = ui.textLineDialog(sys.argv[1], "sudopw", async="done", pw=True) ui.mainloop() exit(ecode)
def __init__(self): Uipi.__init__(self)