Exemplo n.º 1
0
    def removeTheme(self):
        self.threadAction = _("remove")
        self.threadPackage = self.plymouth.getRemovablePackageName(self.selectedRemoveTheme)
        if self.threadPackage:
            dialog = QuestionDialog(_("Remove theme"), _("Continue removing theme:\n%(theme)s") % { "theme": self.threadPackage }, self.window)
            go = dialog.show()
            if (go):
                self.toggleGuiElements(True)

                # Start apt in a separate thread
                self.log.write(_("Start removing theme: %(theme)s") % { "theme": self.threadPackage }, 'dpm.removeTheme', 'info')
                cmd = 'apt-get purge -y %s %s' % (self.force, self.threadPackage)
                t = ExecuteApt(self.log, cmd, self.queue)
                t.daemon = True
                t.start()
                self.queue.join()

                #self.log.write("Check every 250 miliseconds if thread is still active", 'dpm.removeTheme')
                GObject.timeout_add(250, self.checkAptThread)
            else:
                self.log.write(_("User cancel remove theme: %(theme)s") % { "theme": self.threadPackage }, 'dpm.removeTheme', 'info')
        else:
            title = _("%(act1)s%(act2)s theme") % { "act1": self.threadAction[0].capitalize(), "act2": self.threadAction[1:] }
            msg = _("The package cannot be removed: %(pck)s\nIt is part of a meta package.\nTry apt instead") % { "pck": self.selectedRemoveTheme }
            self.log.write(msg, 'dpm.removeTheme')
            MessageDialogSafe(title, msg, Gtk.MessageType.INFO, self.window).show()
Exemplo n.º 2
0
 def on_btnRemove_clicked(self, widget):
     selected = self.tvHandlerDistros.getToggledValues(toggleColNr=0, valueColNr=2)
     for path in selected:
         qd = QuestionDialog(self.btnRemove.get_label(), _("Are you sure you want to remove the selected distribution from the list?\n" \
                                                           "(This will not remove the directory and its data)"), self.window)
         answer = qd.show()
         if answer:
             self.saveDistroFile(distroPath=path, addDistro=False)
     self.fillTreeViewDistros()
Exemplo n.º 3
0
    def on_btnSave_clicked(self, widget):
        self.iso = ""
        if self.chkFromIso.get_active():
            self.iso = self.txtIso.get_text()
        self.dir = self.txtDir.get_text()

        title = _("Save existing working directory")
        if self.iso != "":
            title = _("Unpack ISO and save")

        if not exists(self.dir):
            makedirs(self.dir)

        if not exists(self.dir):
            self.showError(
                title,
                _("Could not create directory %(dir)s: exiting" %
                  {"dir": self.dir}), self.window)
        else:
            self.windowAddDistro.hide()
            if self.iso != "":
                if not exists(self.iso):
                    self.showInfo(
                        self.btnSave.get_label(),
                        _("The path to the ISO file does not exist:\n{}".
                          format(self.iso)), self.window)
                    return
                if listdir(self.dir):
                    qd = QuestionDialog(
                        self.btnSave.get_label(),
                        _("The destination directory is not empty.\n"
                          "Are you sure you want to overwrite all data in {}?".
                          format(self.dir)), self.window)
                    answer = qd.show()
                    if not answer:
                        return

                self.showOutput("Start unpacking the ISO...")
                self.toggleGuiElements(True)
                t = IsoUnpack(self.mountDir, self.iso, self.dir, self.queue)
                t.start()
                self.queue.join()
                GObject.timeout_add(1000, self.checkThread, True)
            else:
                self.saveDistroFile(self.dir, True)
                self.fillTreeViewDistros()
                self.showOutput(_("Existing working directory added"))
Exemplo n.º 4
0
 def on_btnGroupRemove_clicked(self, widget):
     # Remove group
     if self.selectedGroup is not None:
         title = _("Remove group")
         if self.selectedGroup != self.loggedinUserPrimaryGroup:
             qd = QuestionDialog(title, _("Are you sure you want to remove the following group:\n\n'%(group)s'") % { "group": self.selectedGroup }, self.windowGroup)
             answer = qd.show()
             if answer:
                 ret = self.usr.deleteGroup(self.selectedGroup)
                 if ret == "":
                     self.showInfo(title, _("Group successfully removed: %(group)s") % {"group": self.selectedGroup}, self.windowGroup)
                     self.refreshData()
                 else:
                     retMsg = "\n\n%s" % ret
                     self.showError(title, _("Could not remove group: %(group)s %(retmsg)s") % {"group": self.selectedGroup, "retmsg": retMsg}, self.windowGroup)
         else:
             self.showError(title, _("You cannot remove the currently logged in user's primary group"), self.windowGroup)
