changeset 14:42a225be7e56

first version of the GUI
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 28 Apr 2010 02:36:00 +0200
parents 591ecc2a99bd
children b1aeb98824c1
files .hgignore MainWindowController.py Makefile Ui_MainWindow.ui feedupdate-main.py feedworm-gui.py
diffstat 6 files changed, 104 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Apr 28 02:23:00 2010 +0200
+++ b/.hgignore	Wed Apr 28 02:36:00 2010 +0200
@@ -1,2 +1,5 @@
 syntax: glob
 *.pyc
+Ui_*.py
+
+syntax: regexp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MainWindowController.py	Wed Apr 28 02:36:00 2010 +0200
@@ -0,0 +1,10 @@
+
+from Ui_MainWindow import Ui_MainWindow
+from PyQt4 import QtGui
+
+class MainWindowController(QtGui.QMainWindow):
+    def __init__(self, session=None):
+        QtGui.QWidget.__init__(self, None)
+        self.session = session
+        self.ui = Ui_MainWindow()
+        self.ui.setupUi(self)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Wed Apr 28 02:36:00 2010 +0200
@@ -0,0 +1,13 @@
+
+# find all .ui files and generate corresponding filenames ending in .py
+PY_FILES = $(patsubst %.ui, %.py, $(wildcard *.ui))
+
+all: $(PY_FILES)
+
+%.py: %.ui
+	pyuic4 -o $@ $<
+
+.PHONY: clean
+clean:
+	rm $(PY_FILES)
+	rm *.pyc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ui_MainWindow.ui	Wed Apr 28 02:36:00 2010 +0200
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Feedworm</string>
+  </property>
+  <widget class="QWidget" name="centralwidget"/>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>800</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuFeed">
+    <property name="title">
+     <string>Feed</string>
+    </property>
+    <addaction name="actionQuit"/>
+   </widget>
+   <addaction name="menuFeed"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="actionQuit">
+   <property name="text">
+    <string>Quit</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Q</string>
+   </property>
+  </action>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>actionQuit</sender>
+   <signal>activated()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>399</x>
+     <y>299</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
--- a/feedupdate-main.py	Wed Apr 28 02:23:00 2010 +0200
+++ b/feedupdate-main.py	Wed Apr 28 02:36:00 2010 +0200
@@ -1,9 +1,9 @@
 #!/usr/bin/env python
 
-from util import configureLogging, createSession
 from Feed import Feed
 from FeedUpdater import updateAllFeeds
 import logging
+from util import configureLogging, createSession
 
 logger = logging.getLogger("feedupdater")
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/feedworm-gui.py	Wed Apr 28 02:36:00 2010 +0200
@@ -0,0 +1,14 @@
+
+from MainWindowController import MainWindowController
+from PyQt4 import QtGui
+import sys
+from util import configureLogging, createSession
+
+if __name__ == '__main__':
+    configureLogging()
+    session = createSession()
+    
+    app = QtGui.QApplication(sys.argv)
+    mainWindowController = MainWindowController(session)
+    mainWindowController.show()
+    sys.exit(app.exec_())