initial commit

master
Hans P. Möller 5 years ago
commit f5c827290e

@ -0,0 +1,36 @@
#!/usr/bin/python3
# coding=utf-8
# Copyright (C) 2020 Hans P. Möller <hmollercl@lubuntu.me>
#
# 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 <http://www.gnu.org/licenses/>.
import sys
from argparse import ArgumentParser
import lubuntuBreeze
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument('--version',
action='version',
version='%(prog)s 0.1')
options = parser.parse_args()
# TODO translations replace gettext with _ ???
# localesApp="lubuntu-breeze"
# localesDir="/usr/share/locale"
# gettext.bindtextdomain(localesApp, localesDir)
# gettext.textdomain(localesApp)
lubuntuBreeze.main(sys.argv)

@ -0,0 +1,11 @@
[Desktop Entry]
Exec=breeze-config
Name=Lubuntu Breeze Config
GenericName=Lubuntu Breeze Config
Comment=Configure Breeze Theme
Icon=preferences-desktop-color
Type=Application
Version=0.1
Categories=System;Settings;DesktopSettings;Qt;LXQt;
Keywords=breeze;config
Terminal=false

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Main</class>
<widget class="QWidget" name="Main">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>479</width>
<height>168</height>
</rect>
</property>
<property name="windowTitle">
<string>Lubuntu Breeze Config</string>
</property>
<property name="windowIcon">
<iconset theme="preferences-desktop-color">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="toolTip">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Select Color Scheme</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox"/>
</item>
<item>
<widget class="QLabel" name="note">
<property name="text">
<string>&lt;font size=&quot;-1&quot;&gt;Applications need to be restarted for changes to take effect.&lt;br&gt;
In case of pcmanfm-qt, since it handles the desktop, a restart of the desktop is needed&lt;br/&gt;
Easier, restart session.&lt;br/&gt;Best results if a matching GTK Theme is selected.&lt;/font&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

5
debian/changelog vendored

