Replaced pixmap icons by vector icons. release-2.1.0

Thu, 09 Apr 2020 18:44:19 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 09 Apr 2020 18:44:19 +0200
changeset 85
246e51cc11ae
parent 84
427a7f8d662f
child 86
94ee489db94c

Replaced pixmap icons by vector icons.

ChangeLog file | annotate | diff | comparison | revisions
PKGLIST file | annotate | diff | comparison | revisions
PluginTimeTracker.e4p file | annotate | diff | comparison | revisions
PluginTimeTracker.py file | annotate | diff | comparison | revisions
PluginTimeTracker.zip file | annotate | diff | comparison | revisions
TimeTracker/TimeTracker.py file | annotate | diff | comparison | revisions
TimeTracker/icons/clock-dark.svg file | annotate | diff | comparison | revisions
TimeTracker/icons/clock-light.svg file | annotate | diff | comparison | revisions
TimeTracker/icons/clock.png file | annotate | diff | comparison | revisions
--- a/ChangeLog	Wed Jan 01 11:59:01 2020 +0100
+++ b/ChangeLog	Thu Apr 09 18:44:19 2020 +0200
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 2.1.0:
+- replaced pixmap icons by vector icons
+
 Version 2.0.10:
 - updated Russian translations
 
--- a/PKGLIST	Wed Jan 01 11:59:01 2020 +0100
+++ b/PKGLIST	Thu Apr 09 18:44:19 2020 +0200
@@ -15,4 +15,5 @@
 TimeTracker/i18n/timetracker_es.qm
 TimeTracker/i18n/timetracker_pt.qm
 TimeTracker/i18n/timetracker_ru.qm
-TimeTracker/icons/clock.png
+TimeTracker/icons/clock-dark.svg
+TimeTracker/icons/clock-light.svg
--- a/PluginTimeTracker.e4p	Wed Jan 01 11:59:01 2020 +0100
+++ b/PluginTimeTracker.e4p	Thu Apr 09 18:44:19 2020 +0200
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE Project SYSTEM "Project-5.1.dtd">
 <!-- eric project file for project PluginTimeTracker -->
-<!-- Copyright (C) 2018 Detlev Offenbach, detlev@die-offenbachs.de -->
+<!-- Copyright (C) 2020 Detlev Offenbach, detlev@die-offenbachs.de -->
 <Project version="5.1">
   <Language>en</Language>
   <Hash>9af6dcaf8f823f072f714e662c15d44dfdecceab</Hash>
@@ -49,7 +49,8 @@
     <Other>PluginTimeTracker.zip</Other>
     <Other>TimeTracker/Documentation/LICENSE.GPL3</Other>
     <Other>TimeTracker/Documentation/source</Other>
-    <Other>TimeTracker/icons/clock.png</Other>
+    <Other>TimeTracker/icons/clock-dark.svg</Other>
+    <Other>TimeTracker/icons/clock-light.svg</Other>
   </Others>
   <MainScript>PluginTimeTracker.py</MainScript>
   <Vcs>
--- a/PluginTimeTracker.py	Wed Jan 01 11:59:01 2020 +0100
+++ b/PluginTimeTracker.py	Thu Apr 09 18:44:19 2020 +0200
@@ -24,7 +24,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "2.0.10"
+version = "2.1.0"
 className = "TimeTrackerPlugin"
 packageName = "TimeTracker"
 shortDescription = "Time Tracker to keep track of the project time."
