don't go out of focus during initialization
This commit is contained in:
parent
c8adfae0fa
commit
b88becb9d0
|
@ -3,23 +3,30 @@ from pathlib import Path
|
|||
|
||||
class Environment:
|
||||
|
||||
# ToDo: Probably, we don't need a class (just a module with a few functions)
|
||||
def __init__(self):
|
||||
"""Read and provide values of DAMASK configuration."""
|
||||
self.screen_width = 1024
|
||||
self.screen_height = 768
|
||||
"""Do Nothing."""
|
||||
pass
|
||||
|
||||
@property
|
||||
def screen_size(self):
|
||||
width = 1024
|
||||
height = 768
|
||||
try:
|
||||
import wx
|
||||
_ = wx.App(False) # noqa
|
||||
self.screenwidth, self.screenheight = wx.GetDisplaySize()
|
||||
_ = wx.App(False) # noqa
|
||||
width, height = wx.GetDisplaySize()
|
||||
except ImportError:
|
||||
try:
|
||||
import tkinter
|
||||
tk = tkinter.Tk()
|
||||
self.screen_width = tk.winfo_screenwidth()
|
||||
self.screen_height = tk.winfo_screenheight()
|
||||
width = tk.winfo_screenwidth()
|
||||
height = tk.winfo_screenheight()
|
||||
tk.destroy()
|
||||
except Exception as e:
|
||||
pass
|
||||
return (width,height)
|
||||
|
||||
|
||||
@property
|
||||
def options(self):
|
||||
|
@ -32,6 +39,7 @@ class Environment:
|
|||
|
||||
return options
|
||||
|
||||
|
||||
@property
|
||||
def root_dir(self):
|
||||
"""Return DAMASK root path."""
|
||||
|
|
|
@ -242,7 +242,7 @@ class VTK:
|
|||
ren.AddActor(actor)
|
||||
ren.SetBackground(0.2,0.2,0.2)
|
||||
|
||||
window.SetSize(Environment().screen_width,Environment().screen_height)
|
||||
window.SetSize(Environment().screen_size[0],Environment().screen_size[1])
|
||||
|
||||
iren = vtk.vtkRenderWindowInteractor()
|
||||
iren.SetRenderWindow(window)
|
||||
|
|
Loading…
Reference in New Issue