@ -0,0 +1,5 @@
lubuntu-breeze-color (0.1) UNRELEASED; urgency=medium
* Initial release. (Closes: #XXXXXX)
-- Hans P. Möller <hmollercl@lubuntu.me> Thu, 05 Mar 2020 17:18:27 -0300

22
debian/control vendored

@ -0,0 +1,22 @@
Source: lubuntu-breeze-color
Section: utils
Priority: optional
Maintainer: Hans P Möller <hmollercl@lubuntu.me>
Build-Depends: debhelper-compat (= 12),
dh-python,
python3-all,
python3-setuptools,
Standards-Version: 4.5.0
Rules-Requires-Root: no
Package: lubuntu-breeze-color
Architecture: all
Depends: python3,
python3-pyqt5,
${misc:Depends},
${python3:Depends},
Description: Breeze Theme Color Scheme Selector
It lets you pick a color scheme from "/usr/share/color-schemes/" and copy it
to "~/.config/kdeglobals" so system use it. Applications need restart in order
to use it. Take into consideration that some file managers also manage the
desktop so you need to restart that too.

16
debian/copyright vendored

@ -0,0 +1,16 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://phab.lubuntu.me/##################################
Files: *
Copyright: © 2020 Lubuntu Team.
© 2020 Hans P Möller <hmollercl@lubuntu.me>
License: GPL-3+
License: GPL-3+
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.
.
On Debian systems, the full text of the GNU General Public License version
3 can be found in the file `/usr/share/common-licenses/GPL-3'.

@ -0,0 +1,5 @@
[authors]
lubuntu-breeze-color was primarily written by Hans P Moller.
[name]
breeze-color \- is a Color Scheme Selector for Breeze Theme.

@ -0,0 +1,2 @@
data/breeze-color.desktop /usr/share/applications/breeze-color.desktop
data/designer /usr/share/lubuntu-breeze-color/designer

@ -0,0 +1 @@
debian/manpages/breeze-config.1

@ -0,0 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.12.
.TH BREEZE-CONFIG "1" "March 2020" "breeze-config 0.1" "User Commands"
.SH NAME
breeze-config \- is a Color Scheme Selector for Breeze Theme.
.SH DESCRIPTION
usage: breeze\-config [\-h] [\-\-version]
.SS "optional arguments:"
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-\-version\fR
show program's version number and exit
.SH AUTHORS
lubuntu-breeze-config was primarily written by Hans P Moller.

7
debian/rules vendored

@ -0,0 +1,7 @@
#! /usr/bin/make -f
export DH_VERBOSE=1
export PYBUILD_INTERPRETERS=python3
export PYBUILD_NAME=lubuntu-breeze-color
%:
dh $@ --with python3 --buildsystem=pybuild

@ -0,0 +1 @@
3.0 (native)

@ -0,0 +1,3 @@
Tests: run-tests
Depends: xvfb,
@

@ -0,0 +1,4 @@
#!/bin/sh
xvfb-run
python3 setup.py test

@ -0,0 +1,113 @@
#!/usr/bin/python3
# coding=utf-8
# Copyright (C) 2020 Hans P. Möller <hmollercl@lubuntu.me>
#
# 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 <http://www.gnu.org/licenses/>.
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 += "<br/>"
noteText += _("In case of pcmanfm-qt, since it handles the desktop, ")
noteText += _("a restart of the desktop is needed") + "<br/>"
noteText += _("Easier, restart session.")
noteText += "<br/>"
noteText += _("Best results if a matching GTK Theme is selected.")
self.note.setText('<font size="-1">' + noteText + '</font>')
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_()

@ -0,0 +1,37 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2020-03-02 20:52-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
#: lubuntuBreeze.py:39
msgid "Select Color Scheme for Breeze Qt Style:"
msgstr "Selecciona el Esquema de Color de Breeze para el estilo Qt"
#: lubuntuBreeze.py:40
msgid "Applications need to be restarted for changes to take effect."
msgstr "Las aplicaciones se deben reiniciar para que los cambios tengan efecto."
#: lubuntuBreeze.py:42
msgid "In case of pcmanfm-qt, since it handles the desktop, a restart of the desktop is needed"
msgstr "En caso de pcmanfm-qt, dado que maneja el escritorio, un reinicio del escritorio es necesario"
#: lubuntuBreeze.py:44
msgid "Easier, restart session."
msgstr "Más fácil es reiniciar la sesión"
#: lubuntuBreeze.py:46
msgid "Best results if a matching GTK Theme is selected."
msgstr "Mejores resultados si se ocupa un tema GTK que se asemeje."

@ -0,0 +1,37 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2020-03-02 20:52-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
#: lubuntuBreeze.py:39
msgid "Select Color Scheme for Breeze Qt Style:"
msgstr ""
#: lubuntuBreeze.py:40
msgid "Applications need to be restarted for changes to take effect."
msgstr ""
#: lubuntuBreeze.py:42
msgid "In case of pcmanfm-qt, since it handles the desktop, a restart of the desktop is needed"
msgstr ""
#: lubuntuBreeze.py:44
msgid "Easier, restart session."
msgstr ""
#: lubuntuBreeze.py:46
msgid "Best results if a matching GTK Theme is selected."
msgstr ""

@ -0,0 +1,2 @@
[sdist]
formats = bztar

@ -0,0 +1,32 @@
#!/usr/bin/env python3
# coding=utf-8
# Copyright (C) 2019 Hans P. Möller <hmollercl@lubuntu.me>
#
# 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. See the
# 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 <http://www.gnu.org/licenses/>.
from setuptools import setup
setup(
name="lubuntu-breeze-color",
version="0.1",
packages=['lubuntu-breeze-color'],
scripts=['breeze-color'],
data_files=[
('lib/lubuntu-breeze-color/',
['lubuntuBreeze.py', ]
),
],
test_suite="tests",
)

@ -0,0 +1,82 @@
#!/usr/bin/python3
# coding=utf-8
import unittest
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QDir, QSettings
# from PyQt5.QtTest import QTest
from pathlib import Path
from gettext import gettext as _ # better than in main "_ = gettext.gettext" for testing
# from lubuntuBreezeConfig import lubuntuBreeze
# import lubuntuBreezeConfig
# help(lubuntuBreezeConfig)
sys.path.insert(0, "")
import lubuntuBreeze
app = QApplication(sys.argv)
class LubuntuBreezeTest(unittest.TestCase):
def setUp(self):
self.form = lubuntuBreeze.MainWindow()
dir = QDir(self.form.schemeDir)
self.files = dir.entryList(dir, dir.Files)
self.confFile = Path(Path.home() / ".config/kdeglobals")
def testText(self):
'''Test GUI in default state'''
label = _("Select Color Scheme for Breeze Qt Style:")
noteText =_("Applications need to be restarted for changes to take effect.")
noteText += "<br/>"
noteText += _("In case of pcmanfm-qt, since it handles the desktop, ")
noteText += _("a restart of the desktop is needed") + "<br/>"
noteText += _("Easier, restart session.")
noteText += "<br/>"
noteText += _("Best results if a matching GTK Theme is selected.")
self.assertEqual(self.form.label.text(), label)
self.assertEqual(self.form.note.text(), '<font size="-1">' + noteText + '</font>')
def testComoboxPopulation(self):
'''test if combobox is populated with same entries as number of files
(+1 because on None)'''
len(self.files)
self.assertEqual(self.form.comboBox.count(), len(self.files) + 1)
def testComoboxSelected(self):
'''test if comobox select the actual'''
if self.confFile.is_file():
settings = QSettings(str(self.confFile), QSettings.NativeFormat)
set = settings.value("ColorScheme")
self.assertEqual(self.form.comboBox.currentText(), set)
else:
self.assertEqual(self.form.comboBox.currentText(), _("None"))
"""def testSelectApply(self):
'''check if '''
if self.form.comboBox.currentText() == "None":
# select something else
for f in self.files:
set = QSettings(self.form.schemeDir + f, QSettings.NativeFormat)
if(set.value("ColorScheme") == self.form.comboBox.currentText()):
settings = QSettings(str(self.confFile), QSettings.NativeFormat)
set = settings.value("ColorScheme")
self.assertEqual(self.form.comboBox.currentText(),set)
# copyfile(self.schemeDir + f, self.confFile)
else:
# select NONE and see if file is removed
def testClose(self):
'''test apply'''
"""
if __name__ == "__main__":
unittest.main()
Loading…
Cancel
Save