Bundle icons

This commit is contained in:
Fabian 2021-11-17 16:03:16 +01:00
parent 5177bc4706
commit fb21e41090
17 changed files with 459 additions and 17 deletions

View File

@ -17,3 +17,6 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Included icons are taken from KDE breeze-icons (https://invent.kde.org/frameworks/breeze-icons),
which are licensed under LGPL 3.

325
src/fime/icons/__init__.py Normal file
View File

@ -0,0 +1,325 @@
# Resource object code (Python 3)
# Created by: object code
# Created by: The Resource Compiler for Qt version 5.15.2
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore
qt_resource_data = b"\
\x00\x00\x02\xdd\
<\
svg xmlns=\x22http:\
//www.w3.org/200\
0/svg\x22 viewBox=\x22\
0 0 32 32\x22>\x0a <d\
efs id=\x22defs3051\
\x22>\x0a <style ty\
pe=\x22text/css\x22 id\
=\x22current-color-\
scheme\x22>\x0a .\
ColorScheme-Text\
{\x0a color\
:#232629;\x0a \
}\x0a </style>\
\x0a </defs>\x0a <pat\
h style=\x22fill:cu\
rrentColor;fill-\
opacity:1;stroke\
:none\x22 \x0a d\
=\x22M16 4A12 12 0 \
0 0 7.886719 7.1\
79688L7.885 7.17\
8A12 12 0 0 0 7.\
847656 7.214844 \
12 12 0 0 0 4 16\
12 12 0 0 0 16 \
28 12 12 0 0 0 2\
4.11328 24.82031\
2L24.12 24.822A1\
2 12 0 0 0 24.15\
234 24.785156 12\
12 0 0 0 28 16 \
12 12 0 0 0 16 4\
M16 5A11 11 0 0 \
1 27 16 11 11 0 \
0 1 24.11523 23.\
408203L8.592 7.8\
85A11 11 0 0 1 1\
6 5M7.885 8.592L\
23.408 24.12A11 \
11 0 0 1 16 27 1\
1 11 0 0 1 5 16 \
11 11 0 0 1 7.88\
4766 8.591797\x22\x0a \
class=\x22Color\
Scheme-Text\x22\x0a \
/>\x0a</svg>\x0a\
\x00\x00\x02`\
<\
svg xmlns=\x22http:\
//www.w3.org/200\
0/svg\x22 viewBox=\x22\
0 0 32 32\x22>\x0a <d\
efs\x0a id=\x22def\
s3051\x22>\x0a <sty\
le\x0a type=\x22\
text/css\x22\x0a \
id=\x22current-col\
or-scheme\x22>\x0a \
.ColorScheme-T\
ext {\x0a co\
lor:#232629;\x0a \
}\x0a </sty\
le>\x0a </defs>\x0a \
<path\x0a style\
=\x22fill:currentCo\
lor;fill-opacity\
:1;stroke:none\x22 \
\x0a d=\x22M 16 4 \
A 12 12 0 0 0 4 \
16 A 12 12 0 0 0\
16 28 A 12 12 0\
0 0 28 16 A 12 \
12 0 0 0 16 4 z \
M 16 5 A 11 11 0\
0 1 27 16 A 11 \
11 0 0 1 16 27 A\
11 11 0 0 1 5 1\
6 A 11 11 0 0 1 \
16 5 z M 15 7 L \
15 17 L 24 17 L \
24 16 L 16 16 L \
16 7 L 15 7 z \x22\x0a\
id=\x22path78\x22\
\x0a class=\x22Co\
lorScheme-Text\x22\x0a\
/>\x0a</svg>\x0a\
\x00\x00\x01L\
<\
svg viewBox=\x220 0\
32 32\x22 xmlns=\x22h\
ttp://www.w3.org\
/2000/svg\x22>\x0a \
<style\x0a t\
ype=\x22text/css\x22\x0a \
id=\x22curre\
nt-color-scheme\x22\
>\x0a .Color\
Scheme-Text {\x0a \
color:\
#232629;\x0a \
}\x0a </style>\x0a\
<path d=\x22M23\
.707 16l-14-14L9\
2.707 22.293 16\
9 29.293l.707.7\
07z\x22 class=\x22Colo\
rScheme-Text\x22 fi\
ll=\x22currentColor\
\x22/>\x0a</svg>\x0a\
\x00\x00\x01K\
<\
svg viewBox=\x220 0\
32 32\x22 xmlns=\x22h\
ttp://www.w3.org\
/2000/svg\x22>\x0a \
<style\x0a t\
ype=\x22text/css\x22\x0a \
id=\x22curre\
nt-color-scheme\x22\
>\x0a .Color\
Scheme-Text {\x0a \
color:\
#232629;\x0a \
}\x0a </style>\x0a\
<path d=\x22M8.\
293 16l14 14 .70\
7-.707L9.707 16 \
23 2.707 22.293 \
2z\x22 class=\x22Color\
Scheme-Text\x22 fil\
l=\x22currentColor\x22\
/>\x0a</svg>\x0a\
\x00\x00\x01\xe6\
<\
svg xmlns=\x22http:\
//www.w3.org/200\
0/svg\x22 viewBox=\x22\
0 0 24 24\x22 width\
=\x2224\x22 height=\x2224\
\x22>\x0a <defs id=\x22d\
efs3051\x22>\x0a <s\
tyle type=\x22text/\
css\x22 id=\x22current\
-color-scheme\x22>\x0a\
.ColorSche\
me-Text {\x0a \
color:#232629;\
\x0a }\x0a <\
/style>\x0a </defs\
>\x0a <g transform\
=\x22translate(1,1)\
\x22>\x0a <path sty\
le=\x22fill:current\
Color;fill-opaci\
ty:1;stroke:none\
\x22 d=\x22M 10 4 L 10\
11 L 3 11 L 3 1\
2 L 10 12 L 10 1\
9 L 11 19 L 11 1\
2 L 18 12 L 18 1\
1 L 11 11 L 11 4\
L 10 4 z \x22 clas\
s=\x22ColorScheme-T\
ext\x22/>\x0a </g>\x0a</\
svg>\x0a\
\x00\x00\x01L\
<\
svg viewBox=\x220 0\
32 32\x22 xmlns=\x22h\
ttp://www.w3.org\
/2000/svg\x22>\x0a \
<style\x0a t\
ype=\x22text/css\x22\x0a \
id=\x22curre\
nt-color-scheme\x22\
>\x0a .Color\
Scheme-Text {\x0a \
color:\
#232629;\x0a \
}\x0a </style>\x0a\
<path d=\x22M23\
.707 16l-14-14L9\
2.707 22.293 16\
9 29.293l.707.7\
07z\x22 class=\x22Colo\
rScheme-Text\x22 fi\
ll=\x22currentColor\
\x22/>\x0a</svg>\x0a\
\x00\x00\x01c\
<\
svg viewBox=\x220 0\
32 32\x22 xmlns=\x22h\
ttp://www.w3.org\
/2000/svg\x22><styl\
e type=\x22text/css\
\x22 id=\x22current-co\
lor-scheme\x22>.Col\
orScheme-Text{co\
lor:#232629;}</s\
tyle><path d=\x22m3\
0 6.5961948-19.3\
03301 19.3032992\
-8.696699-8.6966\
97.7071076-.7071\
06 7.9895914 7.9\
89592 18.596195-\
18.5961947z\x22 sty\
le=\x22fill:current\
Color;fill-opaci\
ty:1;stroke:none\
\x22 class=\x22ColorSc\
heme-Text\x22/></sv\
g>\
\x00\x00\x01\xa2\
<\
svg xmlns=\x22http:\
//www.w3.org/200\
0/svg\x22 viewBox=\x22\
0 0 24 24\x22 width\
=\x2224\x22 height=\x2224\
\x22>\x0a <defs id=\x22d\
efs3051\x22>\x0a <s\
tyle type=\x22text/\
css\x22 id=\x22current\
-color-scheme\x22>\x0a\
.ColorSche\
me-Text {\x0a \
color:#232629;\
\x0a }\x0a <\
/style>\x0a </defs\
>\x0a <g transform\
=\x22translate(1,1)\
\x22>\x0a <path sty\
le=\x22fill:current\
Color\x22 class=\x22Co\
lorScheme-Text\x22 \
d=\x22M 3 7 L 3 9 L\
13 9 L 13 7 L 3\
7 z\x22 transform=\
\x22translate(3 3)\x22\
/>\x0a </g>\x0a</svg>\
\x0a\
"
qt_resource_name = b"\
\x00\x05\
\x00o\xa6S\
\x00i\
\x00c\x00o\x00n\x00s\
\x00\x11\
\x03S\x8a\x87\
\x00d\
\x00i\x00a\x00l\x00o\x00g\x00-\x00c\x00a\x00n\x00c\x00e\x00l\x00.\x00s\x00v\x00g\
\
\x00\x13\
\x03gvg\
\x00a\
\x00p\x00p\x00o\x00i\x00n\x00t\x00m\x00e\x00n\x00t\x00-\x00n\x00e\x00w\x00.\x00s\
\x00v\x00g\
\x00\x0f\
\x0f\x22iG\
\x00a\
\x00r\x00r\x00o\x00w\x00-\x00r\x00i\x00g\x00h\x00t\x00.\x00s\x00v\x00g\
\x00\x0e\
\x08\xfa8\xa7\
\x00a\
\x00r\x00r\x00o\x00w\x00-\x00l\x00e\x00f\x00t\x00.\x00s\x00v\x00g\
\x00\x0c\
\x09\xc6\x14\xa7\
\x00l\
\x00i\x00s\x00t\x00-\x00a\x00d\x00d\x00.\x00s\x00v\x00g\
\x00\x0b\
\x0c+\x12G\
\x00g\
\x00o\x00-\x00n\x00e\x00x\x00t\x00.\x00s\x00v\x00g\
\x00\x0d\
\x09\xae0'\
\x00d\
\x00i\x00a\x00l\x00o\x00g\x00-\x00o\x00k\x00.\x00s\x00v\x00g\
\x00\x0f\
\x020\x86g\
\x00l\
\x00i\x00s\x00t\x00-\x00r\x00e\x00m\x00o\x00v\x00e\x00.\x00s\x00v\x00g\
"
qt_resource_struct = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x08\x00\x00\x00\x02\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x01\x04\x00\x00\x00\x00\x00\x01\x00\x00\x0c\x85\
\x00\x00\x01}.b\xfd-\
\x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01}.a\xe4+\
\x00\x00\x008\x00\x00\x00\x00\x00\x01\x00\x00\x02\xe1\
\x00\x00\x01}.\x1a\xb9\xf9\
\x00\x00\x00\x88\x00\x00\x00\x00\x00\x01\x00\x00\x06\x95\
\x00\x00\x01}.b $\
\x00\x00\x00\xe4\x00\x00\x00\x00\x00\x01\x00\x00\x0b\x1e\
\x00\x00\x01}.a\xce_\
\x00\x00\x00\xaa\x00\x00\x00\x00\x00\x01\x00\x00\x07\xe4\
\x00\x00\x01}.b\xe1.\
\x00\x00\x00\xc8\x00\x00\x00\x00\x00\x01\x00\x00\x09\xce\
\x00\x00\x01}.b\x05\xfc\
\x00\x00\x00d\x00\x00\x00\x00\x00\x01\x00\x00\x05E\
\x00\x00\x01}.b1)\
"
def qInitResources():
QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
def qCleanupResources():
QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
qInitResources()

