changeset 88:48d1d7bba548

UI for setting the proxy settings
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 18 Nov 2010 12:14:41 +0100
parents b8bfd1bd6c55
children 2eddb44920d1
files PreferencesDialog.py Ui_Preferences.ui
diffstat 2 files changed, 71 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/PreferencesDialog.py	Wed Nov 17 21:22:31 2010 +0100
+++ b/PreferencesDialog.py	Thu Nov 18 12:14:41 2010 +0100
@@ -11,17 +11,24 @@
         self.ui = Ui_Preferences()
         self.ui.setupUi(self)
         self.fillUi()
-        
+
     def fillUi(self):
         maximized = self.preferences.startMaximized()
         self.ui.startMaximized.setChecked(maximized)
-        
+
         hideRead = self.preferences.hideReadFeedEntries()
         self.ui.hideReadFeedEntries.setChecked(hideRead)
-        
+
         showOnlyUnreadFeeds = self.preferences.showOnlyUnreadFeeds()
         self.ui.showOnlyUnreadFeeds.setChecked(showOnlyUnreadFeeds)
 
+        self.fillProxySettings()
+
+    def fillProxySettings(self):
+        if self.preferences.isProxyConfigured():
+            self.ui.proxyHost.setText(self.preferences.proxyHost())
+            self.ui.proxyPort.setText(str(self.preferences.proxyPort()))
+
     def startMaximizedChanged(self, change):
         if change:
             self.preferences.setStartMaximized(True)
@@ -40,12 +47,19 @@
         else:
             self.preferences.setShowOnlyUnreadFeeds(False)
 
+    def storeProxySettings(self):
+        proxyHost = str(self.ui.proxyHost.text())
+        self.preferences.setProxyHost(proxyHost)
+
+        proxyPort = int(self.ui.proxyPort.text())
+        self.preferences.setProxyPort(proxyPort)
+
     def accept(self):
+        self.storeProxySettings()
         self.session.commit()
         QtGui.QDialog.accept(self)
-        
+
     def reject(self):
         self.session.rollback()
         QtGui.QDialog.reject(self)
-        
-        
\ No newline at end of file
+
--- a/Ui_Preferences.ui	Wed Nov 17 21:22:31 2010 +0100
+++ b/Ui_Preferences.ui	Thu Nov 18 12:14:41 2010 +0100
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>152</height>
+    <width>390</width>
+    <height>247</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -20,10 +20,10 @@
   <widget class="QDialogButtonBox" name="buttonBox">
    <property name="geometry">
     <rect>
-     <x>30</x>
-     <y>110</y>
-     <width>341</width>
-     <height>32</height>
+     <x>10</x>
+     <y>210</y>
+     <width>160</width>
+     <height>27</height>
     </rect>
    </property>
    <property name="orientation">
@@ -72,6 +72,51 @@
     <string>Show only feeds that have unread entries</string>
    </property>
   </widget>
+  <widget class="QGroupBox" name="groupBox">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>100</y>
+     <width>353</width>
+     <height>96</height>
+    </rect>
+   </property>
+   <property name="title">
+    <string>Web Proxy</string>
+   </property>
+   <widget class="QWidget" name="">
+    <property name="geometry">
+     <rect>
+      <x>6</x>
+      <y>18</y>
+      <width>336</width>
+      <height>71</height>
+     </rect>
+    </property>
+    <layout class="QGridLayout" name="gridLayout">
+     <item row="1" column="0">
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string>Port</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QLineEdit" name="proxyHost"/>
+     </item>
+     <item row="1" column="1">
+      <widget class="QLineEdit" name="proxyPort"/>
+     </item>
+     <item row="0" column="0">
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Host</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </widget>
+  </widget>
  </widget>
  <resources>
   <include location="Feedworm.qrc"/>