当前位置: 首页>>代码示例>>Python>>正文


Python WarningDialog.exec_loop方法代码示例

本文整理汇总了Python中yali.gui.YaliDialog.WarningDialog.exec_loop方法的典型用法代码示例。如果您正苦于以下问题:Python WarningDialog.exec_loop方法的具体用法?Python WarningDialog.exec_loop怎么用?Python WarningDialog.exec_loop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yali.gui.YaliDialog.WarningDialog的用法示例。


在下文中一共展示了WarningDialog.exec_loop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Widget

# 需要导入模块: from yali.gui.YaliDialog import WarningDialog [as 别名]
# 或者: from yali.gui.YaliDialog.WarningDialog import exec_loop [as 别名]
class Widget(SetupUsersWidget, ScreenWidget):

    help = _('''
<font size="+2">User setup</font>

<font size="+1">
<p>
Other than the system administrator user,
you can create a user account for your 
daily needs, i.e reading your e-mail, surfing
on the web and searching for daily recipe
offerings. Usual password assignment
rules also apply here: This password should 
be unique and private. Choose a password 
difficult to guess, but easy to remember. 
</p>
<p>
Click Next button to proceed.
</p>
</font>
''')

    def __init__(self, *args):
        apply(SetupUsersWidget.__init__, (self,) + args)

        self.pix.setPixmap(ctx.iconfactory.newPixmap("users"))
        self.pass_error.setText("")
        self.edititemindex = None

        # User Icons
        self.normalUserIcon = ctx.iconfactory.newPixmap("user_normal")
        self.superUserIcon = ctx.iconfactory.newPixmap("user_root")

        # KDE AutoLogin
        self.autoLoginUser = ""

        # Give Admin Privileges default
        self.admin.setChecked(True)

        self.createButton.setEnabled(False)

        self.connect(self.pass1, SIGNAL("textChanged(const QString &)"),
                     self.slotTextChanged)
        self.connect(self.pass2, SIGNAL("textChanged(const QString &)"),
                     self.slotTextChanged)
        self.connect(self.username, SIGNAL("textChanged(const QString &)"),
                     self.slotTextChanged)
        self.connect(self.createButton, SIGNAL("clicked()"),
                     self.slotCreateUser)
        self.connect(self.deleteButton, SIGNAL("clicked()"),
                     self.slotDeleteUser)
        self.connect(self.userList, SIGNAL("doubleClicked(QListBoxItem*)"),
                     self.slotEditUser)
        self.connect(self.pass2, SIGNAL("returnPressed()"),
                     self.slotReturnPressed)
        self.checkUsers()

    def shown(self):
        from os.path import basename
        ctx.debugger.log("%s loaded" % basename(__file__))

        ctx.installData.users = []
        ctx.installData.autoLoginUser = None

        self.checkUsers()
        self.checkCapsLock()
        self.username.setFocus()

    def execute(self):
        isAdminSet = False
        for i in range(self.userList.count()):
            u = self.userList.item(i).getUser()
            if "wheel" in u.groups:
                isAdminSet = True

        if not isAdminSet:
            # show confirmation dialog
            w = WarningWidget(self)
            w.warning.setText(_('''<b>
<p>You have not defined an administrator!</p>

<p>A user without administrative rights cannot complete system maintenance 
tasks. You are strongly encouraged to define an administrator user.</p>

<p>Click "Cancel" to define an administrator user (recommended) or "OK" to 
go to next screen.</p>
</b>
'''))
            self.dialog = WarningDialog(w, self)
            if not self.dialog.exec_loop():
                ctx.screens.enablePrev()
                ctx.screens.enableNext()
                return False

        # reset and fill pending_users
        yali.users.reset_pending_users()

        ctx.installData.autoLoginUser = str(self.autoLogin.currentText())

        for i in range(self.userList.count()):
#.........这里部分代码省略.........
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:103,代码来源:ScrUsers.py

