Bug#698467: RE : Bug#698467: unblock: taurus/3.0.0-2
>The diff you sent doesn't contain these patches...
Sorry about that, I did the debdiff with the .dsc but.
So here the 2 patches
Cheers
Fred
From: =?UTF-8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= <picca@debian.org>
Date: Fri, 18 Jan 2013 21:20:39 +0100
Subject: upstream fix for the FTBFS due to image conversion
---
setup.py | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/setup.py b/setup.py
index c3afb89..92d570a 100644
--- a/setup.py
+++ b/setup.py
@@ -585,7 +585,6 @@ if sphinx:
def run(self):
self.resource_dir = abspath('lib', 'taurus', 'qt', 'qtgui', 'resource')
self.taurus = os.path.join(self.resource_dir, 'taurus.png')
- import PyQt4.Qt
orig_dir = os.path.abspath(os.curdir)
os.chdir(self.resource_dir)
@@ -699,13 +698,13 @@ if sphinx:
class build_doc(BuildDoc):
user_options = BuildDoc.user_options + \
- [('use-inkscape', None,
- "Use inkscape for building the icon catalog (useful if QApplication cannot be used when building, but requires inkscape)")]
- boolean_options = BuildDoc.boolean_options + ['use-inkscape']
+ [('external-img-tools', None,
+ "Use external tools for converting the icon catalog (useful if QApplication cannot be used while building, but requires inkscape and imagemagick)")]
+ boolean_options = BuildDoc.boolean_options + ['external-img-tools']
def initialize_options (self):
BuildDoc.initialize_options(self)
- self.use_inkscape = False
+ self.external_img_tools = False
def has_doc_api(self):
return True
@@ -757,20 +756,20 @@ if sphinx:
# copy the tango icons to the build directory of documentation
target = os.path.join(build_dir, 'devel')
- if not self.use_inkscape:
+ if not self.external_img_tools:
import PyQt4.Qt
if PyQt4.Qt.qApp.instance() is None:
self.app = PyQt4.Qt.QApplication([])
print("\tBuilding PNGs for icon catalog")
- os.path.walk(resource, svg_to_png, (resource, target, self.use_inkscape))
+ os.path.walk(resource, svg_to_png, (resource, target, self.external_img_tools))
return
cmdclass['build_doc'] = build_doc
def svg_to_png(arg, dirname, fnames):
- resource, target, use_inkscape = arg
- if not use_inkscape:
+ resource, target, external_img_tools = arg
+ if not external_img_tools:
import PyQt4.Qt
relpath = os.path.relpath(dirname, start=resource)
path = os.path.join(target, relpath)
@@ -783,9 +782,12 @@ def svg_to_png(arg, dirname, fnames):
target_fname = fbase + ".png"
full_target_fname = os.path.join(path, target_fname)
if not os.path.isfile(full_target_fname):
- if use_inkscape:
- cmd = "inkscape -z -e '%s' -w 24 '%s' > /dev/null"%(full_target_fname, full_source_fname)
+ if external_img_tools:
+ cmd = "inkscape -z '%s' -e '%s' -w 24 >/dev/null 2>/dev/null"%(full_source_fname, full_target_fname)
ok = not(os.system(cmd))
+ if not ok:
+ cmd = "convert -resize 24 '%s' '%s' >/dev/null 2>/dev/null"%(full_source_fname, full_target_fname)
+ ok = not(os.system(cmd))
else:
pixmap = PyQt4.Qt.QPixmap(full_source_fname)
pix = pixmap.scaledToWidth(24, PyQt4.Qt.Qt.SmoothTransformation)
From: =?UTF-8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= <picca@debian.org>
Date: Fri, 18 Jan 2013 21:13:40 +0100
Subject: upstream fix tango icon resources
---
.../qt/qtgui/resource/taurus_resource_utils.py | 94 +++++++++-----------
1 file changed, 44 insertions(+), 50 deletions(-)
diff --git a/lib/taurus/qt/qtgui/resource/taurus_resource_utils.py b/lib/taurus/qt/qtgui/resource/taurus_resource_utils.py
index 5976544..42f8438 100644
--- a/lib/taurus/qt/qtgui/resource/taurus_resource_utils.py
+++ b/lib/taurus/qt/qtgui/resource/taurus_resource_utils.py
@@ -47,7 +47,6 @@ DevHealth = taurus.core.TaurusSWDevHealth
Size = Qt.QSize
__INITIALIZED = False
-__INITIALIZED_THEME = False
# Theme capacity was only added in Qt 4.6
__THEME_CAPACITY = hasattr(Qt.QIcon, "fromTheme")
# Uncomment the following line to force NOT to use OS theme.
@@ -66,60 +65,47 @@ __3DQS = Size(3*__DW, __DH)
def __init():
global __INITIALIZED
+ global __THEME_MEMBERS
if __INITIALIZED: return
-
+
+ #register only the tango-icons rcc files (and initialize the THEME_MEMBERS)
res_dir = os.path.dirname(os.path.abspath(__file__))
Qt.QDir.addSearchPath("resource", res_dir)
-
- for res_file in [ f for f in os.listdir(res_dir) if f.endswith(".rcc") ]:
- if not Qt.QResource.registerResource("resource:" + res_file):
- __LOGGER.info("Failed to load resource %s" % res_file)
+ prefix = 'qrc_tango_icons_'
+ suffix = '.rcc'
+ lp, ls = len(prefix),len(suffix)
+ theme_members = {}
+ other_rcc_files = []
+ for f in os.listdir(res_dir):
+ if f.endswith(suffix):
+ if f.startswith(prefix):
+ if Qt.QResource.registerResource("resource:" + f):
+ d = f[lp:-ls]
+ theme_members[d] = [str(e)[:-4] for e in Qt.QDir(":%s"%d).entryList() if str(e).endswith('.svg')]
+ else:
+ __LOGGER.info("Failed to load resource %s" % f)
+ else:
+ other_rcc_files.append(f) #we remember these and will register later
+ __THEME_MEMBERS = theme_members
+
+ #register the rest of the resource files
+ for f in other_rcc_files:
+ if not Qt.QResource.registerResource("resource:" + f):
+ __LOGGER.info("Failed to load resource %s" % f)
__INITIALIZED = True
__init()
-def __init_theme_members():
- global __INITIALIZED_THEME
- global __THEME_MEMBERS
- global __THEME_CAPACITY
- global __LOGGER
-
- if __INITIALIZED_THEME: return __THEME_MEMBERS
-
- app = Qt.QApplication.instance()
- if app is None and __THEME_CAPACITY:
- raise Exception("Cannot calculate theme without QApplication instance")
-
- res_dir = os.path.dirname(os.path.abspath(__file__))
- theme_icon_dir = os.path.join(res_dir, "tango-icons")
- members = {}
- for d in os.listdir(theme_icon_dir):
- abs_dir = os.path.join(theme_icon_dir, d)
- if d[0] == "." or not os.path.isdir(abs_dir):
- continue
- elems = []
- for elem in os.listdir(abs_dir):
- abs_elem = os.path.join(abs_dir, elem)
- idx = elem.rfind(".svg")
- if elem[0] == "." or idx < 0 or not os.path.isfile(abs_elem):
- continue
- elems.append(elem[:idx])
- members[d] = elems
-
- __THEME_MEMBERS = members
-
- __INITIALIZED_THEME = True
- return __THEME_MEMBERS
-
def getThemeMembers():
"""Returns the current icon theme elements
:return: the current icon theme elements in a dictionary where each key is
a group name and the value is a sequence of theme icon name.
:rtype: dict<str,seq<str>>"""
- return __init_theme_members()
+ global __THEME_MEMBERS
+ return __THEME_MEMBERS
def getPixmap(key, size=None):
"""Returns a PyQt4.QtGui.QPixmap object for the given key and size
@@ -168,13 +154,17 @@ def getThemePixmap(key, size=None):
:return: (PyQt4.QtGui.QPixmap) a PyQt4.QtGui.QPixmap for the given key and size"""
global __THEME_CAPACITY
- if __THEME_CAPACITY and Qt.QIcon.hasThemeIcon(key):
- size = size or 48
- return Qt.QIcon.fromTheme(key).pixmap(size, size)
-
+ global __LOGGER
+ if __THEME_CAPACITY:
+ if Qt.QIcon.hasThemeIcon(key):
+ size = size or 48
+ return Qt.QIcon.fromTheme(key).pixmap(size, size)
+ else:
+ __LOGGER.debug('Theme pixmap "%s" not supported. Trying to provide a fallback...',key)
for member, items in getThemeMembers().items():
if not key in items: continue
return getPixmap(":/%s/%s.svg" % (member, key), size)
+ __LOGGER.debug('Theme pixmap "%s" not supported.', key)
return Qt.QPixmap()
def getThemeIcon(key):
@@ -192,12 +182,16 @@ def getThemeIcon(key):
:return: (PyQt4.QtGui.QIcon) a PyQt4.QtGui.QIcon for the given key"""
global __THEME_CAPACITY
- if __THEME_CAPACITY and Qt.QIcon.hasThemeIcon(key):
- return Qt.QIcon.fromTheme(key)
-
+ global __LOGGER
+ if __THEME_CAPACITY:
+ if Qt.QIcon.hasThemeIcon(key):
+ return Qt.QIcon.fromTheme(key)
+ else:
+ __LOGGER.debug('Theme icon "%s" not supported. Trying to provide a fallback...',key)
for member, items in getThemeMembers().items():
if not key in items: continue
return Qt.QIcon(":/%s/%s.svg" % (member, key))
+ __LOGGER.debug('Theme icon "%s" not supported.', key)
return Qt.QIcon()
def getStandardIcon(key, widget=None):
@@ -205,7 +199,7 @@ def getStandardIcon(key, widget=None):
QStyle.StandardPixmap enumeration member. The widget argument is optional
and can also be used to aid the determination of the icon.
- :param key: (QStyle.StandardPixmap) a standard pixmap which can follow some existing GUI style or guidelin
+ :param key: (QStyle.StandardPixmap) a standard pixmap which can follow some existing GUI style or guideline
:param widget: (Qt.QWidget) the widget argument (optional) can also be used to aid the determination of the icon.
:return: (PyQt4.QtGui.QIcon) a PyQt4.QtGui.QIcon for the given key"""
@@ -220,7 +214,7 @@ def getStandardIcon(key, widget=None):
__IDX_ELEM_TYPE_ICON, __IDX_ELEM_TYPE_SIZE, __IDX_ELEM_TYPE_TOOLTIP = range(3)
# New default role map
-# Elements are: icon theme, prefered size, description/tooltip
+# Elements are: icon theme, preferred size, description/tooltip
_ELEM_TYPE_MAP = { ElemType.Name : ("folder", __3DQS, None),
ElemType.Device : ("applications-system", Size(210, __DH), "Tango device name"),
ElemType.DeviceAlias : ("applications-system", Size(140, __DH), "Tango device alias"),
@@ -354,4 +348,4 @@ def getSWDevHealthPixmap(elemHealth, size=None):
if data is None:
return
themeName = data[__IDX_HEALTH_ICON]
- return getThemePixmap(themeName, size)
\ No newline at end of file
+ return getThemePixmap(themeName, size)
Reply to: