changeset 40:c858aab71e5b

add preferences dialog
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 14 May 2010 07:05:02 +0200
parents 0c2578196643
children 9fa1e33b67da
files MainWindow.py Preferences.py Ui_MainWindow.ui Ui_Preferences.ui
diffstat 4 files changed, 145 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MainWindow.py	Fri May 14 06:48:48 2010 +0200
+++ b/MainWindow.py	Fri May 14 07:05:02 2010 +0200
@@ -3,6 +3,7 @@
 from DisplayModel import DisplayModel
 from Feed import Feed
 from FeedEntry import FeedEntry
+from Preferences import Preferences
 from PyQt4 import QtGui
 from PyQt4.QtCore import QUrl
 from PyQt4.QtGui import QFont
@@ -66,6 +67,11 @@
         url = QUrl(self.selectedEntry.link)
         self.ui.webView.load(url)
         self.ui.webView.show()
+        
+    def showPreferences(self):
+        preferences = Preferences(self.session)
+        preferences.exec_()
+        
 
 class FeedEntryItemDelegate(QtGui.QStyledItemDelegate):
     def __init__(self):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Preferences.py	Fri May 14 07:05:02 2010 +0200
@@ -0,0 +1,13 @@
+
+from PyQt4 import QtGui
+from Ui_Preferences import Ui_Preferences
+
+class Preferences(QtGui.QDialog):
+    def __init__(self, session=None):
+        QtGui.QWidget.__init__(self, None)
+        self.session = session
+        self.ui = Ui_Preferences()
+        self.ui.setupUi(self)
+
+    def startMaximizedChanged(self, change):
+        print("start maximized: " + str(change))
--- a/Ui_MainWindow.ui	Fri May 14 06:48:48 2010 +0200
+++ b/Ui_MainWindow.ui	Fri May 14 07:05:02 2010 +0200
@@ -15,7 +15,7 @@
   </property>
   <property name="windowIcon">
    <iconset>
-    <normaloff>worm.png</normaloff>worm.png</iconset>
+    <normaloff>../../../.designer/backup/worm.png</normaloff>../../../.designer/backup/worm.png</iconset>
   </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QGridLayout" name="gridLayout">
@@ -136,11 +136,14 @@
   </action>
   <action name="actionPreferences">
    <property name="enabled">
-    <bool>false</bool>
+    <bool>true</bool>
    </property>
    <property name="text">
     <string>Preferences</string>
    </property>
+   <property name="shortcut">
+    <string>Ctrl+.</string>
+   </property>
   </action>
   <action name="actionFeedSettings">
    <property name="enabled">
@@ -272,6 +275,22 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>actionPreferences</sender>
+   <signal>activated()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>showPreferences()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>495</x>
+     <y>374</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>addFeed()</slot>
@@ -280,5 +299,6 @@
   <slot>toggleReadOnSelectedEntry()</slot>
   <slot>openSelectedEntryInBrowser()</slot>
   <slot>openLinkFromSelectedEntry()</slot>
+  <slot>showPreferences()</slot>
  </slots>
 </ui>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ui_Preferences.ui	Fri May 14 07:05:02 2010 +0200
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Preferences</class>
+ <widget class="QDialog" name="Preferences">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Preferences</string>
+  </property>
+  <property name="windowIcon">
+   <iconset>
+    <normaloff>worm.png</normaloff>worm.png</iconset>
+  </property>
+  <widget class="QDialogButtonBox" name="buttonBox">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>240</y>
+     <width>341</width>
+     <height>32</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+   </property>
+  </widget>
+  <widget class="QCheckBox" name="startMaximized">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>141</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Start maximized</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>Preferences</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>Preferences</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>startMaximized</sender>
+   <signal>stateChanged(int)</signal>
+   <receiver>Preferences</receiver>
+   <slot>startMaximizedChanged()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>80</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>149</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+ <slots>
+  <slot>startMaximizedChanged()</slot>
+ </slots>
+</ui>