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:
|
class Environment:
|
||||||
|
|
||||||
|
# ToDo: Probably, we don't need a class (just a module with a few functions)
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Read and provide values of DAMASK configuration."""
|
"""Do Nothing."""
|
||||||
self.screen_width = 1024
|
pass
|
||||||
self.screen_height = 768
|
|
||||||
|
@property
|
||||||
|
def screen_size(self):
|
||||||
|
width = 1024
|
||||||
|
height = 768
|
||||||
try:
|
try:
|
||||||
import wx
|
import wx
|
||||||
_ = wx.App(False) # noqa
|
_ = wx.App(False) # noqa
|
||||||
self.screenwidth, self.screenheight = wx.GetDisplaySize()
|
width, height = wx.GetDisplaySize()
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
import tkinter
|
import tkinter
|
||||||
tk = tkinter.Tk()
|
tk = tkinter.Tk()
|
||||||
self.screen_width = tk.winfo_screenwidth()
|
width = tk.winfo_screenwidth()
|
||||||
self.screen_height = tk.winfo_screenheight()
|
height = tk.winfo_screenheight()
|
||||||
tk.destroy()
|
tk.destroy()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
return (width,height)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def options(self):
|
def options(self):
|
||||||
|
@ -32,6 +39,7 @@ class Environment:
|
||||||
|
|
||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def root_dir(self):
|
def root_dir(self):
|
||||||
"""Return DAMASK root path."""
|
"""Return DAMASK root path."""
|
||||||
|
|
|
@ -242,7 +242,7 @@ class VTK:
|
||||||
ren.AddActor(actor)
|
ren.AddActor(actor)
|
||||||
ren.SetBackground(0.2,0.2,0.2)
|
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 = vtk.vtkRenderWindowInteractor()
|
||||||
iren.SetRenderWindow(window)
|
iren.SetRenderWindow(window)
|
||||||
|
|
Loading…
Reference in New Issue