예제 #1
0
 def wrapToolButtonText(self, text):
     """
     Add a newline character at the end of each word in the toolbutton text
     """
     #ninad 070126 QToolButton lacks this method. This is not really a 
     #'word wrap' but OK for now. 
     
     #@@@ ninad 070126. Not calling this method as it is creating an annoying
     #resizing problem in the Command toolbar layout. Possible solution is 
     #to add a spacer item in a vbox layout to the command toolbar layout
     
     stringlist = text.split(" ", QString.SkipEmptyParts)
     text2 = QString()
     if len(stringlist) > 1:
         for l in stringlist:
             text2.append(l)
             text2.append("\n")
         return text2
             
     return None
예제 #2
0
    def fillContent(self):
        subject = "<p><li><b>%s</b></li><ul>"
        item    = "<li>%s</li>"
        end     = "</ul></p>"
        content = QString("")

        content.append("""<html><body><ul>""")

        # Keyboard Layout
        if ctx.installData.keyData:
            content.append(subject % _("Keyboard Settings"))
            content.append(item %
                           _("Selected keyboard layout is <b>%s</b>") %
                           ctx.installData.keyData["name"])
            content.append(end)

        # TimeZone
        if ctx.installData.timezone:
            content.append(subject % _("Date/Time Settings"))
            content.append(item %
                           _("Selected TimeZone is <b>%s</b>") %
                           ctx.installData.timezone)
            content.append(end)

        # Users
        if len(yali.users.PENDING_USERS) > 0:
            content.append(subject % _("User Settings"))
            for user in yali.users.PENDING_USERS:
                state = _("User %(username)s (<b>%(realname)s</b>) added.")
                if "wheel" in user.groups:
                    state = _("User %(username)s (<b>%(realname)s</b>) added with <u>administrator privileges</u>.")
                content.append(item % state % {"username":user.realname, "realname":user.username})
            content.append(end)

        # HostName
        if ctx.installData.hostName:
            content.append(subject % _("Hostname Settings"))
            content.append(item %
                           _("Hostname is set as <b>%s</b>") %
                           ctx.installData.hostName)
            content.append(end)

        # Partition
        if ctx.storage.clearPartType is not None:
            content.append(subject % _("Partition Settings"))
            devices = ""
            for disk in ctx.storage.clearPartDisks:
                device = ctx.storage.devicetree.getDeviceByName(disk)
                devices += "(%s on %s)" % (device.model, device.name)

            if ctx.storage.doAutoPart:
                content.append(item % _("Automatic Partitioning selected."))
                if ctx.storage.clearPartType == CLEARPART_TYPE_ALL:
                    content.append(item % _("Use All Space"))
                    content.append(item % _("Removes all partitions on the selected "\
                                            "%s device(s). <b><u>This includes partitions "\
                                            "created by other operating systems.</u></b>") % devices)
                elif ctx.storage.clearPartType == CLEARPART_TYPE_LINUX:
                    content.append(item % _("Replace Existing Linux System(s)"))
                    content.append(item % _("Removes all Linux partitions on the selected" \
                                            "%s device(s). This does not remove "\
                                            "other partitions you may have on your " \
                                            "storage device(s) (such as VFAT or FAT32)") % devices)
                elif ctx.storage.clearPartType == CLEARPART_TYPE_NONE:
                    content.append(item % _("Use Free Space"))
                    content.append(item % _("Retains your current data and partitions" \
                                            " and uses only the unpartitioned space on " \
                                            "the selected %s device(s), assuming you have "\
                                            "enough free space available.") % devices)

            else:
                content.append(item % _("Manual Partitioning selected."))
                for operation in ctx.storage.devicetree.operations:
                    content.append(item % operation)

            content.append(end)

        # Bootloader
        if ctx.bootloader.stage1Device:
            content.append(subject % _("Bootloader Settings"))
            grubstr = _("GRUB will be installed to <b>%s</b>.")
            if ctx.bootloader.bootType == BOOT_TYPE_NONE:
                content.append(item % _("GRUB will not be installed."))
            else:
                content.append(item % grubstr % ctx.bootloader.stage1Device)

            content.append(end)

        if ctx.flags.collection and ctx.installData.autoCollection:
            content.append(subject % _("Package Installation Settings"))
            content.append(item % _("Collection <b>%s</b> selected") %
                           ctx.installData.autoCollection.title)

            content.append(end)

        content.append("""</ul></body></html>""")

        self.ui.content.setHtml(content)
