minimum screen size?

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

minimum screen size?

Post by joleenf »

Hi,

Is there a minimum screen size that can be achieved in scripting? It seems that when I run the following on my mac:

Code: Select all

import os
homeDir=expandpath("~")
panel = buildWindow(height=360,width=640)

fileName=os.path.join(homeDir, test1.png)
panel[0].captureImage(fileName)


the file size
PNG image data, 695 x 360, 8-bit/color RGB, non-interlaced
which is not the input buildWindow size.

However, if I run

Code: Select all

import os

homeDir=expandpath("~")
panel = buildWindow(height=360,width=640)
#force the output size to be what I want
panel[0].setFullScreenSize(640,360)
panel[0].setFullScreen()

fileName=os.path.join(homeDir,"test2.png")
panel[0].captureImage(fileName)


then, the size is correct: "PNG image data, 640 x 360, 8-bit/color RGB, non-interlaced"

Is this expected or does it have an explanation?

Thanks,
Joleen
User avatar
Rick
Posts: 404
Joined: Fri Jan 16, 2009 8:20 pm

Re: minimum screen size?

Post by Rick »

Hi Joleen,

I was able to run a background script (not from the jython shell) using buildWindow(width=50,height=50) and successfully created a movie that was exactly that size. Are you running from the jython shell or from background? Creating a window through the jython shell requires that the window includes the buttons and menu items.

Rick
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: minimum screen size?

Post by joleenf »

Hi Rick,

  • Commands which are run from a script should produce consistent results whether or not they are run within a McIDAS-V session jython shell, or run in the background.
  • When writing a script and building a window in most software packages, the window display size is defined and consistent whether the script is run in foreground or background.
  • When users build a display, would they really define the width of the final image as (width+the width of the button controls). If this is true, the margin needed for button controls must be documented.
  • The current situation is even less intuitive than just allowing for the button controls and menu items because the result is not (defined height+some margin for button controls)X(defined width+some margin for button controls). It is (defined width+some margin for button controls)X(defined height). If the disparity between defined size and the final image size is due to extra controls, then both height and width should be affected.

For these reasons, I believe the current behavior is incorrect.

Thanks,
Joleen
User avatar
Rick
Posts: 404
Joined: Fri Jan 16, 2009 8:20 pm

Re: minimum screen size?

Post by Rick »

Hi Joleen,

Documenting the exact size is difficult as it changes between operating systems. Additionally, user defined buttons are not likely to be of uniform size. I have written up an inquiry allow buildWindow to create a window without a toolbar. You would not be able to interactively work with the window, but you could still make changes with commands via a jython shell. Another possibility to create a smaller window is to remove as many buttons as possible.

Inquiry 2124
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: minimum screen size?

Post by joleenf »

\Rick,

I am sorry that I am not understanding this problem quickly. Is the problem that when fullScreenSize is used to define the exact display size, this only works on macs? Why should buttons on the frame matter and if they do, why does the problem only affect the width?

I tested the screen size by removing every side bar, when created via buildWindow, there is no attached legend. If the argument that the buttons are causing the problem is true, then I would expect that removing all the navigation toolbars would solve the problem. The final size of a defined 640x360 is still 695x360.

Thanks,
Joleen

Window created via jython shell without any navigation toolbars
Screen Shot 2015-07-31 at 6.17.58 AM.png


final image from captureImage
test.png
User avatar
Rick
Posts: 404
Joined: Fri Jan 16, 2009 8:20 pm

Re: minimum screen size?

Post by Rick »

Hi Joleen,

The size limitation is not only due to the buttons (for example the Stop Sign and remove layers/data), but also the menu items (for example File and Tools) These are required in the foreground. Per our discussion, I'm also adding two additional potential solutions to the inquiry:

The first would be to stack the buttons and menu items if they don't fit inside the size of the requested window (see Microsoft word for an example). The second is to 'eject' the tool bar (buttons and menu items) similar to the Legend.
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: minimum screen size?

Post by joleenf »

Thanks Rick. The main reason we discussed the other options (i.e. eject tool bar or to mimic behavior of toolbars in software like Firefox and Microsoft Word when window width does not allow room for all toolbar items), is to maintain current functionality while still addressing the issue of screen size. Thank-you for the update.

Joleen
Post Reply