/
config.py
58 lines (47 loc) · 1.65 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""Constants and other similar configuration, and related minimal functions."""
import pyglet
def prepare_display_settings():
display = pyglet.window.get_platform().get_default_display()
screens = display.get_screens()
if len(screens) > 1:
# Xinerama or nVidia TwinView: two screens accessible but one display
fullscreen=True
navscreen=screens[1] #default screen is screens[0] so skip it
width = navscreen.width
height = navscreen.height
barsize = height * STDBARSIZE / STDHEIGHT
else:
# single display - mini touch for demo mode
# set fallback resolution here!
width = 640
height = 480
barsize = 125
fullscreen = False
navscreen = None # won't be used - not fullscreen
return (width, height, barsize, fullscreen, navscreen)
def is_in_bar(x, y):
if BARLOC=="top":
return (y>HEIGHT-BARSIZE and y<HEIGHT)
elif BARLOC=="bottom":
return (y>0 and y<BARSIZE)
elif BARLOC=="right":
return (x>WIDTH-BARSIZE and x<WIDTH)
elif BARLOC=="left":
return (x>0 and x<BARSIZE)
else:
raise Exception("invalid bar location specified in config")
def bar_location():
#TODO: implement using above. use in canvassedwindow
pass
#############################
# Run dynamic configuration #
#############################
STDHEIGHT = 480
STDWIDTH = 1024
STDBARSIZE = 200
BARLOC = "top"
ICONSIZE = 64 #32
PILES = False
# Set display configuration based on detected run type.
(WIDTH, HEIGHT, BARSIZE, FULLSCREEN, NAVSCREEN) = prepare_display_settings()
WALLFILENAME='wallpaper'+str(WIDTH)+'.png'