Index: palm/trunk/SCRIPTS/palm_gf_files/palm_gf.ui
===================================================================
--- palm/trunk/SCRIPTS/palm_gf_files/palm_gf.ui	(revision 2116)
+++ palm/trunk/SCRIPTS/palm_gf_files/palm_gf.ui	(revision 2308)
@@ -6,4 +6,7 @@
    <enum>Qt::WindowModal</enum>
   </property>
+  <property name="enabled">
+   <bool>true</bool>
+  </property>
   <property name="geometry">
    <rect>
@@ -11,5 +14,5 @@
     <y>0</y>
     <width>584</width>
-    <height>375</height>
+    <height>386</height>
    </rect>
   </property>
@@ -82,4 +85,7 @@
       <item>
        <widget class="QSpinBox" name="nx_min_box">
+        <property name="toolTip">
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Minimum of number of Gridpoints in X-direction.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+        </property>
         <property name="minimum">
          <number>1</number>
@@ -92,4 +98,7 @@
       <item>
        <widget class="QSpinBox" name="ny_min_box">
+        <property name="toolTip">
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Minimum of number of Gridpoints in Y-direction.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+        </property>
         <property name="minimum">
          <number>1</number>
@@ -102,4 +111,7 @@
       <item>
        <widget class="QSpinBox" name="nz_min_box">
+        <property name="toolTip">
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Minimum of number of Gridpoints in Z-direction.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+        </property>
         <property name="minimum">
          <number>1</number>
@@ -124,4 +136,16 @@
       <item>
        <widget class="QSpinBox" name="nx_max_box">
+        <property name="toolTip">
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Maximum of number of Gridpoints in X-direction.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+        </property>
+        <property name="autoFillBackground">
+         <bool>false</bool>
+        </property>
+        <property name="styleSheet">
+         <string notr="true"/>
+        </property>
+        <property name="frame">
+         <bool>true</bool>
+        </property>
         <property name="minimum">
          <number>1</number>
@@ -134,4 +158,7 @@
       <item>
        <widget class="QSpinBox" name="ny_max_box">
+        <property name="toolTip">
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Maxmimum of number of Gridpoints in Y-direction.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+        </property>
         <property name="minimum">
          <number>1</number>
@@ -144,4 +171,7 @@
       <item>
        <widget class="QSpinBox" name="nz_max_box">
+        <property name="toolTip">
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Maximum of number of Gridpoints in Z-direction.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+        </property>
         <property name="minimum">
          <number>1</number>
@@ -162,4 +192,7 @@
        <height>22</height>
       </rect>
+     </property>
+     <property name="toolTip">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Defines Ratio between the number of Gridpoints in X- and Y-direction.&lt;/p&gt;&lt;p&gt;If nx/ny = 0 , option is deactivated&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
      </property>
      <property name="maximum">
@@ -239,5 +272,5 @@
      </property>
      <property name="text">
-      <string>   ny</string>
+      <string>   nz</string>
      </property>
      <property name="scaledContents">
@@ -270,5 +303,5 @@
      </property>
      <property name="text">
-      <string>    nz</string>
+      <string>    ny</string>
      </property>
     </widget>
@@ -297,4 +330,23 @@
      <property name="text">
       <string>Maximum</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="warning_label">
+     <property name="geometry">
+      <rect>
+       <x>230</x>
+       <y>155</y>
+       <width>121</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <property name="autoFillBackground">
+      <bool>false</bool>
+     </property>
+     <property name="styleSheet">
+      <string notr="true"/>
+     </property>
+     <property name="text">
+      <string>Input error! Min &gt; Max</string>
      </property>
     </widget>
@@ -306,5 +358,5 @@
       <y>0</y>
       <width>211</width>
-      <height>201</height>
+      <height>221</height>
      </rect>
     </property>
@@ -399,5 +451,5 @@
        <x>22</x>
        <y>94</y>
-       <width>51</width>
+       <width>61</width>
        <height>21</height>
       </rect>
@@ -405,36 +457,4 @@
      <property name="text">
       <string>Maximum</string>
-     </property>
-    </widget>
-    <widget class="QLabel" name="label_8">
-     <property name="geometry">
-      <rect>
-       <x>16</x>
-       <y>130</y>
-       <width>89</width>
-       <height>27</height>
-      </rect>
-     </property>
-     <property name="toolTip">
-      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tasks per node. Default value: 24&lt;/p&gt;&lt;p&gt;If Tasks / Node = 0 , option is deactivated (not recommended).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-     </property>
-     <property name="text">
-      <string>Tasks / Node</string>
-     </property>
-    </widget>
-    <widget class="QLabel" name="label_10">
-     <property name="geometry">
-      <rect>
-       <x>16</x>
-       <y>164</y>
-       <width>89</width>
-       <height>21</height>
-      </rect>
-     </property>
-     <property name="toolTip">
-      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Ratio between number of processors in X- and Y-direction.&lt;/p&gt;&lt;p&gt;If npex / npey = 0,00 , option is deactivated.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-     </property>
-     <property name="text">
-      <string>npex / npey</string>
      </property>
     </widget>
@@ -466,4 +486,7 @@
       </size>
      </property>
+     <property name="toolTip">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Maximum of number of processors used for calculation.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
      <property name="minimum">
       <number>1</number>
@@ -500,4 +523,7 @@
       </size>
      </property>
+     <property name="toolTip">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Minimum of number of processors used for calculation.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
      <property name="minimum">
       <number>1</number>
@@ -507,68 +533,138 @@
      </property>
     </widget>
-    <widget class="QSpinBox" name="tpn_box">
-     <property name="geometry">
-      <rect>
-       <x>110</x>
+    <widget class="QWidget" name="layoutWidget">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
        <y>130</y>
-       <width>72</width>
-       <height>25</height>
-      </rect>
-     </property>
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="minimumSize">
-      <size>
-       <width>72</width>
-       <height>25</height>
-      </size>
-     </property>
-     <property name="maximumSize">
-      <size>
-       <width>72</width>
-       <height>25</height>
-      </size>
-     </property>
-     <property name="maximum">
-      <number>10000</number>
+       <width>182</width>
+       <height>27</height>
+      </rect>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QCheckBox" name="strict_box">
+        <property name="toolTip">
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Fixed value for the tasks per node&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+        </property>
+        <property name="text">
+         <string>Strict Matching</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSpinBox" name="tpn_box">
+        <property name="enabled">
+         <bool>true</bool>
+        </property>
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>72</width>
+          <height>25</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>72</width>
+          <height>25</height>
+         </size>
+        </property>
+        <property name="toolTip">
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Fixed value for the tasks per node&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+        </property>
+        <property name="maximum">
+         <number>10000</number>
+        </property>
+        <property name="value">
+         <number>24</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+    <widget class="QSlider" name="tolerance_bar">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>190</y>
+       <width>121</width>
+       <height>23</height>
+      </rect>
+     </property>
+     <property name="toolTip">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tolerance for npex / npey&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
      </property>
      <property name="value">
