diffpy / diffpy.pdfgui

graphical user interface for real space structure refinement to PDF
Other
18 stars 27 forks source link

update remaining wxg files for wxglade-0.8.3 #31

Closed pavoljuhas closed 4 years ago

pavoljuhas commented 5 years ago

The commit 3ce35c9649ccf105ce0fdb4cd6ef52b419209672 updated 4 out of 27 wxg files to wxglade-0.8.3.

For the sake of code maintenance we should

@dragonyanglong - can you take on this one?

dragonyanglong commented 5 years ago

Sure, I am glad to do it!

dragonyanglong commented 5 years ago

Hi @pavoljuhas ,

I am updating all wxg files by the filename's alphabetic order to the newest wxGlade v0.9.3.

So far, adddatapanel, addphasepanel, bondlengthdialog works compatibly okay in wxpython 3. But wxGlade v0.9.3 is requiring wxpython 4. For example, if I update datasetconstrintpanel to wxGlade v0.9.3 and still run pdfgui in wxpython 3, it gives the error as below.

/Users/Dragon/anaconda/envs/pdfgui2/bin/python.app -m diffpy.pdfgui.applications.pdfgui
diffpy/pdfgui/version.py:37: UserWarning: Package metadata not found, execute "./setup.py egg_info".
  warn('Package metadata not found, execute "./setup.py egg_info".')
Traceback (most recent call last):
  File "/Users/Dragon/anaconda/envs/pdfgui2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/Dragon/anaconda/envs/pdfgui2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/Dragon/Documents/Billinge/dev/diffpy.pdfgui/src/diffpy/pdfgui/applications/pdfgui.py", line 129, in <module>
    main()
  File "/Users/Dragon/Documents/Billinge/dev/diffpy.pdfgui/src/diffpy/pdfgui/applications/pdfgui.py", line 121, in main
    guimain.main()
  File "diffpy/pdfgui/gui/Main.py", line 38, in main
    app = PDFGuiApp(0)
  File "/Users/Dragon/anaconda/envs/pdfgui2/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx/_core.py", line 8631, in __init__
    self._BootstrapApp()
  File "/Users/Dragon/anaconda/envs/pdfgui2/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx/_core.py", line 8196, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "diffpy/pdfgui/gui/Main.py", line 24, in OnInit
    self.frame = MainFrame(None, -1, "")
  File "diffpy/pdfgui/gui/mainframe.py", line 185, in __init__
    self.__customProperties()
  File "diffpy/pdfgui/gui/mainframe.py", line 313, in __customProperties
    "dataset"      :       DataSetPanel(self, -1),
  File "diffpy/pdfgui/gui/datasetpanel.py", line 36, in __init__
    self.constraintPanel = DataSetConstraintPanel(self.constraintsPage, -1)
  File "diffpy/pdfgui/gui/datasetconstraintpanel.py", line 39, in __init__
    self.__set_properties()
  File "diffpy/pdfgui/gui/datasetconstraintpanel.py", line 48, in __set_properties
    self.setToolTips(toolTips)
  File "diffpy/pdfgui/gui/errorwrapper.py", line 59, in _f
    return func(*args, **kwargs)
  File "diffpy/pdfgui/gui/pdfpanel.py", line 51, in setToolTips
    control = getattr(self, controlName)
AttributeError: 'DataSetConstraintPanel' object has no attribute 'sizer_panelname_staticbox'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/Users/Dragon/anaconda/envs/pdfgui2/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
PyAssertionError: C++ assertion "GetEventHandler() == this" failed at /BUILD/wxPython-src-3.0.0.0/src/common/wincmn.cpp(478) in ~wxWindowBase(): any pushed event handlers must have been removed
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/Users/Dragon/anaconda/envs/pdfgui2/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
wx._core.PyAssertionError: C++ assertion "GetEventHandler() == this" failed at /BUILD/wxPython-src-3.0.0.0/src/common/wincmn.cpp(478) in ~wxWindowBase(): any pushed event handlers must have been removed

I suspect the reason is that wxpython4 has some different functions (issue dragonyanglong/diffpy.pdfgui#33) So I tried to conda update package to wxpython4, but then I cannot launch PDFgui anymore. Please see the error as below. It seems like some old function in mainframe.py is not supported in wxpython4 anymore. However, there is no wxg file for the mainframe. How can I upgrade this file? Do you have suggestions about that? Thank you very much!

(pdfgui2_test) yanglongdeMacBook-Pro:src Dragon$ python.app -m diffpy.pdfgui.applications.pdfgui   
diffpy/pdfgui/version.py:37: UserWarning: Package metadata not found, execute "./setup.py egg_info".
  warn('Package metadata not found, execute "./setup.py egg_info".')
02:53:48 PM: Debug: Adding duplicate image handler for 'Windows bitmap file'
Traceback (most recent call last):
  File "diffpy/pdfgui/gui/Main.py", line 24, in OnInit
    self.frame = MainFrame(None, -1, "")
  File "diffpy/pdfgui/gui/mainframe.py", line 179, in __init__
    self.treeCtrlMain = FitTree(self, -1, style=wx.TR_HAS_BUTTONS|wx.TR_NO_LINES|wx.TR_EDIT_LABELS|wx.TR_MULTIPLE|wx.TR_HIDE_ROOT|wx.TR_MULTIPLE|wx.TR_EXTENDED|wx.TR_DEFAULT_STYLE|wx.SUNKEN_BORDER)
AttributeError: 'module' object has no attribute 'TR_EXTENDED'
OnInit returned false, exiting...
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/Users/Dragon/anaconda/envs/pdfgui2_test/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
wxAssertionError: C++ assertion "GetEventHandler() == this" failed at /opt/concourse/worker/volumes/live/80490b2f-c578-4407-562a-dbbbe365123b/volume/wxpython_1547931284446/work/ext/wxWidgets/src/common/wincmn.cpp(478) in ~wxWindowBase(): any pushed event handlers must have been removed
Error in sys.exitfunc:
/Users/Dragon/anaconda/envs/pdfgui2_test/bin/python.app: line 3: 18038 Segmentation fault: 11  /Users/Dragon/anaconda/envs/pdfgui2_test/python.app/Contents/MacOS/python "$@"
(pdfgui2_test) yanglongdeMacBook-Pro:src Dragon$ 
pavoljuhas commented 5 years ago

AttributeError: 'DataSetConstraintPanel' object has no attribute 'sizer_panelname_staticbox'

The issue here is that wxglade 0.9.3 somehow removed sizer_panelname_staticbox attribute. You can use git diff after wxglade run to see what exactly did it change in the datasetconstraintpanel module. When that is clear, you will need to update the tooltip definitions https://github.com/diffpy/diffpy.pdfgui/blob/337956c13935e7db1e5428a7fadde8e6be32f7ed/src/diffpy/pdfgui/gui/tooltips.py#L47-L56 so that they are consistent with the GUI attributes created in DataSetConstraintPanel.__init__.

AttributeError: 'module' object has no attribute 'TR_EXTENDED'

According to this comment the TR_EXTENDED flag has been removed from recent wxpython as it is probably standard behavior. I would just remove that flag from FitTree instantiation.

I think we should upgrade the entire GUI code for wxpython4, because it is becoming a problem for Anaconda installation (which provides wx4 by default).

pavoljuhas commented 4 years ago

Completed as of 90d1fdb52eb46213732ae667efe55523bcd2b08e. All wxg files were updated to wxGlade 0.9.3. All dependent sources were refreshed.