Index: /palm/trunk/SCRIPTS/palm_gf
===================================================================
--- /palm/trunk/SCRIPTS/palm_gf	(revision 2116)
+++ /palm/trunk/SCRIPTS/palm_gf	(revision 2116)
@@ -0,0 +1,363 @@
+#!/usr/bin/python -B
+# -*- coding: utf-8 -*-
+#--------------------------------------------------------------------------------#
+# This file is part of PALM.
+#
+# PALM is free software: you can redistribute it and/or modify it under the terms
+# of the GNU General Public License as published by the Free Software Foundation,
+# either version 3 of the License, or (at your option) any later version.
+#
+# PALM is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# PALM. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 1997-2017  Leibniz Universitaet Hannover
+#--------------------------------------------------------------------------------#
+#
+# Current revisions:
+# -----------------
+# Initial revision
+# 
+# Former revisions:
+# -----------------
+# $Id$
+#
+# 
+#
+# Description:
+# ------------
+# 
+#
+# Instructions:
+# -------------
+#
+#------------------------------------------------------------------------------!
+
+import sys
+import os
+import palm_gf_files.palm_gf_exec as execute_script
+import palm_gf_files.palm_gf_conf as config_wr
+import sqlite3
+import subprocess as sub
+
+from PyQt4 import QtCore, QtGui, uic
+from palm_gf_files.palm_gf_tools import MyApp3
+
+# Determine PALM directories
+try: 
+   devnull = open(os.devnull, 'w')
+   out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
+   palm_bin = out.rstrip()
+   palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1]
+   out = None
+except:   
+   print "Error. $PALM_BIN is not set."
+   raise SystemExit
+
+qtCreatorFile = palm_bin + '/palm_gf_files/palm_gf.ui'
+
+Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
+
+
+class MyApp1(QtGui.QMainWindow, Ui_MainWindow):
+    def __init__(self, parent=None):
+
+
+
+        QtGui.QMainWindow.__init__(self)
+        Ui_MainWindow.__init__(self)
+        #self.setWindowTitle('Gridfinder')
+
+        frameGm = self.frameGeometry()
+        screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos())
+        centerPoint = QtGui.QApplication.desktop().screenGeometry(screen).center()
+        frameGm.moveCenter(centerPoint)
+        self.move(frameGm.topLeft())
+
+        self.setupUi(self)
+        self.startbutton.clicked.connect(self.run_program)  # starts grid_calculation
+        self.psolver_box.currentIndexChanged.connect(self.vis)  # triggers visibility of fft_method option
+        self.save_button.clicked.connect(self.save_results)  # saves .db file under given name
+        self.fft_method_box.setVisible(False)
+        self.fft_method_label.setVisible(False)
+        self.result_headline.setVisible(False)
+        self.result_label.setVisible(False)
+        self.line_res_up.setVisible(False)
+        self.line_res_down.setVisible(False)
+        self.view_result_button.setVisible(False)
+        self.tableWidget.setVisible(False)
+        self.load_text_label.setVisible(False)
+        self.nor_spinbox.setVisible(False)
+        self.filename_line.setVisible(False)
+        self.save_button.setVisible(False)
+        self.view_result_button.clicked.connect(self.load_gui)
+
+        #self.startbutton.clicked.connect(self.progress)
+        #self.progressBar.setEnabled(False)
+        #self.progressBar.setVisible(False)
+
+    #def progress(self):
+    #    import time
+    #    self.progressBar.setVisible(True)
+    #    self.progressBar.setDisabled(False)
+    #    self.progressBar.setValue(10)
+    #    time.sleep(1)
+    #    self.progressBar.setValue(50)
+    #    time.sleep(1)
+    #    self.progressBar.setValue(100)
+    #    time.sleep(1)
+    #    self.progressBar.setEnabled(False)
+
+    def vis(self):
+
+        if str(self.psolver_box.currentIndex()) == str(1):
+            self.fft_method_box.setVisible(True)
+            self.fft_method_label.setVisible(True)
+
+        if str(self.psolver_box.currentIndex()) != str(1):
+            self.fft_method_box.setVisible(False)
+            self.fft_method_label.setVisible(False)
+
+    def load_gui(self):
+        print("not yet possible")
+        self.child_win = MyApp3()
+        self.child_win.show()
+        #self.load_results_2()
+        #MyApp2(self).show()
+        # import filter_script
+        # upt = filter_script.MyApp2()
+        # upt.cur_grid()
+
+    def load_results(self):
+        self.setGeometry(330, 250, 584, 622)
+        self.tableWidget.setVisible(True)
+        conn = sqlite3.connect(".palm_gf_data.db")
+        c = conn.cursor()
+        nor = int(self.nor_spinbox.value())
+        self.tableWidget.setRowCount(nor)
+        c.execute("SELECT * FROM grid_current")
+        results = c.fetchmany(nor)
+        i = 0
+        j = 0
+
+        while i < nor:
+            line = results[i]
+            while j < 6:
+                var = line[j]
+
+                self.tableWidget.setItem(i, j, QtGui.QTableWidgetItem(str(var)))
+
+                j += 1
+            j = 0
+            i += 1
+
+        c.close()
+        conn.close()
+
+    def run_program(self):
+        self.setEnabled(False)
+        # self.Ui_MainWindow.setDisabled(True)
+        self.qmsg()
+        np_min = str(self.np_min_box.value())
+        np_max = str(self.np_max_box.value())
+        nx_min = str(self.nx_min_box.value())
+        nx_max = str(self.nx_max_box.value())
+        ny_min = str(self.ny_min_box.value())
+        ny_max = str(self.ny_max_box.value())
+        nz_min = str(self.nz_min_box.value())
+        nz_max = str(self.nz_max_box.value())
+        tpn = str(self.tpn_box.value())
+        dnpexnpey = str(self.d_box.value())
+        dnxny = str(self.dnxny_box.value())
+
+        if str(self.psolver_box.currentIndex()) == str(1):
+            poisfft = True
+            switch = True
+            if str(self.fft_method_box.currentIndex()) == str(2):
+                temperton = True
+            else:
+                temperton = False
+        else:
+            poisfft = False
+            temperton = False
+            switch = False
+
+        if str(self.psolver_box.currentIndex()) == str(2):
+            mlt_grid = True
+        else:
+            mlt_grid = False
+
+        if str(self.Oos_checkbox.checkState()) == str(2):
+            spctre = True
+            poisfft = True
+        else:
+            spctre = False
+        print(poisfft, switch, temperton, mlt_grid, spctre)
+        config_wr.write_config(np_min, np_max, nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, tpn, dnpexnpey, dnxny,
+                               str(poisfft), str(switch), str(temperton), str(mlt_grid), str(spctre))
+        execute_script.grid_executer()
+        #execute_script.grid_maxmin()
+        checkfile = open(".palm_gf_tmp", "r")
+        self.result_label.setText(str(checkfile.readline()))
+        if int(checkfile.readline()) == 1:
+            self.view_result_button.setVisible(True)
+        self.result_label.setVisible(True)
+        self.result_headline.setVisible(True)
+        self.line_res_down.setVisible(True)
+        self.line_res_up.setVisible(True)
+        self.load_text_label.setVisible(False)
+        self.nor_spinbox.setVisible(False)
+        checkfile.close()
+        self.setEnabled(True)
+        self.filename_line.setVisible(True)
+        self.save_button.setVisible(True)
+
+    def load_results_2(self):
+
+        database = str(".palm_gf_data.db")
+        print(database)
+        self.tableWidget.setVisible(True)
+        conn = sqlite3.connect(database)  # ".palm_gf_data.db"
+        c = conn.cursor()
+        c.execute("SELECT * FROM " + 'grid_current')  # "grid_current" database[:-3]
+        # c.execute("SELECT * FROM " + database)
+        results = c.fetchall()
+
+        self.tableWidget.setRowCount(len(results))
+
+        i = 0
+        j = 0
+
+        while i < len(results):
+            line = results[i]
+            while j < 6:
+                var = line[j]
+
+                self.tableWidget.setItem(i, j, QtGui.QTableWidgetItem(str(var)))
+
+                if i == 0 and j == 0:
+                    np_min = line[0]
+                    np_max = line[0]
+                    npex_min = line[1]
+                    npex_max = line[1]
+                    npey_min = line[2]
+                    npey_max = line[2]
+                    nx_min = line[3]
+                    nx_max = line[3]
+                    ny_min = line[4]
+                    ny_max = line[4]
+                    nz_min = line[5]
+                    nz_max = line[5]
+                else:
+                    if line[0] > np_max:
+                        np_max = line[0]
+                    if line[0] < np_min:
+                        np_min = line[0]
+                    if line[1] > npex_max:
+                        npex_max = line[1]
+                    if line[1] < npex_min:
+                        npex_min = line[1]
+                    if line[2] > npey_max:
+                        npey_max = line[2]
+                    if line[2] < npey_min:
+                        npey_min = line[2]
+                    if line[3] > nx_max:
+                        nx_max = line[3]
+                    if line[3] < nx_min:
+                        nx_min = line[3]
+                    if line[4] > ny_max:
+                        ny_max = line[4]
+                    if line[4] < ny_min:
+                        ny_min = line[4]
+                    if line[5] > nz_max:
+                        nz_max = line[5]
+                    if line[5] < nz_min:
+                        nz_min = line[5]
+
+                j += 1
+            j = 0
+            i += 1
+
+        c.close()
+        conn.close()
+
+        self.np_max.setValue(np_max)
+
+        self.np_min.setValue(np_min)
+        self.npex_max.setValue(npex_max)
+        self.npex_min.setValue(npex_min)
+        self.npey_max.setValue(npey_max)
+        self.npey_min.setValue(npey_min)
+        self.nx_max.setValue(nx_max)
+        self.nx_min.setValue(nx_min)
+        self.ny_max.setValue(ny_max)
+        self.ny_min.setValue(ny_min)
+        self.nz_max.setValue(nz_max)
+        self.nz_min.setValue(nz_min)
+        self.np_max.setMaximum(np_max)
+        self.np_min.setMinimum(np_min)
+        self.npex_max.setMaximum(npex_max)
+        self.npex_min.setMinimum(npex_min)
+        self.npey_max.setMaximum(npey_max)
+        self.npey_min.setMinimum(npey_min)
+        self.nx_max.setMaximum(nx_max)
+        self.nx_min.setMinimum(nx_min)
+        self.ny_max.setMaximum(ny_max)
+        self.ny_min.setMinimum(ny_min)
+        self.nz_max.setMaximum(nz_max)
+        self.nz_min.setMinimum(nz_min)
+
+        self.nr_output_label.setText(str(len(results)) + ' results')
+
+
+
+    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)
+        else:
+            path = None
+        dialog.Destroy()
+        return
+
+
+
+    def save_results(self):
+
+        #self.get_path()
+
+
+
+        import os
+        import shutil
+        prvs = '.palm_gf_data.db'
+        new = str(self.filename_line.text())
+        print(new)
+        shutil.copy(prvs, new)
+        print(prvs, new)
+
+    def qmsg(self):
+        msgbox = QtGui.QMessageBox()
+        msgbox.setWindowTitle("Information")
+        # msgbox.setVisible(False)
+        msgbox.Information
+        msgbox.setText("Calculating, please be patient.")
+        # msgbox.
+        msgbox.setModal(True)
+        msgbox.exec_()
+
+
+if __name__ == "__main__":
+    import time
+    app = QtGui.QApplication(sys.argv)
+    window = MyApp1()
+    window.setWindowTitle('Gridfinder')
+    window.show()
+    sys.exit(app.exec_())
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 2116)
@@ -0,0 +1,1191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="windowModality">
+   <enum>Qt::WindowModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>584</width>
+    <height>375</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>584</width>
+    <height>375</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>584</width>
+    <height>622</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QFrame" name="frame_2">
+    <property name="geometry">
+     <rect>
+      <x>0</x>
+      <y>0</y>
+      <width>361</width>
+      <height>201</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::StyledPanel</enum>
+    </property>
+    <property name="frameShadow">
+     <enum>QFrame::Raised</enum>
+    </property>
+    <widget class="QLabel" name="label">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>10</y>
+       <width>237</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="text">
+      <string>Define numerical grid</string>
+     </property>
+    </widget>
+    <widget class="QWidget" name="horizontalLayoutWidget_2">
+     <property name="geometry">
+      <rect>
+       <x>70</x>
+       <y>60</y>
+       <width>283</width>
+       <height>41</height>
+      </rect>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_2">
+      <item>
+       <widget class="QSpinBox" name="nx_min_box">
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>100000</number>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSpinBox" name="ny_min_box">
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>100000</number>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSpinBox" name="nz_min_box">
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>100000</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+    <widget class="QWidget" name="horizontalLayoutWidget_3">
+     <property name="geometry">
+      <rect>
+       <x>70</x>
+       <y>100</y>
+       <width>283</width>
+       <height>41</height>
+      </rect>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_3">
+      <item>
+       <widget class="QSpinBox" name="nx_max_box">
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>100000</number>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSpinBox" name="ny_max_box">
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>100000</number>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSpinBox" name="nz_max_box">
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>100000</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+    <widget class="QDoubleSpinBox" name="dnxny_box">
+     <property name="geometry">
+      <rect>
+       <x>150</x>
+       <y>160</y>
+       <width>72</width>
+       <height>22</height>
+      </rect>
+     </property>
+     <property name="maximum">
+      <double>1000.000000000000000</double>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_11">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>160</y>
+       <width>149</width>
+       <height>21</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="text">
+      <string>Set fixed ratio (nx / ny):</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_3">
+     <property name="enabled">
+      <bool>true</bool>
+     </property>
+     <property name="geometry">
+      <rect>
+       <x>70</x>
+       <y>41</y>
+       <width>86</width>
+       <height>27</height>
+      </rect>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>24</height>
+      </size>
+     </property>
+     <property name="toolTip">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Gridpoints in X-direction.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+     <property name="text">
+      <string>  nx</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_5">
+     <property name="geometry">
+      <rect>
+       <x>260</x>
+       <y>41</y>
+       <width>41</width>
+       <height>27</height>
+      </rect>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>24</height>
+      </size>
+     </property>
+     <property name="toolTip">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Gridpoints in Y-direction.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+     <property name="text">
+      <string>   ny</string>
+     </property>
+     <property name="scaledContents">
+      <bool>false</bool>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_4">
+     <property name="geometry">
+      <rect>
+       <x>162</x>
+       <y>41</y>
+       <width>41</width>
+       <height>27</height>
+      </rect>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>27</height>
+      </size>
+     </property>
+     <property name="toolTip">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Gridpoints in Z-direction.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+     <property name="text">
+      <string>    nz</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_6">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>60</y>
+       <width>80</width>
+       <height>37</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Minimum</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_7">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>104</y>
+       <width>83</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Maximum</string>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QFrame" name="frame">
+    <property name="geometry">
+     <rect>
+      <x>360</x>
+      <y>0</y>
+      <width>211</width>
+      <height>201</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::StyledPanel</enum>
+    </property>
+    <property name="frameShadow">
+     <enum>QFrame::Raised</enum>
+    </property>
+    <widget class="QLabel" name="label_2">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>10</y>
+       <width>204</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="text">
+      <string>Define processor topology</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_14">
+     <property name="geometry">
+      <rect>
+       <x>20</x>
+       <y>40</y>
+       <width>141</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>141</width>
+       <height>16</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>141</width>
+       <height>16</height>
+      </size>
+     </property>
+     <property name="toolTip">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of processors used for calculation.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+     <property name="text">
+      <string>Number of processors:</string>
+     </property>
+    </widget>
+    <widget class="Line" name="line">
+     <property name="geometry">
+      <rect>
+       <x>0</x>
+       <y>105</y>
+       <width>201</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_20">
+     <property name="geometry">
+      <rect>
+       <x>22</x>
+       <y>61</y>
+       <width>89</width>
+       <height>22</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Minimum</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_21">
+     <property name="geometry">
+      <rect>
+       <x>22</x>
+       <y>94</y>
+       <width>51</width>
+       <height>21</height>
+      </rect>
+     </property>
+     <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>
+    <widget class="QSpinBox" name="np_max_box">
+     <property name="geometry">
+      <rect>
+       <x>110</x>
+       <y>90</y>
+       <width>83</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>83</width>
+       <height>25</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>83</width>
+       <height>25</height>
+      </size>
+     </property>
+     <property name="minimum">
+      <number>1</number>
+     </property>
+     <property name="maximum">
+      <number>10000000</number>
+     </property>
+    </widget>
+    <widget class="QSpinBox" name="np_min_box">
+     <property name="geometry">
+      <rect>
+       <x>110</x>
+       <y>59</y>
+       <width>83</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>83</width>
+       <height>25</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>83</width>
+       <height>25</height>
+      </size>
+     </property>
+     <property name="minimum">
+      <number>1</number>
+     </property>
+     <property name="maximum">
+      <number>10000</number>
+     </property>
+    </widget>
+    <widget class="QSpinBox" name="tpn_box">
+     <property name="geometry">
+      <rect>
+       <x>110</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>
+     </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>
+    </widget>
+   </widget>
+   <widget class="QFrame" name="frame_3">
+    <property name="geometry">
+     <rect>
+      <x>0</x>
+      <y>200</y>
+      <width>172</width>
+      <height>131</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::StyledPanel</enum>
+    </property>
+    <property name="frameShadow">
+     <enum>QFrame::Raised</enum>
+    </property>
+    <widget class="QLabel" name="label_9">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>10</y>
+       <width>161</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="text">
+      <string>Pressure solver</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_12">
+     <property name="geometry">
+      <rect>
+       <x>12</x>
+       <y>37</y>
+       <width>119</width>
+       <height>15</height>
+      </rect>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>1</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="text">
+      <string>Method (psolver):</string>
+     </property>
+    </widget>
+    <widget class="QComboBox" name="psolver_box">
+     <property name="geometry">
+      <rect>
+       <x>11</x>
+       <y>57</y>
+       <width>119</width>
+       <height>20</height>
+      </rect>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>18</height>
+      </size>
+     </property>
+     <property name="acceptDrops">
+      <bool>true</bool>
+     </property>
+     <property name="frame">
+      <bool>true</bool>
+     </property>
+     <item>
+      <property name="text">
+       <string>-</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>poisfft</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>multigrid</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>multigrid_fast</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>sor</string>
+      </property>
+     </item>
+    </widget>
+    <widget class="QLabel" name="fft_method_label">
+     <property name="geometry">
+      <rect>
+       <x>12</x>
+       <y>80</y>
+       <width>131</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Specify FFT-method:</string>
+     </property>
+    </widget>
+    <widget class="QComboBox" name="fft_method_box">
+     <property name="geometry">
+      <rect>
+       <x>11</x>
+       <y>99</y>
+       <width>119</width>
+       <height>20</height>
+      </rect>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>18</height>
+      </size>
+     </property>
+     <item>
+      <property name="text">
+       <string>-</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>FFTW</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Temperton</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Singleton</string>
+      </property>
+     </item>
+    </widget>
+   </widget>
+   <widget class="QFrame" name="frame_4">
+    <property name="geometry">
+     <rect>
+      <x>170</x>
+      <y>200</y>
+      <width>181</width>
+      <height>131</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::StyledPanel</enum>
+    </property>
+    <property name="frameShadow">
+     <enum>QFrame::Raised</enum>
+    </property>
+    <widget class="QLabel" name="label_16">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>10</y>
+       <width>91</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="text">
+      <string>Misc</string>
+     </property>
+    </widget>
+    <widget class="QCheckBox" name="Oos_checkbox">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>30</y>
+       <width>161</width>
+       <height>21</height>
+      </rect>
+     </property>
+     <property name="toolTip">
+      <string>Hallo, ich bin ein Test-toolTip. Hier kÃ¶nnte eine tolle erklÃ€rung zu dieser SchaltflÃ€che stehen.</string>
+     </property>
+     <property name="text">
+      <string>Output of spectra</string>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="filename_line">
+     <property name="geometry">
+      <rect>
+       <x>24</x>
+       <y>104</y>
+       <width>100</width>
+       <height>23</height>
+      </rect>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>23</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>100</width>
+       <height>23</height>
+      </size>
+     </property>
+     <property name="text">
+      <string>FILENAME.db</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="save_button">
+     <property name="geometry">
+      <rect>
+       <x>125</x>
+       <y>104</y>
+       <width>45</width>
+       <height>23</height>
+      </rect>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>23</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>45</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <property name="text">
+      <string>Save</string>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QWidget" name="verticalLayoutWidget_8">
+    <property name="geometry">
+     <rect>
+      <x>380</x>
+      <y>220</y>
+      <width>197</width>
+      <height>31</height>
+     </rect>
+    </property>
+    <layout class="QVBoxLayout" name="verticalLayout_8">
+     <item>
+      <widget class="QLabel" name="result_label">
+       <property name="text">
+        <string>placeholder, should never be seen</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </widget>
+   <widget class="QLabel" name="result_headline">
+    <property name="geometry">
+     <rect>
+      <x>370</x>
+      <y>180</y>
+      <width>179</width>
+      <height>59</height>
+     </rect>
+    </property>
+    <property name="font">
+     <font>
+      <weight>75</weight>
+      <bold>true</bold>
+     </font>
+    </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>
+   <widget class="Line" name="line_res_down">
+    <property name="geometry">
+     <rect>
+      <x>360</x>
+      <y>280</y>
+      <width>201</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="orientation">
+     <enum>Qt::Horizontal</enum>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="view_result_button">
+    <property name="geometry">
+     <rect>
+      <x>490</x>
+      <y>261</y>
+      <width>75</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="text">
+     <string>View results</string>
+    </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>
+      <width>42</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Fixed" vsizetype="Minimum">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="minimumSize">
+     <size>
+      <width>0</width>
+      <height>23</height>
+     </size>
+    </property>
+    <property name="toolTip">
+     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of results you want to load in this Ui.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+    </property>
+    <property name="text">
+     <string>  Load</string>
+    </property>
+   </widget>
+   <widget class="QSpinBox" name="nor_spinbox">
+    <property name="enabled">
+     <bool>false</bool>
+    </property>
+    <property name="geometry">
+     <rect>
+      <x>420</x>
+      <y>261</y>
+      <width>61</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="minimumSize">
+     <size>
+      <width>0</width>
+      <height>23</height>
+     </size>
+    </property>
+    <property name="maximum">
+     <number>9999</number>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="startbutton">
+    <property name="geometry">
+     <rect>
+      <x>490</x>
+      <y>304</y>
+      <width>75</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="minimumSize">
+     <size>
+      <width>0</width>
+      <height>23</height>
+     </size>
+    </property>
+    <property name="maximumSize">
+     <size>
+      <width>16777215</width>
+      <height>23</height>
+     </size>
+    </property>
+    <property name="toolTip">
+     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Starts calculation with the given parameters.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+    </property>
+    <property name="text">
+     <string>Start</string>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>18</width>
+      <height>18</height>
+     </size>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="quitbutton">
+    <property name="geometry">
+     <rect>
+      <x>415</x>
+      <y>304</y>
+      <width>75</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="minimumSize">
+     <size>
+      <width>0</width>
+      <height>23</height>
+     </size>
+    </property>
+    <property name="text">
+     <string>Quit</string>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>18</width>
+      <height>18</height>
+     </size>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>584</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuGridfinder">
+    <property name="title">
+     <string>Gridfinder</string>
+    </property>
+    <addaction name="actionSchlie_en"/>
+   </widget>
+   <addaction name="menuGridfinder"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="actionSchlie_en">
+   <property name="text">
+    <string>SchlieÃen</string>
+   </property>
+  </action>
+ </widget>
+ <tabstops>
+  <tabstop>nx_min_box</tabstop>
+  <tabstop>nx_max_box</tabstop>
+  <tabstop>ny_min_box</tabstop>
+  <tabstop>ny_max_box</tabstop>
+  <tabstop>nz_min_box</tabstop>
+  <tabstop>nz_max_box</tabstop>
+  <tabstop>np_min_box</tabstop>
+  <tabstop>np_max_box</tabstop>
+  <tabstop>tpn_box</tabstop>
+  <tabstop>d_box</tabstop>
+  <tabstop>dnxny_box</tabstop>
+  <tabstop>psolver_box</tabstop>
+  <tabstop>fft_method_box</tabstop>
+  <tabstop>startbutton</tabstop>
+  <tabstop>nor_spinbox</tabstop>
+  <tabstop>view_result_button</tabstop>
+  <tabstop>save_button</tabstop>
+  <tabstop>quitbutton</tabstop>
+  <tabstop>filename_line</tabstop>
+  <tabstop>tableWidget</tabstop>
+  <tabstop>Oos_checkbox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>quitbutton</sender>
+   <signal>clicked()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>448</x>
+     <y>335</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>291</x>
+     <y>187</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 2116)
@@ -0,0 +1,61 @@
+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):
+    #from configparser import ConfigParser  # windows
+    from ConfigParser import ConfigParser  # Linux
+
+    # if __name__ == "__main__":
+    cfg = ConfigParser()
+
+    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", "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)
+
+    with open(".palm_gf_config", "w") as configfile:
+        cfg.write(configfile)
+
+
+def read_config():
+    #from configparser import ConfigParser  # windows
+    from ConfigParser import ConfigParser  # Linux
+
+    cfg = ConfigParser()
+
+    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")
+    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")
+
+    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
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 2116)
@@ -0,0 +1,327 @@
+def grid_executer():
+    import palm_gf_conf as config_wr
+    import sqlite3
+    conn = sqlite3.connect(".palm_gf_data.db")
+    c = conn.cursor()
+    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)")
+    conn.commit()
+    main_bool = True
+    parameters = config_wr.read_config()
+    print(parameters)
+    min_procs = int(parameters[0])
+    max_procs = int(parameters[1])
+    tpn = int(parameters[2])
+    dnpexnpey = float(parameters[3])
+    dnxny = float(parameters[4])
+    nx_min = int(parameters[5])
+    nx_max = int(parameters[6])
+    ny_min = int(parameters[7])
+    ny_max = int(parameters[8])
+    nz_min = int(parameters[9])
+    nz_max = int(parameters[10])
+    poisfft = parameters[11]
+    switch = parameters[12]
+    tempterton = parameters[13]
+    mlt_grid = parameters[14]
+    spectr = parameters[15]
+
+    if poisfft == str(True):
+        poisfft = True
+    else:
+        poisfft = False
+
+    if switch == str(True):
+        switch = True
+    else:
+        switch = False
+
+    if tempterton == str(True):
+        tempterton = True
+    else:
+        tempterton = False
+
+    if mlt_grid == str(True):
+        mlt_grid = True
+    else:
+        mlt_grid = False
+
+    if spectr == str(True):
+        spectr = True
+    else:
+        spectr = False
+
+    print(spectr, type(spectr))
+    results = open(".palm_gf_results", "w")
+    print(poisfft, switch, tempterton, mlt_grid, spectr)
+
+    np_used = min_procs
+    counter = 0
+
+    nx = nx_min
+    ny = ny_min
+    nz = nz_min
+
+    from math import floor
+
+    def factors(n):
+        result = []
+        for i in range(2, n + 1):  # test all integers between 2 and n
+            s = 0
+            while n / i == floor(n / float(i)):  # is n/i an integer?
+                n = n / float(i)
+                s += 1
+            if s > 0:
+                for k in range(s):
+                    result.append(i)  # i is a pf s times
+                    if n == 1:
+                        return result
+
+    while np_used <= max_procs:
+        a = 1
+
+        while a <= np_used:
+            prcs_var = np_used % a
+            if prcs_var != 0:
+                a += 1
+            elif prcs_var == 0:
+                npex = a
+                npey = int(np_used / npex)
+
+                if tpn != 0:
+                    if np_used % tpn != 0:
+                        a += 1
+                        continue
+
+                if dnpexnpey != 0 and npex / npey != dnpexnpey:
+                    a += 1
+                    continue
+
+                while nx <= nx_max:
+                    if (nx + 1) % npex != 0:
+                        nx += 1
+                        continue
+
+                    if mlt_grid is True and (nx + 1) % 2 != 0:
+                        nx += 1
+                        continue
+
+                    if switch is True and (nx + 1) % npey != 0:
+                        nx += 1
+                        continue
+                    if npex > nx:
+                        nx += 1
+                        continue
+
+                    while ny <= ny_max:
+
+                        if dnxny != 0 and float(nx) / float(ny) != float(dnxny):
+                            ny += 1
+                            continue
+                        if (ny + 1) % npey != 0:
+                            ny += 1
+                            continue
+
+                        if mlt_grid is True and ny % 2 != 0:
+                            ny += 1
+                            continue
+
+                        if (ny + 1) % npex != 0 and switch is True:
+                            ny += 1
+                            continue
+                        if npey > ny:
+                            ny += 1
+                            continue
+
+                        while nz <= nz_max:
+
+                            if mlt_grid is True and nz % 2 != 0:
+                                nz += 1
+                                continue
+
+                            if poisfft is True and nz % npex != 0:
+                                nz += 1
+                                continue
+
+                            if spectr is True and nz % npey != 0:
+                                nz += 1
+                                continue
+
+                            if tempterton is True and nx > 1 and ny > 1:  # and nz < 1:
+
+                                nx_list = factors(nx + 1)
+                                i = 0
+                                nx_var = nx_list[i]
+
+                                while i < len(nx_list):
+                                    if nx_var != 2 or nx_var != 3 or nx_var != 5:
+
+                                        i += 1
+                                        continue
+
+                                    i += 1
+                                ny_list = factors(ny + 1)
+                                i = 0
+                                ny_var = ny_list[i]
+                                while i < len(ny_list):
+                                    if ny_var != 2 or ny_var != 3 or ny_var != 5:
+
+                                        i += 1
+                                        continue
+                                    i += 1
+
+                            counter += 1
+
+                            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 = nz_min
+                        ny += 1
+                    ny = ny_min
+                    nx += 1
+                nx = nx_min
+                a += 1
+                #  a += 1
+        np_used += 1
+
+        conn.commit()
+
+
+
+    results.close()
+    conn.commit()
+    c.close()
+    conn.close()
+
+    #********************************
+
+    conn = sqlite3.connect(".palm_gf_data.db")
+    c = conn.cursor()
+    try:
+        c.execute("SELECT nx FROM grid_current ORDER BY nx DESC LIMIT 1")
+        mx_nx = c.fetchone()[0]
+        #print(mx_nx)
+        c.execute("SELECT nx FROM grid_current ORDER BY nx  LIMIT 1")
+        mn_nx = c.fetchone()[0]
+        #print(mn_nx)
+        c.execute("SELECT ny FROM grid_current ORDER BY ny DESC LIMIT 1")
+        mx_ny = c.fetchone()[0]
+        #print(mx_ny)
+        c.execute("SELECT ny FROM grid_current ORDER BY ny  LIMIT 1")
+        mn_ny = c.fetchone()[0]
+        #print(mn_ny)
+        c.execute("SELECT nz FROM grid_current ORDER BY nz DESC LIMIT 1")
+        mx_nz = c.fetchone()[0]
+        #print(mx_nz)
+        c.execute("SELECT nz FROM grid_current ORDER BY nz  LIMIT 1")
+        mn_nz = c.fetchone()[0]
+        #print(mn_nz)
+        c.execute("SELECT npex FROM grid_current ORDER BY npex DESC LIMIT 1")
+        mx_npex = c.fetchone()[0]
+        #print(mx_npex)
+        c.execute("SELECT npex FROM grid_current ORDER BY npex  LIMIT 1")
+        mn_npex = c.fetchone()[0]
+        #print(mn_npex)
+        c.execute("SELECT npey FROM grid_current ORDER BY npey DESC LIMIT 1")
+        mx_npey = c.fetchone()[0]
+        #print(mx_npey)
+        c.execute("SELECT npey FROM grid_current ORDER BY npey  LIMIT 1")
+        mn_npey = c.fetchone()[0]
+        #print(mn_npey)
+        c.execute("SELECT npxnpy FROM grid_current ORDER BY npxnpy DESC LIMIT 1")
+        mx_npxnpy = c.fetchone()[0]
+        #print(mx_npxnpy)
+        c.execute("SELECT npxnpy FROM grid_current ORDER BY npxnpy  LIMIT 1")
+        mn_npxnpy = c.fetchone()[0]
+        #print(mn_npxnpy)
+        c.execute("SELECT np FROM grid_current ORDER BY np DESC LIMIT 1")
+        mx_np = c.fetchone()[0]
+        #print(mx_np)
+        c.execute("SELECT np FROM grid_current ORDER BY np LIMIT 1")
+        mn_np = c.fetchone()[0]
+        #print(mn_np)
+        c.execute("SELECT ngpts FROM grid_current ORDER BY ngpts DESC LIMIT 1")
+        mx_ngpts = c.fetchone()[0]
+        #print(mx_ngpts)
+        c.execute("SELECT ngpts FROM grid_current ORDER BY ngpts LIMIT 1")
+        mn_ngpts = c.fetchone()[0]
+        #print(mn_ngpts)
+
+        conn.commit()
+        c.execute(
+            """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",
+            (mn_nx, mn_ny, mn_nz, mn_npex, mn_npey, mn_npxnpy, mn_np, mn_ngpts))
+        #conn.commit()
+        #print("test", mn_nx)
+        c.execute(
+            """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",
+            (mx_nx, mx_ny, mx_nz, mx_npex, mx_npey, mx_npxnpy, mx_np, mx_ngpts))
+        conn.commit()
+
+        c.close()
+        conn.close()
+    except TypeError:
+
+        checkfile = open(".palm_gf_tmp", "w")
+        if counter != 0:
+            checkfile.write("Gridfinder found " + str(counter) + " results.\n1")
+        else:
+            checkfile.write("Check input, no Results found.\n0")
+        checkfile.close()
+
+
+
+    checkfile = open(".palm_gf_tmp", "w")
+    if counter != 0:
+        checkfile.write("Gridfinder found " + str(counter) + " results.\n1")
+    else:
+        checkfile.write("Check input, no Results found.\n0")
+    checkfile.close()
+    return main_bool
+
+
+
+def grid_maxmin():
+
+    import palm_gf_conf
+    import sqlite3
+
+    conn = sqlite3.connect("grid_current.db")
+    c = conn.cursor()
+    c.execute("DROP TABLE IF EXISTS grid_maxmin")
+    c.execute("CREATE TABLE IF NOT EXISTS grid_maxmin(np_min INT,np_max INT, npex_min INT,npex_max INT, npey_min INT,npey_max INT, nx_min INT,nx_max INT,"
+              " ny_min INT,ny_max INT, nz_min INT, nz_max INT)")
+    parm = config_wr.read_config()
+    min_procs = int(parm[0])
+    max_procs = int(parameters[1])
+    tpn = int(parameters[2])
+    dnpexnpey = float(parameters[3])
+    dnxny = float(parameters[4])
+    nx_min = int(parameters[5])
+    nx_max = int(parameters[6])
+    ny_min = int(parameters[7])
+    ny_max = int(parameters[8])
+    nz_min = int(parameters[9])
+    nz_max = int(parameters[10])
+
+
+
+
+
+    c.execute(
+        """INSERT OR REPLACE INTO grid_maxmin(np_min, np_max, npex_min, npex_max, npey_min, npey_max, nx_min, nx_max,
+         ny_min, ny_max, nz_min, nz_max) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
+        (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))
+
+    conn.commit()
+    c.close()
+    conn.close()
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 2116)
@@ -0,0 +1,1222 @@
+<?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>822</width>
+    <height>483</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <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>
+     <width>805</width>
+     <height>266</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="acceptDrops">
+    <bool>false</bool>
+   </property>
+   <property name="horizontalScrollBarPolicy">
+    <enum>Qt::ScrollBarAlwaysOff</enum>
+   </property>
+   <property name="dragEnabled">
+    <bool>false</bool>
+   </property>
+   <property name="dragDropOverwriteMode">
+    <bool>false</bool>
+   </property>
+   <property name="selectionBehavior">
+    <enum>QAbstractItemView::SelectRows</enum>
+   </property>
+   <property name="sortingEnabled">
+    <bool>false</bool>
+   </property>
+   <property name="rowCount">
+    <number>8</number>
+   </property>
+   <attribute name="verticalHeaderVisible">
+    <bool>false</bool>
+   </attribute>
+   <row>
+    <property name="text">
+     <string>1</string>
+    </property>
+   </row>
+   <row>
+    <property name="text">
+     <string>2</string>
+    </property>
+   </row>
+   <row>
+    <property name="text">
+     <string>3</string>
+    </property>
+   </row>
+   <row>
+    <property name="text">
+     <string>4</string>
+    </property>
+   </row>
+   <row>
+    <property name="text">
+     <string>5</string>
+    </property>
+   </row>
+   <row>
+    <property name="text">
+     <string>6</string>
+    </property>
+   </row>
+   <row>
+    <property name="text">
+     <string>7</string>
+    </property>
+   </row>
+   <row/>
+   <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>
+   <column>
+    <property name="text">
+     <string>npex</string>
+    </property>
+   </column>
+   <column>
+    <property name="text">
+     <string>npey</string>
+    </property>
+   </column>
+   <column>
+    <property name="text">
+     <string>npex/npey</string>
+    </property>
+   </column>
+   <column>
+    <property name="text">
+     <string>np</string>
+    </property>
+   </column>
+   <column>
+    <property name="text">
+     <string>ngpts</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">
+   <property name="geometry">
+    <rect>
+     <x>655</x>
+     <y>60</y>
+     <width>30</width>
+     <height>75</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Vertical</enum>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_11">
+   <property name="geometry">
+    <rect>
+     <x>675</x>
+     <y>112</y>
+     <width>131</width>
+     <height>17</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="nx_max">
+   <property name="geometry">
+    <rect>
+     <x>145</x>
+     <y>110</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="ny_max">
+   <property name="geometry">
+    <rect>
+     <x>208</x>
+     <y>110</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="nz_max">
+   <property name="geometry">
+    <rect>
+     <x>271</x>
+     <y>110</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="npex_max">
+   <property name="geometry">
+    <rect>
+     <x>334</x>
+     <y>110</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="npey_max">
+   <property name="geometry">
+    <rect>
+     <x>397</x>
+     <y>110</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QDoubleSpinBox" name="npxnpy_max">
+   <property name="geometry">
+    <rect>
+     <x>460</x>
+     <y>110</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="np_max">
+   <property name="geometry">
+    <rect>
+     <x>523</x>
+     <y>110</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="ngpts_max">
+   <property name="geometry">
+    <rect>
+     <x>587</x>
+     <y>110</y>
+     <width>80</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>80</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>80</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="autoFillBackground">
+    <bool>false</bool>
+   </property>
+   <property name="wrapping">
+    <bool>false</bool>
+   </property>
+   <property name="frame">
+    <bool>true</bool>
+   </property>
+   <property name="buttonSymbols">
+    <enum>QAbstractSpinBox::UpDownArrows</enum>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999999</number>
+   </property>
+   <property name="value">
+    <number>0</number>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>115</x>
+     <y>107</y>
+     <width>47</width>
+     <height>29</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Max</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>115</x>
+     <y>83</y>
+     <width>48</width>
+     <height>29</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Min</string>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="nx_min">
+   <property name="geometry">
+    <rect>
+     <x>146</x>
+     <y>86</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="ny_min">
+   <property name="geometry">
+    <rect>
+     <x>209</x>
+     <y>86</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="nz_min">
+   <property name="geometry">
+    <rect>
+     <x>272</x>
+     <y>86</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="npex_min">
+   <property name="geometry">
+    <rect>
+     <x>335</x>
+     <y>86</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="npey_min">
+   <property name="geometry">
+    <rect>
+     <x>398</x>
+     <y>86</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QDoubleSpinBox" name="npxnpy_min">
+   <property name="geometry">
+    <rect>
+     <x>461</x>
+     <y>86</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="np_min">
+   <property name="geometry">
+    <rect>
+     <x>524</x>
+     <y>86</y>
+     <width>62</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>62</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999</number>
+   </property>
+  </widget>
+  <widget class="QSpinBox" name="ngpts_min">
+   <property name="geometry">
+    <rect>
+     <x>587</x>
+     <y>86</y>
+     <width>80</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>80</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>80</width>
+     <height>22</height>
+    </size>
+   </property>
+   <property name="correctionMode">
+    <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
+   </property>
+   <property name="maximum">
+    <number>99999999</number>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_12">
+   <property name="geometry">
+    <rect>
+     <x>675</x>
+     <y>70</y>
+     <width>52</width>
+     <height>14</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Status:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="calc_label">
+   <property name="geometry">
+    <rect>
+     <x>675</x>
+     <y>90</y>
+     <width>131</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
+  <widget class="Line" name="line_2">
+   <property name="geometry">
+    <rect>
+     <x>100</x>
+     <y>55</y>
+     <width>8</width>
+     <height>80</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Vertical</enum>
+   </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">
+    <rect>
+     <x>149</x>
+     <y>67</y>
+     <width>58</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>59</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="text">
+    <string>  nx</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_4">
+   <property name="enabled">
+    <bool>true</bool>
+   </property>
+   <property name="geometry">
+    <rect>
+     <x>213</x>
+     <y>67</y>
+     <width>57</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="text">
+    <string>  ny</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_5">
+   <property name="geometry">
+    <rect>
+     <x>275</x>
+     <y>67</y>
+     <width>57</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="text">
+    <string>  nz</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_6">
+   <property name="geometry">
+    <rect>
+     <x>340</x>
+     <y>67</y>
+     <width>57</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="text">
+    <string> npex</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_8">
+   <property name="geometry">
+    <rect>
+     <x>400</x>
+     <y>67</y>
+     <width>57</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="text">
+    <string> npey</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_7">
+   <property name="geometry">
+    <rect>
+     <x>461</x>
+     <y>67</y>
+     <width>57</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="text">
+    <string> npx/npy</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_9">
+   <property name="geometry">
+    <rect>
+     <x>525</x>
+     <y>67</y>
+     <width>57</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="text">
+    <string>   np</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_10">
+   <property name="geometry">
+    <rect>
+     <x>590</x>
+     <y>67</y>
+     <width>57</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>57</width>
+     <height>19</height>
+    </size>
+   </property>
+   <property name="text">
+    <string>  ngpts</string>
+   </property>
+  </widget>
+ </widget>
+ <tabstops>
+  <tabstop>pushButton_3</tabstop>
+  <tabstop>nx_min</tabstop>
+  <tabstop>nx_max</tabstop>
+  <tabstop>ny_min</tabstop>
+  <tabstop>ny_max</tabstop>
+  <tabstop>nz_min</tabstop>
+  <tabstop>nz_max</tabstop>
+  <tabstop>npex_min</tabstop>
+  <tabstop>npex_max</tabstop>
+  <tabstop>npey_min</tabstop>
+  <tabstop>npey_max</tabstop>
+  <tabstop>npxnpy_min</tabstop>
+  <tabstop>npxnpy_max</tabstop>
+  <tabstop>np_min</tabstop>
+  <tabstop>np_max</tabstop>
+  <tabstop>ngpts_min</tabstop>
+  <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>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
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 2116)
@@ -0,0 +1,332 @@
+import sys
+import os
+import sqlite3
+from PyQt4 import QtCore, QtGui, uic
+import subprocess as sub
+   
+out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
+palm_bin = out.rstrip()
+
+qtCreatorFile = palm_bin + '/palm_gf_files/palm_gf_table.ui'
+
+Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
+
+class MyApp3(QtGui.QMainWindow, Ui_MainWindow):
+
+    class MyTableWidgetItem(QtGui.QTableWidgetItem):
+        def __init__(self, text, sortKey):
+            QtGui.QTableWidgetItem.__init__(self, text, QtGui.QTableWidgetItem.UserType)
+            self.sortKey = sortKey
+
+        def __lt__(self, other):
+            return self.sortKey < other.sortKey
+
+
+    def __init__(self):   #     def __init__(self, parent=None):
+        QtGui.QMainWindow.__init__(self)
+        Ui_MainWindow.__init__(self)
+
+        framegm = self.frameGeometry()
+        screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos())
+        centerpoint = QtGui.QApplication.desktop().screenGeometry(screen).center()
+        framegm.moveCenter(centerpoint)
+        self.move(framegm.topLeft())
+        self.setupUi(self)
+        self.pushButton_3.clicked.connect(self.load_result)
+        #self.nx_min.valueChanged.connect(self.check)
+        self.load_trigger()
+        self.pushButton.clicked.connect(self.filter_results)
+        self.Sortnow_button.clicked.connect(self.sort_order)
+        self.pushButton_2.clicked.connect(self.load_trigger)
+
+
+
+    def load_trigger(self):
+        dtb = str('.palm_gf_data.db')
+        con = sqlite3.connect(dtb)
+        c = con.cursor()
+        c.execute("SELECT * FROM " + 'grid_limits')
+        mini = c.fetchone()
+        max = c.fetchone()
+        self.nx_min.setValue(mini[0])
+        self.nx_max.setValue(max[0])
+        self.ny_min.setValue(mini[1])
+        self.ny_max.setValue(max[1])
+        self.nz_min.setValue(mini[2])
+        self.nz_max.setValue(max[2])
+        self.npex_min.setValue(mini[3])
+        self.npex_max.setValue(max[3])
+        self.npey_min.setValue(mini[4])
+        self.npey_max.setValue(max[4])
+        self.npxnpy_min.setValue(mini[5])
+        self.npxnpy_max.setValue(max[5])
+        self.np_min.setValue(mini[6])
+        self.np_max.setValue(max[6])
+        self.ngpts_min.setValue(mini[7])
+        self.ngpts_max.setValue(max[7])
+
+        self.nx_min.setMinimum(mini[0])
+        self.nx_max.setMaximum(max[0])
+        self.ny_min.setMinimum(mini[1])
+        self.ny_max.setMaximum(max[1])
+        self.nz_min.setMinimum(mini[2])
+        self.nz_max.setMaximum(max[2])
+        self.npex_min.setMinimum(mini[3])
+        self.npex_max.setMaximum(max[3])
+        self.npey_min.setMinimum(mini[4])
+        self.npey_max.setMaximum(max[4])
+        self.npxnpy_min.setMinimum(mini[5])
+        self.npxnpy_max.setMaximum(max[5])
+        self.np_min.setMinimum(mini[6])
+        self.np_max.setMaximum(max[6])
+        self.ngpts_min.setMinimum(mini[7])
+        self.ngpts_max.setMaximum(max[7])
+        self.ngpts_min.setMaximum(max[7])
+        self.ngpts_max.setMinimum(mini[7])
+
+
+
+        con.commit()
+        c.close()
+        con.close()
+
+
+
+
+    def check(self):
+        dtb = str('.palm_gf_data.db')
+        con = sqlite3.connect(dtb)
+        c = con.cursor()
+        c.execute("SELECT * FROM " + 'grid_limits')
+        mini = c.fetchone()
+        max = c.fetchone()
+        if self.nx_min.value() < mini[0]:
+
+            self.nx_min.setValue(mini[0])
+
+
+    def process1(self):
+        self.calc_label.setText('loading...')
+        QtGui.QApplication.processEvents()
+
+
+
+    def load_result(self):
+        self.setEnabled(False)
+        QtGui.QApplication.processEvents()
+        self.load_trigger()
+        self.process1()
+        database = str('.palm_gf_data.db')
+        conn = sqlite3.connect(database)
+        c = conn.cursor()
+        c.execute("SELECT * FROM " + 'grid_current')
+        results = c.fetchall()
+
+        self.tableWidget.setRowCount(len(results))
+
+        i = 0
+        j = 0
+        k = 0
+
+        while i < len(results):
+            line = results[i]
+            while j < 8:
+                var = line[j]
+
+                self.tableWidget.setItem(i, j, self.MyTableWidgetItem(str(var), j+i))
+                #item = self.MyTableWidgetItem(str(var), k)
+                #self.tableWidget.setItem(i, j, item)
+
+                j += 1
+                #if j == 3:
+                    #print(k)
+                #k += 1
+            #k -= 7
+            k += 1
+            j = 0
+            i += 1
+
+        c.close()
+        conn.close()
+        self.calc_label.setText('loading completed')
+        self.label_11.setText(str(len(results)) + ' results ')
+        self.setEnabled(True)
+        QtGui.QApplication.processEvents()
+
+    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)
+        c = conn.cursor()
+        c.execute("SELECT * FROM " + "grid_current")
+        results = c.fetchall()
+        #print(results)
+
+        self.tableWidget.setRowCount(len(results))
+
+        i = 0
+        j = 0
+        row_cnt = -1
+        while i < len(results):
+            line = results[i]
+
+            if line[0] <= self.nx_max.value():
+
+                if line[0] >= self.nx_min.value():
+
+                    if line[1] <= self.ny_max.value():
+
+                        if line[1] >= self.ny_min.value():
+
+                            if line[2] <= self.nz_max.value():
+
+                                if line[2] >= self.nz_min.value():
+
+                                    if line[3] <= self.npex_max.value():
+
+                                        if line[3] >= self.npex_min.value():
+
+                                            if line[4] <= self.npey_max.value():
+
+                                                if line[4] >= self.npey_min.value():
+
+                                                    if line[5] <= self.npxnpy_max.value():
+
+                                                        if line[5] >= self.npxnpy_min.value():
+
+                                                            if line[6] <= self.np_max.value():
+
+                                                                if line[6] >= self.np_min.value():
+
+                                                                    if line[7] <= self.ngpts_max.value():
+
+                                                                        if line[7] >= self.ngpts_min.value():
+
+                                                                            row_cnt += 1
+                                                                            while j < 8:
+                                                                                var = line[j]
+                                                                                self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str(var), i))
+
+                                                                                j += 1
+
+            j = 0
+            i += 1
+
+        c.close()
+        conn.close()
+        self.tableWidget.setRowCount(row_cnt + 1)
+        self.setEnabled(True)
+        self.calc_label.setText('calculation completed')
+        self.label_11.setText(str(row_cnt + 1) + ' results')
+        QtGui.QApplication.processEvents()
+
+
+
+
+
+    def sort_order(self):
+
+        sorted = 0
+        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 str(self.Sortvariable_box.currentIndex()) == str(1):
+
+
+            sorted_col = "nx"
+        if str(self.Sortvariable_box.currentIndex()) == str(2):
+
+            sorted_col = "ny"
+        if str(self.Sortvariable_box.currentIndex()) == str(3):
+
+            sorted_col = "nz"
+        if str(self.Sortvariable_box.currentIndex()) == str(4):
+
+            sorted_col = "npex"
+        if str(self.Sortvariable_box.currentIndex()) == str(5):
+
+            sorted_col = "npey"
+        if str(self.Sortvariable_box.currentIndex()) == str(6):
+
+            sorted_col = "npxnpy"
+        if str(self.Sortvariable_box.currentIndex()) == str(7):
+
+            sorted_col = "np"
+        if str(self.Sortvariable_box.currentIndex()) == str(8):
+
+            sorted_col = "ngpts"
+
+        print(self.Sortvariable_box.currentIndex())
+
+        if str(self.Sortorder_box.currentIndex()) == str(1):
+
+            order = " ASC"
+
+        if str(self.Sortorder_box.currentIndex()) == str(2):
+
+            order = " DESC"
+
+
+
+
+
+
+
+
+        conn = sqlite3.connect(".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]
+                self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str(value)))
+
+
+
+
+
+
+        print(len(sorted))
+        #print(sorted)
+
+
+
+
+if __name__ == "__main__":
+    app = QtGui.QApplication(sys.argv)
+    window = MyApp3()
+    window.setWindowTitle('Gridfilter')
+    window.show()
+    sys.exit(app.exec_())
+