-      <number>24</number>
-     </property>
-    </widget>
-    <widget class="QDoubleSpinBox" name="d_box">
-     <property name="geometry">
-      <rect>
-       <x>110</x>
-       <y>162</y>
-       <width>72</width>
-       <height>25</height>
-      </rect>
-     </property>
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="minimumSize">
-      <size>
-       <width>72</width>
-       <height>25</height>
-      </size>
-     </property>
-     <property name="maximumSize">
-      <size>
-       <width>72</width>
-       <height>25</height>
-      </size>
-     </property>
-     <property name="maximum">
-      <double>1000.000000000000000</double>
-     </property>
+      <number>10</number>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+    <widget class="QSpinBox" name="tolerance_value">
+     <property name="geometry">
+      <rect>
+       <x>131</x>
+       <y>190</y>
+       <width>61</width>
+       <height>22</height>
+      </rect>
+     </property>
+     <property name="toolTip">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tolerance for npex / npey in percent&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+     <property name="value">
+      <number>10</number>
+     </property>
+    </widget>
+    <widget class="QWidget" name="layoutWidget">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>160</y>
+       <width>181</width>
+       <height>27</height>
+      </rect>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_4">
+      <item>
+       <widget class="QCheckBox" name="npex_npey_box">
+        <property name="text">
+         <string>npex / npey</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QDoubleSpinBox" name="d_box">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>72</width>
+          <height>25</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>72</width>
+          <height>25</height>
+         </size>
+        </property>
+        <property name="maximum">
+         <double>1000.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+     </layout>
     </widget>
    </widget>
@@ -665,10 +761,10 @@
      <item>
       <property name="text">
-       <string>multigrid</string>
+       <string>multigrid_noopt</string>
       </property>
      </item>
      <item>
       <property name="text">
-       <string>multigrid_fast</string>
+       <string>multigrid</string>
       </property>
      </item>
@@ -846,5 +942,5 @@
      <rect>
       <x>380</x>
-      <y>220</y>
+      <y>240</y>
       <width>197</width>
       <height>31</height>
@@ -865,7 +961,7 @@
      <rect>
       <x>370</x>
-      <y>180</y>
+      <y>218</y>
       <width>179</width>
-      <height>59</height>
+      <height>20</height>
      </rect>
     </property>
@@ -876,19 +972,9 @@
      </font>
     </property>
+    <property name="toolTip">
+     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;tolerance for npex / npey&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+    </property>
     <property name="text">
      <string>Results</string>
-    </property>
-   </widget>
-   <widget class="Line" name="line_res_up">
-    <property name="geometry">
-     <rect>
-      <x>360</x>
-      <y>190</y>
-      <width>201</width>
-      <height>20</height>
-     </rect>
-    </property>
-    <property name="orientation">
-     <enum>Qt::Horizontal</enum>
     </property>
    </widget>
@@ -897,5 +983,5 @@
      <rect>
       <x>360</x>
-      <y>280</y>
+      <y>300</y>
       <width>201</width>
       <height>20</height>
@@ -910,5 +996,5 @@
      <rect>
       <x>490</x>
-      <y>261</y>
+      <y>281</y>
       <width>75</width>
       <height>23</height>
@@ -925,91 +1011,9 @@
     </property>
    </widget>
-   <widget class="QTableWidget" name="tableWidget">
-    <property name="geometry">
-     <rect>
-      <x>10</x>
-      <y>340</y>
-      <width>491</width>
-      <height>241</height>
-     </rect>
-    </property>
-    <property name="sizePolicy">
-     <sizepolicy hsizetype="Maximum" vsizetype="Expanding">
-      <horstretch>0</horstretch>
-      <verstretch>0</verstretch>
-     </sizepolicy>
-    </property>
-    <property name="maximumSize">
-     <size>
-      <width>900</width>
-      <height>16777215</height>
-     </size>
-    </property>
-    <property name="layoutDirection">
-     <enum>Qt::LeftToRight</enum>
-    </property>
-    <property name="frameShape">
-     <enum>QFrame::Box</enum>
-    </property>
-    <property name="frameShadow">
-     <enum>QFrame::Sunken</enum>
-    </property>
-    <property name="lineWidth">
-     <number>1</number>
-    </property>
-    <property name="horizontalScrollBarPolicy">
-     <enum>Qt::ScrollBarAlwaysOff</enum>
-    </property>
-    <property name="showGrid">
-     <bool>true</bool>
-    </property>
-    <property name="sortingEnabled">
-     <bool>true</bool>
-    </property>
-    <attribute name="horizontalHeaderVisible">
-     <bool>true</bool>
-    </attribute>
-    <attribute name="horizontalHeaderCascadingSectionResizes">
-     <bool>false</bool>
-    </attribute>
-    <attribute name="horizontalHeaderDefaultSectionSize">
-     <number>80</number>
-    </attribute>
-    <column>
-     <property name="text">
-      <string>np</string>
-     </property>
-    </column>
-    <column>
-     <property name="text">
-      <string>npex</string>
-     </property>
-    </column>
-    <column>
-     <property name="text">
-      <string>npey</string>
-     </property>
-    </column>
-    <column>
-     <property name="text">
-      <string>nx</string>
-     </property>
-    </column>
-    <column>
-     <property name="text">
-      <string>ny</string>
-     </property>
-    </column>
-    <column>
-     <property name="text">
-      <string>nz</string>
-     </property>
-    </column>
-   </widget>
    <widget class="QLabel" name="load_text_label">
     <property name="geometry">
      <rect>
       <x>379</x>
-      <y>261</y>
+      <y>281</y>
       <width>42</width>
       <height>23</height>
@@ -1042,5 +1046,5 @@
      <rect>
       <x>420</x>
-      <y>261</y>
+      <y>281</y>
       <width>61</width>
       <height>23</height>
@@ -1067,5 +1071,5 @@
      <rect>
       <x>490</x>
-      <y>304</y>
+      <y>324</y>
       <width>75</width>
       <height>23</height>
@@ -1101,5 +1105,5 @@
      <rect>
       <x>415</x>
-      <y>304</y>
+      <y>324</y>
       <width>75</width>
       <height>23</height>
@@ -1120,4 +1124,30 @@
       <height>18</height>
      </size>