@@ -61,11 +61,24 @@
     
     @return dictionary containing the relevant data
     """
+    try:
+        usesDarkPalette = e5App().usesDarkPalette()
+    except AttributeError:
+        from PyQt5.QtGui import QPalette
+        palette = e5App().palette()
+        lightness = palette.color(QPalette.Window).lightness()
+        usesDarkPalette = lightness <= 128
+    if usesDarkPalette:
+        iconSuffix = "dark"
+    else:
+        iconSuffix = "light"
+    
     return {
         "timeTrackerPage": [
             QCoreApplication.translate("TimeTrackerPlugin",
                                        "Time Tracker"),
-            os.path.join("TimeTracker", "icons", "clock.png"),
+            os.path.join("TimeTracker", "icons",
+                         "clock-{0}".format(iconSuffix)),
             createTimeTrackerPage, None, None],
     }
 
@@ -122,7 +135,19 @@
         global timeTrackerPluginObject
         timeTrackerPluginObject = self
         
-        self.__object = TimeTracker(self, self.__ui)
+        try:
+            usesDarkPalette = e5App().usesDarkPalette()
+        except AttributeError:
+            from PyQt5.QtGui import QPalette
+            palette = e5App().palette()
+            lightness = palette.color(QPalette.Window).lightness()
+            usesDarkPalette = lightness <= 128
+        if usesDarkPalette:
+            iconSuffix = "dark"
+        else:
+            iconSuffix = "light"
+        
+        self.__object = TimeTracker(self, iconSuffix, self.__ui)
         self.__object.activate()
         e5App().registerPluginObject("TimeTracker", self.__object)
         
Binary file PluginTimeTracker.zip has changed
--- a/TimeTracker/TimeTracker.py	Wed Jan 01 11:59:01 2020 +0100
+++ b/TimeTracker/TimeTracker.py	Thu Apr 09 18:44:19 2020 +0200
@@ -31,16 +31,21 @@
     """
     FileName = "TimeTracker.txt"
     
-    def __init__(self, plugin, parent=None):
+    def __init__(self, plugin, iconSuffix, parent=None):
         """
         Constructor
         
-        @param plugin reference to the plugin object (TimeTrackerPlugin)
-        @param parent parent (QObject)
+        @param plugin reference to the plugin object
+        @type TimeTrackerPlugin
+        @param iconSuffix suffix for the icons
+        @type str
+        @param parent parent
+        @type QObject
         """
         QObject.__init__(self, parent)
         
         self.__plugin = plugin
+        self.__iconSuffix = iconSuffix
         self.__ui = parent
         
         self.__e5project = e5App().getObject("Project")
@@ -69,7 +74,9 @@
         self.__ui.addSideWidget(
             self.__ui.BottomSide, self.__widget,
             UI.PixmapCache.getIcon(
-                os.path.join("TimeTracker", "icons", "clock.png")),
+                os.path.join("TimeTracker", "icons",
+                             "clock-{0}".format(self.__iconSuffix))
+            ),
             self.tr("Time Tracker"))
         
         self.__activateAct = E5Action(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TimeTracker/icons/clock-dark.svg	Thu Apr 09 18:44:19 2020 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
+ <defs>
+  <style type="text/css">.ColorScheme-Text {
+        color:#eff0f1;
+      }</style>
+ </defs>
+ <path class="ColorScheme-Text" d="m11 1c-5.54 0-10 4.46-10 10 0 5.54 4.46 10 10 10 5.54 0 10-4.46 10-10 0-5.54-4.46-10-10-10m0 1.25c4.8475 0 8.75 3.9025 8.75 8.75 0 4.8475-3.9025 8.75-8.75 8.75-4.8475 0-8.75-3.9025-8.75-8.75 0-4.8475 3.9025-8.75 8.75-8.75m-1.25 1.25v8.75h7.5v-1.25h-6.25v-7.5h-1.25" color="#eff0f1" fill="currentColor"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TimeTracker/icons/clock-light.svg	Thu Apr 09 18:44:19 2020 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
+ <defs>
+  <style type="text/css">.ColorScheme-Text {
+        color:#eff0f1;
+      }</style>
+ </defs>
+ <path class="ColorScheme-Text" d="m11 1c-5.54 0-10 4.46-10 10 0 5.54 4.46 10 10 10 5.54 0 10-4.46 10-10 0-5.54-4.46-10-10-10m0 1.25c4.8475 0 8.75 3.9025 8.75 8.75 0 4.8475-3.9025 8.75-8.75 8.75-4.8475 0-8.75-3.9025-8.75-8.75 0-4.8475 3.9025-8.75 8.75-8.75m-1.25 1.25v8.75h7.5v-1.25h-6.25v-7.5h-1.25" color="#eff0f1" fill="#232629"/>
+</svg>
Binary file TimeTracker/icons/clock.png has changed

eric ide

mercurial