mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-09 03:42:16 +03:00
Merge pull request #570 from A-UNDERSCORE-D/fix/display-var-errors
Fix #568 with ENV var workaround
This commit is contained in:
commit
758b726878
4
EDMC.py
4
EDMC.py
@ -8,6 +8,10 @@ import json
|
|||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
# workaround for https://github.com/EDCD/EDMarketConnector/issues/568
|
||||||
|
os.environ["EDMC_NO_UI"] = "1"
|
||||||
|
|
||||||
from os.path import dirname, getmtime, join
|
from os.path import dirname, getmtime, join
|
||||||
from time import time, sleep
|
from time import time, sleep
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
15
theme.py
15
theme.py
@ -5,6 +5,7 @@
|
|||||||
# So can't use ttk's theme support. So have to change colors manually.
|
# So can't use ttk's theme support. So have to change colors manually.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
from sys import platform
|
from sys import platform
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
|
||||||
@ -18,6 +19,11 @@ from config import appname, applongname, config
|
|||||||
if __debug__:
|
if __debug__:
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
|
|
||||||
|
if platform == "linux":
|
||||||
|
from ctypes import *
|
||||||
|
|
||||||
|
|
||||||
|
def setup_UI__():
|
||||||
if platform == 'win32':
|
if platform == 'win32':
|
||||||
import ctypes
|
import ctypes
|
||||||
from ctypes.wintypes import LPCWSTR, DWORD, LPCVOID
|
from ctypes.wintypes import LPCWSTR, DWORD, LPCVOID
|
||||||
@ -28,8 +34,6 @@ if platform == 'win32':
|
|||||||
AddFontResourceEx(join(config.respath, u'EUROCAPS.TTF'), FR_PRIVATE, 0)
|
AddFontResourceEx(join(config.respath, u'EUROCAPS.TTF'), FR_PRIVATE, 0)
|
||||||
|
|
||||||
elif platform == 'linux':
|
elif platform == 'linux':
|
||||||
from ctypes import *
|
|
||||||
|
|
||||||
XID = c_ulong # from X.h: typedef unsigned long XID
|
XID = c_ulong # from X.h: typedef unsigned long XID
|
||||||
Window = XID
|
Window = XID
|
||||||
Atom = c_ulong
|
Atom = c_ulong
|
||||||
@ -67,6 +71,10 @@ elif platform == 'linux':
|
|||||||
('status', c_ulong),
|
('status', c_ulong),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# workaround for https://github.com/EDCD/EDMarketConnector/issues/568
|
||||||
|
if os.getenv("EDMC_NO_UI") :
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
xlib = cdll.LoadLibrary('libX11.so.6')
|
xlib = cdll.LoadLibrary('libX11.so.6')
|
||||||
XInternAtom = xlib.XInternAtom
|
XInternAtom = xlib.XInternAtom
|
||||||
@ -87,6 +95,7 @@ elif platform == 'linux':
|
|||||||
dpy = xlib.XOpenDisplay(None)
|
dpy = xlib.XOpenDisplay(None)
|
||||||
if not dpy:
|
if not dpy:
|
||||||
raise Exception("Can't find your display, can't continue")
|
raise Exception("Can't find your display, can't continue")
|
||||||
|
|
||||||
motif_wm_hints_property = XInternAtom(dpy, b'_MOTIF_WM_HINTS', False)
|
motif_wm_hints_property = XInternAtom(dpy, b'_MOTIF_WM_HINTS', False)
|
||||||
motif_wm_hints_normal = MotifWmHints(MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS,
|
motif_wm_hints_normal = MotifWmHints(MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS,
|
||||||
MWM_FUNC_RESIZE | MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE | MWM_FUNC_CLOSE,
|
MWM_FUNC_RESIZE | MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE | MWM_FUNC_CLOSE,
|
||||||
@ -379,5 +388,7 @@ class _Theme(object):
|
|||||||
self.minwidth = root.winfo_width() # Minimum width = width on first creation
|
self.minwidth = root.winfo_width() # Minimum width = width on first creation
|
||||||
root.minsize(self.minwidth, -1)
|
root.minsize(self.minwidth, -1)
|
||||||
|
|
||||||
|
|
||||||
|
setup_UI__()
|
||||||
# singleton
|
# singleton
|
||||||
theme = _Theme()
|
theme = _Theme()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user