+    </property>
+   </widget>
+   <widget class="QProgressBar" name="testbar">
+    <property name="geometry">
+     <rect>
+      <x>364</x>
+      <y>239</y>
+      <width>206</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="value">
+     <number>0</number>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="question_box">
+    <property name="geometry">
+     <rect>
+      <x>395</x>
+      <y>324</y>
+      <width>21</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>?</string>
     </property>
    </widget>
@@ -1129,5 +1159,5 @@
      <y>0</y>
      <width>584</width>
-     <height>21</height>
+     <height>20</height>
     </rect>
    </property>
@@ -1136,4 +1166,5 @@
      <string>Gridfinder</string>
     </property>
+    <addaction name="actionSetting"/>
     <addaction name="actionSchlie_en"/>
    </widget>
@@ -1144,4 +1175,9 @@
    <property name="text">
     <string>SchlieÃen</string>
+   </property>
+  </action>
+  <action name="actionSetting">
+   <property name="text">
+    <string>Settings</string>
    </property>
   </action>
@@ -1167,5 +1203,4 @@
   <tabstop>quitbutton</tabstop>
   <tabstop>filename_line</tabstop>
-  <tabstop>tableWidget</tabstop>
   <tabstop>Oos_checkbox</tabstop>
  </tabstops>
@@ -1188,4 +1223,100 @@
    </hints>
   </connection>
