diff options
author | Victor Häggqvist <[email protected]> | 2015-01-01 17:48:07 +0100 |
---|---|---|
committer | Victor Häggqvist <[email protected]> | 2015-01-01 17:48:07 +0100 |
commit | 813f879a62d778aa0c62261fb97493aa8087699e (patch) | |
tree | 06c43f6726d7bbed27c108e152f6f8bd377695ad | |
parent | ac79fb2dacd0e6af14006bf25773b52b055d6676 (diff) |
preview app icons
-rwxr-xr-x | AndroidResR/AndroidResR.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/AndroidResR/AndroidResR.py b/AndroidResR/AndroidResR.py index 6fd31f3..9518539 100755 --- a/AndroidResR/AndroidResR.py +++ b/AndroidResR/AndroidResR.py @@ -142,6 +142,22 @@ class Window(QtGui.QMainWindow, Ui_MainWindow): return icon = join(self.searchpath, self.srcIconFiles[self.currentIndex]) + log(icon) + self.setPreviewIcon(icon) + + def previewDestIcon(self): + if self.currentIndexDest is None: + return + + thisResource = self.appResources[self.currentIndexDest] + previewResolution = 'xhdpi' + if 'xhdpi' not in thisResource[1]: + previewResolution = thisResource[-1] + + icon = join(self.appResFolder, 'drawable-'+previewResolution, thisResource[0]) + self.setPreviewIcon(icon) + + def setPreviewIcon(self, icon): color = self.getColor() html = '<body style="background:'+color+'"><img src="file://'+icon+'"></body>' self.webView.setHtml(html) @@ -155,6 +171,7 @@ class Window(QtGui.QMainWindow, Ui_MainWindow): def destSelectionChange(self): self.currentIndexDest = self.destListWidget.selectedIndexes()[0].row() if len(self.destListWidget.selectedIndexes()) else None self.displayResInfo() + self.previewDestIcon() def displayResInfo(self): if self.currentIndexDest is None: |