Пример #1
0
def check_memory(opts, display_mode=None):

    if not display_mode:
        display_mode = opts.display_mode

    reason = ''
    needed_ram = isys.MIN_RAM
    if not within_available_memory(needed_ram):
        from snack import SnackScreen, ButtonChoiceWindow
        screen = SnackScreen()
        ButtonChoiceWindow(screen,
                           _('Fatal Error'),
                           _('You do not have enough RAM to install %s '
                             'on this machine%s.\n'
                             '\n'
                             'Press <return> to reboot your system.\n') %
                           (product.productName, reason),
                           buttons=(_("OK"), ))
        screen.finish()
        sys.exit(0)

    # override display mode if machine cannot nicely run X
    if display_mode not in ('t', 'c') and not flags.usevnc:
        needed_ram = isys.MIN_GUI_RAM

        if not within_available_memory(needed_ram):
            stdoutLog.warning(
                _("You do not have enough RAM to use the graphical "
                  "installer.  Starting text mode."))
            opts.display_mode = 't'
            time.sleep(2)
Пример #2
0
def process():
    global NvLtDrvURL, LatestFile, LatestHeader, DownloadFlag, SymlinkFlag
    screen = SnackScreen()
    bb = ButtonBar(screen, (("End", "end"), ))
    tbTittle = Textbox(65, 3, "Processing Input... ", 0, 1)

    tbDownload = Textbox(65, 3, " ", 0, 1)

    tbSymlink = Textbox(65, 3, " ", 0, 1)

    g = GridForm(screen, "chkltdr (NvDrIn) - by Trodskovich", 1, 6)
    g.add(tbTittle, 0, 2)
    g.add(tbDownload, 0, 3, growx=1)
    g.add(tbSymlink, 0, 4, growx=1)
    g.add(bb, 0, 5, growx=1)

    if DownloadFlag:
        tbDownload.setText("Downloading Please Wait...")
        result = g.runOnce()
        screen.finish()
        urllib.request.urlretrieve(NvLtDrvURL, "./" + LatestFile)
    else:
        tbDownload.setText("Download Skipped")

    if SymlinkFlag:
        subprocess.call(
            ["ln -nfs ./" + LatestFile + " NVIDIA-Linux-x86_64-Latest.run"],
            shell=True)
        tbSymlink.setText("Symlink Created")
    else:
        tbSymlink.setText("Symlink Skipped")
    result = g.runOnce()
    screen.finish()
    return bb.buttonPressed(result)
 def __init__(self, controller):
     """
     @param: controller, a list of AssistantControllers
     """
     from snack import SnackScreen
     self.controller = controller
     self.screen = SnackScreen()
     self.confignames = self.controller.getCompleteConfigSetNames()
Пример #4
0
    def show(self):
        self.screen = SnackScreen()

        action = self.show_menu(self.kconf.mainmenu_text,
                                self.kconf.top_node.list)

        self.screen.finish()
        return action
Пример #5
0
 def __init__(self, frontend):
     self._frontend = frontend
     self.screen = SnackScreen()
     self.textview_changes = None
     self.button_bar = None
     self.checkbox_tree_updates = None
     self.layout = None
     self._app = None
     self._updates_received = False
 def __init__(self, controller, title="Com-EC Assistant"):
     """
     @param: controller, a list of AssistantControllers
     """
     from snack import SnackScreen
     self.title = title
     self.controller = controller
     self.infodict = self._build_infodict()
     self.screen = SnackScreen()
Пример #7
0
    def __init__(self,
                 margin,
                 title,
                 message=None,
                 vendor_text=None,
                 args=None):
        self.debug_mode = args is not None and args.debug

        self.screen = SnackScreen()

        # set usual colors
        for i in colorsets["ROOT"], colorsets["ROOTTEXT"], colorsets[
                "HELPLINE"], colorsets["EMPTYSCALE"]:
            self.screen.setColor(i, "white", "blue") if not self.debug_mode else \
                self.screen.setColor(i, "brightgreen", "black")

        # remove silly default help text
        self.screen.popHelpLine()

        # write static messages
        self.screen.drawRootText((self.screen.width - len(message)) // 2, 4,
                                 message)
        self.screen.drawRootText(-len(vendor_text) - 2, -2, vendor_text)

        if self.debug_mode:
            # write some static debug information
            self.screen.drawRootText(1, 1, _("DEBUG MODE"))
            self.screen.drawRootText(
                2, 2, "screen {}×{}".format(self.screen.width,
                                            self.screen.height))
            self.screen.drawRootText(2, 3, "file {}".format(args.input))

        self.window_width = self.screen.width - margin * 2

        # assemble our progress bar
        self.scale = Scale(self.window_width, 100)
        self.spacer = Label("")
        self.taskbox = Textbox(self.window_width - 2, 1, "")
        self.messagebox = Textbox(self.window_width - 8, 1, " . . . ")

        self.grid = Grid(1, 4)
        self.grid.setField(self.scale, 0, 0)
        self.grid.setField(self.spacer, 0, 1)
        self.grid.setField(self.taskbox, 0, 2)
        self.grid.setField(self.messagebox, 0, 3)
        self.grid.place(1, 1)

        self.screen.gridWrappedWindow(self.grid, title)
        self.form = Form()
        self.form.add(self.scale)
        self.form.add(self.taskbox)
        self.form.add(self.messagebox)
        self.form.draw()
        self.screen.refresh()