View File

@ -0,0 +1,18 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs
id="defs3051">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 16 4 A 12 12 0 0 0 4 16 A 12 12 0 0 0 16 28 A 12 12 0 0 0 28 16 A 12 12 0 0 0 16 4 z M 16 5 A 11 11 0 0 1 27 16 A 11 11 0 0 1 16 27 A 11 11 0 0 1 5 16 A 11 11 0 0 1 16 5 z M 15 7 L 15 17 L 24 17 L 24 16 L 16 16 L 16 7 L 15 7 z "
id="path78"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 608 B

View File

@ -0,0 +1,10 @@
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
<path d="M8.293 16l14 14 .707-.707L9.707 16 23 2.707 22.293 2z" class="ColorScheme-Text" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 331 B

View File

@ -0,0 +1,10 @@
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
<path d="M23.707 16l-14-14L9 2.707 22.293 16 9 29.293l.707.707z" class="ColorScheme-Text" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 332 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="M16 4A12 12 0 0 0 7.886719 7.179688L7.885 7.178A12 12 0 0 0 7.847656 7.214844 12 12 0 0 0 4 16 12 12 0 0 0 16 28 12 12 0 0 0 24.11328 24.820312L24.12 24.822A12 12 0 0 0 24.15234 24.785156 12 12 0 0 0 28 16 12 12 0 0 0 16 4M16 5A11 11 0 0 1 27 16 11 11 0 0 1 24.11523 23.408203L8.592 7.885A11 11 0 0 1 16 5M7.885 8.592L23.408 24.12A11 11 0 0 1 16 27 11 11 0 0 1 5 16 11 11 0 0 1 7.884766 8.591797"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 733 B