예제 #3
0
    def fillContent(self):
        subject = "<p><li><b>%s</b></li><ul>"
        item = "<li>%s</li>"
        end = "</ul></p>"
        content = QString("")

        content.append("""<html><body><ul>""")

        # Keyboard Layout
        if ctx.installData.keyData:
            content.append(subject % _("Keyboard Settings"))
            content.append(item % _("Selected keyboard layout is <b>%s</b>") %
                           ctx.installData.keyData["name"])
            content.append(end)

        # TimeZone
        if ctx.installData.timezone:
            content.append(subject % _("Date/Time Settings"))
            content.append(item % _("Selected TimeZone is <b>%s</b>") %
                           ctx.installData.timezone)
            content.append(end)

        # Users
        if len(yali.users.PENDING_USERS) > 0:
            content.append(subject % _("User Settings"))
            for user in yali.users.PENDING_USERS:
                state = _("User %(username)s (<b>%(realname)s</b>) added.")
                if "wheel" in user.groups:
                    state = _(
                        "User %(username)s (<b>%(realname)s</b>) added with <u>administrator privileges</u>."
                    )
                content.append(item % state % {
                    "username": user.realname,
                    "realname": user.username
                })
            content.append(end)

        # HostName
        if ctx.installData.hostName:
            content.append(subject % _("Hostname Settings"))
            content.append(item % _("Hostname is set as <b>%s</b>") %
                           ctx.installData.hostName)
            content.append(end)

        # Partition
        if ctx.storage.clearPartType is not None:
            content.append(subject % _("Partition Settings"))
            devices = ""
            for disk in ctx.storage.clearPartDisks:
                device = ctx.storage.devicetree.getDeviceByName(disk)
                devices += "(%s on %s)" % (device.model, device.name)

            if ctx.storage.doAutoPart:
                content.append(item % _("Automatic Partitioning selected."))
                if ctx.storage.clearPartType == CLEARPART_TYPE_ALL:
                    content.append(item % _("Use All Space"))
                    content.append(item % _("Removes all partitions on the selected "\
                                            "%s device(s). <b><u>This includes partitions "\
                                            "created by other operating systems.</u></b>") % devices)
                elif ctx.storage.clearPartType == CLEARPART_TYPE_LINUX:
                    content.append(item %
                                   _("Replace Existing Linux System(s)"))
                    content.append(item % _("Removes all Linux partitions on the selected" \
                                            "%s device(s). This does not remove "\
                                            "other partitions you may have on your " \
                                            "storage device(s) (such as VFAT or FAT32)") % devices)
                elif ctx.storage.clearPartType == CLEARPART_TYPE_NONE:
                    content.append(item % _("Use Free Space"))
                    content.append(item % _("Retains your current data and partitions" \
                                            " and uses only the unpartitioned space on " \
                                            "the selected %s device(s), assuming you have "\
                                            "enough free space available.") % devices)

            else:
                content.append(item % _("Manual Partitioning selected."))
                for operation in ctx.storage.devicetree.operations:
                    content.append(item % operation)

            content.append(end)

        # Bootloader
        if ctx.bootloader.stage1Device:
            content.append(subject % _("Bootloader Settings"))
            grubstr = _("GRUB will be installed to <b>%s</b>.")
            if ctx.bootloader.bootType == BOOT_TYPE_NONE:
                content.append(item % _("GRUB will not be installed."))
            else:
                content.append(item % grubstr % ctx.bootloader.stage1Device)

            content.append(end)

        if ctx.flags.collection and ctx.installData.autoCollection:
            content.append(subject % _("Package Installation Settings"))
            content.append(item % _("Collection <b>%s</b> selected") %
                           ctx.installData.autoCollection.title)

            content.append(end)

        content.append("""</ul></body></html>""")

        self.ui.content.setHtml(content)