[Avida-cvs] [Avida2-svn] r222 - trunk/source/python/AvidaGui2
jclune@myxo.css.msu.edu
jclune at myxo.css.msu.edu
Fri Jul 1 12:01:00 PDT 2005
Author: jclune
Date: 2005-07-01 15:01:00 -0400 (Fri, 01 Jul 2005)
New Revision: 222
Added:
trunk/source/python/AvidaGui2/pyFreezeOrganismCtrl.py
trunk/source/python/AvidaGui2/pyFreezeOrganismView.ui
Log:
added
Added: trunk/source/python/AvidaGui2/pyFreezeOrganismCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyFreezeOrganismCtrl.py 2005-07-01 18:55:25 UTC (rev 221)
+++ trunk/source/python/AvidaGui2/pyFreezeOrganismCtrl.py 2005-07-01 19:01:00 UTC (rev 222)
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+
+from qt import *
+from pyFreezeOrganismView import pyFreezeOrganismView
+import shutil, os, os.path
+
+# class to pop up a dialog box to ask for what to freeze and to
+# return the name of a file to save information to be frozen
+
+class pyFreezeOrganismCtrl (pyFreezeOrganismView):
+ def __init__(self):
+ pyFreezeOrganismView.__init__(self)
+
+ def showDialog(self, freezer_dir = None):
+ found_valid_name = False
+ dialog_result = 1
+ while (found_valid_name == False and dialog_result > 0):
+ while (self.exec_loop() and self.result() == 0):
+ pass
+ dialog_result = self.result()
+ tmp_name = str(self.FileNameLineEdit.text())
+
+ if dialog_result == 0:
+ return ''
+ elif (tmp_name == ''):
+ found_valid_name = False
+ self.MainMessageTextLabel.setText("Enter a Non-Blank Name of Organism to Freeze")
+ else:
+ if (tmp_name.endswith(".organism") == False):
+ tmp_name = tmp_name + ".organism"
+ tmp_name = os.path.join(freezer_dir, tmp_name)
+ if os.path.exists(tmp_name):
+ found_valid_name = False
+ self.MainMessageTextLabel.setText("Organism Name Exists, Please Enter a Different Name")
+ else:
+ found_valid_name = True
+ return tmp_name
+
Added: trunk/source/python/AvidaGui2/pyFreezeOrganismView.ui
===================================================================
--- trunk/source/python/AvidaGui2/pyFreezeOrganismView.ui 2005-07-01 18:55:25 UTC (rev 221)
+++ trunk/source/python/AvidaGui2/pyFreezeOrganismView.ui 2005-07-01 19:01:00 UTC (rev 222)
@@ -0,0 +1,114 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>pyFreezeOrganismView</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>pyFreezeOrganismView</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>392</width>
+ <height>152</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Freeze</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>MainMessageTextLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Enter Name of Organism to Freeze</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>FileNameLineEdit</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>LineEditPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>SaveToFreezerPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>Freeze</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>CancelPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>SaveToFreezerPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>pyFreezeOrganismView</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>CancelPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>pyFreezeOrganismView</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
More information about the Avida-cvs
mailing list