[Avida-cvs] [Avida2-svn] r101 - trunk/source/python/AvidaGui2

baerb at myxo.css.msu.edu baerb at myxo.css.msu.edu
Tue Apr 5 12:36:53 PDT 2005


Author: baerb
Date: 2005-04-05 15:36:53 -0400 (Tue, 05 Apr 2005)
New Revision: 101

Added:
   trunk/source/python/AvidaGui2/pyQuitDialogCtrl.py
   trunk/source/python/AvidaGui2/pyQuitDialogView.ui
Log:
Added Quit Dialog -- is not used yet.



Added: trunk/source/python/AvidaGui2/pyQuitDialogCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyQuitDialogCtrl.py	2005-04-04 15:28:29 UTC (rev 100)
+++ trunk/source/python/AvidaGui2/pyQuitDialogCtrl.py	2005-04-05 19:36:53 UTC (rev 101)
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+
+from qt import *
+from pyQuitDialogView import pyQuitDialogView
+import shutil, os, os.path
+
+# class to pop up a dialog box when the user quits
+# to ask for what to freeze and to
+# return the name of a file to save information to be frozen
+
+class pyQuitDialogCtrl (pyQuitDialogView):
+  def __init__(self):
+    pyQuitDialogView.__init__(self)
+    self.connect(self.QuitPushButton, SIGNAL("clicked()"), self.DownQuitSlot)
+    
+  def DownQuitSlot(self):
+    self.QuitPushButton.setDown()
+    
+  def showDialog(self):
+    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())
+      print "dialog_result = " + str(dialog_result) + " QuitPushButton.isDown() = " + str(QuitPushButton.isDown())
+      if dialog_result == 0:
+        return 0
+      elif QuitPushButton.isDown():
+        return 1
+      else:
+        return 2

Added: trunk/source/python/AvidaGui2/pyQuitDialogView.ui
===================================================================
--- trunk/source/python/AvidaGui2/pyQuitDialogView.ui	2005-04-04 15:28:29 UTC (rev 100)
+++ trunk/source/python/AvidaGui2/pyQuitDialogView.ui	2005-04-05 19:36:53 UTC (rev 101)
@@ -0,0 +1,69 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>pyQuitDialogView</class>
+<widget class="QDialog">
+    <property name="name">
+        <cstring>pyQuitDialogView</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>322</width>
+            <height>54</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>Quit</string>
+    </property>
+    <hbox>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <widget class="QPushButton">
+            <property name="name">
+                <cstring>SaveToFreezerPushButton</cstring>
+            </property>
+            <property name="text">
+                <string>Freeze and Quit</string>
+            </property>
+        </widget>
+        <widget class="QPushButton">
+            <property name="name">
+                <cstring>QuitPushButton</cstring>
+            </property>
+            <property name="text">
+                <string>Quit</string>
+            </property>
+        </widget>
+        <widget class="QPushButton">
+            <property name="name">
+                <cstring>CancelPushButton</cstring>
+            </property>
+            <property name="text">
+                <string>Cancel</string>
+            </property>
+        </widget>
+    </hbox>
+</widget>
+<connections>
+    <connection>
+        <sender>SaveToFreezerPushButton</sender>
+        <signal>clicked()</signal>
+        <receiver>pyQuitDialogView</receiver>
+        <slot>accept()</slot>
+    </connection>
+    <connection>
+        <sender>CancelPushButton</sender>
+        <signal>clicked()</signal>
+        <receiver>pyQuitDialogView</receiver>
+        <slot>reject()</slot>
+    </connection>
+    <connection>
+        <sender>QuitPushButton</sender>
+        <signal>clicked()</signal>
+        <receiver>pyQuitDialogView</receiver>
+        <slot>close()</slot>
+    </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>




More information about the Avida-cvs mailing list