cmessage 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cmessage-0.1.0/PKG-INFO +31 -0
- cmessage-0.1.0/README.md +11 -0
- cmessage-0.1.0/cmessage/__init__.py +1 -0
- cmessage-0.1.0/cmessage/cmessage.py +164 -0
- cmessage-0.1.0/cmessage.egg-info/PKG-INFO +31 -0
- cmessage-0.1.0/cmessage.egg-info/SOURCES.txt +8 -0
- cmessage-0.1.0/cmessage.egg-info/dependency_links.txt +1 -0
- cmessage-0.1.0/cmessage.egg-info/top_level.txt +1 -0
- cmessage-0.1.0/setup.cfg +4 -0
- cmessage-0.1.0/setup.py +19 -0
cmessage-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cmessage
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Simple ctypes-based MessageBox wrapper for Windows
|
|
5
|
+
Home-page: https://github.com/yourusername/cmessage
|
|
6
|
+
Author: Your Name
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Topic :: Utilities
|
|
11
|
+
Requires-Python: >=3.4
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: requires-python
|
|
19
|
+
Dynamic: summary
|
|
20
|
+
|
|
21
|
+
# cmessage
|
|
22
|
+
|
|
23
|
+
Simple ctypes-based MessageBox wrapper for Windows.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from cmessage import CMessage
|
|
29
|
+
|
|
30
|
+
cm = CMessage()
|
|
31
|
+
cm.Message().Show("Info", "Hello world!")
|
cmessage-0.1.0/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .cmessage import CMessage
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import ctypes
|
|
2
|
+
|
|
3
|
+
# ------------------------
|
|
4
|
+
# BUTTON FLAGS
|
|
5
|
+
# ------------------------
|
|
6
|
+
MB_OK = 0x0
|
|
7
|
+
MB_OKCANCEL = 0x1
|
|
8
|
+
MB_ABORTRETRYIGNORE = 0x2
|
|
9
|
+
MB_YESNOCANCEL = 0x3
|
|
10
|
+
MB_YESNO = 0x4
|
|
11
|
+
MB_RETRYCANCEL = 0x5
|
|
12
|
+
MB_CANCELTRYCONTINUE = 0x6
|
|
13
|
+
|
|
14
|
+
# ------------------------
|
|
15
|
+
# RETURN VALUES
|
|
16
|
+
# ------------------------
|
|
17
|
+
IDOK = 1
|
|
18
|
+
IDCANCEL = 2
|
|
19
|
+
IDABORT = 3
|
|
20
|
+
IDRETRY = 4
|
|
21
|
+
IDIGNORE = 5
|
|
22
|
+
IDYES = 6
|
|
23
|
+
IDNO = 7
|
|
24
|
+
IDTRYAGAIN = 10
|
|
25
|
+
IDCONTINUE = 11
|
|
26
|
+
|
|
27
|
+
# ------------------------
|
|
28
|
+
# ICONS
|
|
29
|
+
# ------------------------
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class CMessage:
|
|
35
|
+
ICON_NONE = 0x0
|
|
36
|
+
ICON_ERROR = 0x10
|
|
37
|
+
ICON_QUESTION = 0x20
|
|
38
|
+
ICON_WARNING = 0x30
|
|
39
|
+
ICON_INFO = 0x40
|
|
40
|
+
def __init__(self):
|
|
41
|
+
self.user32 = ctypes.windll.user32
|
|
42
|
+
|
|
43
|
+
# ------------------------
|
|
44
|
+
# Simple OK
|
|
45
|
+
# ------------------------
|
|
46
|
+
class Message:
|
|
47
|
+
def __init__(self, parent=None):
|
|
48
|
+
self.parent = parent if parent else 0
|
|
49
|
+
|
|
50
|
+
def Show(self, title, text, pressedok=None, icon_flag=None):
|
|
51
|
+
result = ctypes.windll.user32.MessageBoxW(
|
|
52
|
+
self.parent, text, title, MB_OK | icon_flag
|
|
53
|
+
)
|
|
54
|
+
if result == IDOK and pressedok:
|
|
55
|
+
pressedok()
|
|
56
|
+
return result
|
|
57
|
+
|
|
58
|
+
# ------------------------
|
|
59
|
+
# Yes / No
|
|
60
|
+
# ------------------------
|
|
61
|
+
class MessageYesNo:
|
|
62
|
+
def __init__(self, parent=None):
|
|
63
|
+
self.parent = parent if parent else 0
|
|
64
|
+
|
|
65
|
+
def Show(self, title, text, pressedyes=None, pressedno=None, icon_flag=None):
|
|
66
|
+
result = ctypes.windll.user32.MessageBoxW(
|
|
67
|
+
self.parent, text, title, MB_YESNO | icon_flag
|
|
68
|
+
)
|
|
69
|
+
if result == IDYES and pressedyes:
|
|
70
|
+
pressedyes()
|
|
71
|
+
elif result == IDNO and pressedno:
|
|
72
|
+
pressedno()
|
|
73
|
+
return result
|
|
74
|
+
|
|
75
|
+
# ------------------------
|
|
76
|
+
# OK / Cancel
|
|
77
|
+
# ------------------------
|
|
78
|
+
class MessageOkCancel:
|
|
79
|
+
def __init__(self, parent=None):
|
|
80
|
+
self.parent = parent if parent else 0
|
|
81
|
+
|
|
82
|
+
def Show(self, title, text, pressedok=None, pressedcancel=None, icon_flag=None):
|
|
83
|
+
result = ctypes.windll.user32.MessageBoxW(
|
|
84
|
+
self.parent, text, title, MB_OKCANCEL | icon_flag
|
|
85
|
+
)
|
|
86
|
+
if result == IDOK and pressedok:
|
|
87
|
+
pressedok()
|
|
88
|
+
elif result == IDCANCEL and pressedcancel:
|
|
89
|
+
pressedcancel()
|
|
90
|
+
return result
|
|
91
|
+
|
|
92
|
+
# ------------------------
|
|
93
|
+
# Retry / Cancel
|
|
94
|
+
# ------------------------
|
|
95
|
+
class MessageRetryCancel:
|
|
96
|
+
def __init__(self, parent=None):
|
|
97
|
+
self.parent = parent if parent else 0
|
|
98
|
+
|
|
99
|
+
def Show(self, title, text, pressedretry=None, pressedcancel=None, icon_flag=None):
|
|
100
|
+
result = ctypes.windll.user32.MessageBoxW(
|
|
101
|
+
self.parent, text, title, MB_RETRYCANCEL | icon_flag
|
|
102
|
+
)
|
|
103
|
+
if result == IDRETRY and pressedretry:
|
|
104
|
+
pressedretry()
|
|
105
|
+
elif result == IDCANCEL and pressedcancel:
|
|
106
|
+
pressedcancel()
|
|
107
|
+
return result
|
|
108
|
+
|
|
109
|
+
# ------------------------
|
|
110
|
+
# Abort / Retry / Ignore
|
|
111
|
+
# ------------------------
|
|
112
|
+
class MessageAbortRetryIgnore:
|
|
113
|
+
def __init__(self, parent=None):
|
|
114
|
+
self.parent = parent if parent else 0
|
|
115
|
+
|
|
116
|
+
def Show(self, title, text, pressedabort=None, pressedretry=None, pressedignore=None, icon_flag=None):
|
|
117
|
+
result = ctypes.windll.user32.MessageBoxW(
|
|
118
|
+
self.parent, text, title, MB_ABORTRETRYIGNORE | icon_flag
|
|
119
|
+
)
|
|
120
|
+
if result == IDABORT and pressedabort:
|
|
121
|
+
pressedabort()
|
|
122
|
+
elif result == IDRETRY and pressedretry:
|
|
123
|
+
pressedretry()
|
|
124
|
+
elif result == IDIGNORE and pressedignore:
|
|
125
|
+
pressedignore()
|
|
126
|
+
return result
|
|
127
|
+
|
|
128
|
+
# ------------------------
|
|
129
|
+
# Yes / No / Cancel
|
|
130
|
+
# ------------------------
|
|
131
|
+
class MessageYesNoCancel:
|
|
132
|
+
def __init__(self, parent=None):
|
|
133
|
+
self.parent = parent if parent else 0
|
|
134
|
+
|
|
135
|
+
def Show(self, title, text, pressedyes=None, pressedno=None, pressedcancel=None, icon_flag=None):
|
|
136
|
+
result = ctypes.windll.user32.MessageBoxW(
|
|
137
|
+
self.parent, text, title, MB_YESNOCANCEL | icon_flag
|
|
138
|
+
)
|
|
139
|
+
if result == IDYES and pressedyes:
|
|
140
|
+
pressedyes()
|
|
141
|
+
elif result == IDNO and pressedno:
|
|
142
|
+
pressedno()
|
|
143
|
+
elif result == IDCANCEL and pressedcancel:
|
|
144
|
+
pressedcancel()
|
|
145
|
+
return result
|
|
146
|
+
|
|
147
|
+
# ------------------------
|
|
148
|
+
# Cancel / Try Again / Continue
|
|
149
|
+
# ------------------------
|
|
150
|
+
class MessageCancelTryContinue:
|
|
151
|
+
def __init__(self, parent=None):
|
|
152
|
+
self.parent = parent if parent else 0
|
|
153
|
+
|
|
154
|
+
def Show(self, title, text, pressedcancel=None, pressedtryagain=None, pressedcontinue=None, icon_flag=None):
|
|
155
|
+
result = ctypes.windll.user32.MessageBoxW(
|
|
156
|
+
self.parent, text, title, MB_CANCELTRYCONTINUE | icon_flag
|
|
157
|
+
)
|
|
158
|
+
if result == IDCANCEL and pressedcancel:
|
|
159
|
+
pressedcancel()
|
|
160
|
+
elif result == IDTRYAGAIN and pressedtryagain:
|
|
161
|
+
pressedtryagain()
|
|
162
|
+
elif result == IDCONTINUE and pressedcontinue:
|
|
163
|
+
pressedcontinue()
|
|
164
|
+
return result
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cmessage
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Simple ctypes-based MessageBox wrapper for Windows
|
|
5
|
+
Home-page: https://github.com/yourusername/cmessage
|
|
6
|
+
Author: Your Name
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Topic :: Utilities
|
|
11
|
+
Requires-Python: >=3.4
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: requires-python
|
|
19
|
+
Dynamic: summary
|
|
20
|
+
|
|
21
|
+
# cmessage
|
|
22
|
+
|
|
23
|
+
Simple ctypes-based MessageBox wrapper for Windows.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from cmessage import CMessage
|
|
29
|
+
|
|
30
|
+
cm = CMessage()
|
|
31
|
+
cm.Message().Show("Info", "Hello world!")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cmessage
|
cmessage-0.1.0/setup.cfg
ADDED
cmessage-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="cmessage",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
description="Simple ctypes-based MessageBox wrapper for Windows",
|
|
8
|
+
long_description=open("README.md", encoding="utf-8").read(),
|
|
9
|
+
long_description_content_type="text/markdown",
|
|
10
|
+
author="Your Name",
|
|
11
|
+
url="https://github.com/yourusername/cmessage",
|
|
12
|
+
python_requires=">=3.4",
|
|
13
|
+
classifiers=[
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Operating System :: Microsoft :: Windows",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Topic :: Utilities",
|
|
18
|
+
],
|
|
19
|
+
)
|