示例2: Widget

# 需要导入模块: from yali.gui.YaliDialog import WarningDialog [as 别名]
# 或者: from yali.gui.YaliDialog.WarningDialog import exec_loop [as 别名]
class Widget(QWidget, ScreenWidget):

    help = _('''
<font size="+2">Congratulations</font>


<font size="+1">
<p>
You have successfully installed Pardus, a very easy to use desktop system on
your machine. Now you can start playing with your system and stay productive
all the time.
</p>
<P>
Click on the Next button to proceed. One note: You remember your password,
don't you?
</p>
</font>
''')

    def __init__(self, *args):
        apply(QWidget.__init__, (self,) + args)

        img = QLabel(self)
        img.setPixmap(ctx.iconfactory.newPixmap("goodbye"))

        self.steps = YaliSteps(self)

        self.info = QLabel(self)
        self.info.setText(
            _('<b><font size="+2" color="#FF6D19">Rebooting system. Please wait!</font></b>'))
        self.info.hide()
        self.info.setAlignment(QLabel.AlignCenter|QLabel.AlignTop)
        self.info.setMinimumSize(QSize(0,50))

        vbox = QVBoxLayout(self)
        vbox.addStretch(1)

        hbox = QHBoxLayout(vbox)
        hbox.addStretch(1)
        #FIXME Where is the steps layout ??
        hbox.addWidget(img)
        hbox.addStretch(1)

        vbox.addStretch(1)
        vbox.addWidget(self.info)

    def shown(self):
        from os.path import basename
        ctx.debugger.log("%s loaded" % basename(__file__))
        ctx.screens.disablePrev()
        self.processPendingActions()
        self.steps.slotRunOperations()

    def execute(self):
        ctx.screens.disableNext()

        self.info.show()
        self.info.setAlignment(QLabel.AlignCenter)

        try:
            ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir + "/home"))
            yali.sysutils.umount(ctx.consts.target_dir + "/home")
            ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir))
            yali.sysutils.umount(ctx.consts.target_dir)
        except:
            ctx.debugger.log("Umount Failed.")
            pass

        w = RebootWidget(self)

        ctx.debugger.log("Show reboot dialog.")
        self.dialog = WarningDialog(w, self)
        self.dialog.exec_loop()

        ctx.debugger.log("Trying to eject the CD.")
        # remove cd...
        yali.sysutils.eject_cdrom()

        ctx.debugger.log("Yali, fastreboot calling..")

        # store log content
        if ctx.debugEnabled:
            open(ctx.consts.log_file,"w").write(str(ctx.debugger.traceback.plainLogs))

        time.sleep(4)
        yali.sysutils.fastreboot()

    # process pending actions defined in other screens.
    def processPendingActions(self):
        comarLink = None

        def connectToComar():
            global comarLink
            for i in range(20):
                try:
                    ctx.debugger.log("trying to start comar..")
                    comarLink = comar.Link(sockname=consts.comar_socket_file)
                    break
                except comar.CannotConnect:
                    time.sleep(1)
#.........这里部分代码省略.........
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:103,代码来源:ScrGoodbye.py

示例3: Widget