+  <connection>
+   <sender>strict_box</sender>
+   <signal>clicked(bool)</signal>
+   <receiver>tpn_box</receiver>
+   <slot>setVisible(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>422</x>
+     <y>193</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>514</x>
+     <y>193</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>npex_npey_box</sender>
+   <signal>clicked(bool)</signal>
+   <receiver>d_box</receiver>
+   <slot>setVisible(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>422</x>
+     <y>193</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>513</x>
+     <y>193</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>tolerance_bar</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>tolerance_value</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>430</x>
+     <y>221</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>521</x>
+     <y>220</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>npex_npey_box</sender>
+   <signal>clicked(bool)</signal>
+   <receiver>tolerance_bar</receiver>
+   <slot>setVisible(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>422</x>
+     <y>193</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>430</x>
+     <y>221</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>npex_npey_box</sender>
+   <signal>clicked(bool)</signal>
+   <receiver>tolerance_value</receiver>
+   <slot>setVisible(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>422</x>
+     <y>193</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>521</x>
+     <y>220</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>tolerance_value</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>tolerance_bar</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>521</x>
+     <y>220</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>430</x>
+     <y>221</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>
Index: palm/trunk/SCRIPTS/palm_gf_files/palm_gf_conf.py
===================================================================
--- palm/trunk/SCRIPTS/palm_gf_files/palm_gf_conf.py	(revision 2116)
+++ palm/trunk/SCRIPTS/palm_gf_files/palm_gf_conf.py	(revision 2308)
@@ -1,4 +1,4 @@
-def write_config(np_min, np_max, nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, tpn, dnpexnpey, dnxny, poisfft, switch,
-                 temperton, mlt_grid, spectr):
+def write_config(np_min, np_max, nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, tpn, dnpexnpey, dnpexnpey_tolerance, dnxny, poisfft, switch,
+                 temperton, mlt_grid, spectr, rslt_thrs, ld_thrs):
     #from configparser import ConfigParser  # windows
     from ConfigParser import ConfigParser  # Linux
@@ -7,12 +7,19 @@
     cfg = ConfigParser()
 
-    cfg.add_section("processor_topology")
+    import os.path
+    if os.path.exists('.palm_gf_conf') is False:
+        cfg.add_section("processor_topology")
+        cfg.add_section("numerical_grid")
+        cfg.add_section("method")
+
+    #cfg.add_section("processor_topology")
     cfg.set("processor_topology", "np_min", np_min)
     cfg.set("processor_topology", "np_max", np_max)
     cfg.set("processor_topology", "tasks_per_node", tpn)
     cfg.set("processor_topology", "dnpexnpey", dnpexnpey)
+    cfg.set("processor_topology", "dnpexnpey_tolerance", dnpexnpey_tolerance)
     cfg.set("processor_topology", "dnxny", dnxny)
 
-    cfg.add_section("numerical_grid")
+    #cfgadd_section("numerical_grid").
     cfg.set("numerical_grid", "nx_min", nx_min)
     cfg.set("numerical_grid", "nx_max", nx_max)
@@ -22,5 +29,5 @@
     cfg.set("numerical_grid", "nz_max", nz_max)
 
-    cfg.add_section("method")
+    #cfg.add_section("method")
     cfg.set("method", "poisfft", poisfft)
     cfg.set("method", "switch", switch)
@@ -29,5 +36,11 @@
     cfg.set("method", "spectr", spectr)
 
-    with open(".palm_gf_config", "w") as configfile:
+    #cfg.add_section("settings")
+    #cfg.set("settings", "path", path)
+    #cfg.set("settings", "result_threshold", rslt_thrs)
+    #cfg.set("settings", "load_threshold", ld_thrs)
+
+
+    with open(".palm_gf_config", "a") as configfile:
         cfg.write(configfile)
 
@@ -36,4 +49,5 @@
     #from configparser import ConfigParser  # windows
     from ConfigParser import ConfigParser  # Linux
+
 
     cfg = ConfigParser()
@@ -44,4 +58,5 @@
     tpn = cfg.get("processor_topology", "tasks_per_node")
     dnpexnpey = cfg.get("processor_topology", "dnpexnpey")
+    dnpexnpey_tolerance = cfg.get("processor_topology", "dnpexnpey_tolerance")
     dnxny = cfg.get("processor_topology", "dnxny")
 
@@ -59,3 +74,217 @@
     spectr = cfg.get("method", "spectr")
 
-    return np_min, np_max, tpn, dnpexnpey, dnxny, nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, poisfft, switch, temperton, mlt_grid, spectr
+    import ConfigParser as conf
+    try:
+        result_threshold = cfg.get("settings", "result_threshold")
+        load_threshold = cfg.get("settings", "load_threshold")
+        path = cfg.get("settings", 'path')
+
+    except conf.NoSectionError:
+
+        path = '/localdata/'
+        result_threshold = 250000
+        load_threshold = 100000
+
+    return np_min, np_max, tpn, dnpexnpey, dnpexnpey_tolerance, dnxny, nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, poisfft, switch, temperton, mlt_grid, spectr, result_threshold, load_threshold, path
+
+
+def write_config_settings(path, rslt_thrs, ld_thrs):
+
+    from ConfigParser import ConfigParser
+
+    cfg = ConfigParser()
+
+    cfg.add_section('settings')
+
+    cfg.set('settings', 'path', path)
+    cfg.set('settings', "result_threshold", rslt_thrs)
+    cfg.set('settings', "load_threshold", ld_thrs)
+
+    with open(".palm_gf_config", "a") as configfile:
+        cfg.write(configfile)
+
+
+def read_config_settings():
+
+    from ConfigParser import ConfigParser
+    import ConfigParser as con
+
+    cfg = ConfigParser()
+    cfg.read(".palm_gf_config")
+
+    try:
+        path = cfg.get("settings", "path")
+        result_thrs = cfg.get("settings", "result_threshold")
+        load_thrs = cfg.get("settings", "load_threshold")
+
+    except con.NoSectionError:
+
+        path = '/localdata/'
+        result_thrs = 250000
+        load_thrs = 100000
+
+    except con.NoOptionError:
+
+        path = '/localdata/'
+        result_thrs = 250000
+        load_thrs = 100000
+
+    #print path, result_thrs, load_thrs
+
+    return path, result_thrs, load_thrs
+
+
+# ***********************************************
+
+
+def closing_cleanup():
+    from ConfigParser import ConfigParser  # Linux
+    import ConfigParser as conf
+    import os, shutil, time
+
+    cfg = ConfigParser()
+
+    try:
+
+        cfg.read(".palm_gf_config")
+        np_min = cfg.get("processor_topology", "np_min")
+        np_max = cfg.get("processor_topology", "np_max")
+        tpn = cfg.get("processor_topology", "tasks_per_node")
+        dnpexnpey = cfg.get("processor_topology", "dnpexnpey")
+        dnpexnpey_tolerance = cfg.get("processor_topology", "dnpexnpey_tolerance")
+        dnxny = cfg.get("processor_topology", "dnxny")
+
+        nx_min = cfg.get("numerical_grid", "nx_min")
+        nx_max = cfg.get("numerical_grid", "nx_max")
+        ny_min = cfg.get("numerical_grid", "ny_min")
+        ny_max = cfg.get("numerical_grid", "ny_max")
+        nz_min = cfg.get("numerical_grid", "nz_min")
+        nz_max = cfg.get("numerical_grid", "nz_max")
+
+        poisfft = cfg.get("method", "poisfft")
+        switch = cfg.get("method", "switch")
+        temperton = cfg.get("method", "temperton")
+        mlt_grid = cfg.get("method", "mlt_grid")
+        spectr = cfg.get("method", "spectr")
+
+        var1_bool = True
+
+    except conf.NoSectionError:
+        np_min = 0
+        np_max = 0
+        tpn = 0
+        dnpexnpey = 0
+        dnpexnpey_tolerance = 0
+        dnxny = 0
+
+        nx_min = 0
+        nx_max = 0
+        ny_min = 0
+        ny_max = 0
+        nz_min = 0
+        nz_max = 0
+
+        poisfft = False
+        switch = False
+        temperton = False
+        mlt_grid = False
+        spectr = False
+        var1_bool = False
+
+    with open(".palm_gf_config", "w") as configfile:
+        cfg.write(configfile)
+
+    try:
+        cfg.read(".palm_gf_config")
+        rslt_thrs = cfg.get("settings", "result_threshold")
+        ld_thrs = cfg.get("settings", "load_threshold")
+        path = cfg.get("settings", 'path')
+
+        var2_bool = True
+
+    except conf.NoSectionError:
+
+        path = '/localdata/'
+        rslt_thrs = 250000
+        ld_thrs = 100000
+
+        var2_bool = False
+
+
+
+    with open(".palm_gf_config", "w") as configfile:
+        cfg.write(configfile)
+
+
+
+    #os.remove('.palm_gf_config')
+
+
+
+    try:
+        cfg.set("processor_topology", "np_min", np_min)
+        cfg.set("processor_topology", "np_max", np_max)
+        cfg.set("processor_topology", "tasks_per_node", tpn)
+        cfg.set("processor_topology", "dnpexnpey", dnpexnpey)
+        cfg.set("processor_topology", "dnpexnpey_tolerance", dnpexnpey_tolerance)
+        cfg.set("processor_topology", "dnxny", dnxny)
+
+
+        cfg.set("numerical_grid", "nx_min", nx_min)
+        cfg.set("numerical_grid", "nx_max", nx_max)
+        cfg.set("numerical_grid", "ny_min", ny_min)
+        cfg.set("numerical_grid", "ny_max", ny_max)
+        cfg.set("numerical_grid", "nz_min", nz_min)
+        cfg.set("numerical_grid", "nz_max", nz_max)
+
+
+        cfg.set("method", "poisfft", poisfft)
+        cfg.set("method", "switch", switch)
+        cfg.set("method", "temperton", temperton)
+        cfg.set("method", "mlt_grid", mlt_grid)
+        cfg.set("method", "spectr", spectr)
+
+    except conf.NoSectionError:
+        cfg.add_section("processor_topology")
+        cfg.set("processor_topology", "np_min", np_min)
+        cfg.set("processor_topology", "np_max", np_max)
+        cfg.set("processor_topology", "tasks_per_node", tpn)
+        cfg.set("processor_topology", "dnpexnpey", dnpexnpey)
+        cfg.set("processor_topology", "dnpexnpey_tolerance", dnpexnpey_tolerance)
+        cfg.set("processor_topology", "dnxny", dnxny)
+
+        cfg.add_section("numerical_grid")
+        cfg.set("numerical_grid", "nx_min", nx_min)
+        cfg.set("numerical_grid", "nx_max", nx_max)
+        cfg.set("numerical_grid", "ny_min", ny_min)
+        cfg.set("numerical_grid", "ny_max", ny_max)
+        cfg.set("numerical_grid", "nz_min", nz_min)
+        cfg.set("numerical_grid", "nz_max", nz_max)
+
+        cfg.add_section("method")
+        cfg.set("method", "poisfft", poisfft)
+        cfg.set("method", "switch", switch)
+        cfg.set("method", "temperton", temperton)
+        cfg.set("method", "mlt_grid", mlt_grid)
+        cfg.set("method", "spectr", spectr)
+
+
+    try:
+        cfg.set("settings", "path", path)
+        cfg.set("settings", "result_threshold", rslt_thrs)
+        cfg.set("settings", "load_threshold", ld_thrs)
+
+    except conf.NoSectionError:
+        cfg.add_section("settings")
+        cfg.set("settings", "path", path)
+        cfg.set("settings", "result_threshold", rslt_thrs)
+        cfg.set("settings", "load_threshold", ld_thrs)
+
+
+
+
+
+
+    with open(".palm_gf_config", "w") as configfile:
+        cfg.write(configfile)
+
Index: palm/trunk/SCRIPTS/palm_gf_files/palm_gf_exec.py
===================================================================
--- palm/trunk/SCRIPTS/palm_gf_files/palm_gf_exec.py	(revision 2116)
+++ palm/trunk/SCRIPTS/palm_gf_files/palm_gf_exec.py	(revision 2308)
@@ -6,5 +6,4 @@
     c.execute("DROP TABLE IF EXISTS grid_current")
     c.execute("DROP TABLE IF EXISTS grid_limits")
-    #c.execute("CREATE TABLE IF NOT EXISTS grid_current(np INT, npex INT, npey INT, nx INT, ny INT, nz INT)")
     c.execute("CREATE TABLE IF NOT EXISTS grid_current(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT)")
     c.execute("CREATE TABLE IF NOT EXISTS grid_limits(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT)")
@@ -56,5 +55,4 @@
 
     print(spectr, type(spectr))
-    results = open(".palm_gf_results", "w")
     print(poisfft, switch, tempterton, mlt_grid, spectr)
 
@@ -177,12 +175,8 @@
 
                             npxnpy = format(float(npex)/float(npey), '.2f')
-                            results.write(
-                                str(" npex: ") + str(npex) + str(" npey: ") + str(npey) + str(" nx: ") + str(nx) + str(
-                                    " ny: ") + str(ny) + str(" nz: ") + str(nz) + "\n")
                             c.execute("""INSERT OR REPLACE INTO grid_current(nx, ny, nz, npex, npey, npxnpy, np, ngpts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",
                             (nx, ny, nz, npex, npey, npxnpy, (npex * npey), (nx*ny*nz)))
-                            #print(npxnpy)
-
-                            nz += 1
+
+                            nz += 11
                         nz = nz_min
                         ny += 1
@@ -198,5 +192,4 @@
 
 
-    results.close()
     conn.commit()
     c.close()
Index: palm/trunk/SCRIPTS/palm_gf_files/palm_gf_settings.ui
===================================================================
--- palm/trunk/SCRIPTS/palm_gf_files/palm_gf_settings.ui	(revision 2308)
+++ palm/trunk/SCRIPTS/palm_gf_files/palm_gf_settings.ui	(revision 2308)
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>560</width>
+    <height>145</height>
+   </rect>
+  </property>
+  <property name="contextMenuPolicy">
+   <enum>Qt::DefaultContextMenu</enum>
+  </property>
+  <property name="windowTitle">
+   <string>Settings</string>
+  </property>
+  <widget class="QDialogButtonBox" name="buttonBox">
+   <property name="geometry">
+    <rect>
+     <x>70</x>
+     <y>100</y>
+     <width>181</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="QWidget" name="layoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>20</y>
+     <width>231</width>
+     <height>78</height>
+    </rect>
+   </property>
+   <layout class="QHBoxLayout" name="horizontalLayout">
+    <item>
+     <widget class="Line" name="line">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QPushButton" name="savepath">
+        <property name="text">
+         <string>path to save</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>result threshold</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="label_3">
+        <property name="text">
+         <string>load threshold</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <widget class="QLineEdit" name="linepath">
+        <property name="text">
+         <string>/localdata/</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSpinBox" name="result_thres">
+        <property name="maximum">
+         <number>9999999</number>
+        </property>
+        <property name="singleStep">
+         <number>10000</number>
+        </property>
+        <property name="value">
+         <number>250000</number>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSpinBox" name="load_thres">
+        <property name="maximum">
+         <number>9999999</number>
+        </property>
+        <property name="singleStep">
+         <number>10000</number>
+        </property>
+        <property name="value">
+         <number>100000</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QTextBrowser" name="textBrowser">
+   <property name="geometry">
+    <rect>
+     <x>280</x>
+     <y>10</y>
+     <width>271</width>
+     <height>131</height>
+    </rect>
+   </property>
+   <property name="html">
+    <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Current Version Remarks:&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- Default Values for thresholds: &lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;        results = 250000&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;        load      = 100000&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- it is recommended to keep threshold values as low as possible&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- gridfinder shows you the complete number of results, but only saves up to the result threshold value&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;-when using FFTW / Temperton, always activate strict matching (for now)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: palm/trunk/SCRIPTS/palm_gf_files/palm_gf_table.ui
===================================================================
--- palm/trunk/SCRIPTS/palm_gf_files/palm_gf_table.ui	(revision 2116)
+++ palm/trunk/SCRIPTS/palm_gf_files/palm_gf_table.ui	(revision 2308)
@@ -7,6 +7,6 @@
     <x>0</x>
     <y>0</y>
-    <width>822</width>
-    <height>483</height>
+    <width>817</width>
+    <height>439</height>
    </rect>
   </property>
@@ -14,35 +14,9 @@
    <string>Dialog</string>
   </property>
-  <widget class="QPushButton" name="pushButton">
-   <property name="geometry">
-    <rect>
-     <x>19</x>
-     <y>79</y>
-     <width>80</width>
-     <height>27</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>Execute filter</string>
-   </property>
-  </widget>
-  <widget class="QPushButton" name="pushButton_2">
-   <property name="geometry">
-    <rect>
-     <x>19</x>
-     <y>107</y>
-     <width>80</width>
-     <height>27</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>Reset limits</string>
-   </property>
-  </widget>
   <widget class="QTableWidget" name="tableWidget">
    <property name="geometry">
     <rect>
-     <x>2</x>
-     <y>171</y>
+     <x>5</x>
+     <y>166</y>
      <width>805</width>
      <height>266</height>
@@ -61,4 +35,7 @@
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
+   <property name="autoScroll">
+    <bool>true</bool>
+   </property>
    <property name="dragEnabled">
     <bool>false</bool>
@@ -67,6 +44,9 @@
     <bool>false</bool>
    </property>
+   <property name="selectionMode">
+    <enum>QAbstractItemView::MultiSelection</enum>
+   </property>
    <property name="selectionBehavior">
-    <enum>QAbstractItemView::SelectRows</enum>
+    <enum>QAbstractItemView::SelectItems</enum>
    </property>
    <property name="sortingEnabled">
@@ -76,4 +56,10 @@
     <number>8</number>
    </property>
+   <attribute name="horizontalHeaderVisible">
+    <bool>false</bool>
+   </attribute>
+   <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
+    <bool>true</bool>
+   </attribute>
    <attribute name="verticalHeaderVisible">
     <bool>false</bool>
@@ -117,90 +103,42 @@
    <column>
     <property name="text">
-     <string>nx</string>
+     <string/>
     </property>
    </column>
    <column>
     <property name="text">
-     <string>ny</string>
+     <string/>
     </property>
    </column>
    <column>
     <property name="text">
-     <string>nz</string>
+     <string/>
     </property>
    </column>
    <column>
     <property name="text">
-     <string>npex</string>
+     <string/>
     </property>
    </column>
    <column>
     <property name="text">
-     <string>npey</string>
+     <string/>
     </property>
    </column>
    <column>
     <property name="text">
-     <string>npex/npey</string>
+     <string/>
     </property>
    </column>
    <column>
     <property name="text">
-     <string>np</string>
+     <string/>
     </property>
    </column>
    <column>
     <property name="text">
-     <string>ngpts</string>
+     <string/>
     </property>
    </column>
-   <item row="0" column="0">
-    <property name="text">
-     <string/>
-    </property>
-   </item>
-   <item row="1" column="0">
-    <property name="text">
-     <string/>
-    </property>
-   </item>
-   <item row="2" column="0">
-    <property name="text">
-     <string/>
-    </property>
-   </item>
-   <item row="3" column="0">
-    <property name="text">
-     <string/>
-    </property>
-   </item>
-   <item row="4" column="0">
-    <property name="text">
-     <string/>
-    </property>
-   </item>
-   <item row="5" column="0">
-    <property name="text">
-     <string/>
-    </property>
-   </item>
-   <item row="6" column="0">
-    <property name="text">
-     <string/>
-    </property>
-   </item>
-  </widget>
-  <widget class="QPushButton" name="pushButton_3">
-   <property name="geometry">
-    <rect>
-     <x>19</x>
-     <y>51</y>
-     <width>80</width>
-     <height>27</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>Load all</string>
-   </property>
   </widget>
   <widget class="Line" name="line">
@@ -848,97 +786,4 @@
    </property>
   </widget>
-  <widget class="QComboBox" name="Sortvariable_box">
-   <property name="geometry">
-    <rect>
-     <x>146</x>
-     <y>140</y>
-     <width>111</width>
-     <height>23</height>
-    </rect>
-   </property>
-   <item>
-    <property name="text">
-     <string>Sorting...</string>
-    </property>
-   </item>
-   <item>
-    <property name="text">
-     <string>nx</string>
-    </property>
-   </item>
-   <item>
-    <property name="text">
-     <string>ny</string>
-    </property>
-   </item>
-   <item>
-    <property name="text">
-     <string>nz</string>
-    </property>
-   </item>
-   <item>
-    <property name="text">
-     <string>npex</string>
-    </property>
-   </item>
-   <item>
-    <property name="text">
-     <string>npey</string>
-    </property>
-   </item>
-   <item>
-    <property name="text">
-     <string>npex/npey</string>
-    </property>
-   </item>
-   <item>
-    <property name="text">
-     <string>np</string>
-    </property>
-   </item>
-   <item>
-    <property name="text">
-     <string>ngpts</string>
-    </property>
-   </item>
-  </widget>
-  <widget class="QComboBox" name="Sortorder_box">
-   <property name="geometry">
-    <rect>
-     <x>260</x>
-     <y>140</y>
-     <width>101</width>
-     <height>23</height>
-    </rect>
-   </property>
-   <item>
-    <property name="text">
-     <string>Order...</string>
-    </property>
-   </item>
-   <item>
-    <property name="text">
-     <string>Ascending</string>
-    </property>
-   </item>
-   <item>
-    <property name="text">
-     <string>Descending</string>
-    </property>
-   </item>
-  </widget>
-  <widget class="QPushButton" name="Sortnow_button">
-   <property name="geometry">
-    <rect>
-     <x>365</x>
-     <y>140</y>
-     <width>90</width>
-     <height>23</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>Sort now</string>
-   </property>
-  </widget>
   <widget class="QLabel" name="label_3">
    <property name="geometry">
@@ -1191,4 +1036,196 @@
     <string>  ngpts</string>
    </property>
+  </widget>
+  <widget class="QPushButton" name="nx_table">
+   <property name="geometry">
+    <rect>
+     <x>6</x>
+     <y>149</y>
+     <width>102</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>nx</string>
+   </property>
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="autoRepeat">
+    <bool>false</bool>
+   </property>
+   <property name="autoDefault">
+    <bool>true</bool>
+   </property>
+   <property name="default">
+    <bool>false</bool>
+   </property>
+   <property name="flat">
+    <bool>false</bool>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="ny_table">
+   <property name="geometry">
+    <rect>
+     <x>105</x>
+     <y>149</y>
+     <width>104</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>ny</string>
+   </property>
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="nz_table">
+   <property name="geometry">
+    <rect>
+     <x>206</x>
+     <y>149</y>
+     <width>102</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>nz</string>
+   </property>
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="npex_table">
+   <property name="geometry">
+    <rect>
+     <x>305</x>
+     <y>149</y>
+     <width>103</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>npex</string>
+   </property>
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="autoRepeat">
+    <bool>false</bool>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="npey_table">
+   <property name="geometry">
+    <rect>
+     <x>405</x>
+     <y>149</y>
+     <width>104</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>npey</string>
+   </property>
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="npexnpey_table">
+   <property name="geometry">
+    <rect>
+     <x>506</x>
+     <y>149</y>
+     <width>102</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>npex/npey</string>
+   </property>
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="np_table">
+   <property name="geometry">
+    <rect>
+     <x>605</x>
+     <y>149</y>
+     <width>103</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>np</string>
+   </property>
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="ngpts_table">
+   <property name="geometry">
+    <rect>
+     <x>705</x>
+     <y>149</y>
+     <width>104</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>ngpts</string>
+   </property>
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QWidget" name="layoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>5</x>
+     <y>25</y>
+     <width>97</width>
+     <height>106</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QPushButton" name="save_to_file_button">
+      <property name="enabled">
+       <bool>false</bool>
+      </property>
+      <property name="toolTip">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Currently Disabled&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+      </property>
+      <property name="text">
+       <string>Save to file</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton_3">
+      <property name="toolTip">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Loads all calculated results. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+      </property>
+      <property name="text">
+       <string>Load all</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton">
+      <property name="text">
+       <string>Execute filter</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton_2">
+      <property name="text">
+       <string>Reset limits</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
   </widget>
  </widget>
@@ -1212,7 +1249,4 @@
   <tabstop>ngpts_max</tabstop>
   <tabstop>pushButton</tabstop>
-  <tabstop>Sortvariable_box</tabstop>
-  <tabstop>Sortorder_box</tabstop>
-  <tabstop>Sortnow_button</tabstop>
   <tabstop>pushButton_2</tabstop>
   <tabstop>tableWidget</tabstop>
Index: palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py
===================================================================
--- palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py	(revision 2116)
+++ palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py	(revision 2308)
@@ -4,4 +4,5 @@
 from PyQt4 import QtCore, QtGui, uic
 import subprocess as sub
+import palm_gf_conf as configwr
    
 out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
@@ -22,5 +23,4 @@
             return self.sortKey < other.sortKey
 
-
     def __init__(self):   #     def __init__(self, parent=None):
         QtGui.QMainWindow.__init__(self)
@@ -31,5 +31,15 @@
         centerpoint = QtGui.QApplication.desktop().screenGeometry(screen).center()
         framegm.moveCenter(centerpoint)
+
+        #centerpoint = str(centerpoint)
+        #xcenter = centerpoint.split('(')[1].split(',')[0]
+        #ycenter = centerpoint.split('(')[1].split(',')[1].split(')')[0]
+        ##print xcenter, ycenter
+        #centerpoint = QtCore.QPoint(int(xcenter) + 418, int(ycenter))
+        #framegm.moveCenter(centerpoint)
         self.move(framegm.topLeft())
+
+
+
         self.setupUi(self)
         self.pushButton_3.clicked.connect(self.load_result)
@@ -37,12 +47,41 @@
         self.load_trigger()
         self.pushButton.clicked.connect(self.filter_results)
-        self.Sortnow_button.clicked.connect(self.sort_order)
+        #self.Sortnow_button.clicked.connect(self.sort_order)
         self.pushButton_2.clicked.connect(self.load_trigger)
+        self.tableWidget.horizontalHeader().setClickable(True)
+
+
+        self.nx_table.clicked.connect(lambda: self.sort_table(str("nx")))
+        self.ny_table.clicked.connect(lambda: self.sort_table(str("ny")))
+        self.nz_table.clicked.connect(lambda: self.sort_table(str("nz")))
+        self.npex_table.clicked.connect(lambda: self.sort_table(str("npex")))
+        self.npey_table.clicked.connect(lambda: self.sort_table(str("npey")))
+        self.npexnpey_table.clicked.connect(lambda: self.sort_table(str("npexnpey")))
+        self.np_table.clicked.connect(lambda: self.sort_table(str("np")))
+        self.ngpts_table.clicked.connect(lambda: self.sort_table(str("ngpts")))
+
+        self.instant()
+
+        self.save_to_file_button.clicked.connect(self.get_path)
+
+    def instant(self):
+        checkfile = open(".palm_gf_tmp", "r")
+        # self.result_label.setText(str(checkfile.readline()))
+        res_text = str(checkfile.readline())  # XXX
+        result_nr = res_text.split(' ')[2]
+        checkfile.close()
+        if int(result_nr) < 100000:
+            self.load_result()
 
 
 
     def load_trigger(self):
+        pathx = configwr.read_config()
+        pathx = pathx[19]
+
+
         dtb = str('.palm_gf_data.db')
-        con = sqlite3.connect(dtb)
+        #con = sqlite3.connect("/localdata/.palm_gf_data.db")
+        con = sqlite3.connect(pathx + '.palm_gf_data.db')
         c = con.cursor()
         c.execute("SELECT * FROM " + 'grid_limits')
@@ -96,5 +135,5 @@
     def check(self):
         dtb = str('.palm_gf_data.db')
-        con = sqlite3.connect(dtb)
+        con = sqlite3.connect("/localdata/.palm_gf_data.db")
         c = con.cursor()
         c.execute("SELECT * FROM " + 'grid_limits')
@@ -113,4 +152,6 @@
 
     def load_result(self):
+        #print("LOADED!!!")
+        import decimal
         self.setEnabled(False)
         QtGui.QApplication.processEvents()
@@ -118,5 +159,5 @@
         self.process1()
         database = str('.palm_gf_data.db')
-        conn = sqlite3.connect(database)
+        conn = sqlite3.connect("/localdata/.palm_gf_data.db")
         c = conn.cursor()
         c.execute("SELECT * FROM " + 'grid_current')
@@ -134,5 +175,10 @@
                 var = line[j]
 
-                self.tableWidget.setItem(i, j, self.MyTableWidgetItem(str(var), j+i))
+                if j == 7:
+                    self.tableWidget.setItem(i, j, self.MyTableWidgetItem(str("%.1e" % var), j + i))
+                    #print("%.2e" % int(var), "%.4e" % int(1782))
+
+                else:
+                    self.tableWidget.setItem(i, j, self.MyTableWidgetItem(str(var), j+i))
                 #item = self.MyTableWidgetItem(str(var), k)
                 #self.tableWidget.setItem(i, j, item)
@@ -155,9 +201,10 @@
 
     def filter_results(self):
+
         self.setEnabled(False)
         self.calc_label.setText('calculating...')
         QtGui.QApplication.processEvents()
         database = str('.palm_gf_data.db')
-        conn = sqlite3.connect(database)
+        conn = sqlite3.connect("/localdata/.palm_gf_data.db")
         c = conn.cursor()
         c.execute("SELECT * FROM " + "grid_current")
@@ -208,5 +255,10 @@
                                                                             while j < 8:
                                                                                 var = line[j]
-                                                                                self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str(var), i))
+
+                                                                                if j == 7:
+                                                                                    self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str("%.1e" % var), i))
+
+                                                                                else:
+                                                                                    self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str(var), i))
 
                                                                                 j += 1
@@ -224,4 +276,196 @@
 
 
+
+    def sort_table(self, column):
+
+        fnx_mn = self.nx_min.value()
+        fnx_mx = self.nx_max.value()
+        fny_mn = self.ny_min.value()
+        fny_mx = self.ny_max.value()
+        fnz_mn = self.nz_min.value()
+        fnz_mx = self.nz_max.value()
+        fnpex_mn = self.npex_min.value()
+        fnpex_mx = self.npex_max.value()
+        fnpey_mn = self.npex_min.value()
+        fnpey_mx = self.npey_max.value()
+        fnpxnpy_mn = self.npxnpy_min.value()
+        fnpxnpy_mx = self.npxnpy_max.value()
+        fnp_mn = self.np_min.value()
+        fnp_mx = self.np_max.value()
+        fngpts_mn = self.ngpts_min.value()
+        fngpts_mx = self.ngpts_max.value()
+
+        if column == str("nx"):
+            sorted_col = "nx"
+
+            if self.nx_table.isChecked() is True:
+                order = " DESC"
+
+            else:
+
+                order = " ASC"
+
+            self.ny_table.setChecked(False)
+            self.nz_table.setChecked(False)
+            self.npex_table.setChecked(False)
+            self.npey_table.setChecked(False)
+            self.npexnpey_table.setChecked(False)
+            self.np_table.setChecked(False)
+            self.ngpts_table.setChecked(False)
+
+        if column == str("ny"):
+            sorted_col = "ny"
+
+            if self.ny_table.isChecked() is True:
+                order = " DESC"
+
+            else:
+
+                order = " ASC"
+
+            self.nx_table.setChecked(False)
+            self.nz_table.setChecked(False)
+            self.npex_table.setChecked(False)
+            self.npey_table.setChecked(False)
+            self.npexnpey_table.setChecked(False)
+            self.np_table.setChecked(False)
+            self.ngpts_table.setChecked(False)
+
+        if column == str("nz"):
+            sorted_col = "nz"
+
+            if self.nz_table.isChecked() is True:
+                order = " DESC"
+
+            else:
+
+                order = " ASC"
+
+            self.nx_table.setChecked(False)
+            self.ny_table.setChecked(False)
+            self.npex_table.setChecked(False)
+            self.npey_table.setChecked(False)
+            self.npexnpey_table.setChecked(False)
+            self.np_table.setChecked(False)
+            self.ngpts_table.setChecked(False)
+
+        if column == str("npex"):
+            sorted_col = "npex"
+
+            if self.npex_table.isChecked() is True:
+                order = " DESC"
+
+            else:
+
+                order = " ASC"
+
+            self.ny_table.setChecked(False)
+            self.nz_table.setChecked(False)
+            self.nx_table.setChecked(False)
+            self.npey_table.setChecked(False)
+            self.npexnpey_table.setChecked(False)
+            self.np_table.setChecked(False)
+            self.ngpts_table.setChecked(False)
+
+        if column == str("npey"):
+            sorted_col = "npey"
+
+            if self.npey_table.isChecked() is True:
+                order = " DESC"
+
+            else:
+
+                order = " ASC"
+
+
+            self.ny_table.setChecked(False)
+            self.nz_table.setChecked(False)
+            self.npex_table.setChecked(False)
+            self.nx_table.setChecked(False)
+            self.npexnpey_table.setChecked(False)
+            self.np_table.setChecked(False)
+            self.ngpts_table.setChecked(False)
+
+        if column == str("npexnpey"):
+            sorted_col = "npxnpy"
+
+            if self.npexnpey_table.isChecked() is True:
+                order = " DESC"
+
+            else:
+
+                order = " ASC"
+
+            self.ny_table.setChecked(False)
+            self.nz_table.setChecked(False)
+            self.npex_table.setChecked(False)
+            self.npey_table.setChecked(False)
+            self.nx_table.setChecked(False)
+            self.np_table.setChecked(False)
+            self.ngpts_table.setChecked(False)
+
+        if column == str("np"):
+            sorted_col = "np"
+
+            if self.np_table.isChecked() is True:
+                order = " DESC"
+
+            else:
+
+                order = " ASC"
+
+            self.ny_table.setChecked(False)
+            self.nz_table.setChecked(False)
+            self.npex_table.setChecked(False)
+            self.npey_table.setChecked(False)
+            self.npexnpey_table.setChecked(False)
+            self.nx_table.setChecked(False)
+            self.ngpts_table.setChecked(False)
+
+        if column == str("ngpts"):
+            sorted_col = "ngpts"
+
+            if self.ngpts_table.isChecked() is True:
+                order = " DESC"
+
+            else:
+
+                order = " ASC"
+
+            self.ny_table.setChecked(False)
+            self.nz_table.setChecked(False)
+            self.npex_table.setChecked(False)
+            self.npey_table.setChecked(False)
+            self.npexnpey_table.setChecked(False)
+            self.np_table.setChecked(False)
+            self.nx_table.setChecked(False)
+
+
+
+        conn = sqlite3.connect("/localdata/.palm_gf_data.db")
+        c = conn.cursor()
+        c.execute("SELECT * FROM grid_current  WHERE nx <= " + str(fnx_mx) + " AND nx >= "  + str(fnx_mn) + " AND ny <= " + str(fny_mx) + " AND ny >= " + str(fny_mn) + " AND nz <= " + str(fnz_mx) +
+                  " AND nz >= " + str(fnz_mn) + " AND npex <= " + str(fnpex_mx) + " AND npex >= " +
+        str(fnpex_mn) + " AND npey <= " + str(fnpey_mx) + " AND npey >= " + str(fnpey_mn) + " AND "
+                  "npxnpy <= " + str(fnpxnpy_mx) + " AND npxnpy >= " + str(fnpxnpy_mn) + " AND np <= " + str(fnp_mx) + " AND np >= " + str(fnp_mn) + " AND ngpts <= " + str(fngpts_mx) + " AND ngpts >= " + str(fngpts_mn) +
+        " ORDER BY " + str(sorted_col) + str(order))
+
+
+
+        sorted = c.fetchall()
+
+        c.close()
+        conn.close()
+        self.tableWidget.setRowCount(len(sorted))
+
+        for row_indx in range(0,len(sorted)):
+
+            for col_indx in range(0,8):
+                row = sorted[row_indx]
+                value = row[col_indx]
+                if col_indx == 7:
+                    self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str("%.1e" % value)))
+                else:
+                    self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str(value)))
 
 
@@ -273,5 +517,5 @@
             sorted_col = "ngpts"
 
-        print(self.Sortvariable_box.currentIndex())
+        #print(self.Sortvariable_box.currentIndex())
 
         if str(self.Sortorder_box.currentIndex()) == str(1):
@@ -285,10 +529,5 @@
 
 
-
-
-
-
-
-        conn = sqlite3.connect(".palm_gf_data.db")
+        conn = sqlite3.connect("/localdata/.palm_gf_data.db")
         c = conn.cursor()
         c.execute("SELECT * FROM grid_current  WHERE nx <= " + str(fnx_mx) + " AND nx >= "  + str(fnx_mn) + " AND ny <= " + str(fny_mx) + " AND ny >= " + str(fny_mn) + " AND nz <= " + str(fnz_mx) +
@@ -311,13 +550,34 @@
                 row = sorted[row_indx]
                 value = row[col_indx]
-                self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str(value)))
-
-
-
-
-
-
-        print(len(sorted))
+                self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str(var)))
+
+
+
+
+
+
+        #print(len(sorted))
         #print(sorted)
+
+    def get_path(wildcard):
+        import wx
+        app = wx.App(None)
+        style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST
+        dialog = wx.FileDialog(None, 'Open', wildcard='*.db')
+        if dialog.ShowModal() == wx.ID_OK:
+            path = dialog.GetPath()
+
+            print(path, file)
+        else:
+            path = None
+        dialog.Destroy()
+        return
+
+
+
+
+
+
+
 
 