Exemplo n.º 5
0
 def on_btnUserRemove_clicked(self, widget):
     # Remove user
     if self.selectedUser is not None:
         title = _("Remove user")
         if self.selectedUser != self.loggedinUser:
             qd = QuestionDialog(title, _("Are you sure you want to remove the following user:\n\n'%(user)s'") % { "user": self.selectedUser }, self.window)
             answer = qd.show()
             if answer:
                 # TODO
                 ret = self.usr.deleteUser(self.selectedUser)
                 if ret == "":
                     self.showInfo(title, _("User successfully removed: %(user)s") % {"user": self.selectedUser}, self.window)
                     self.refreshData()
                 else:
                     retMsg = "\n\n%s" % ret
                     self.showError(title, _("Could not remove user: %(user)s %(retmsg)s") % {"user": self.selectedUser, "retmsg": retMsg}, self.window)
         else:
             self.showError(title, _("You cannot remove the currently logged in user"), self.window)
Exemplo n.º 6
0
    def removeTheme(self):
        self.threadAction = _("remove")
        self.threadPackage = self.plymouth.getRemovablePackageName(
            self.selectedRemoveTheme)
        if self.threadPackage:
            dialog = QuestionDialog(
                _("Remove theme"),
                _("Continue removing theme:\n%(theme)s") %
                {"theme": self.threadPackage}, self.window)
            go = dialog.show()
            if (go):
                self.toggleGuiElements(True)

                # Start apt in a separate thread
                self.log.write(
                    _("Start removing theme: %(theme)s") %
                    {"theme": self.threadPackage}, 'dpm.removeTheme', 'info')
                cmd = 'apt-get purge -y %s %s' % (self.force,
                                                  self.threadPackage)
                t = ExecuteApt(self.log, cmd, self.queue)
                t.daemon = True
                t.start()
                self.queue.join()

                #self.log.write("Check every 250 miliseconds if thread is still active", 'dpm.removeTheme')
                GObject.timeout_add(250, self.checkAptThread)
            else:
                self.log.write(
                    _("User cancel remove theme: %(theme)s") %
                    {"theme": self.threadPackage}, 'dpm.removeTheme', 'info')
        else:
            title = _("%(act1)s%(act2)s theme") % {
                "act1": self.threadAction[0].capitalize(),
                "act2": self.threadAction[1:]
            }
            msg = _(
                "The package cannot be removed: %(pck)s\nIt is part of a meta package.\nTry apt instead"
            ) % {
                "pck": self.selectedRemoveTheme
            }
            self.log.write(msg, 'dpm.removeTheme')
            MessageDialogSafe(title, msg, Gtk.MessageType.INFO,
                              self.window).show()
Exemplo n.º 7
0
    def on_btnSave_clicked(self, widget):
        self.iso = ""
        if self.chkFromIso.get_active():
            self.iso = self.txtIso.get_text()
        self.dir = self.txtDir.get_text()

        title = _("Save existing working directory")
        if self.iso != "":
            title = _("Unpack ISO and save")

        if not exists(self.dir):
            makedirs(self.dir)

        if not exists(self.dir):
            self.showError(title, _("Could not create directory %(dir)s: exiting" % {"dir": self.dir}), self.window)
        else:
            self.windowAddDistro.hide()
            if self.iso != "":
                if not exists(self.iso):
                    self.showInfo(self.btnSave.get_label(), _("The path to the ISO file does not exist:\n{}".format(self.iso)), self.window)
                    return
                if listdir(self.dir):
                    qd = QuestionDialog(self.btnSave.get_label(),
                        _("The destination directory is not empty.\n"
                        "Are you sure you want to overwrite all data in {}?".format(self.dir)),
                        self.window)
                    answer = qd.show()
                    if not answer:
                        return

                self.showOutput("Start unpacking the ISO...")
                self.toggleGuiElements(True)
                t = IsoUnpack(self.mountDir, self.iso, self.dir, self.queue)
                t.start()
                self.queue.join()
                GObject.timeout_add(1000, self.checkThread, True)
            else:
                self.saveDistroFile(self.dir, True)
                self.fillTreeViewDistros()
                self.showOutput(_("Existing working directory added"))