# 需要导入模块: from yali.gui.YaliDialog import WarningDialog [as 别名]
# 或者: from yali.gui.YaliDialog.WarningDialog import exec_loop [as 别名]
class Widget(AutoPartWidget, ScreenWidget):

    help = _('''
<font size="+2">Automatic Partitioning</font>

<font size="+1">
<p>
Pardus can be installed on a variety of hardware. You can install Pardus
on an empty disk or hard disk partition. <b>An installation will automatically
destroy the previously saved information on selected partitions. </b>
</p>
<p>
Automatic partitioning use your entire disk for Pardus installation. From 
this screen you can select to automatically partition one of you disks, or
you can skip this screen and try manual partitioning.
</p>
<p>
Please refer to Pardus Installing and Using Guide for more information
about disk partitioning.
</p>
</font>
''')

    def __init__(self, *args):
        apply(AutoPartWidget.__init__, (self,) + args)
        
        self.device = None
        self.enable_next = False
        
        self.device_list.setPaletteBackgroundColor(ctx.consts.bg_color)
        self.device_list.setPaletteForegroundColor(ctx.consts.fg_color)

        # initialize all storage devices
        if not yali.storage.init_devices():
            raise GUIException, _("Can't find a storage device!")

        # fill device list
        for dev in yali.storage.devices:
            if dev.getTotalMB() >= ctx.consts.min_root_size:
                DeviceItem(self.device_list, dev)
        # select the first disk by default
        self.device_list.setSelected(0, True)


        self.connect(self.accept_auto, SIGNAL("clicked()"),
                     self.slotSelectAuto)
        self.connect(self.manual, SIGNAL("clicked()"),
                     self.slotSelectManual)

        self.connect(self.device_list, SIGNAL("selectionChanged(QListBoxItem*)"),
                     self.slotDeviceChanged)
        

    def shown(self):
        ctx.screens.enablePrev()

        self.updateUI()

    def execute(self):

        def autopartDevice():
            dev = self.device

            # fist delete partitions on device
            dev.deleteAllPartitions()
            dev.commit()

            p = dev.addPartition(parttype.root.parted_type,
                                 parttype.root.filesystem,
                                 dev.getFreeMB(),
                                 parttype.root.parted_flags)
            p = dev.getPartition(p.num) # get partition.Partition
            dev.commit()

            ctx.partrequests.append(
                request.MountRequest(p, parttype.root))
            ctx.partrequests.append(
                request.FormatRequest(p, parttype.root))
            ctx.partrequests.append(
                request.SwapFileRequest(p, parttype.root))


        if self.accept_auto.isChecked():

            # show confirmation dialog
            w = WarningWidget(self)
            self.dialog = WarningDialog(w, self)
            if not self.dialog.exec_loop():
                return False


            # inform user
            self.info.setText(_('<font color="#FF6D19">Preparing your disk for installation!</font>'))
            ctx.screens.processEvents()

            
            ctx.use_autopart = True
            autopartDevice()
            # need to wait for devices to be created
            time.sleep(1)
#.........这里部分代码省略.........
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:103,代码来源:AutoPartitioning.py

示例4: Widget

# 需要导入模块: from yali.gui.YaliDialog import WarningDialog [as 别名]
# 或者: from yali.gui.YaliDialog.WarningDialog import exec_loop [as 别名]
class Widget(QWidget, ScreenWidget):

    help = _('''
<font size="+2">Congratulations</font>


<font size="+1">
<p><b>Voila! You made it!</b></p>
<p>
You have successfully installed Pardus, a very easy to use desktop system on
your machine. Now you can start playing with your system and stay productive
all the time.
</p>
<P>
Click on the Next button to proceed. One note: You remember your password,
don't you?
</p>
</font>
''')

    def __init__(self, *args):
        apply(QWidget.__init__, (self,) + args)
        
        img = QLabel(self)
        img.setPixmap(ctx.iconfactory.newPixmap("goodbye"))

        self.info = QLabel(self)
        self.info.setText(
            _('<b><font size="+2" color="#FF6D19">Rebooting system. Please wait!</font></b>'))
        self.info.hide()
        self.info.setAlignment(QLabel.AlignCenter|QLabel.AlignTop)
        self.info.setMinimumSize(QSize(0,50))

        vbox = QVBoxLayout(self)
        vbox.addStretch(1)

        hbox = QHBoxLayout(vbox)
        hbox.addStretch(1)
        hbox.addWidget(img)
        hbox.addStretch(1)

        vbox.addStretch(1)
        vbox.addWidget(self.info)


    def shown(self):
        ctx.screens.disablePrev()
