Beispiel #1
0
    def __init__(self, parent=None, name=None):
        mainForm.__init__(self, parent, name)

        # Just for block devices
        self.knownFS=['ext3:Ext3',
                      'ext2:Ext2',
                      'reiserfs:ReiserFS',
                      'xfs:XFS',
                      'ntfs-3g:NTFS',
                      'vfat:Fat 16/32']

        # Check user is root or not
        if os.getuid()!=0:
            self.btn_update.setEnabled(False)
            self.btn_autoFind.setEnabled(False)
            self.label_warn.show()
        else:
            self.label_warn.hide()

        # Check users group if s/he not in disk group
        if not os.getgroups().__contains__(grp.getgrnam("disk")[2]):
            QMessageBox(i18n("Error"),i18n("User not in disk group !"),QMessageBox.Warning,QMessageBox.Ok,0,0,self).exec_loop()
            self.disableAll()
        else:
            try:
                self.Fstab = fstab.Fstab()
                self.Dbus = DbusListener()
                self.fillFileSystems()
                self.list_main.header().hide()
                self.diskIcon.setPixmap(loadIcon('hdd_unmount',size=64))
                self.initialize()
            except:
                self.label_warn.setText(i18n("File /etc/fstab is not correct, please fix it manually."))
                self.label_warn.show()
                QMessageBox(i18n("Error"),i18n("File /etc/fstab is not correct, please fix it manually."),
                                          QMessageBox.Warning,QMessageBox.Ok,0,0,self).exec_loop()
                self.disableAll()

        # Connections
        self.connect(self.list_main, SIGNAL('selectionChanged()'), self.slotList)
        self.connect(self.btn_update, SIGNAL('clicked()'), self.slotUpdate)
        self.connect(self.btn_help, SIGNAL('clicked()'), self.slotHelp)
        self.connect(self.btn_autoFind, SIGNAL('clicked()'), self.slotAutoFind)
        self.connect(self.btn_defaultOpts, SIGNAL('clicked()'),self.getDefaultOptions)
        self.connect(self.check_allPart, SIGNAL('clicked()'), self.toggleAllPartitions)
        self.connect(self.line_opts, SIGNAL('lostFocus()'), self.saveSession)
        self.connect(self.line_mountpoint, SIGNAL('lostFocus()'), self.saveSession)
        self.connect(self.combo_fs,SIGNAL('activated(const QString&)'),self.saveSession)
Beispiel #2
0
    def __init__(self, parent=None, name=None):
        mainForm.__init__(self, parent, name)

        self.Fstab = fstab.Fstab()
        self.Dbus = DbusListener()

        if os.getuid()!=0:
            self.btn_update.setEnabled(False)
            self.btn_autoFind.setEnabled(False)
            self.label_warn.show()
        else:
            pass
            self.label_warn.hide()

        # Just for block devices
        self.knownFS=['ext3:Ext3',
                      'ext2:Ext2',
                      'reiserfs:ReiserFS',
                      'xfs:XFS',
                      'ntfs-3g:NTFS',
                      'vfat:Fat 16/32']

        self.fillFileSystems()
        self.list_main.header().hide()
        self.diskIcon.setPixmap(loadIcon('hdd_unmount',size=64))
        self.initialize()

        # Connections
        self.connect(self.list_main, SIGNAL('selectionChanged()'), self.slotList)
        self.connect(self.btn_update, SIGNAL('clicked()'), self.slotUpdate)
        self.connect(self.btn_help, SIGNAL('clicked()'), self.slotHelp)
        self.connect(self.btn_autoFind, SIGNAL('clicked()'), self.slotAutoFind)
        self.connect(self.btn_defaultOpts, SIGNAL('clicked()'),self.getDefaultOptions)
        self.connect(self.check_allPart, SIGNAL('clicked()'), self.toggleAllPartitions)
        self.connect(self.line_opts, SIGNAL('lostFocus()'), self.saveSession)
        self.connect(self.line_mountpoint, SIGNAL('lostFocus()'), self.saveSession)
        self.connect(self.combo_fs,SIGNAL('activated(const QString&)'),self.saveSession)