changeset 41:9fa1e33b67da

use Qt resources for window icons
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 14 May 2010 08:04:54 +0200
parents c858aab71e5b
children 0c0d1760b737
files .hgignore .settings/org.eclipse.core.resources.prefs Feedworm.qrc Makefile Preferences.py Ui_MainWindow.ui Ui_Preferences.ui
diffstat 7 files changed, 32 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Fri May 14 07:05:02 2010 +0200
+++ b/.hgignore	Fri May 14 08:04:54 2010 +0200
@@ -1,6 +1,7 @@
 syntax: glob
 *.pyc
 Ui_*.py
+*_rc.py
 
 syntax: regexp
 ^feedworm\.sqlite$
--- a/.settings/org.eclipse.core.resources.prefs	Fri May 14 07:05:02 2010 +0200
+++ b/.settings/org.eclipse.core.resources.prefs	Fri May 14 08:04:54 2010 +0200
@@ -1,4 +1,4 @@
-#Thu Apr 29 05:48:00 CEST 2010
+#Fri May 14 07:19:36 CEST 2010
 eclipse.preferences.version=1
 encoding/Ui_AddFeed.py=utf-8
 encoding/Ui_MainWindow.py=utf-8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Feedworm.qrc	Fri May 14 08:04:54 2010 +0200
@@ -0,0 +1,5 @@
+<RCC>
+  <qresource prefix="newPrefix">
+    <file>worm.png</file>
+  </qresource>
+</RCC>
--- a/Makefile	Fri May 14 07:05:02 2010 +0200
+++ b/Makefile	Fri May 14 08:04:54 2010 +0200
@@ -1,12 +1,16 @@
 
 # find all .ui files and generate corresponding filenames ending in .py
 PY_FILES = $(patsubst %.ui, %.py, $(wildcard *.ui))
+RC_FILES = $(patsubst %.qrc, %_rc.py, $(wildcard *.qrc))
 
-all: $(PY_FILES)
+all: $(PY_FILES) $(RC_FILES)
 
 %.py: %.ui
 	pyuic4 -o $@ $<
 
+%_rc.py: %.qrc
+	pyrcc4 -o $@ $<
+
 .PHONY: clean
 clean:
 	rm $(PY_FILES)
--- a/Preferences.py	Fri May 14 07:05:02 2010 +0200
+++ b/Preferences.py	Fri May 14 08:04:54 2010 +0200
@@ -11,3 +11,13 @@
 
     def startMaximizedChanged(self, change):
         print("start maximized: " + str(change))
+
+    def accept(self):
+        # TODO save the session
+        QtGui.QDialog.accept(self)
+        
+    def reject(self):
+        # TODO revert the session
+        QtGui.QDialog.reject(self)
+        
+        
\ No newline at end of file
--- a/Ui_MainWindow.ui	Fri May 14 07:05:02 2010 +0200
+++ b/Ui_MainWindow.ui	Fri May 14 08:04:54 2010 +0200
@@ -14,8 +14,8 @@
    <string>Feedworm</string>
   </property>
   <property name="windowIcon">
-   <iconset>
-    <normaloff>../../../.designer/backup/worm.png</normaloff>../../../.designer/backup/worm.png</iconset>
+   <iconset resource="Feedworm.qrc">
+    <normaloff>:/newPrefix/worm.png</normaloff>:/newPrefix/worm.png</iconset>
   </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QGridLayout" name="gridLayout">
@@ -161,7 +161,9 @@
    <header>QtWebKit/QWebView</header>
   </customwidget>
  </customwidgets>
- <resources/>
+ <resources>
+  <include location="Feedworm.qrc"/>
+ </resources>
  <connections>
   <connection>
    <sender>actionQuit</sender>
--- a/Ui_Preferences.ui	Fri May 14 07:05:02 2010 +0200
+++ b/Ui_Preferences.ui	Fri May 14 08:04:54 2010 +0200
@@ -14,8 +14,8 @@
    <string>Preferences</string>
   </property>
   <property name="windowIcon">
-   <iconset>
-    <normaloff>worm.png</normaloff>worm.png</iconset>
+   <iconset resource="Feedworm.qrc">
+    <normaloff>:/newPrefix/worm.png</normaloff>:/newPrefix/worm.png</iconset>
   </property>
   <widget class="QDialogButtonBox" name="buttonBox">
    <property name="geometry">
@@ -47,7 +47,9 @@
    </property>
   </widget>
  </widget>
- <resources/>
+ <resources>
+  <include location="Feedworm.qrc"/>
+ </resources>
  <connections>
   <connection>
    <sender>buttonBox</sender>