bugpyFormex - Bugs: bug #46201, canvas size should not be set...

 
 

bug #46201: canvas size should not be set larger than central space of GUI

Submitter:  gianluca de santis <gianlucadesi>
Submitted:  Tue 13 Oct 2015 01:46:14 PM UTC
   
 
Category:  GUI Severity:  1 - Wish
Item Group:  Feature request Status:  Wont Fix
Privacy:  Public Assigned to:  bverheg
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 13 Oct 2015 03:29:15 PM UTC, comment #3: 

It is better to put it in your application. If another user has an application saying

canvasSize(w,h)
save_image

we do not want him to suddenly have a failing script, interrupted by warnings.

What is acceptable, and how to best handle resize, is dependent on the application. Some may prefer: if larger than widget, resize to widget size. Others prefer a warning. Still others want to just resize as told.

In each case the user can now predicatbly program the situation as he wants. So I would just add the test and warning in your application.

Scrollbars could be a visual help. I am not sure, but they could be automatic when resizing the central widget. So maybe we could add an option to draw.canvasSize(w,h,resize_widget=False) ?

Benedict Verhegghe <bverheg>
Group administrator
Tue 13 Oct 2015 03:06:46 PM UTC, comment #2: 

I agree. It is important to provide a user-friendly way to set a canvas size (either by scripting or by gui) like it is already implemented now and leave the expert user the option to have larger-than-screen images. But today I had a issue: I had to create a canvas with a specific width x height to look at an object in the same way I was watching it some time ago and I found out that I was not watching the entire canvas, but a portion of it, without getting any warning message.

To make the user aware that the canvas could be outside the window the scroll bars idea is probably the best. For the time being, could we add a warning in pyformex.opengl.draw.canvasSize(w, h) ?



gianluca de santis <gianlucadesi>
Group Member
Tue 13 Oct 2015 02:30:26 PM UTC, comment #1: 

I see no reason to limit the OpenGL canvas to the central GUI widget size. And if we would want to limit it, or issue a warning, then certainly not in the gui.viewport low level function (which is e.g. further used in draw.canvasSize).

pyFormex is not intended as a interactive tool guiding the user in all operations, but rather as a programming too to create such applications. There are good reasons to set a larger than widget canvas (e.g. to create images with a higher resolution), and we do not want our programmed applications be interrupted with tons of warnings, requiring user interaction.

To set the canvas to the widget size, you can just enter negative values for width and heigth. Or you can slightly adjust the window size.

A warning would only be acceptable in the menu interface function viewportMenu.setCanvasSize. But then other more friendly helpers are possible as well: display the widget size,
add a button to set to widget size (though as said above, (-1,-1) will just do fine, add a tooltip.

Maybe a more interesting option would be to add scrollbars when the canvas exceeds the widget.


Benedict Verhegghe <bverheg>
Group administrator
Tue 13 Oct 2015 01:46:14 PM UTC, original submission:  

If the user tries to set a canvas (w,h) larger than the central space of the GUI the canvas gets partially hidden. Probably, it is better to warn the user and limit the canvas size to the maxCanvasSize.

I would propose to change the 'changeSize' in gui.viewport:

def changeSize(self, width, height):
    w, h = pf.GUI.maxCanvasSize()
    if width < 0 or height < 0:       
        if width < 0 or width>w:
            warning(...)
            width = w
        if height < 0 or height>h:
            warning(...)
            height = h
        self.resize(width, height)


gianluca de santis <gianlucadesi>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bverheg (Posted a comment)
  • -email is unavailable- added by gianlucadesi (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-10-30 bverheg Open/ClosedOpen Closed
    2015-10-13 bverheg StatusNone Wont Fix
        Assigned toNone bverheg

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code