mailRe: [task #6847] The Bieri graphical user interface.


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

Header


Content

Posted by Edward d'Auvergne on January 20, 2010 - 11:30:
Hi,

Ah, ok.  I missed that file.  I'll add it now (there'll probably be
comments).  Ok, I have a few comments:

- The copyright year is incorrect, it should be 2010.

- The directory 'res' may not be the best place for the file.  What
does 'res' stand for?  It would be good to have one directory for the
pictures, one directory for the calculation code, and one directory
for the GUI elements.  Clean separation of ideas, code, files, etc. is
important.

- There are no module docstrings, class docstrings, or method/function
docstrings.  For example you could easily replace:

   def cancel_calculation(self, event): # abort calculation
       self.close_button.Enable(True)
       event.Skip()

with:

   def cancel_calculation(self, event):
       """Abort the calculation.

       @param event:    Some description of what this argument is.
       @type event:       The specific type of this arg, i.e. int,
float, xxx class instance, wx.XXX instance, etc.
       """

       self.close_button.Enable(True)
       event.Skip()

Note the capital at the start and the full stop.  For the @param and
@type fields, look at any other part of relax (specific_fns or
generic_fns is good) to see how I've done this.  This is very
important for the API documentation (http://www.nmr-relax.com/api/).
It is also to tell other developers what the specific aims of this
function are.

- The commenting is very good!  This is perfect for others to
understand what is happening.

- I would again suggest a rearrangement to allow for expansion, easier
debugging, and adding flexibility such as resizing capabilities if the
main window is made bigger or smaller.  That is that __init__(),
__set_properties(), and __do_layout() are redesigned.  I would have a
series of methods called from __init__():

ui_main_window(),
ui_header(),
ui_log_panel(),
ui_progress_bar(),
ui_buttons(),

These are just suggestions.  The could be private, _ui_main_window(),
or they could be differently named _main_window(), main_window(),
gui_main_window(), etc.  In these methods,  the wx commands are issued
to create the objects, to set their properties, and to perform the
layout.  The reason to divide to GUI code up like this is so that all
the progress bar code is in one place - you don't have to jump to 3
different places in the file to modify the progress bar.  Each of
these methods would have a creation section, a sizing section, a
properties section, and a layout section (if other objects go inside
this object).  If this module expands to 1000+ lines, then this
becomes more and more important.

-  The global parameters are again a major issue.  These should be
passed into functions or returned by functions, and never placed in
the global namespace for all to access.

Cheers,

Edward


2010/1/20 Michael Bieri <michael.bieri@xxxxxx>:
Hi edward

I am at home now and will fix the remaining patches tomorrow, but thank you
for these changes!

The new module is from the new script file i attached to the task:
relax_control.py (or similar)!

Have a nice day!

Liebe grüsse
Michael



Am 20.01.2010 um 19:38 schrieb "Edward d'Auvergne" <edward@xxxxxxxxxxxxx>:

Hi,

I've applied what I can, but a few patches failed.  Here is a summary.

Successful:
  application_patch
  import_patch (this was mildly problematic, but still applied)
  removed_tab_in_modelfree_patch (the gui_bieri/relax_gui.py changes
were no applied!)
  calc_rx_patch
  calc_noe_patch

Failed:
  statusbar_size_patch (cannot find the revision this applies to)
  mkdir_patch (broken patch)
  relax_log_window_start_patch (cannot find the revision this
applies to, and also contains a change from multi_openfile to openfile
which doesn't belong in this patch)

Fixing and resubmitting the last three shouldn't be too difficult.  If
you could apply them to the current revision ("svn up" to get to
r10264 or higher), report the exact revision they work against, and
reattach them to the task, that would be appreciated.  I've also
tested the code and noticed an import error:

[edward@localhost bieri_gui]$ ./relax -g
Traceback (most recent call last):
 File "./relax", line 54, in <module>
  import gui_bieri
 File "/data/relax/branches/bieri_gui/gui_bieri/__init__.py", line
39, in <module>
  from relax_gui import about_relax, main
 File "/data/relax/branches/bieri_gui/gui_bieri/relax_gui.py", line
47, in <module>
  from res.relax_control import start_rx, start_noe
ImportError: No module named relax_control

Is there a new module called relax_control.py?  Is it new, or was it
copied from somewhere?

Cheers,

Edward


2010/1/19 Michael Bieri <NO-REPLY.INVALID-ADDRESS@xxxxxxx>:

Follow-up Comment #20, task #6847 (project relax):

Hi Edward

I collected all the missing patches:

relax_log_window_start_patch:

Opening the relaxGUI Log Window after pushing start-relax button

added:
+from res.project import create_save_file, open_file
+from res.relax_control import start_rx, start_noe

changed:
make_noe() to start_noe()
make_rx() to start_rx()

_________________________________


calc_noe_patch:

Created feedback to relaxGUI Log Window during NOE calculation

added:

class RedirectText --> redirect the relax output to relaxGUI Log Window

# Number of Monte Carlo simulations
global montecarlo
montecarlo = int(global_setting[6])

--> set monte carlo value for updating progress bar in log window


# value for progress bar during monte carlo simulation
global progress
progress = 5.0

--> initial progress value before monte carlo simulation



# redirect relax output and errors to relaxGUI - log panel
redir=RedirectText(self)
sys.stdout=redir
sys.stderr=redir

redirecting system output and error to new created class that updates log
window

_________________________________


calc_rx_patch:

Created feedback to relaxGUI Log Window during Rx calculation

added:

class RedirectText --> redirect the relax output to relaxGUI Log Window

# Number of Monte Carlo simulations
global montecarlo
montecarlo = int(global_setting[6])

--> set monte carlo value for updating progress bar in log window


# value for progress bar during monte carlo simulation
global progress
progress = 5.0

--> initial progress value before monte carlo simulation



# redirect relax output and errors to relaxGUI - log panel
redir=RedirectText(self)
sys.stdout=redir
sys.stderr=redir

redirecting system output and error to new created class that updates log
window

-------------------------------------------------

removed_tab_in_modelfree_patch:

replaced tabulators to 4 space characters in calc_model_free.py


----------------------------------------------------

mkdir_patch:

replaced os.sytem('mkdir ' + ....) to os.mkdir()


--------------------------------------------------


statusbar_size_patch:

increased the size of the 3. cell of the status bar. Now 'repository
checkout' is fully displaid


-------------------------------------------------

import_patch:

replaced form xxxx import * with from xxx import yyy, aaa....  in
relax_gui.py


------------------------ ------------------------

application_patch:

about relaxGUI panel does not create own wx application

removed:

about.py:
-    app = wx.PySimpleApp(0)
-    wx.InitAllImageHandlers()
-    start = MyFrame(None, -1, "")
-    app.SetTopWindow(start)
-    start.Show()
-    app.MainLoop()


changed:
xw.Frame to wx.Dialog in about.py

moved:
in __init__.py (main folder)

+    # start wx Application
+    relaxGUI = wx.PySimpleApp(0)
+    wx.InitAllImageHandlers()

 -->  to start one wx application for about panel and main relaxGUI
window

-----------------------------------


The patches are in the compressed file below.

Cheers
Michael



(file #7726)
  _______________________________________________________

Additional Item Attachment:

File name: 100120_patches.zip             Size:20 KB


  _______________________________________________________

Reply to this item at:

 <http://gna.org/task/?6847>

_______________________________________________
 Nachricht geschickt von/durch Gna!
 http://gna.org/


_______________________________________________
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 Jan 20 12:00:24 2010