Example #1
0
 def __init__(self, ctrl, anaconda):
     #log.debug("called smartinstall.AnacondaInterface.__init__")
     Interface.__init__(self, ctrl)
     self.anaconda = anaconda
     self._progress = AnacondaProgress(self.anaconda.intf)
     self.statusWindow = None
     self.waitWindow = None
 def __init__(self, ctrl):
     Interface.__init__(self, ctrl)
     self._log = GtkLog()
     self._progress = GtkProgress(False)
     self._hassubprogress = GtkProgress(True)
     self._changes = GtkChanges()
     self._window = None
     self._sys_excepthook = sys.excepthook
Example #3
0
 def __init__(self, ctrl):
     Interface.__init__(self, ctrl)
     self._log = GtkLog()
     self._progress = GtkProgress(False)
     self._hassubprogress = GtkProgress(True)
     self._changes = GtkChanges()
     self._window = None
     self._sys_excepthook = sys.excepthook
 def __init__(self, ctrl, argv):
     Interface.__init__(self, ctrl)
     self._log = QtLog()
     self._progress = QtProgress(False)
     self._progress.setMainThread(self._currentThread())
     self._hassubprogress = QtProgress(True)
     self._hassubprogress.setMainThread(self._currentThread())
     self._changes = QtChanges()
     self._window = None
     self._sys_excepthook = sys.excepthook
Example #5
0
 def __init__(self, ctrl, argv):
     Interface.__init__(self, ctrl)
     self._log = QtLog()
     self._progress = QtProgress(False)
     self._progress.setMainThread(self._currentThread())
     self._hassubprogress = QtProgress(True)
     self._hassubprogress.setMainThread(self._currentThread())
     self._changes = QtChanges()
     self._window = None
     self._sys_excepthook = sys.excepthook
Example #6
0
def init(command=None,
         argv=None,
         datadir=None,
         configfile=None,
         gui=False,
         shell=False,
         interface=None,
         forcelocks=False,
         loglevel=None):
    from smart.const import DEBUG, INFO, WARNING, ERROR, DISTROFILE
    from smart.const import DATADIR, USERDATADIR
    from smart.interface import Interface, createInterface
    from smart.sysconfig import SysConfig
    from smart.pkgconfig import PkgConfig
    from smart.interface import Interface
    from smart.control import Control

    iface.object = Interface(None)
    sysconf.object = SysConfig()
    pkgconf.object = PkgConfig(sysconf.object)
    sysconf.set("log-level", INFO, weak=True)
    sysconf.set("data-dir", DATADIR, weak=True)
    if loglevel:
        level = {
            "error": ERROR,
            "warning": WARNING,
            "debug": DEBUG,
            "info": INFO
        }.get(loglevel)
        if level is None:
            raise Error, _("Unknown log level")
        sysconf.set("log-level", level, soft=True)
    if datadir:
        sysconf.set("data-dir", os.path.expanduser(datadir), soft=True)
    sysconf.set("user-data-dir", os.path.expanduser(USERDATADIR), soft=True)
    ctrl = Control(configfile, forcelocks)
    if gui:
        ifacename = sysconf.get("default-gui", "gtk")
    elif shell:
        ifacename = sysconf.get("default-shell", "text")
        if command:
            raise Error, _("Can't use commands with shell interfaces")
    elif interface:
        ifacename = interface
    else:
        ifacename = "text"
    iface.object = createInterface(ifacename, ctrl, command, argv)

    # Run distribution script, if available.
    if os.path.isfile(DISTROFILE):
        execfile(
            DISTROFILE, {
                "ctrl": ctrl,
                "iface": iface,
                "sysconf": sysconf,
                "pkgconf": pkgconf,
                "hooks": hooks
            })

    return ctrl
Example #7
0
 def __init__(self, ctrl):
     Interface.__init__(self, ctrl)
     self._progress = Up2dateProgress()
     self._activestatus = False
Example #8
0
 def askPassword(self, location, caching=OPTIONAL):
     self._progress.lock()
     passwd = Interface.askPassword(self, location, caching)
     self._progress.unlock()
     return passwd
 def run(self, command=None, argv=None):
     self.setCatchExceptions(True)
     result = Interface.run(self, command, argv)
     self.setCatchExceptions(False)
     return result
Example #10
0
 def __init__(self, ctrl):
     Interface.__init__(self, ctrl)
     self._progress = TextProgress()
     self._activestatus = False
Example #11
0
 def askPassword(self, location, caching=OPTIONAL):
     self._progress.lock()
     passwd = Interface.askPassword(self, location, caching)
     self._progress.unlock()
     return passwd
Example #12
0
 def run(self, command=None, argv=None):
     self.setCatchExceptions(True)
     result = Interface.run(self, command, argv)
     self.setCatchExceptions(False)
     return result
Example #13
0
def init(command=None, argv=None,
         datadir=None, configfile=None,
         gui=False, shell=False, quiet=False, interface=None,
         forcelocks=False, loglevel=None):
    from smart.const import DEBUG, INFO, WARNING, ERROR
    from smart.const import DATADIR, USERDATADIR
    from smart.interface import Interface, createInterface
    from smart.sysconfig import SysConfig
    from smart.pkgconfig import PkgConfig
    from smart.interface import Interface
    from smart.control import Control

    _smart_run_lock.acquire()

    iface.object = Interface(None)
    sysconf.object = SysConfig()
    pkgconf.object = PkgConfig(sysconf.object)
    sysconf.set("log-level", INFO, weak=True)
    sysconf.set("data-dir", DATADIR, weak=True)
    if loglevel:
        level = {"error": ERROR, "warning": WARNING,
                 "debug": DEBUG, "info": INFO}.get(loglevel)
        if level is None:
            raise Error, _("Unknown log level")
        sysconf.set("log-level", level, soft=True)
    if datadir:
        sysconf.set("data-dir", os.path.expanduser(datadir), soft=True)
    sysconf.set("user-data-dir", os.path.expanduser(USERDATADIR), soft=True)
    ctrl = Control(configfile, forcelocks)
    if gui:
        ifacename = sysconf.get("default-gui", "gtk")
    elif shell:
        ifacename = sysconf.get("default-shell", "text")
        if command:
            raise Error, _("Can't use commands with shell interfaces")
    elif quiet:
        ifacename = None
    elif interface:
        ifacename = interface
    else:
        ifacename = "text"
    iface.object = createInterface(ifacename, ctrl, command, argv)

    # Python's default to SIGPIPE is SIG_IGN, set by initsigs() in
    # pythonrun.c. As a side effect:
    #
    #   >>> os.system("yes | read any")
    #   yes: standard output: Broken pipe
    #   yes: write error
    #
    #   >>> signal.signal(signal.SIGPIPE, signal.SIG_DFL)
    #   >>> os.system("yes | read any")
    #   >>>
    #
    try:
        import signal
        signal.signal(signal.SIGPIPE, signal.SIG_DFL)
    except ValueError:
        if signal.getsignal(signal.SIGPIPE) != signal.SIG_DFL:
            iface.warning("SIGPIPE isn't SIG_DFL. Scriptlets may fail.")

    return ctrl
 def __init__(self, ctrl):
     self._progress = AnacondaProgress()
     Interface.__init__(self, ctrl)