Exemplo n.º 8
0
    def on_btnSave_clicked(self, widget):
        saved = False
        saveHideUsers = False
        saveAutoUser = False
        saveFaces = False
        saveBackground = False
        saveTheme = False
        if self.chkHideUsers.get_active() != self.curHideUsers:
            saveHideUsers = True
        if self.curAutoUser != self.newAutoUser:
            saveAutoUser = True
        if self.newFaces:
            saveFaces = True
        if self.curBgPath != self.newbgImg:
            saveBackground = True
        self.newTheme = self.cmbHandlerThemes.getValue()
        if self.curTheme != self.newTheme:
            saveTheme = True

        if saveHideUsers or saveAutoUser or saveFaces or saveBackground or saveTheme:
            qd = QuestionDialog(
                _("LightDM settings"),
                _("Settings have changed\n\nDo you want to save the new settings?"
                  ), self.window)
            answer = qd.show()
            if answer:
                if saveAutoUser:
                    if self.newAutoUser is not None:
                        # Save the auto-login user
                        self.cfgLightdm.setValue('SeatDefaults',
                                                 'autologin-user',
                                                 self.newAutoUser)
                        self.cfgLightdm.setValue('SeatDefaults',
                                                 'autologin-user-timeout', '0')
                        self.curAutoUser = self.newAutoUser
                        self.log.write(
                            "New auto-login user: %(usr)s" %
                            {"usr": self.curAutoUser},
                            'LightDMManager.saveSettings', 'debug')
                    else:
                        self.cfgLightdm.removeOption('SeatDefaults',
                                                     'autologin-user')
                        self.cfgLightdm.removeOption('SeatDefaults',
                                                     'autologin-user-timeout')
                        self.curAutoUser = None
                        self.log.write("Auto-login disabled",
                                       'LightDMManager.saveSettings', 'debug')
                if saveHideUsers:
                    hideUsers = str(self.chkHideUsers.get_active()).lower()
                    self.cfgLightdm.setValue('SeatDefaults',
                                             'greeter-hide-users', hideUsers)
                    self.log.write(
                        "Hide users saved: %(users)s" % {"users": hideUsers},
                        'LightDMManager.saveSettings', 'debug')
                if saveFaces:
                    for face in self.newFaces:
                        if exists(face[0]):
                            copy(face[0], face[1])
                            if exists(face[1]):
                                os.system(
                                    "chown %(owner)s:%(group)s %(path)s" % {
                                        "owner": face[2],
                                        "group": face[3],
                                        "path": face[1]
                                    })
                    self.log.write("User icons saved",
                                   'LightDMManager.saveSettings', 'debug')
                if saveTheme:
                    self.cfgGreeter.setValue('greeter', 'theme-name',
                                             self.newTheme)
                    self.curTheme = self.newTheme
                    self.log.write(
                        "Theme saved: %(theme)s" % {"theme": self.curTheme},
                        'LightDMManager.saveSettings', 'debug')
                if saveBackground:
                    if os.path.exists(self.newbgImg):
                        self.cfgGreeter.setValue('greeter', 'background',
                                                 self.newbgImg)
                        self.curBgPath = self.newbgImg
                        self.log.write(
                            "Background saved: %(background)s" %
                            {"background": self.curBgPath},
                            'LightDMManager.saveSettings', 'debug')
                saved = True
            else:
                if os.path.exists(self.curBgPath):
                    self.setBackground(self.curBgPath)
                    self.log.write(
                        "Current background: %(background)s" %
                        {"background": self.curBgPath},
                        'LightDMManager.saveSettings', 'debug')
                else:
                    self.imgBackground.set_from_file(
                        join(self.scriptDir,
                             '../../share/lightdm-manager/select.png'))
                    self.log.write("No background set",
                                   'LightDMManager.saveSettings', 'debug')
                self.fillUsers()

        if saved:
            self.curHideUsers = self.chkHideUsers.get_active()
            self.curAutoUser = self.newAutoUser
            self.newFaces = []
            self.curBgPath = self.newbgImg
            self.curTheme = self.newTheme
            MessageDialogSafe(_("Saved"),
                              _("LightDM settings saved successfully."),
                              Gtk.MessageType.INFO, self.window).show()
    def on_btnSave_clicked(self, widget):
        saved = False
        saveHideUsers = False
        saveAutoUser = False
        saveFaces = False
        saveBackground = False
        saveTheme = False
        if self.chkHideUsers.get_active() != self.curHideUsers:
            saveHideUsers = True
        if self.curAutoUser != self.newAutoUser:
            saveAutoUser = True
        if self.newFaces:
            saveFaces = True
        if self.curBgPath != self.newbgImg:
            saveBackground = True
        self.newTheme = self.cmbHandlerThemes.getValue()
        if self.curTheme != self.newTheme:
            saveTheme = True

        if saveHideUsers or saveAutoUser or saveFaces or saveBackground or saveTheme:
            qd = QuestionDialog(_("LightDM settings"), _("Settings have changed\n\nDo you want to save the new settings?"), self.window)
            answer = qd.show()
            if answer:
                if saveAutoUser:
                    if self.newAutoUser is not None:
                        # Save the auto-login user
                        self.cfgLightdm.setValue('SeatDefaults', 'autologin-user', self.newAutoUser)
                        self.cfgLightdm.setValue('SeatDefaults', 'autologin-user-timeout', '0')
                        self.curAutoUser = self.newAutoUser
                        self.log.write("New auto-login user: %(usr)s" % { "usr": self.curAutoUser }, 'LightDMManager.saveSettings', 'debug')
                    else:
                        self.cfgLightdm.removeOption('SeatDefaults', 'autologin-user')
                        self.cfgLightdm.removeOption('SeatDefaults', 'autologin-user-timeout')
                        self.curAutoUser = None
                        self.log.write("Auto-login disabled", 'LightDMManager.saveSettings', 'debug')
                if saveHideUsers:
                    hideUsers = str(self.chkHideUsers.get_active()).lower()
                    self.cfgLightdm.setValue('SeatDefaults', 'greeter-hide-users', hideUsers)
                    self.log.write("Hide users saved: %(users)s" % {"users": hideUsers}, 'LightDMManager.saveSettings', 'debug')
                if saveFaces:
                    for face in self.newFaces:
                        if exists(face[0]):
                            copy(face[0], face[1])
                            if exists(face[1]):
                                os.system("chown %(owner)s:%(group)s %(path)s" % {"owner": face[2], "group": face[3], "path": face[1]})
                    self.log.write("User icons saved", 'LightDMManager.saveSettings', 'debug')
                if saveTheme:
                    self.cfgGreeter.setValue('greeter', 'theme-name', self.newTheme)
                    self.curTheme = self.newTheme
                    self.log.write("Theme saved: %(theme)s" % { "theme": self.curTheme }, 'LightDMManager.saveSettings', 'debug')
                if saveBackground:
                    if os.path.exists(self.newbgImg):
                        self.cfgGreeter.setValue('greeter', 'background', self.newbgImg)
                        self.curBgPath = self.newbgImg
                        self.log.write("Background saved: %(background)s" % { "background": self.curBgPath }, 'LightDMManager.saveSettings', 'debug')
                saved = True
            else:
                if os.path.exists(self.curBgPath):
                    self.setBackground(self.curBgPath)
                    self.log.write("Current background: %(background)s" % { "background": self.curBgPath }, 'LightDMManager.saveSettings', 'debug')
                else:
                    self.imgBackground.set_from_file(join(self.scriptDir, '../../share/lightdm-manager/select.png'))
                    self.log.write("No background set", 'LightDMManager.saveSettings', 'debug')
                self.fillUsers()

        if saved:
            self.curHideUsers = self.chkHideUsers.get_active()
            self.curAutoUser = self.newAutoUser
            self.newFaces = []
            self.curBgPath = self.newbgImg
            self.curTheme = self.newTheme
            MessageDialogSafe(_("Saved"), _("LightDM settings saved successfully."), Gtk.MessageType.INFO, self.window).show()