#        print yali.users.pending_users
#        for i in yali.users.pending_users:
#            print i
        self.processPendingActions()


    def execute(self):

        ctx.screens.disableNext()

        self.info.show()
        self.info.setAlignment(QLabel.AlignCenter)

        #FIXME: this is a dirty and temporary workaround.. will be removed.
#        os.chmod(ctx.consts.target_dir + "/var/tmp", 01777)

        # remove cd...
        w = RebootWidget(self)
        self.dialog = WarningDialog(w, self)
        self.dialog.exec_loop()


        try:
            mount.umount(ctx.consts.target_dir + "/home")
        except:
            pass

        mount.umount(ctx.consts.target_dir)
        reboot.fastreboot()


    # process pending actions defined in other screens.
    def processPendingActions(self):
        for u in yali.users.pending_users:
            u.addUser()
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:84,代码来源:Goodbye.py

示例5: Widget

# 需要导入模块: from yali.gui.YaliDialog import WarningDialog [as 别名]
# 或者: from yali.gui.YaliDialog.WarningDialog import exec_loop [as 别名]

#.........这里部分代码省略.........
        p = dev.addPartition(parttype.root.parted_type,
                             parttype.root.filesystem,
                             dev.getFreeMB(),
                             parttype.root.parted_flags)
        p = dev.getPartition(p.num) # get partition.Partition

        # create the partition
        dev.commit()

        # make partition requests
        ctx.partrequests.append(request.MountRequest(p, parttype.root))
        ctx.partrequests.append(request.FormatRequest(p, parttype.root))
        ctx.partrequests.append(request.LabelRequest(p, parttype.root))
        ctx.partrequests.append(request.SwapFileRequest(p, parttype.root))

    def checkSwap(self):
        # check swap partition, if not present use swap file
        rt = request.mountRequestType
        pt = parttype.swap
        swap_part_req = ctx.partrequests.searchPartTypeAndReqType(pt, rt)

        if not swap_part_req:
            # No swap partition defined using swap as file in root
            # partition
            rt = request.mountRequestType
            pt = parttype.root
            root_part_req = ctx.partrequests.searchPartTypeAndReqType(pt, rt)
            ctx.partrequests.append(request.SwapFileRequest(root_part_req.partition(),
                                    root_part_req.partitionType()))


    def execute(self):

        w = WarningWidget(self)

        # We need different warning messages for Auto and Manual Partitioning
        if ctx.installData.autoPartDev:
            # show confirmation dialog
            w.warning.setText(_('''<b>
<p>This action will use your entire disk for Pardus installation and
all your present data on the selected disk will be lost.</p>

<p>After being sure you had your backup this is generally a safe
and easy way to install Pardus.</p>
</b>
'''))
        if not ctx.autoInstall:
            self.dialog = WarningDialog(w, self)
            if not self.dialog.exec_loop():
                # disabled by weaver
                ctx.screens.enablePrev()
                return False

        info_window = InformationWindow(self, _("Please wait while formatting!"))
        ctx.screens.processEvents()

        # We should do partitioning operations in here.

        # Auto Partitioning
        if ctx.installData.autoPartDev:
            ctx.partrequests.remove_all()
            ctx.use_autopart = True
            self.autopartDevice()
            time.sleep(1)
            ctx.partrequests.applyAll()

        # Manual Partitioning
        else:
            for dev in yali.storage.devices:
                dev.commit()
            # wait for udev to create device nodes
            time.sleep(2)
            self.checkSwap()
            ctx.partrequests.applyAll()

        info_window.close()

        root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root,
                                                                  request.mountRequestType)

        # install_dev
        if self.noInstall.isChecked():
            ctx.installData.bootLoaderDev = None
        elif self.installPart.isChecked():
            ctx.installData.bootLoaderDev = basename(root_part_req.partition().getPath())
        elif self.installMBR.isChecked():
            ctx.installData.bootLoaderDev = basename(self.device.getPath())
        else:
            if len(yali.storage.devices) > 1:
                self.orderedDiskList = yali.storage.getOrderedDiskList()
                ctx.installData.bootLoaderDev = basename(self.orderedDiskList[0])
            else:
                ctx.installData.bootLoaderDev = str(basename(root_part_req.partition().getPath()))

        _ins_part = root_part_req.partition().getPath()

        ctx.debugger.log("Pardus installed to : %s" % _ins_part)
        ctx.debugger.log("GRUB will be installed to : %s" % ctx.installData.bootLoaderDev)

        return True
