mailRe: r11067 - /branches/bieri_gui/gui_bieri/controller.py


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

Header


Content

Posted by Michael Bieri on April 14, 2010 - 00:24:
I googled a lot and everybody seems to be complaining about handling threads in both modules. The advantage of threading is that you might check if the thread is still running, but this is somehow useless for us. We can hope that newer python releases include a way to kill threads - especially considering newer computers have quad core processors....

Edward d'Auvergne wrote:
Could we switch 100% to the 'threading' package?  Would this allow a
thread to be killed?  Are there other ways to stop a thread?  Others
must have encountered this and found clean solutions.

Regards,

Edward


On 13 April 2010 00:44, Michael Bieri <michael.bieri@xxxxxxxxxxxxx> wrote:
Python does not allow management of threads in both modules, thread and
threading... The question dialog was applied later on.

Edward d'Auvergne wrote:
Ouch, is this necessary?  Can the threading module be used instead?  A
kill button that instantly blows up the program is a bit dangerous.  I
thought that that was why the question dialog was introduced before
exiting.  The user will always have access to file->quit or the close
button in the top right hand corner.  I would suggest instead of
shifting all the cancel button code into its own method and then
commenting out the one line creating the button until we can properly
cancel a thread (note that the status object could be used here to
communicate with the other code that it should stop!).

Regards,

Edward


On 12 April 2010 06:43,  <michael.bieri@xxxxxxxxxxxxx> wrote:

Author: michaelbieri
Date: Mon Apr 12 06:43:06 2010
New Revision: 11067

URL: http://svn.gna.org/viewcvs/relax?rev=11067&view=rev
Log:
The relaxGUI controller cancel button is replaced with a kill  button.

As python does not allow to selectively kill running threads, a kill button 
in the relaxGUI controller was introduced, which kills the program.

Modified:
   branches/bieri_gui/gui_bieri/controller.py

Modified: branches/bieri_gui/gui_bieri/controller.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/controller.py?rev=11067&r1=11066&r2=11067&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/controller.py (original)
+++ branches/bieri_gui/gui_bieri/controller.py Mon Apr 12 06:43:06 2010
@@ -61,7 +61,7 @@
        self.progress_bar = wx.Gauge(self, -1, 100)

        # buttons
-        self.cancel_button = wx.Button(self, -1, "Cancel")
+        self.cancel_button = wx.Button(self, -1, "Kill")
        self.close_button = wx.Button(self, -1, "Close")

        # Create Objects (see below)
@@ -118,6 +118,8 @@
        @type event:    wx event
        """

+        sys.exit(0)
+
        # Terminate the event.
        event.Skip()

@@ -178,14 +180,17 @@
            wx.CallAfter(self.out.progress_bar.SetValue, 
(100*no/total_models))

        # Sphere to Ellipsoid Models.
-        if self.status.dAuvergne_protocol.diff_model in ['sphere', 
'prolate', 'oblate', 'ellipsoid']:
+        elif self.status.dAuvergne_protocol.diff_model in ['sphere', 
'prolate', 'oblate', 'ellipsoid']:
            # Determine actual round (maximum is 20).
            wx.CallAfter(self.out.progress_bar.SetValue, 
(100*(self.status.dAuvergne_protocol.round-1)/20))

        # Final analysis.
-        if self.status.dAuvergne_protocol.diff_model == 'final':
+        elif self.status.dAuvergne_protocol.diff_model == 'final':
            mc_simulation = self.status.mc_number

+        # Rx Analysis.
+        else:
+            print str(cdp.sim_number)

        # Add new output.
        wx.CallAfter(self.out.log_panel.AppendText, string)


_______________________________________________
relax (http://nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits


_______________________________________________
relax (http://nmr-relax.com)

This is the relax-devel mailing list
relax-devel@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel



_______________________________________________
relax (http://nmr-relax.com)

This is the relax-devel mailing list
relax-devel@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel






Related Messages


Powered by MHonArc, Updated Wed Apr 14 00:40:15 2010