mailr12059 - in /branches/bieri_gui/gui_bieri: menu.py paths.py user_functions/pipes.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on December 30, 2010 - 23:51:
Author: bugman
Date: Thu Dec 30 23:51:38 2010
New Revision: 12059

URL: http://svn.gna.org/viewcvs/relax?rev=12059&view=rev
Log:
Created the pipe.copy user function window and menu entry.


Modified:
    branches/bieri_gui/gui_bieri/menu.py
    branches/bieri_gui/gui_bieri/paths.py
    branches/bieri_gui/gui_bieri/user_functions/pipes.py

Modified: branches/bieri_gui/gui_bieri/menu.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/menu.py?rev=12059&r1=12058&r2=12059&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/menu.py (original)
+++ branches/bieri_gui/gui_bieri/menu.py Thu Dec 30 23:51:38 2010
@@ -197,13 +197,14 @@
                 [wx.NewId(), "&delete", paths.icon_16x16.remove, 
self.gui.user_functions.molecule.delete]
             ]],
             [wx.NewId(), "&pipe", paths.icon_16x16.pipe, None, [
+                [wx.NewId(), "&copy",   paths.icon_16x16.copy, 
self.gui.user_functions.pipes.copy],
                 [wx.NewId(), "&create", paths.icon_16x16.add, 
self.gui.user_functions.pipes.create],
                 [wx.NewId(), "&delete", paths.icon_16x16.remove, 
self.gui.user_functions.pipes.delete],
                 [wx.NewId(), "&switch", paths.icon_16x16.pipe_switch, 
self.gui.user_functions.pipes.switch]
             ]],
             [wx.NewId(), "&relax_data", paths.icon_16x16.relax_data, None, [
                 [wx.NewId(), "&delete", paths.icon_16x16.remove, 
self.gui.user_functions.relax_data.delete],
-                [wx.NewId(), "&read", paths.icon_16x16.open, 
self.gui.user_functions.relax_data.read]
+                [wx.NewId(), "&read",   paths.icon_16x16.open, 
self.gui.user_functions.relax_data.read]
             ]],
             [wx.NewId(), "resid&ue", paths.icon_16x16.residue, None, [
                 [wx.NewId(), "&create", paths.icon_16x16.add, 
self.gui.user_functions.residue.create],

Modified: branches/bieri_gui/gui_bieri/paths.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/paths.py?rev=12059&r1=12058&r2=12059&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/paths.py (original)
+++ branches/bieri_gui/gui_bieri/paths.py Thu Dec 30 23:51:38 2010
@@ -69,6 +69,7 @@
         self.cancel =               path + 'actions'    + sep + 
'dialog-cancel.png'
         self.contact =              path + 'actions'    + sep + 
'mail-mark-unread-new.png'
         self.controller =           path + 'apps'       + sep + 
'preferences-system-performance.png'
+        self.copy =                 path + 'actions'    + sep + 
'list-add.png'
         self.edit_delete =          path + 'actions'    + sep + 
'edit-delete.png'
         self.exit =                 path + 'actions'    + sep + 
'system-shutdown.png'
         self.load =                 path + 'actions'    + sep + 
'arrow-right.png'
@@ -101,6 +102,7 @@
         self.apply =                path + 'actions' + sep + 
'dialog-ok-apply.png'
         self.cancel =               path + 'actions' + sep + 
'dialog-cancel.png'
         self.close =                path + 'actions' + sep + 
'dialog-close.png'
+        self.copy =                 path + 'actions' + sep + 'list-add.png'
         self.ok =                   path + 'actions' + sep + 'dialog-ok.png'
         self.save =                 path + 'actions' + sep + 
'document-save.png'
         self.view_refresh =         path + 'actions' + sep + 
'view-refresh.png'
@@ -129,6 +131,7 @@
         self.apply =        path + 'actions' + sep + 'dialog-ok-apply.png'
         self.cancel =       path + 'actions' + sep + 'dialog-cancel.png'
         self.close =        path + 'actions' + sep + 'dialog-close.png'
+        self.copy =         path + 'actions' + sep + 'list-add.png'
         self.ok =           path + 'actions' + sep + 'dialog-ok.png'
         self.save =         path + 'actions' + sep + 'document-save.png'
         self.view_refresh = path + 'actions' + sep + 'view-refresh.png'
@@ -147,6 +150,7 @@
         self.add =          path + 'actions' + sep + 
'list-add-relax-blue.png'
         self.backwards =    path + 'actions' + sep + 'go-previous-view.png'
         self.cancel =       path + 'actions' + sep + 'dialog-cancel.png'
+        self.copy =         path + 'actions' + sep + 'list-add.png'
         self.forwards =     path + 'actions' + sep + 'go-next-view.png'
         self.remove =       path + 'actions' + sep + 'list-remove.png'
         self.save =         path + 'actions' + sep + 'document-save.png'

Modified: branches/bieri_gui/gui_bieri/user_functions/pipes.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/pipes.py?rev=12059&r1=12058&r2=12059&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/user_functions/pipes.py (original)
+++ branches/bieri_gui/gui_bieri/user_functions/pipes.py Thu Dec 30 23:51:38 
2010
@@ -31,6 +31,7 @@
 
 # GUI module imports.
 from base import UF_base, UF_window
+from gui_bieri.misc import gui_to_str
 from gui_bieri.paths import WIZARD_IMAGE_PATH
 
 
@@ -53,6 +54,23 @@
 
         # Destroy.
         self._create_window.Destroy()
+
+
+    def copy(self, event):
+        """The pipe.copy user function.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Initialise the dialog.
+        window = Copy_window(self.gui, self.interpreter)
+
+        # Show the dialog.
+        window.ShowModal()
+
+        # Destroy.
+        window.Destroy()
 
 
     def delete(self, event):
@@ -125,6 +143,65 @@
 
         # Set the name.
         self.interpreter.pipe.create(pipe_name=pipe_name, 
pipe_type=pipe_type)
+
+
+
+class Copy_window(UF_window):
+    """The pipe.copy() user function window."""
+
+    # Some class variables.
+    size_x = 600
+    size_y = 400
+    frame_title = 'Copy a data pipe'
+    image_path = WIZARD_IMAGE_PATH + 'pipe.png'
+    main_text = 'This dialog allows you to copy data pipes.'
+    title = 'Data pipe copy'
+
+
+    def add_uf(self, sizer):
+        """Add the pipe specific GUI elements.
+
+        @param sizer:   A sizer object.
+        @type sizer:    wx.Sizer instance
+        """
+
+        # The source pipe.
+        self.pipe_from = self.combo_box(sizer, "The source pipe:", [])
+
+        # The destination pipe.
+        self.pipe_to = self.input_field(sizer, "The destination pipe name:")
+
+
+    def execute(self):
+        """Execute the user function."""
+
+        # Get the pipe names.
+        pipe_from = gui_to_str(self.pipe_from.GetValue())
+        pipe_to = gui_to_str(self.pipe_to.GetValue())
+
+        # Copy the data pipe.
+        self.interpreter.pipe.copy(pipe_from, pipe_to)
+
+        # Update.
+        self.update(None)
+
+
+    def update(self, event):
+        """Update the UI.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Clear the previous data.
+        self.pipe_from.Clear()
+
+        # Clear the pipe name.
+        self.pipe_from.SetValue('')
+
+        # The list of pipe names.
+        for name in pipe_names():
+            self.pipe_from.Append(name)
 
 
 




Related Messages


Powered by MHonArc, Updated Fri Dec 31 09:40:02 2010