Exemplo n.º 10
0
ec = ExecCmd()
scriptDir = os.path.dirname(os.path.realpath(__file__))
dist = functions.getDistroName()
luaDir = os.path.join(home, '.lua/scripts')
lua = os.path.join(luaDir, 'clock_rings.lua')
conkyrc = os.path.join(home, '.conkyrc')
conkyStart = os.path.join(home, '.conky-start')
autostartDir = os.path.join(home, '.config/autostart')
desktop = os.path.join(autostartDir, 'conky.desktop')
title = "SolydXK Conky"



if 'solydx' in dist.lower():
    qd = QuestionDialog(title, "Make sure compositing is enabled.\nGo to: Settings > Window Manager Tweaks > Tab: Compositor > check: Enable display compositing\n\nContinue installing SolydXK Conky?")
    answer = qd.show()
    if not answer:
        sys.exit(2)

qd = QuestionDialog(title, "Show temperatures in Celsius?\n\nSelect 'No' to show temperatures in Fahrenheit.")
answer = qd.show()
if not answer:
    tmpUnit = '°F'
    sensors = ec.run('sensors -f', False, False)
else:
    tmpUnit = '°C'
    sensors = ec.run('sensors', False, False)

functions.log('=============================================', True)
functions.log(title)
functions.log("Running distribution: %s" % dist)