User:Pallav

From ASCEND
Jump to: navigation, search

He is dual-degree undergraduate student of International Institute of Information Technology, Hyderabad (IIIT-H) and pursuing MS in the field of Data Visualization at Center of Data Engineering(CDE) under the guidance of Prof. Kamal Karlapalem. Currently, he is involved in the development and improvements in the PYGTK GUI of ASCEND.

Contact Email : pallav.tinna1604@gmail.com

Subversion account : pallav:/

Link to all weekly project reports : here

GSoC 2013 Project : Porting to gtk3 and GUI Improvements

The proposal details can be found here


Highlights of the Project

  • Porting gtk2 PYGTK GUI to gtk3
    • Testing apps written to check which way of porting the whole application is better : compact layer or direct port. Turned out that compact layer has a few limitations - http://code.ascend4.org/viewvc/play/pt/
    • Using a pygtk compatible layer(pygtkcompat) which provides a pygtk compatible API on the top of gobject-introspection. This might not be a good option, so direct porting to pygi would be suitable.
    • Replacing deprecated functionality with the newer version API.
      • Cairo is used only in canvas modeller, which needs to be updated to new version, before porting. Since, in pygi the gdkDrawable was completely removed. It's good that we don't have any of this currently and all the drawings are done in cairo. But, the interaction of cairo with gtk3 changed a bit. So, need to look into it.
      • Look for the alternative for "pygtk require" command. [ Gtk.require_version('Gtk','3.0') ] package - libgtk-3-dev
      • All imports must be in different lines. This would ease the porting using the shell script (pygi-convert.sh). I did some changes manually in the script, to automate the process.
      • Vboxes/Hboxes orientation needs to be altered. GtkHBox and GtkVBox, commonly used containers in GTK2 code, have pack_start and pack_end methods. These take 4 parameters:
        • The widget to pack into the container
        • expand: Whether the child should receive extra space when the container grows (default True)
        • fill: True if space given to child by the expand option is actually allocated to child, rather than just padding it. This parameter has no effect if expand is set to False. A child is always allocated the full height of a gtk.HBox and the full width of a gtk.VBox. This option affects the other dimension. (default True)
        • padding: extra space in pixels to put between child and its neighbor (default 0)
      • In PyGTK, the expand, fill and padding parameters were optional: if unspecified, the default values above were used. In PyGI, these parameters are not optional: all 4 must be specified. Hence the rules for adding in the extra parameters are:
        • If expand was not set, use value True
        • If fill was not set, use value True. (however, if expand is False, this parameter gets ignored so False is an equally acceptable option when expand=False)
        • If padding was not set, use value 0.
      • Problems with tooltips and toolbars is that a lot of changes in the APIs. Need to look deeper, there are a few files.
      • No change in Gtk.builder and interaction with glade.
      • Labeling of objects must be handled using Label module [not necessary, but it would be good to follow a generalised rule]. This is for formatting text appearing in the window and objects like buttons, widgets etc.
      • Gtk.main_iteration no longer takes any arguments. Removing them seems to fix the error with no consequences. I probably didn’t need to be messing with the arguments there to begin with.
    • Code-flow for porting
    • Successful changes here, http://code.ascend4.org/viewvc/play/pt/changes_success/
      • No change required- varentry, config, preferences, help, incindencematrix, selftest, testloadunload and version check
      • Levels
        • 1. infodialog.py, imagedialog.py, filechooser.py, imagewindow.py, solverparameters.py, gtkexcepthook.py, libview.py,unitsdialog.py, loading.py
        • 2. properties.py
        • 3. modelview.py, moduleview.py, solverreporter.py
        • 4. solverhooks.py, studyreporter.py
        • 5. study.py, observer.py
        • 6. Diagnose Window : Testing
        • 7. integratorreporter.py : Testing
        • 8. integrator.py : Testing
        • 9. gtkbrowser.py : Testing
        • 10. librarytest.py, run.py
      • Changes done in the ipython_view, in accordance with gtk3 and pygi.
      • moduleview -> gtksourceview was not compatible with gtk3. Need to look for newer version of this.
        • gi.repository.GtkSource() provides the same functionality and is compatible with pygi, so it has replaced gtksourceview.
      • Matplotlib backend compatiblity with gtk3 [ https://github.com/matplotlib/matplotlib/pull/590 ]
        • Matplotlib issue is finally closed, it has been tested properly. There're no further requirements on the version of matplotlib. Here are the details of the solution,
          • -External loading of GTK3 backend files won't work with pylab, because once "import pylab" is called, it makes use of the default backend applied to it and the canvas renderer properties then cannot be changed externally, that is why it is recommended to use "matplotlib.use('Gtk3agg')" before importing pylab.
          • -Added a new custom backend for GTK3 support for plotting using matplotlib and pylab.
          • -The backend bundle of gtk3 files, have been added to the PYTHONPATH of ascend i.e ascxx.
          • -The backend can be called using matplotlib.use('module://backend_gtk3')", when required for plotting.
      • ASCDEV script, installation issues with gtk3.
      • In UnitsDialog, typecombo ( ComboBoxEntry ) is deprecated and removed. Need to replace it with newer alternative in GTK3.
      • Status icons of variables and relations
      • Solverparameters edit options.: Sizing issues left.
      • Observer issues : Plotting is disabled and sizing issues left.
      • Incidence Matrix : Plotting is disabled.
      • Right clicks in simulation Tab and Observer, Handling of popups.
    • Restructuring of gtkbrowser code and changing its design to avoid bugs.
      • Adding Scroll bars for viewing graph layouts, images, canvas.
      • Adding Progress bar for solving models.
  • Improvising the Error Reporter Module
    • This module that would accept all the errors that are reported and filter the necessary ones(first or based on some keyword).
    • Removing print statements from the code.
  • More functionalities
    • openGL support for some models.
    • Changes in the METHOD syntax to provide increased automation capability.
    • Adding some missing pieces from tcl/tk interface.
    • Inspection of model code from GUI.

Preliminary timeline for task completion

  • Week-1,2
    • Writing some test-apps to test the compat layer & direct port and the problems that might arise.
    • Work on porting the application to gtk3
    • Understand the dependencies and deprecated functionality in the current code.
  • Week-3,4
    • Add new API changes to the code.
    • Changes in the packages and libraries used in ascend pygtk.
  • Mid Term Assessments ( July 29th - August 2nd )
  • Week-7
    • Work on Error reporter module
    • Provide a filter to the reported errors to fetch the necessary ones.
    • Logging all the errors for future reference.
  • Week-8
    • Work on improvements in the python wrapper
    • Add ASCEND specific commands to the IPython console’s namespace.
    • Map the functionality of the console into the GUI interface using widgets/buttons.
  • Week-9,10
    • Automatic update of the IPython console’s environment.
    • Improvements in the IPython console for tab completion and automatic indentation.
    • Adding openGL support for some models.
    • Changes in the METHOD syntax to provide increased automation capability.
  • Week-11,12
    • Bug fixing.
    • Prepare Documentation.


Bug Fixes

  • bug 530
    • Removed the uncompatibilities based on the IPython API changes.
    • Added new IO stream handling methods.
    • Added a method generatePrompt to provide backward compatibility for the previous versions of IPython (0.10 and 0.11) and renders the prompt manager.
    • Changed the configuring of the IPython config loader.
    • Disabled the auto-indent behaviour, because it was incompatible with the new API changes. Need to add a workaround for the auto-indent issue.
  • bug 572
    • Added a new method close_window_on_confirm(), which displays a confimation dialog box to quit pygtk main_window.
    • This method is mapped to quit() and exit() calls in the ipython console.