Пример #8
0
def select_packages():
    global sellist
    screen = SnackScreen()
    ct = CheckboxTree(height=20, scroll=1)

    for idx, key in enumerate(packages):
        ct.append(key)
        for val in packages[key]:
            ct.addItem(val, (idx, snackArgs["append"]))
            ct.setEntryValue(val)

    bb = ButtonBar(screen, (("Next", "next"), ("Cancel", "cancel")))
    g = GridForm(screen, "Packages", 1, 4)

    g.add(ct, 0, 2)
    g.add(bb, 0, 3, growx=1)

    result = g.runOnce()
    screen.finish()

    # format selected packages list for zypper  and print(result)
    sellist = (str(ct.getSelection()).replace("[",
                                              "").replace("]", "").replace(
                                                  "'", "").replace(",", ""))
    # to confirm Selected Packages
    screen = SnackScreen()
    bb = ButtonBar(screen, (("Next", "next"), ("Cancel", "cancel")))
    tb = Textbox(
        80, 10,
        "the packages selected to install are \n \n" + str(sellist.split(" ")),
        1, 1)
    g = GridForm(screen, "Selected Packages", 1, 4)

    g.add(tb, 0, 2)
    g.add(bb, 0, 3, growx=1)

    result = g.runOnce()
    screen.finish()
    return bb.buttonPressed(result)
Пример #9
0
def welcome():
    screen = SnackScreen()
    bb = ButtonBar(screen, (("Continue", "continue"), ("Cancel", "cancel")))
    tb = Textbox(
        65,
        4,
        "Python Script to Initialize New openSUSE Tumbleweed Installation,\nlike Installing Applications, Enabling & Starting Services, \nand Performing Distrubution Update.",
    )
    g = GridForm(screen, "TW-Init - by Trodskovich", 1, 4)

    g.add(tb, 0, 2)
    g.add(bb, 0, 3, growx=1)

    result = g.runOnce()
    screen.finish()
    return bb.buttonPressed(result)
Пример #10
0
def dup():
    screen = SnackScreen()
    bb = ButtonBar(screen, (("Yes", "yes"), ("No", "no")))
    tb = Textbox(
        70,
        4,
        "It's recomended to run the Distribution Update after Initiliazation. \nDo you want to run Distribution Update after Initiliazation ?",
    )
    g = GridForm(screen, "Distribution Update", 1, 4)

    g.add(tb, 0, 2)
    g.add(bb, 0, 3, growx=1)

    result = g.runOnce()
    screen.finish()
    return bb.buttonPressed(result)