开发者ID:Tayyib,项目名称:uludag,代码行数:104,代码来源:ScrBootloader.py

示例6: Widget

# 需要导入模块: from yali.gui.YaliDialog import WarningDialog [as 别名]
# 或者: from yali.gui.YaliDialog.WarningDialog import exec_loop [as 别名]
class Widget(QWidget, ScreenWidget):

    help = _('''
<font size="+2">Congratulations</font>


<font size="+1">
<p>
You have successfully installed Pardus, a very easy to use desktop system on
your machine. Now you can start playing with your system and stay productive
all the time.
</p>
<P>
Click on the Next button to proceed. One note: You remember your password,
don't you?
</p>
</font>
''')

    def __init__(self, *args):
        apply(QWidget.__init__, (self,) + args)
        
        img = QLabel(self)
        img.setPixmap(ctx.iconfactory.newPixmap("goodbye"))

        self.info = QLabel(self)
        self.info.setText(
            _('<b><font size="+2" color="#FF6D19">Rebooting system. Please wait!</font></b>'))
        self.info.hide()
        self.info.setAlignment(QLabel.AlignCenter|QLabel.AlignTop)
        self.info.setMinimumSize(QSize(0,50))

        vbox = QVBoxLayout(self)
        vbox.addStretch(1)

        hbox = QHBoxLayout(vbox)
        hbox.addStretch(1)
        hbox.addWidget(img)
        hbox.addStretch(1)

        vbox.addStretch(1)
        vbox.addWidget(self.info)

    def shown(self):
        from os.path import basename
        ctx.debugger.log("%s loaded" % basename(__file__))
        ctx.screens.disablePrev()
        self.processPendingActions()

    def execute(self):

        ctx.screens.disableNext()

        self.info.show()
        self.info.setAlignment(QLabel.AlignCenter)

        #open(ctx.consts.log_file,"w").write(ctx.debugger.traceback.plainLogs)

        try:
            ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir + "/home"))
            yali.sysutils.umount(ctx.consts.target_dir + "/home")
            ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir))
            yali.sysutils.umount(ctx.consts.target_dir)
        except:
            ctx.debugger.log("Umount Failed.")
            pass
        
        ctx.debugger.log("Trying to eject the CD.")
        # remove cd...
        w = RebootWidget(self)
        ctx.debugger.log("Show reboot dialog.")
        self.dialog = WarningDialog(w, self)
        self.dialog.exec_loop()

        ctx.debugger.log("Yali, fastreboot calling..")
        yali.sysutils.fastreboot()

    # process pending actions defined in other screens.
    def processPendingActions(self):
        # add users
        for u in yali.users.pending_users:
            ctx.debugger.log("User %s adding to system" % u.username)
            u.addUser()
            ctx.debugger.log("User %s added to system" % u.username)

        # write console keyboard data
        yali.localeutils.write_keymap(ctx.keydata.console)
        ctx.debugger.log("Keymap stored.")

        # migrate xorg.conf
        yali.postinstall.migrate_xorg_conf(ctx.keydata.X)
        ctx.debugger.log("xorg.conf merged.")
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:94,代码来源:ScrGoodbye.py


注:本文中的yali.gui.YaliDialog.WarningDialog.exec_loop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。