View File

@ -0,0 +1 @@
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><style type="text/css" id="current-color-scheme">.ColorScheme-Text{color:#232629;}</style><path d="m30 6.5961948-19.303301 19.3032992-8.696699-8.696697.7071076-.707106 7.9895914 7.989592 18.596195-18.5961947z" style="fill:currentColor;fill-opacity:1;stroke:none" class="ColorScheme-Text"/></svg>

After

Width:  |  Height:  |  Size: 355 B

View File

@ -0,0 +1,10 @@
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
<path d="M23.707 16l-14-14L9 2.707 22.293 16 9 29.293l.707.707z" class="ColorScheme-Text" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 332 B

View File

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
</defs>
<g transform="translate(1,1)">
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M 10 4 L 10 11 L 3 11 L 3 12 L 10 12 L 10 19 L 11 19 L 11 12 L 18 12 L 18 11 L 11 11 L 11 4 L 10 4 z " class="ColorScheme-Text"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 486 B

View File

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
</defs>
<g transform="translate(1,1)">
<path style="fill:currentColor" class="ColorScheme-Text" d="M 3 7 L 3 9 L 13 9 L 13 7 L 3 7 z" transform="translate(3 3)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 418 B

View File

@ -0,0 +1,13 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="icons">
<file>appointment-new.svg</file>
<file>arrow-left.svg</file>
<file>arrow-right.svg</file>
<file>dialog-cancel.svg</file>
<file>dialog-ok.svg</file>
<file>go-next.svg</file>
<file>list-add.svg</file>
<file>list-remove.svg</file>
</qresource>
</RCC>

View File

@ -0,0 +1,2 @@
#!/bin/sh
rcc resources.qrc -g python -o __init__.py

View File

@ -1,6 +1,7 @@
from PySide2 import QtGui, QtWidgets
from fime.task_completer import TaskCompleter
from fime.util import get_icon
class ImportTask(QtWidgets.QDialog):
@ -15,13 +16,13 @@ class ImportTask(QtWidgets.QDialog):
ok_button = QtWidgets.QPushButton()
ok_button.setText("OK")
ok_button.setIcon(QtGui.QIcon.fromTheme("dialog-ok"))
ok_button.setIcon(get_icon("dialog-ok"))
ok_button.pressed.connect(self.accept)
ok_button.setAutoDefault(True)
cancel_button = QtWidgets.QPushButton()
cancel_button.setText("Cancel")
cancel_button.setIcon(QtGui.QIcon.fromTheme("dialog-cancel"))
cancel_button.setIcon(get_icon("dialog-cancel"))
cancel_button.pressed.connect(self.reject)
cancel_button.setAutoDefault(False)

View File

@ -1,18 +1,20 @@
#!/usr/bin/env python3
import sys
import signal
import sys
from functools import partial
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2 import QtCore, QtWidgets
from PySide2.QtWidgets import QMessageBox
# noinspection PyUnresolvedReferences
import fime.icons
from fime.data import Tasks, Log, Data
from fime.exceptions import FimeException
from fime.import_task import ImportTask
from fime.task_edit import TaskEdit
from fime.report import Report
from fime.util import get_screen_height
from fime.task_edit import TaskEdit
from fime.util import get_screen_height, get_icon
class App:
@ -24,7 +26,7 @@ class App:
self.log = Log(data)
self._active_task = self.log.last_log() or "Nothing"
icon = QtGui.QIcon.fromTheme("appointment-new")
icon = get_icon("appointment-new")
self.menu = QtWidgets.QMenu()
@ -79,7 +81,7 @@ class App:
action = self.menu.addAction(t)
action.triggered.connect(partial(self.change_task, t))
if t == self.active_task:
action.setIcon(QtGui.QIcon.fromTheme("go-next"))
action.setIcon(get_icon("go-next"))
tmp_action = self.menu.addAction("tmp")
action_height = self.menu.actionGeometry(tmp_action).height()

View File

@ -5,7 +5,7 @@ from datetime import datetime
from PySide2.QtWidgets import QHeaderView
from fime.data import Tasks
from fime.util import get_screen_height
from fime.util import get_screen_height, get_icon
class Report(QtWidgets.QDialog):
@ -47,31 +47,31 @@ class Report(QtWidgets.QDialog):
self.previous_button = QtWidgets.QPushButton()
self.previous_button.setText("Previous")
self.previous_button.setIcon(QtGui.QIcon.fromTheme("arrow-left"))
self.previous_button.setIcon(get_icon("arrow-left"))
self.previous_button.pressed.connect(self.previous)
self.previous_button.setAutoDefault(False)
self.next_button = QtWidgets.QPushButton()
self.next_button.setText("Next")
self.next_button.setIcon(QtGui.QIcon.fromTheme("arrow-right"))
self.next_button.setIcon(get_icon("arrow-right"))
self.next_button.pressed.connect(self.next)
self.next_button.setAutoDefault(False)
new_button = QtWidgets.QPushButton()
new_button.setText("New item")
new_button.setIcon(QtGui.QIcon.fromTheme("list-add"))
new_button.setIcon(get_icon("list-add"))
new_button.pressed.connect(self.new_log)
new_button.setAutoDefault(False)
del_button = QtWidgets.QPushButton()
del_button.setText("Delete item")
del_button.setIcon(QtGui.QIcon.fromTheme("list-remove"))
del_button.setIcon(get_icon("list-remove"))
del_button.pressed.connect(self.del_log)
del_button.setAutoDefault(False)
ok_button = QtWidgets.QPushButton()
ok_button.setText("OK")
ok_button.setIcon(QtGui.QIcon.fromTheme("dialog-ok"))
ok_button.setIcon(get_icon("dialog-ok"))
ok_button.pressed.connect(self._accept)
ok_button.setAutoDefault(True)

View File

@ -1,5 +1,7 @@
from PySide2 import QtCore, QtGui, QtWidgets
from fime.util import get_icon
class TaskEdit(QtWidgets.QDialog):
def __init__(self, parent, *args, **kwargs):
@ -15,19 +17,19 @@ class TaskEdit(QtWidgets.QDialog):
new_button = QtWidgets.QPushButton()
new_button.setText("New item")
new_button.setIcon(QtGui.QIcon.fromTheme("list-add"))
new_button.setIcon(get_icon("list-add"))
new_button.pressed.connect(self.new_task)
new_button.setAutoDefault(False)
del_button = QtWidgets.QPushButton()
del_button.setText("Delete item")
del_button.setIcon(QtGui.QIcon.fromTheme("list-remove"))
del_button.setIcon(get_icon("list-remove"))
del_button.pressed.connect(self.del_task)
del_button.setAutoDefault(False)
ok_button = QtWidgets.QPushButton()
ok_button.setText("OK")
ok_button.setIcon(QtGui.QIcon.fromTheme("dialog-ok"))
ok_button.setIcon(get_icon("dialog-ok"))
ok_button.pressed.connect(self.accept)
ok_button.setAutoDefault(True)

View File

@ -1,6 +1,14 @@
from PySide2 import QtGui
def get_screen_height(qobject):
if hasattr(qobject, "screen"):
return qobject.screen().size().height()
else:
print("unable to detect screen height falling back to default value of 1080")
return 1080
def get_icon(icon_name):
fallback = QtGui.QIcon(f":/icons/{icon_name}").pixmap(256, 256)
return QtGui.QIcon.fromTheme(icon_name, fallback)