2019-12-13 01:19:16 +05:30
|
|
|
import os
|
2020-06-03 17:02:47 +05:30
|
|
|
from pathlib import Path
|
2019-12-13 01:19:16 +05:30
|
|
|
|
2020-03-19 13:01:24 +05:30
|
|
|
class Environment:
|
2019-12-13 01:19:16 +05:30
|
|
|
|
2020-07-02 11:55:35 +05:30
|
|
|
@property
|
|
|
|
def screen_size(self):
|
2020-03-19 16:21:30 +05:30
|
|
|
try:
|
2020-06-30 07:20:33 +05:30
|
|
|
import wx
|
2020-07-02 11:55:35 +05:30
|
|
|
_ = wx.App(False) # noqa
|
|
|
|
width, height = wx.GetDisplaySize()
|
2020-06-30 07:20:33 +05:30
|
|
|
except ImportError:
|
|
|
|
try:
|
|
|
|
import tkinter
|
|
|
|
tk = tkinter.Tk()
|
2020-07-02 11:55:35 +05:30
|
|
|
width = tk.winfo_screenwidth()
|
|
|
|
height = tk.winfo_screenheight()
|
2020-06-30 07:20:33 +05:30
|
|
|
tk.destroy()
|
2020-06-30 07:36:40 +05:30
|
|
|
except Exception as e:
|
2020-11-14 22:24:47 +05:30
|
|
|
width = 1024
|
|
|
|
height = 768
|
|
|
|
|
2020-07-02 11:55:35 +05:30
|
|
|
return (width,height)
|
|
|
|
|
2019-12-13 01:19:16 +05:30
|
|
|
|
2020-06-03 17:02:47 +05:30
|
|
|
@property
|
|
|
|
def options(self):
|
2020-03-13 00:22:33 +05:30
|
|
|
options = {}
|
2021-01-13 23:13:20 +05:30
|
|
|
for item in ['DAMASK_ROOT', 'MSC_ROOT', 'MSC_VERSION']:
|
2020-03-13 00:22:33 +05:30
|
|
|
options[item] = os.environ[item] if item in os.environ else None
|
|
|
|
|
|
|
|
return options
|