From 6793904f10e6a79f68460330e37b116e3e876271 Mon Sep 17 00:00:00 2001 From: lxrocks Date: Fri, 2 Jan 2015 19:44:02 +1100 Subject: [PATCH] Added css style to fix 'Skinny ProgressBar' in Yosemite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem Description: —————————————— cfclient UI has ‘Skinny’ ProgressBars on Yosemite - thought to be due to the default Look & Feel of Yosemite Code Description: ———————— The code first checks for Yosemite OS before applying the style change. Tests: ——— Yosemite 10.10.1 Ubuntu 14.10 --- lib/cfclient/ui/main.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/lib/cfclient/ui/main.py b/lib/cfclient/ui/main.py index 3f95acdf..5d0db1bb 100644 --- a/lib/cfclient/ui/main.py +++ b/lib/cfclient/ui/main.py @@ -34,6 +34,7 @@ import sys import logging + logger = logging.getLogger(__name__) from PyQt4 import QtGui, uic @@ -97,7 +98,41 @@ class MainUI(QtGui.QMainWindow, main_window_class): def __init__(self, *args): super(MainUI, self).__init__(*args) self.setupUi(self) - + + ###################################################### + ### By lxrocks + ### 'Skinny Progress Bar' tweak for Yosemite + ### Tweak progress bar - artistic I am not - so pick your own colors !!! + ### Only apply to Yosemite + ###################################################### + import platform + if platform.system() == 'Darwin': + + (Version,junk,machine) = platform.mac_ver() + logger.info("This is a MAC - checking if we can apply Progress Bar Stylesheet for Yosemite Skinny Bars ") + yosemite = (10,10,0) + tVersion = tuple(map(int, (Version.split(".")))) + + if tVersion >= yosemite: + logger.info( "Found Yosemite:") + + tcss = """ + QProgressBar { + border: 2px solid grey; + border-radius: 5px; + text-align: center; + } + QProgressBar::chunk { + background-color: #05B8CC; + } + """ + self.setStyleSheet(tcss) + + else: + logger.info( "Pre-Yosemite") + + ###################################################### + self.cf = Crazyflie(ro_cache=sys.path[0] + "/cflib/cache", rw_cache=sys.path[1] + "/cache")