[Avida-cvs] [avida-svn] r430 - branches/developers/avida-edward/source/python/AvidaGui2
baerb@myxo.css.msu.edu
baerb at myxo.css.msu.edu
Tue Jan 3 14:50:36 PST 2006
Author: baerb
Date: 2006-01-03 17:50:36 -0500 (Tue, 03 Jan 2006)
New Revision: 430
Added:
branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogView.ui
Modified:
branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py
Log:
Started adding code to allow users to delete/rename files.
So far have written the interface to allow right clicking.
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py 2005-12-29 20:34:42 UTC (rev 429)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py 2006-01-03 22:50:36 UTC (rev 430)
@@ -8,6 +8,7 @@
from pyReadFreezer import pyReadFreezer
from pyWriteToFreezer import pyWriteToFreezer
from pyFreezeOrganismCtrl import pyFreezeOrganismCtrl
+from pyRightClickDialogCtrl import pyRightClickDialogCtrl
import os.path
class pyFreezerListView(QListView):
@@ -127,6 +128,9 @@
self.connect(self.m_list_view,
SIGNAL("pressed(QListViewItem*, const QPoint &, int )"),
self.pressed_itemSlot)
+ self.connect(self.m_list_view,
+ SIGNAL("rightButtonPressed(QListViewItem*, const QPoint &, int )"),
+ self.right_clicked_itemSlot)
self.setAcceptDrops(1)
descr()
@@ -164,6 +168,10 @@
def createFreezerIndexSlot(self):
descr()
+
+ # Freezer is hardcoded to list in order :
+ # Empty Dishes, Full Dishes, Organisms
+
self.m_empty_item = self.m_list_view.firstChild()
while self.m_empty_item.firstChild():
tmp_child = self.m_empty_item.firstChild()
@@ -249,7 +257,14 @@
self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("freezerItemDoubleClicked"),
(file_name,))
+ # if item is right clicked pull up services menu
+ def right_clicked_itemSlot(self, item):
+ print item.text(0)
+ m_right_click_menu = pyRightClickDialogCtrl()
+ cancel_confirm = m_right_click_menu.showDialog()
+ print cancel_confirm
+
class itemDrag(QTextDrag):
def __init__(self, item_name, parent=None, name=None):
QStoredDrag.__init__(self, 'item name (QString)', parent, name)
Added: branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py 2005-12-29 20:34:42 UTC (rev 429)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py 2006-01-03 22:50:36 UTC (rev 430)
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+
+from qt import *
+from pyRightClickDialogView import pyRightClickDialogView
+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 pyRightClickDialogCtrl (pyRightClickDialogView):
+ def __init__(self):
+ pyRightClickDialogView.__init__(self)
+ self.connect(self.CancelPushButton, SIGNAL("clicked()"), self.DownCancelSlot)
+ self.connect(self.ConfirmPushButton, SIGNAL("clicked()"), self.DownConfirmSlot)
+ self.ConfirmFlag = 1
+ self.CancelFlag = 2
+
+ def DownCancelSlot(self):
+ self.QuitCancelButton.setDown(True)
+
+ def DownConfirmSlot(self):
+ self.ConfirmPushButton.setDown(True)
+
+ def showDialog(self):
+ dialog_result = 1
+ while (dialog_result > 0):
+ while (self.exec_loop() and self.result() == 0):
+ pass
+ dialog_result = self.result()
+ if dialog_result == 0:
+ return self.CancelFlag
+ elif self.ConfirmPushButton.isDown():
+ return self.ConfirmFlag
+ else:
+ return self.CancelFlag
Added: branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogView.ui
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogView.ui 2005-12-29 20:34:42 UTC (rev 429)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogView.ui 2006-01-03 22:50:36 UTC (rev 430)
@@ -0,0 +1,151 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>pyRightClickDialogView</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>pyRightClickDialogView</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>133</width>
+ <height>224</height>
+ </rect>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>100</blue>
+ </color>
+ </property>
+ <property name="caption">
+ <string></string>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ItemChoicesButtonGroup</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>113</width>
+ <height>204</height>
+ </rect>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>100</blue>
+ </color>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="alignment">
+ <set>AlignHCenter</set>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>DeleteRadioButton</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>100</blue>
+ </color>
+ </property>
+ <property name="text">
+ <string>delete</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>RenameRadioButton</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>100</blue>
+ </color>
+ </property>
+ <property name="text">
+ <string>rename</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>SaveAsRadioButton</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>100</blue>
+ </color>
+ </property>
+ <property name="text">
+ <string>save as</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>OpenRadioButton</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>100</blue>
+ </color>
+ </property>
+ <property name="text">
+ <string>open</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ConfirmPushButton</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>100</blue>
+ </color>
+ </property>
+ <property name="text">
+ <string>Confirm</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>CancelPushButton</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>100</blue>
+ </color>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py 2005-12-29 20:34:42 UTC (rev 429)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py 2006-01-03 22:50:36 UTC (rev 430)
@@ -43,6 +43,8 @@
nontest_module_names = [
"AvidaGui2.pyQuitDialogView",
"AvidaGui2.pyQuitDialogCtrl",
+ "AvidaGui2.pyRightClickDialogView",
+ "AvidaGui2.pyRightClickDialogCtrl",
"AvidaGui2.pyAnalyzeControlsView",
"AvidaGui2.pyAnalyzeControlsCtrl",
"AvidaGui2.pyAvidaStatsInterface",
More information about the Avida-cvs
mailing list