Skip to content

Commit 97faa84

Browse files
committed
ALL: Reorganized to avoid IDEs showing external and / or private elements
1 parent b4d7f31 commit 97faa84

File tree

13 files changed

+606
-533
lines changed

13 files changed

+606
-533
lines changed

CHANGES.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
0.1, 2023/08/21 -- Linux: Improved window geometry (thanks to elraymond - (https://github.com/elraymond)
1+
0.4, 2023/08/25 -- Reorganized to avoid IDEs showing external and / or private elements
2+
0.3, 2023/08/21 -- Linux: Improved window geometry (thanks to elraymond - (https://github.com/elraymond)
23
ALL: Improved default onQuery/onSet methods
34
0.0.5, 2023/07/19 -- Initial release
45
0.0.1, 2023/05/22 -- Initial version

dist/PyWinBox-0.3-py3-none-any.whl

-47.9 KB
Binary file not shown.

dist/PyWinBox-0.4-py3-none-any.whl

49.1 KB
Binary file not shown.

src/ewmhlib/Props.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class MoveResize(IntEnum):
116116

117117

118118
class DataFormat(IntEnum):
119+
# I guess 16 is not used in Python (no difference between short and long int)
119120
STR = 8
120121
INT = 32
121122

@@ -134,5 +135,3 @@ class StackMode(IntEnum):
134135
class HintAction(IntEnum):
135136
KEEP = -1
136137
REMOVE = -2
137-
138-

src/ewmhlib/Structs.py

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,28 @@
99

1010

1111
class ScreensInfo(TypedDict):
12+
"""
13+
Container class to handle ScreensInfo struct:
14+
15+
- screen_number (str): int (sequential)
16+
- is_default (bool): ''True'' if the screen is the default screen
17+
- screen (Xlib.Struct): screen Struct (see Xlib documentation)
18+
- root (Xlib.xobject.drawable.Window): root X-Window object belonging to screen
19+
"""
1220
screen_number: str
1321
is_default: bool
1422
screen: Struct
1523
root: XWindow
1624

1725

1826
class DisplaysInfo(TypedDict):
27+
"""
28+
Container class to handle DisplaysInfo struct:
29+
30+
- name: Display name (as per Xlib.display.Display(name))
31+
- is_default: ''True'' if the display is the default display
32+
- screens: list of ScreensInfo structs belonging to display
33+
"""
1934
name: str
2035
is_default: bool
2136
screens: List[ScreensInfo]
@@ -25,7 +40,22 @@ class DisplaysInfo(TypedDict):
2540
Perhaps unnecesary since structs below are defined in Xlib.xobject.icccm.*, though in a more complex way.
2641
"""
2742
class WmHints(TypedDict):
28-
# {'flags': 103, 'input': 1, 'initial_state': 1, 'icon_pixmap': <Pixmap 0x02a22304>, 'icon_window': <Window 0x00000000>, 'icon_x': 0, 'icon_y': 0, 'icon_mask': <Pixmap 0x02a2230b>, 'window_group': <Window 0x02a00001>}
43+
"""
44+
Container class to handle WmHints struct:
45+
46+
Example:
47+
{
48+
'flags': 103,
49+
'input': 1,
50+
'initial_state': 1,
51+
'icon_pixmap': <Pixmap 0x02a22304>,
52+
'icon_window': <Window 0x00000000>,
53+
'icon_x': 0,
54+
'icon_y': 0,
55+
'icon_mask': <Pixmap 0x02a2230b>,
56+
'window_group': <Window 0x02a00001>
57+
}
58+
"""
2959
flags: int
3060
input_mode: int
3161
initial_state: int
@@ -38,12 +68,31 @@ class WmHints(TypedDict):
3868

3969

4070
class Aspect(TypedDict):
71+
"""Container class to handle Aspect struct (num, denum)"""
4172
num: int
4273
denum: int
4374

4475

4576
class WmNormalHints(TypedDict):
46-
# {'flags': 848, 'min_width': 387, 'min_height': 145, 'max_width': 0, 'max_height': 0, 'width_inc': 9, 'height_inc': 18, 'min_aspect': <class 'Xlib.protocol.rq.DictWrapper'>({'num': 0, 'denum': 0}), 'max_aspect': <class 'Xlib.protocol.rq.DictWrapper'>({'num': 0, 'denum': 0}), 'base_width': 66, 'base_height': 101, 'win_gravity': 1}
77+
"""
78+
Container class to handle WmNormalHints
79+
80+
Example:
81+
{
82+
'flags': 848,
83+
'min_width': 387,
84+
'min_height': 145,
85+
'max_width': 0,
86+
'max_height': 0,
87+
'width_inc': 9,
88+
'height_inc': 18,
89+
'min_aspect': <class 'Xlib.protocol.rq.DictWrapper'>({'num': 0, 'denum': 0}),
90+
'max_aspect': <class 'Xlib.protocol.rq.DictWrapper'>({'num': 0, 'denum': 0}),
91+
'base_width': 66,
92+
'base_height': 101,
93+
'win_gravity': 1
94+
}
95+
"""
4796
flags: int
4897
min_width: int
4998
min_height: int

src/ewmhlib/__init__.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
from __future__ import annotations
2-
3-
import sys
4-
assert sys.platform == "linux"
5-
6-
from ._ewmhlib import (getAllDisplaysInfo, getDisplayFromRoot, getDisplayFromWindow,
7-
getProperty, getPropertyValue, changeProperty, sendMessage, _xlibGetAllWindows,
8-
defaultDisplay, defaultScreen, defaultRoot, RootWindow, defaultRootWindow, EwmhWindow
9-
)
10-
import ewmhlib.Props as Props
11-
import ewmhlib.Structs as Structs
1+
#!/usr/bin/python
2+
# -*- coding: utf-8 -*-
123

134
__all__ = [
14-
"version", "getAllDisplaysInfo", "getDisplayFromRoot", "getDisplayFromWindow",
5+
"version", "displaysCount", "getDisplaysNames", "getDisplaysInfo", "getDisplayFromRoot", "getDisplayFromWindow",
156
"getProperty", "getPropertyValue", "changeProperty", "sendMessage",
16-
"defaultDisplay", "defaultScreen", "defaultRoot", "defaultRootWindow", "RootWindow", "EwmhWindow"
7+
"defaultDisplay", "defaultScreen", "defaultRoot", "defaultRootWindow", "RootWindow", "EwmhWindow",
8+
"Props", "Structs"
179
]
1810

19-
2011
__version__ = "0.0.1"
2112

2213

2314
def version(numberOnly: bool = True):
2415
"""Returns the current version of ewmhlib module, in the form ''x.x.xx'' as string"""
2516
return ("" if numberOnly else "EWMHlib-")+__version__
17+
18+
19+
from ._main import (displaysCount, getDisplaysNames, getDisplaysInfo, getDisplayFromRoot, getDisplayFromWindow,
20+
getProperty, getPropertyValue, changeProperty, sendMessage,
21+
defaultDisplay, defaultScreen, defaultRoot, RootWindow, defaultRootWindow, EwmhWindow,
22+
Props, Structs
23+
)

0 commit comments

Comments
 (0)