[Avida-SVN] r1669 - branches/developers/avida-edward/source/python/AvidaGui2
baerb at myxo.css.msu.edu
baerb at myxo.css.msu.edu
Mon Jun 11 14:56:22 PDT 2007
Author: baerb
Date: 2007-06-11 17:56:13 -0400 (Mon, 11 Jun 2007)
New Revision: 1669
Added:
branches/developers/avida-edward/source/python/AvidaGui2/pyRenameDialogCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyRenameDialogView.ui
Log:
Oops forgot to put in these files to work with my new changes.
Added: branches/developers/avida-edward/source/python/AvidaGui2/pyRenameDialogCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyRenameDialogCtrl.py (rev 0)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyRenameDialogCtrl.py 2007-06-11 21:56:13 UTC (rev 1669)
@@ -0,0 +1,37 @@
+from qt import *
+from descr import *
+from pyRenameDialogView import pyRenameDialogView
+import os, os.path
+
+# class to pop up a dialog box to allow a user to rename one or more files
+
+class pyRenameDialogCtrl (pyRenameDialogView):
+ def __init__(self):
+ pyRenameDialogView.__init__(self)
+
+ def showDialog(self, files2process):
+ if (len(files2process) == 1):
+ file_name = files2process[0]
+ short_name_str = os.path.basename(file_name)
+ prefix = str(os.path.dirname(file_name))
+ if (short_name_str.endswith("empty")):
+ short_name_str = short_name_str[:-6]
+ suffix = ".empty"
+ elif (short_name_str.endswith("full")):
+ short_name_str = short_name_str[:-5]
+ suffix = ".full"
+ elif (short_name_str.endswith("organism")):
+ short_name_str = short_name_str[:-9]
+ suffix = ".organism"
+ new_prompt_str = "Enter new name for " + str(short_name_str)
+ self.MainMessageTextLabel.setText(new_prompt_str)
+ self.newNameLineEdit.setText(str(short_name_str))
+ dialog_result = self.exec_loop()
+ if ((dialog_result == 1) and (self.newNameLineEdit.text() != "")):
+ new_name = os.path.join(prefix, str(self.newNameLineEdit.text()) + suffix)
+ if (os.path.exists(new_name) == False):
+ os.rename(file_name, new_name)
+ return(dialog_result)
+ else:
+ warning("Currently you can only rename one item at a time")
+ return(0)
Added: branches/developers/avida-edward/source/python/AvidaGui2/pyRenameDialogView.ui
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyRenameDialogView.ui (rev 0)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyRenameDialogView.ui 2007-06-11 21:56:13 UTC (rev 1669)
@@ -0,0 +1,139 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>pyRenameDialogView</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>pyRenameDialogView</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>387</width>
+ <height>129</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Rename File</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string><p>The new name of the item if you choose to rename it.</p></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>MainMessageTextLabel</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <family>Arial</family>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Enter new name for xxx.</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>newNameLineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <family>Arial</family>
+ </font>
+ </property>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>FreezeCancelButtonGroup</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ConfirmPushButton</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <family>Arial</family>
+ </font>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="text">
+ <string>Confirm</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string><P>Save the named file</P></string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>CancelPushButton</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <family>Arial</family>
+ </font>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string><p>Don't save, return to the program</P></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>CancelPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>pyRenameDialogView</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>ConfirmPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>pyRenameDialogView</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>ConfirmPushButton</tabstop>
+ <tabstop>CancelPushButton</tabstop>
+ <tabstop>FreezeCancelButtonGroup</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
More information about the Avida-cvs
mailing list