From 01401a60fc61864021a38e87bb57524afd80bf4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20P=2E=20M=C3=B6ller?= Date: Sun, 30 Aug 2020 16:46:41 -0400 Subject: [PATCH] clean --- lubuntuBreeze.py | 113 ----------------------------------------------- 1 file changed, 113 deletions(-) delete mode 100755 lubuntuBreeze.py diff --git a/lubuntuBreeze.py b/lubuntuBreeze.py deleted file mode 100755 index c03a38a..0000000 --- a/lubuntuBreeze.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/python3 -# coding=utf-8 - -# Copyright (C) 2020 Hans P. Möller -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import os -import subprocess -import sys -from pathlib import Path -from shutil import copyfile -from PyQt5.QtWidgets import (QWidget, QApplication, QDialogButtonBox) -from PyQt5.QtCore import (QDir, qDebug, QSettings) -from PyQt5 import uic -from gettext import gettext as _ # better than in main "_ = gettext.gettext" for testing - -class MainWindow(QWidget): - def __init__(self): - QWidget.__init__(self) - uic.loadUi("data/designer/main.ui", self) - self.confFile = Path(Path.home() / ".config/kdeglobals") - self.schemeDir = "/usr/share/color-schemes/" - self.initUI() - - def initUI(self): - '''populate text and combobox needed with uic''' - self.label.setText(_("Select Color Scheme for Breeze Qt Style:")) - noteText =_("Applications need to be restarted for changes to take effect.") - noteText += "
" - noteText += _("In case of pcmanfm-qt, since it handles the desktop, ") - noteText += _("a restart of the desktop is needed") + "
" - noteText += _("Easier, restart session.") - noteText += "
" - noteText += _("Best results if a matching GTK Theme is selected.") - - self.note.setText('' + noteText + '') - dir = QDir(self.schemeDir) - self.files = dir.entryList(dir, dir.Files) - self.comboBox.clear() - self.comboBox.addItem(_("None")) - for f in self.files: - settings = QSettings(self.schemeDir + f, QSettings.NativeFormat) - self.comboBox.addItem(settings.value("ColorScheme")) - self.comboBox.setCurrentText(self.checkCurrent()) - self.buttonBox.clicked.connect(self.btnClk) - self.center() - - def center(self): - '''centers UI''' - frameGm = self.frameGeometry() - screen = QApplication.desktop().screenNumber( - QApplication.desktop().cursor().pos()) - centerPoint = QApplication.desktop().screenGeometry(screen).center() - frameGm.moveCenter(centerPoint) - self.move(frameGm.topLeft()) - - def checkCurrent(self): - '''check current used theme''' - if self.confFile.is_file(): - qDebug("exist: " + str(self.confFile)) - settings = QSettings(str(self.confFile), QSettings.NativeFormat) - set = settings.value("ColorScheme") - qDebug(set) - if set != "": - return(set) - else: - return("None") - else: - qDebug(str(self.confFile) + " wasn't found") - return("None") - - def btnClk(self, btn): - '''copy selected color-scheme to kdeglobals or close''' - if btn == self.buttonBox.button(QDialogButtonBox.Apply): - qDebug("apply") - if self.comboBox.currentText() != "None": - for f in self.files: - set = QSettings(self.schemeDir + f, QSettings.NativeFormat) - if(set.value("ColorScheme") == self.comboBox.currentText()): - copyfile(self.schemeDir + f, self.confFile) - else: - os.remove(self.confFile) - filename = os.path.dirname(os.path.abspath(__file__)) + '/breeze-color' - print(filename) - subprocess.Popen(filename) - sys.exit(0) - - elif btn == self.buttonBox.button(QDialogButtonBox.Close): - exit(0) - -class App(QApplication): - def __init__(self, *args): - QApplication.__init__(self, *args) - self.main = MainWindow() - self.main.show() - -def main(args): - global app - app = App(args) - # app.setWindowIcon(QIcon.fromTheme("preferences-desktop-color")) - app.exec_()