Пример #11
0
def add_repo():
    screen = SnackScreen()
    bb = ButtonBar(screen, (("Add", "add"), ("Cancel", "cancel")))
    tb = Textbox(
        50,
        5,
        "Multimedia Applications and Codecs require Packman Repositary to be added in order to work correctly. \nDo you want add Packman repo now ?",
        0,
        1,
    )
    g = GridForm(screen, "Packman Repo", 1, 4)

    g.add(tb, 0, 2)
    g.add(bb, 0, 3, growx=1)

    result = g.runOnce()
    screen.finish()
    return bb.buttonPressed(result)
    def __init__(self, datadir):
        self.screen = SnackScreen()
        # FIXME: self.screen.finish() clears the screen (and all messages)
        #        there too
        #atexit.register(self.restoreScreen)
        self.button_bar = ButtonBar(self.screen, ((_("Cancel"), "cancel"),
                                                  (_("Install"), "ok")),
                                    compact=True)
        self.textview_changes = Textbox(72, 8, _("Changelog"), True, True)
        self.checkbox_tree_updates = CheckboxTree(height=8, width=72, scroll=1)
        self.checkbox_tree_updates.setCallback(self.checkbox_changed)
        self.layout = GridForm(self.screen, _("Updates"), 1, 5)
        self.layout.add(self.checkbox_tree_updates, 0, 0)
        # empty line to make it look less crowded
        self.layout.add(Textbox(60, 1, " ", False, False), 0, 1)
        self.layout.add(self.textview_changes, 0, 2)
        # empty line to make it look less crowded
        self.layout.add(Textbox(60, 1, " ", False, False), 0, 3)
        self.layout.add(self.button_bar, 0, 4)
        # FIXME: better progress than the current suspend/resume screen thing
        self.screen.suspend()
        if not self.DEBUG:
            apt_pkg.pkgsystem_lock()
        self.openCache()
        print(_("Building Updates List"))
        self.fillstore()
        if self.list.distUpgradeWouldDelete > 0:
            print(
                _("""
A normal upgrade can not be calculated, please run:
  sudo apt-get dist-upgrade


This can be caused by:
 * A previous upgrade which didn't complete
 * Problems with some of the installed software
 * Unofficial software packages not provided by Ubuntu
 * Normal changes of a pre-release version of Ubuntu"""))
            sys.exit(1)
        self.screen.resume()
Пример #13
0
    if opts.rescue:
        anaconda.rescue = True

        import rescue, instdata

        anaconda.id = instdata.InstallData(anaconda, [], opts.display_mode)

        if anaconda.isKickstart:
            instClass.setInstallData(anaconda)
            anaconda.id.setKsdata(ksdata)

            # We need an interface before running kickstart execute methods for
            # storage.
            from snack import *
            screen = SnackScreen()
            anaconda.intf = rescue.RescueInterface(screen)

            ksdata.execute()

            anaconda.intf = None
            screen.finish()

            # command line 'nomount' overrides kickstart /same for vnc/
            anaconda.rescue_mount = not (opts.rescue_nomount
                                         or anaconda.id.ksdata.rescue.nomount)

        rescue.runRescue(anaconda, instClass)

        # shouldn't get back here
        sys.exit(1)
Пример #14
0
 def __init__(self):
     InstallInterfaceBase.__init__(self)
     self.screen = SnackScreen()
     self._meh_interface = meh.ui.text.TextIntf()
Пример #15
0
def welcome():
    global NvLtDrvURL, LatestFile, LatestHeader, DownloadFlag, SymlinkFlag
    screen = SnackScreen()
    bb = ButtonBar(screen, (("Continue", "continue"), ("Cancel", "cancel")))
    tbTittle = Textbox(
        65, 3,
        "To check for latest Nvidia Driver form NVIDIA Website, download and optionaly create a symlink to the latest File",
        0, 1)
    for File in os.listdir(path):
        if File.find('.run') > 0 and os.path.isfile(path + "/" + File):
            FList.append(File)
            FList.sort()
    FileText = urllib.request.urlopen(NvLtTxtURL).read().decode('utf-8')
    for i in range(0, len(FileText)):
        if FileText[i] == ' ':
            LatestHeader = FileText[0:i]

    for i in range(0, len(FileText)):
        if FileText[i] == '/':
            LatestFile = FileText[i + 1:len(FileText) - 1]

    NvLtDrvURL = NvLtDrvURL + LatestHeader + "/" + LatestFile

    tbLatestL = Textbox(110, 2, "Latest Local Version: " + FList[-1], 0, 1)
    tbLatestR = Textbox(
        110, 4, "Latest Remote Version: " + LatestFile +
        "\nLatest Driver URL: " + NvLtDrvURL, 0, 1)

    if LatestFile > FList[-1]:
        cbDowload = Checkbox(
            "Download the Latest Driver",
            1,
        )
        cbSymlink = Checkbox(
            "Create / Update Symlink",
            1,
        )
    else:
        cbDowload = Checkbox(
            "Download the Latest Driver",
            0,
        )
        cbSymlink = Checkbox(
            "Create / Update Symlink",
            0,
        )

    g = GridForm(screen, "chkltdr (NvDrIn) - by Trodskovich", 1, 8)

    g.add(tbTittle, 0, 2)
    g.add(tbLatestL, 0, 3, growx=1)
    g.add(tbLatestR, 0, 4, growx=1)
    g.add(cbDowload, 0, 5, growx=1)
    g.add(cbSymlink, 0, 6, growx=1)
    g.add(bb, 0, 7, growx=1)
    result = g.runOnce()

    screen.finish()
    DownloadFlag = cbDowload.value()
    SymlinkFlag = cbSymlink.value()
    return bb.buttonPressed(result)