Kano001 commited on
Commit
d12bc25
1 Parent(s): edba141

Upload 498 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/INSTALLER +1 -0
  3. MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/LICENSE +20 -0
  4. MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/METADATA +47 -0
  5. MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/RECORD +43 -0
  6. MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/WHEEL +5 -0
  7. MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/top_level.txt +2 -0
  8. MLPY/Lib/site-packages/pythonwin/Pythonwin.exe +0 -0
  9. MLPY/Lib/site-packages/pythonwin/dde.pyd +0 -0
  10. MLPY/Lib/site-packages/pythonwin/license.txt +30 -0
  11. MLPY/Lib/site-packages/pythonwin/mfc140u.dll +3 -0
  12. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/cmdserver.cpython-39.pyc +0 -0
  13. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/createwin.cpython-39.pyc +0 -0
  14. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/demoutils.cpython-39.pyc +0 -0
  15. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/dibdemo.cpython-39.pyc +0 -0
  16. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/dlgtest.cpython-39.pyc +0 -0
  17. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/dyndlg.cpython-39.pyc +0 -0
  18. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/fontdemo.cpython-39.pyc +0 -0
  19. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/guidemo.cpython-39.pyc +0 -0
  20. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/hiertest.cpython-39.pyc +0 -0
  21. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/menutest.cpython-39.pyc +0 -0
  22. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/objdoc.cpython-39.pyc +0 -0
  23. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/openGLDemo.cpython-39.pyc +0 -0
  24. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/progressbar.cpython-39.pyc +0 -0
  25. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/sliderdemo.cpython-39.pyc +0 -0
  26. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/splittst.cpython-39.pyc +0 -0
  27. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/threadedgui.cpython-39.pyc +0 -0
  28. MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/toolbar.cpython-39.pyc +0 -0
  29. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/basictimerapp.cpython-39.pyc +0 -0
  30. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/customprint.cpython-39.pyc +0 -0
  31. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/demoutils.cpython-39.pyc +0 -0
  32. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/dlgappdemo.cpython-39.pyc +0 -0
  33. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/dojobapp.cpython-39.pyc +0 -0
  34. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/helloapp.cpython-39.pyc +0 -0
  35. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/basictimerapp.py +258 -0
  36. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/customprint.py +186 -0
  37. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/demoutils.py +65 -0
  38. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/dlgappdemo.py +51 -0
  39. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/dojobapp.py +72 -0
  40. MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/helloapp.py +53 -0
  41. MLPY/Lib/site-packages/pythonwin/pywin/Demos/cmdserver.py +116 -0
  42. MLPY/Lib/site-packages/pythonwin/pywin/Demos/createwin.py +114 -0
  43. MLPY/Lib/site-packages/pythonwin/pywin/Demos/demoutils.py +67 -0
  44. MLPY/Lib/site-packages/pythonwin/pywin/Demos/dibdemo.py +73 -0
  45. MLPY/Lib/site-packages/pythonwin/pywin/Demos/dlgtest.py +145 -0
  46. MLPY/Lib/site-packages/pythonwin/pywin/Demos/dyndlg.py +104 -0
  47. MLPY/Lib/site-packages/pythonwin/pywin/Demos/fontdemo.py +86 -0
  48. MLPY/Lib/site-packages/pythonwin/pywin/Demos/guidemo.py +86 -0
  49. MLPY/Lib/site-packages/pythonwin/pywin/Demos/hiertest.py +138 -0
  50. MLPY/Lib/site-packages/pythonwin/pywin/Demos/menutest.py +13 -0
.gitattributes CHANGED
@@ -84,3 +84,5 @@ MLPY/Lib/site-packages/numpy/core/_simd.cp39-win_amd64.pyd filter=lfs diff=lfs m
84
  MLPY/Lib/site-packages/onnx/onnx_cpp2py_export.cp39-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
85
  MLPY/Lib/site-packages/PIL/_imaging.cp39-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
86
  MLPY/Lib/site-packages/PIL/_imagingft.cp39-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
 
 
 
84
  MLPY/Lib/site-packages/onnx/onnx_cpp2py_export.cp39-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
85
  MLPY/Lib/site-packages/PIL/_imaging.cp39-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
86
  MLPY/Lib/site-packages/PIL/_imagingft.cp39-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
87
+ MLPY/Lib/site-packages/pythonwin/mfc140u.dll filter=lfs diff=lfs merge=lfs -text
88
+ MLPY/Lib/site-packages/pythonwin/win32ui.pyd filter=lfs diff=lfs merge=lfs -text
MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2017-2021 Ingy döt Net
2
+ Copyright (c) 2006-2016 Kirill Simonov
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the "Software"), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8
+ of the Software, and to permit persons to whom the Software is furnished to do
9
+ so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/METADATA ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: PyYAML
3
+ Version: 6.0.1
4
+ Summary: YAML parser and emitter for Python
5
+ Home-page: https://pyyaml.org/
6
+ Author: Kirill Simonov
7
+ Author-email: [email protected]
8
+ License: MIT
9
+ Download-URL: https://pypi.org/project/PyYAML/
10
+ Project-URL: Bug Tracker, https://github.com/yaml/pyyaml/issues
11
+ Project-URL: CI, https://github.com/yaml/pyyaml/actions
12
+ Project-URL: Documentation, https://pyyaml.org/wiki/PyYAMLDocumentation
13
+ Project-URL: Mailing lists, http://lists.sourceforge.net/lists/listinfo/yaml-core
14
+ Project-URL: Source Code, https://github.com/yaml/pyyaml
15
+ Platform: Any
16
+ Classifier: Development Status :: 5 - Production/Stable
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Cython
21
+ Classifier: Programming Language :: Python
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3.6
24
+ Classifier: Programming Language :: Python :: 3.7
25
+ Classifier: Programming Language :: Python :: 3.8
26
+ Classifier: Programming Language :: Python :: 3.9
27
+ Classifier: Programming Language :: Python :: 3.10
28
+ Classifier: Programming Language :: Python :: 3.11
29
+ Classifier: Programming Language :: Python :: Implementation :: CPython
30
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
31
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
32
+ Classifier: Topic :: Text Processing :: Markup
33
+ Requires-Python: >=3.6
34
+ License-File: LICENSE
35
+
36
+ YAML is a data serialization format designed for human readability
37
+ and interaction with scripting languages. PyYAML is a YAML parser
38
+ and emitter for Python.
39
+
40
+ PyYAML features a complete YAML 1.1 parser, Unicode support, pickle
41
+ support, capable extension API, and sensible error messages. PyYAML
42
+ supports standard YAML tags and provides Python-specific tags that
43
+ allow to represent an arbitrary Python object.
44
+
45
+ PyYAML is applicable for a broad range of tasks from complex
46
+ configuration files to object serialization and persistence.
47
+
MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/RECORD ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PyYAML-6.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ PyYAML-6.0.1.dist-info/LICENSE,sha256=jTko-dxEkP1jVwfLiOsmvXZBAqcoKVQwfT5RZ6V36KQ,1101
3
+ PyYAML-6.0.1.dist-info/METADATA,sha256=9LqpZ7ARc_UDWHhaztw28ggwznRds8xf8oJCGOCT60I,2106
4
+ PyYAML-6.0.1.dist-info/RECORD,,
5
+ PyYAML-6.0.1.dist-info/WHEEL,sha256=eep6QWEFiQfg2wcclssb_WY-D33AnLYLnEKGA9Rn-VU,100
6
+ PyYAML-6.0.1.dist-info/top_level.txt,sha256=rpj0IVMTisAjh_1vG3Ccf9v5jpCQwAz6cD1IVU5ZdhQ,11
7
+ _yaml/__init__.py,sha256=04Ae_5osxahpJHa3XBZUAf4wi6XX32gR8D6X6p64GEA,1402
8
+ _yaml/__pycache__/__init__.cpython-39.pyc,,
9
+ yaml/__init__.py,sha256=bhl05qSeO-1ZxlSRjGrvl2m9nrXb1n9-GQatTN0Mrqc,12311
10
+ yaml/__pycache__/__init__.cpython-39.pyc,,
11
+ yaml/__pycache__/composer.cpython-39.pyc,,
12
+ yaml/__pycache__/constructor.cpython-39.pyc,,
13
+ yaml/__pycache__/cyaml.cpython-39.pyc,,
14
+ yaml/__pycache__/dumper.cpython-39.pyc,,
15
+ yaml/__pycache__/emitter.cpython-39.pyc,,
16
+ yaml/__pycache__/error.cpython-39.pyc,,
17
+ yaml/__pycache__/events.cpython-39.pyc,,
18
+ yaml/__pycache__/loader.cpython-39.pyc,,
19
+ yaml/__pycache__/nodes.cpython-39.pyc,,
20
+ yaml/__pycache__/parser.cpython-39.pyc,,
21
+ yaml/__pycache__/reader.cpython-39.pyc,,
22
+ yaml/__pycache__/representer.cpython-39.pyc,,
23
+ yaml/__pycache__/resolver.cpython-39.pyc,,
24
+ yaml/__pycache__/scanner.cpython-39.pyc,,
25
+ yaml/__pycache__/serializer.cpython-39.pyc,,
26
+ yaml/__pycache__/tokens.cpython-39.pyc,,
27
+ yaml/_yaml.cp39-win_amd64.pyd,sha256=AULP_23onG6Yy5UUqIe4N5f4szwfM5lkHQ60Ak04FTQ,251904
28
+ yaml/composer.py,sha256=_Ko30Wr6eDWUeUpauUGT3Lcg9QPBnOPVlTnIMRGJ9FM,4883
29
+ yaml/constructor.py,sha256=kNgkfaeLUkwQYY_Q6Ff1Tz2XVw_pG1xVE9Ak7z-viLA,28639
30
+ yaml/cyaml.py,sha256=6ZrAG9fAYvdVe2FK_w0hmXoG7ZYsoYUwapG8CiC72H0,3851
31
+ yaml/dumper.py,sha256=PLctZlYwZLp7XmeUdwRuv4nYOZ2UBnDIUy8-lKfLF-o,2837
32
+ yaml/emitter.py,sha256=jghtaU7eFwg31bG0B7RZea_29Adi9CKmXq_QjgQpCkQ,43006
33
+ yaml/error.py,sha256=Ah9z-toHJUbE9j-M8YpxgSRM5CgLCcwVzJgLLRF2Fxo,2533
34
+ yaml/events.py,sha256=50_TksgQiE4up-lKo_V-nBy-tAIxkIPQxY5qDhKCeHw,2445
35
+ yaml/loader.py,sha256=UVa-zIqmkFSCIYq_PgSGm4NSJttHY2Rf_zQ4_b1fHN0,2061
36
+ yaml/nodes.py,sha256=gPKNj8pKCdh2d4gr3gIYINnPOaOxGhJAUiYhGRnPE84,1440
37
+ yaml/parser.py,sha256=ilWp5vvgoHFGzvOZDItFoGjD6D42nhlZrZyjAwa0oJo,25495
38
+ yaml/reader.py,sha256=0dmzirOiDG4Xo41RnuQS7K9rkY3xjHiVasfDMNTqCNw,6794
39
+ yaml/representer.py,sha256=IuWP-cAW9sHKEnS0gCqSa894k1Bg4cgTxaDwIcbRQ-Y,14190
40
+ yaml/resolver.py,sha256=9L-VYfm4mWHxUD1Vg4X7rjDRK_7VZd6b92wzq7Y2IKY,9004
41
+ yaml/scanner.py,sha256=YEM3iLZSaQwXcQRg2l2R4MdT0zGP2F9eHkKGKnHyWQY,51279
42
+ yaml/serializer.py,sha256=ChuFgmhU01hj4xgI8GaKv6vfM2Bujwa9i7d2FAHj7cA,4165
43
+ yaml/tokens.py,sha256=lTQIzSVw8Mg9wv459-TjiOQe6wVziqaRlqX2_89rp54,2573
MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.40.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp39-cp39-win_amd64
5
+
MLPY/Lib/site-packages/PyYAML-6.0.1.dist-info/top_level.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ _yaml
2
+ yaml
MLPY/Lib/site-packages/pythonwin/Pythonwin.exe ADDED
Binary file (58.4 kB). View file
 
MLPY/Lib/site-packages/pythonwin/dde.pyd ADDED
Binary file (96.8 kB). View file
 
MLPY/Lib/site-packages/pythonwin/license.txt ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Unless stated in the specfic source file, this work is
2
+ Copyright (c) 1994-2008, Mark Hammond
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions
7
+ are met:
8
+
9
+ Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in
14
+ the documentation and/or other materials provided with the distribution.
15
+
16
+ Neither name of Mark Hammond nor the name of contributors may be used
17
+ to endorse or promote products derived from this software without
18
+ specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
21
+ IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MLPY/Lib/site-packages/pythonwin/mfc140u.dll ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e06c4bd078f4690aa8874a3deb38e802b2a16ccb602a7edc2e077e98c05b5807
3
+ size 5653424
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/cmdserver.cpython-39.pyc ADDED
Binary file (3.19 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/createwin.cpython-39.pyc ADDED
Binary file (3.19 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/demoutils.cpython-39.pyc ADDED
Binary file (1.7 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/dibdemo.cpython-39.pyc ADDED
Binary file (2.25 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/dlgtest.cpython-39.pyc ADDED
Binary file (3.83 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/dyndlg.cpython-39.pyc ADDED
Binary file (2.4 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/fontdemo.cpython-39.pyc ADDED
Binary file (2.38 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/guidemo.cpython-39.pyc ADDED
Binary file (2.08 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/hiertest.cpython-39.pyc ADDED
Binary file (4.96 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/menutest.cpython-39.pyc ADDED
Binary file (557 Bytes). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/objdoc.cpython-39.pyc ADDED
Binary file (2.11 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/openGLDemo.cpython-39.pyc ADDED
Binary file (9.35 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/progressbar.cpython-39.pyc ADDED
Binary file (1.8 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/sliderdemo.cpython-39.pyc ADDED
Binary file (2 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/splittst.cpython-39.pyc ADDED
Binary file (2.84 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/threadedgui.cpython-39.pyc ADDED
Binary file (6.37 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/__pycache__/toolbar.cpython-39.pyc ADDED
Binary file (3.06 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/basictimerapp.cpython-39.pyc ADDED
Binary file (8.31 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/customprint.cpython-39.pyc ADDED
Binary file (6.05 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/demoutils.cpython-39.pyc ADDED
Binary file (1.68 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/dlgappdemo.cpython-39.pyc ADDED
Binary file (1.78 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/dojobapp.cpython-39.pyc ADDED
Binary file (2.27 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/__pycache__/helloapp.cpython-39.pyc ADDED
Binary file (1.23 kB). View file
 
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/basictimerapp.py ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # basictimerapp - a really simple timer application.
2
+ # This should be run using the command line:
3
+ # pythonwin /app demos\basictimerapp.py
4
+ import sys
5
+ import time
6
+
7
+ import timer
8
+ import win32api
9
+ import win32con
10
+ import win32ui
11
+ from pywin.framework import app, cmdline, dlgappcore
12
+
13
+
14
+ class TimerAppDialog(dlgappcore.AppDialog):
15
+ softspace = 1
16
+
17
+ def __init__(self, appName=""):
18
+ dlgappcore.AppDialog.__init__(self, win32ui.IDD_GENERAL_STATUS)
19
+ self.timerAppName = appName
20
+ self.argOff = 0
21
+ if len(self.timerAppName) == 0:
22
+ if len(sys.argv) > 1 and sys.argv[1][0] != "/":
23
+ self.timerAppName = sys.argv[1]
24
+ self.argOff = 1
25
+
26
+ def PreDoModal(self):
27
+ # sys.stderr = sys.stdout
28
+ pass
29
+
30
+ def ProcessArgs(self, args):
31
+ for arg in args:
32
+ if arg == "/now":
33
+ self.OnOK()
34
+
35
+ def OnInitDialog(self):
36
+ win32ui.SetProfileFileName("pytimer.ini")
37
+ self.title = win32ui.GetProfileVal(
38
+ self.timerAppName, "Title", "Remote System Timer"
39
+ )
40
+ self.buildTimer = win32ui.GetProfileVal(
41
+ self.timerAppName, "Timer", "EachMinuteIntervaler()"
42
+ )
43
+ self.doWork = win32ui.GetProfileVal(self.timerAppName, "Work", "DoDemoWork()")
44
+ # replace "\n" with real \n.
45
+ self.doWork = self.doWork.replace("\\n", "\n")
46
+ dlgappcore.AppDialog.OnInitDialog(self)
47
+
48
+ self.SetWindowText(self.title)
49
+ self.prompt1 = self.GetDlgItem(win32ui.IDC_PROMPT1)
50
+ self.prompt2 = self.GetDlgItem(win32ui.IDC_PROMPT2)
51
+ self.prompt3 = self.GetDlgItem(win32ui.IDC_PROMPT3)
52
+ self.butOK = self.GetDlgItem(win32con.IDOK)
53
+ self.butCancel = self.GetDlgItem(win32con.IDCANCEL)
54
+ self.prompt1.SetWindowText("Python Timer App")
55
+ self.prompt2.SetWindowText("")
56
+ self.prompt3.SetWindowText("")
57
+ self.butOK.SetWindowText("Do it now")
58
+ self.butCancel.SetWindowText("Close")
59
+
60
+ self.timerManager = TimerManager(self)
61
+ self.ProcessArgs(sys.argv[self.argOff :])
62
+ self.timerManager.go()
63
+ return 1
64
+
65
+ def OnDestroy(self, msg):
66
+ dlgappcore.AppDialog.OnDestroy(self, msg)
67
+ self.timerManager.stop()
68
+
69
+ def OnOK(self):
70
+ # stop the timer, then restart after setting special boolean
71
+ self.timerManager.stop()
72
+ self.timerManager.bConnectNow = 1
73
+ self.timerManager.go()
74
+ return
75
+
76
+
77
+ # def OnCancel(self): default behaviour - cancel == close.
78
+ # return
79
+
80
+
81
+ class TimerManager:
82
+ def __init__(self, dlg):
83
+ self.dlg = dlg
84
+ self.timerId = None
85
+ self.intervaler = eval(self.dlg.buildTimer)
86
+ self.bConnectNow = 0
87
+ self.bHaveSetPrompt1 = 0
88
+
89
+ def CaptureOutput(self):
90
+ self.oldOut = sys.stdout
91
+ self.oldErr = sys.stderr
92
+ sys.stdout = sys.stderr = self
93
+ self.bHaveSetPrompt1 = 0
94
+
95
+ def ReleaseOutput(self):
96
+ sys.stdout = self.oldOut
97
+ sys.stderr = self.oldErr
98
+
99
+ def write(self, str):
100
+ s = str.strip()
101
+ if len(s):
102
+ if self.bHaveSetPrompt1:
103
+ dest = self.dlg.prompt3
104
+ else:
105
+ dest = self.dlg.prompt1
106
+ self.bHaveSetPrompt1 = 1
107
+ dest.SetWindowText(s)
108
+
109
+ def go(self):
110
+ self.OnTimer(None, None)
111
+
112
+ def stop(self):
113
+ if self.timerId:
114
+ timer.kill_timer(self.timerId)
115
+ self.timerId = None
116
+
117
+ def OnTimer(self, id, timeVal):
118
+ if id:
119
+ timer.kill_timer(id)
120
+ if self.intervaler.IsTime() or self.bConnectNow:
121
+ # do the work.
122
+ try:
123
+ self.dlg.SetWindowText(self.dlg.title + " - Working...")
124
+ self.dlg.butOK.EnableWindow(0)
125
+ self.dlg.butCancel.EnableWindow(0)
126
+ self.CaptureOutput()
127
+ try:
128
+ exec(self.dlg.doWork)
129
+ print("The last operation completed successfully.")
130
+ except:
131
+ t, v, tb = sys.exc_info()
132
+ str = "Failed: %s: %s" % (t, repr(v))
133
+ print(str)
134
+ self.oldErr.write(str)
135
+ tb = None # Prevent cycle
136
+ finally:
137
+ self.ReleaseOutput()
138
+ self.dlg.butOK.EnableWindow()
139
+ self.dlg.butCancel.EnableWindow()
140
+ self.dlg.SetWindowText(self.dlg.title)
141
+ else:
142
+ now = time.time()
143
+ nextTime = self.intervaler.GetNextTime()
144
+ if nextTime:
145
+ timeDiffSeconds = nextTime - now
146
+ timeDiffMinutes = int(timeDiffSeconds / 60)
147
+ timeDiffSeconds = timeDiffSeconds % 60
148
+ timeDiffHours = int(timeDiffMinutes / 60)
149
+ timeDiffMinutes = timeDiffMinutes % 60
150
+ self.dlg.prompt1.SetWindowText(
151
+ "Next connection due in %02d:%02d:%02d"
152
+ % (timeDiffHours, timeDiffMinutes, timeDiffSeconds)
153
+ )
154
+ self.timerId = timer.set_timer(
155
+ self.intervaler.GetWakeupInterval(), self.OnTimer
156
+ )
157
+ self.bConnectNow = 0
158
+
159
+
160
+ class TimerIntervaler:
161
+ def __init__(self):
162
+ self.nextTime = None
163
+ self.wakeUpInterval = 2000
164
+
165
+ def GetWakeupInterval(self):
166
+ return self.wakeUpInterval
167
+
168
+ def GetNextTime(self):
169
+ return self.nextTime
170
+
171
+ def IsTime(self):
172
+ now = time.time()
173
+ if self.nextTime is None:
174
+ self.nextTime = self.SetFirstTime(now)
175
+ ret = 0
176
+ if now >= self.nextTime:
177
+ ret = 1
178
+ self.nextTime = self.SetNextTime(self.nextTime, now)
179
+ # do the work.
180
+ return ret
181
+
182
+
183
+ class EachAnyIntervaler(TimerIntervaler):
184
+ def __init__(self, timeAt, timePos, timeAdd, wakeUpInterval=None):
185
+ TimerIntervaler.__init__(self)
186
+ self.timeAt = timeAt
187
+ self.timePos = timePos
188
+ self.timeAdd = timeAdd
189
+ if wakeUpInterval:
190
+ self.wakeUpInterval = wakeUpInterval
191
+
192
+ def SetFirstTime(self, now):
193
+ timeTup = time.localtime(now)
194
+ lst = []
195
+ for item in timeTup:
196
+ lst.append(item)
197
+ bAdd = timeTup[self.timePos] > self.timeAt
198
+ lst[self.timePos] = self.timeAt
199
+ for pos in range(self.timePos + 1, 6):
200
+ lst[pos] = 0
201
+ ret = time.mktime(tuple(lst))
202
+ if bAdd:
203
+ ret = ret + self.timeAdd
204
+ return ret
205
+
206
+ def SetNextTime(self, lastTime, now):
207
+ return lastTime + self.timeAdd
208
+
209
+
210
+ class EachMinuteIntervaler(EachAnyIntervaler):
211
+ def __init__(self, at=0):
212
+ EachAnyIntervaler.__init__(self, at, 5, 60, 2000)
213
+
214
+
215
+ class EachHourIntervaler(EachAnyIntervaler):
216
+ def __init__(self, at=0):
217
+ EachAnyIntervaler.__init__(self, at, 4, 3600, 10000)
218
+
219
+
220
+ class EachDayIntervaler(EachAnyIntervaler):
221
+ def __init__(self, at=0):
222
+ EachAnyIntervaler.__init__(self, at, 3, 86400, 10000)
223
+
224
+
225
+ class TimerDialogApp(dlgappcore.DialogApp):
226
+ def CreateDialog(self):
227
+ return TimerAppDialog()
228
+
229
+
230
+ def DoDemoWork():
231
+ print("Doing the work...")
232
+ print("About to connect")
233
+ win32api.MessageBeep(win32con.MB_ICONASTERISK)
234
+ win32api.Sleep(2000)
235
+ print("Doing something else...")
236
+ win32api.MessageBeep(win32con.MB_ICONEXCLAMATION)
237
+ win32api.Sleep(2000)
238
+ print("More work.")
239
+ win32api.MessageBeep(win32con.MB_ICONHAND)
240
+ win32api.Sleep(2000)
241
+ print("The last bit.")
242
+ win32api.MessageBeep(win32con.MB_OK)
243
+ win32api.Sleep(2000)
244
+
245
+
246
+ app = TimerDialogApp()
247
+
248
+
249
+ def t():
250
+ t = TimerAppDialog("Test Dialog")
251
+ t.DoModal()
252
+ return t
253
+
254
+
255
+ if __name__ == "__main__":
256
+ import demoutils
257
+
258
+ demoutils.NeedApp()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/customprint.py ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A demo of an Application object that has some custom print functionality.
2
+
3
+ # If you desire, you can also run this from inside Pythonwin, in which
4
+ # case it will do the demo inside the Pythonwin environment.
5
+
6
+ # This sample was contributed by Roger Burnham.
7
+
8
+ import win32api
9
+ import win32con
10
+ import win32ui
11
+ from pywin.framework import app
12
+ from pywin.mfc import afxres, dialog, docview
13
+
14
+ PRINTDLGORD = 1538
15
+ IDC_PRINT_MAG_EDIT = 1010
16
+
17
+
18
+ class PrintDemoTemplate(docview.DocTemplate):
19
+ def _SetupSharedMenu_(self):
20
+ pass
21
+
22
+
23
+ class PrintDemoView(docview.ScrollView):
24
+ def OnInitialUpdate(self):
25
+ ret = self._obj_.OnInitialUpdate()
26
+ self.colors = {
27
+ "Black": (0x00 << 0) + (0x00 << 8) + (0x00 << 16),
28
+ "Red": (0xFF << 0) + (0x00 << 8) + (0x00 << 16),
29
+ "Green": (0x00 << 0) + (0xFF << 8) + (0x00 << 16),
30
+ "Blue": (0x00 << 0) + (0x00 << 8) + (0xFF << 16),
31
+ "Cyan": (0x00 << 0) + (0xFF << 8) + (0xFF << 16),
32
+ "Magenta": (0xFF << 0) + (0x00 << 8) + (0xFF << 16),
33
+ "Yellow": (0xFF << 0) + (0xFF << 8) + (0x00 << 16),
34
+ }
35
+ self.pens = {}
36
+ for name, color in self.colors.items():
37
+ self.pens[name] = win32ui.CreatePen(win32con.PS_SOLID, 5, color)
38
+ self.pen = None
39
+ self.size = (128, 128)
40
+ self.SetScaleToFitSize(self.size)
41
+ self.HookCommand(self.OnFilePrint, afxres.ID_FILE_PRINT)
42
+ self.HookCommand(self.OnFilePrintPreview, win32ui.ID_FILE_PRINT_PREVIEW)
43
+ return ret
44
+
45
+ def OnDraw(self, dc):
46
+ oldPen = None
47
+ x, y = self.size
48
+ delta = 2
49
+ colors = list(self.colors.keys())
50
+ colors.sort()
51
+ colors = colors * 2
52
+ for color in colors:
53
+ if oldPen is None:
54
+ oldPen = dc.SelectObject(self.pens[color])
55
+ else:
56
+ dc.SelectObject(self.pens[color])
57
+ dc.MoveTo((delta, delta))
58
+ dc.LineTo((x - delta, delta))
59
+ dc.LineTo((x - delta, y - delta))
60
+ dc.LineTo((delta, y - delta))
61
+ dc.LineTo((delta, delta))
62
+ delta = delta + 4
63
+ if x - delta <= 0 or y - delta <= 0:
64
+ break
65
+ dc.SelectObject(oldPen)
66
+
67
+ def OnPrepareDC(self, dc, pInfo):
68
+ if dc.IsPrinting():
69
+ mag = self.prtDlg["mag"]
70
+ dc.SetMapMode(win32con.MM_ANISOTROPIC)
71
+ dc.SetWindowOrg((0, 0))
72
+ dc.SetWindowExt((1, 1))
73
+ dc.SetViewportOrg((0, 0))
74
+ dc.SetViewportExt((mag, mag))
75
+
76
+ def OnPreparePrinting(self, pInfo):
77
+ flags = (
78
+ win32ui.PD_USEDEVMODECOPIES
79
+ | win32ui.PD_PAGENUMS
80
+ | win32ui.PD_NOPAGENUMS
81
+ | win32ui.PD_NOSELECTION
82
+ )
83
+ self.prtDlg = ImagePrintDialog(pInfo, PRINTDLGORD, flags)
84
+ pInfo.SetPrintDialog(self.prtDlg)
85
+ pInfo.SetMinPage(1)
86
+ pInfo.SetMaxPage(1)
87
+ pInfo.SetFromPage(1)
88
+ pInfo.SetToPage(1)
89
+ ret = self.DoPreparePrinting(pInfo)
90
+ return ret
91
+
92
+ def OnBeginPrinting(self, dc, pInfo):
93
+ return self._obj_.OnBeginPrinting(dc, pInfo)
94
+
95
+ def OnEndPrinting(self, dc, pInfo):
96
+ del self.prtDlg
97
+ return self._obj_.OnEndPrinting(dc, pInfo)
98
+
99
+ def OnFilePrintPreview(self, *arg):
100
+ self._obj_.OnFilePrintPreview()
101
+
102
+ def OnFilePrint(self, *arg):
103
+ self._obj_.OnFilePrint()
104
+
105
+ def OnPrint(self, dc, pInfo):
106
+ doc = self.GetDocument()
107
+ metrics = dc.GetTextMetrics()
108
+ cxChar = metrics["tmAveCharWidth"]
109
+ cyChar = metrics["tmHeight"]
110
+ left, top, right, bottom = pInfo.GetDraw()
111
+ dc.TextOut(0, 2 * cyChar, doc.GetTitle())
112
+ top = top + (7 * cyChar) / 2
113
+ dc.MoveTo(left, top)
114
+ dc.LineTo(right, top)
115
+ top = top + cyChar
116
+ # this seems to have not effect...
117
+ # get what I want with the dc.SetWindowOrg calls
118
+ pInfo.SetDraw((left, top, right, bottom))
119
+ dc.SetWindowOrg((0, -top))
120
+
121
+ self.OnDraw(dc)
122
+ dc.SetTextAlign(win32con.TA_LEFT | win32con.TA_BOTTOM)
123
+
124
+ rect = self.GetWindowRect()
125
+ rect = self.ScreenToClient(rect)
126
+ height = rect[3] - rect[1]
127
+ dc.SetWindowOrg((0, -(top + height + cyChar)))
128
+ dc.MoveTo(left, 0)
129
+ dc.LineTo(right, 0)
130
+
131
+ x = 0
132
+ y = (3 * cyChar) / 2
133
+
134
+ dc.TextOut(x, y, doc.GetTitle())
135
+ y = y + cyChar
136
+
137
+
138
+ class PrintDemoApp(app.CApp):
139
+ def __init__(self):
140
+ app.CApp.__init__(self)
141
+
142
+ def InitInstance(self):
143
+ template = PrintDemoTemplate(None, None, None, PrintDemoView)
144
+ self.AddDocTemplate(template)
145
+ self._obj_.InitMDIInstance()
146
+ self.LoadMainFrame()
147
+ doc = template.OpenDocumentFile(None)
148
+ doc.SetTitle("Custom Print Document")
149
+
150
+
151
+ class ImagePrintDialog(dialog.PrintDialog):
152
+ sectionPos = "Image Print Demo"
153
+
154
+ def __init__(self, pInfo, dlgID, flags=win32ui.PD_USEDEVMODECOPIES):
155
+ dialog.PrintDialog.__init__(self, pInfo, dlgID, flags=flags)
156
+ mag = win32ui.GetProfileVal(self.sectionPos, "Document Magnification", 0)
157
+ if mag <= 0:
158
+ mag = 2
159
+ win32ui.WriteProfileVal(self.sectionPos, "Document Magnification", mag)
160
+
161
+ self["mag"] = mag
162
+
163
+ def OnInitDialog(self):
164
+ self.magCtl = self.GetDlgItem(IDC_PRINT_MAG_EDIT)
165
+ self.magCtl.SetWindowText(repr(self["mag"]))
166
+ return dialog.PrintDialog.OnInitDialog(self)
167
+
168
+ def OnOK(self):
169
+ dialog.PrintDialog.OnOK(self)
170
+ strMag = self.magCtl.GetWindowText()
171
+ try:
172
+ self["mag"] = int(strMag)
173
+ except:
174
+ pass
175
+ win32ui.WriteProfileVal(self.sectionPos, "Document Magnification", self["mag"])
176
+
177
+
178
+ if __name__ == "__main__":
179
+ # Running under Pythonwin
180
+ def test():
181
+ template = PrintDemoTemplate(None, None, None, PrintDemoView)
182
+ template.OpenDocumentFile(None)
183
+
184
+ test()
185
+ else:
186
+ app = PrintDemoApp()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/demoutils.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Utilities for the demos
2
+
3
+ import sys
4
+
5
+ import win32api
6
+ import win32con
7
+ import win32ui
8
+
9
+ NotScriptMsg = """\
10
+ This demo program is not designed to be run as a Script, but is
11
+ probably used by some other test program. Please try another demo.
12
+ """
13
+
14
+ NeedGUIMsg = """\
15
+ This demo program can only be run from inside of Pythonwin
16
+
17
+ You must start Pythonwin, and select 'Run' from the toolbar or File menu
18
+ """
19
+
20
+
21
+ NeedAppMsg = """\
22
+ This demo program is a 'Pythonwin Application'.
23
+
24
+ It is more demo code than an example of Pythonwin's capabilities.
25
+
26
+ To run it, you must execute the command:
27
+ pythonwin.exe /app "%s"
28
+
29
+ Would you like to execute it now?
30
+ """
31
+
32
+
33
+ def NotAScript():
34
+ import win32ui
35
+
36
+ win32ui.MessageBox(NotScriptMsg, "Demos")
37
+
38
+
39
+ def NeedGoodGUI():
40
+ from pywin.framework.app import HaveGoodGUI
41
+
42
+ rc = HaveGoodGUI()
43
+ if not rc:
44
+ win32ui.MessageBox(NeedGUIMsg, "Demos")
45
+ return rc
46
+
47
+
48
+ def NeedApp():
49
+ import win32ui
50
+
51
+ rc = win32ui.MessageBox(NeedAppMsg % sys.argv[0], "Demos", win32con.MB_YESNO)
52
+ if rc == win32con.IDYES:
53
+ try:
54
+ parent = win32ui.GetMainFrame().GetSafeHwnd()
55
+ win32api.ShellExecute(
56
+ parent, None, "pythonwin.exe", '/app "%s"' % sys.argv[0], None, 1
57
+ )
58
+ except win32api.error as details:
59
+ win32ui.MessageBox("Error executing command - %s" % (details), "Demos")
60
+
61
+
62
+ if __name__ == "__main__":
63
+ import demoutils
64
+
65
+ demoutils.NotAScript()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/dlgappdemo.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # dlgappdemo - a demo of a dialog application.
2
+ # This is a demonstration of both a custom "application" module,
3
+ # and a Python program in a dialog box.
4
+ #
5
+ # NOTE: You CAN NOT import this module from either PythonWin or Python.
6
+ # This module must be specified on the commandline to PythonWin only.
7
+ # eg, PythonWin /app dlgappdemo.py
8
+
9
+ import sys
10
+
11
+ import win32ui
12
+ from pywin.framework import app, dlgappcore
13
+
14
+
15
+ class TestDialogApp(dlgappcore.DialogApp):
16
+ def CreateDialog(self):
17
+ return TestAppDialog()
18
+
19
+
20
+ class TestAppDialog(dlgappcore.AppDialog):
21
+ def __init__(self):
22
+ self.edit = None
23
+ dlgappcore.AppDialog.__init__(self, win32ui.IDD_LARGE_EDIT)
24
+
25
+ def OnInitDialog(self):
26
+ self.SetWindowText("Test dialog application")
27
+ self.edit = self.GetDlgItem(win32ui.IDC_EDIT1)
28
+ print("Hello from Python")
29
+ print("args are:", end=" ")
30
+ for arg in sys.argv:
31
+ print(arg)
32
+ return 1
33
+
34
+ def PreDoModal(self):
35
+ sys.stdout = sys.stderr = self
36
+
37
+ def write(self, str):
38
+ if self.edit:
39
+ self.edit.SetSel(-2)
40
+ # translate \n to \n\r
41
+ self.edit.ReplaceSel(str.replace("\n", "\r\n"))
42
+ else:
43
+ win32ui.OutputDebug("dlgapp - no edit control! >>\n%s\n<<\n" % str)
44
+
45
+
46
+ app.AppBuilder = TestDialogApp
47
+
48
+ if __name__ == "__main__":
49
+ import demoutils
50
+
51
+ demoutils.NeedApp()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/dojobapp.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # dojobapp - do a job, show the result in a dialog, and exit.
2
+ #
3
+ # Very simple - faily minimal dialog based app.
4
+ #
5
+ # This should be run using the command line:
6
+ # pythonwin /app demos\dojobapp.py
7
+
8
+
9
+ import win32api
10
+ import win32con
11
+ import win32ui
12
+ from pywin.framework import app, dlgappcore
13
+
14
+
15
+ class DoJobAppDialog(dlgappcore.AppDialog):
16
+ softspace = 1
17
+
18
+ def __init__(self, appName=""):
19
+ self.appName = appName
20
+ dlgappcore.AppDialog.__init__(self, win32ui.IDD_GENERAL_STATUS)
21
+
22
+ def PreDoModal(self):
23
+ pass
24
+
25
+ def ProcessArgs(self, args):
26
+ pass
27
+
28
+ def OnInitDialog(self):
29
+ self.SetWindowText(self.appName)
30
+ butCancel = self.GetDlgItem(win32con.IDCANCEL)
31
+ butCancel.ShowWindow(win32con.SW_HIDE)
32
+ p1 = self.GetDlgItem(win32ui.IDC_PROMPT1)
33
+ p2 = self.GetDlgItem(win32ui.IDC_PROMPT2)
34
+
35
+ # Do something here!
36
+
37
+ p1.SetWindowText("Hello there")
38
+ p2.SetWindowText("from the demo")
39
+
40
+ def OnDestroy(self, msg):
41
+ pass
42
+
43
+
44
+ # def OnOK(self):
45
+ # pass
46
+ # def OnCancel(self): default behaviour - cancel == close.
47
+ # return
48
+
49
+
50
+ class DoJobDialogApp(dlgappcore.DialogApp):
51
+ def CreateDialog(self):
52
+ return DoJobAppDialog("Do Something")
53
+
54
+
55
+ class CopyToDialogApp(DoJobDialogApp):
56
+ def __init__(self):
57
+ DoJobDialogApp.__init__(self)
58
+
59
+
60
+ app.AppBuilder = DoJobDialogApp
61
+
62
+
63
+ def t():
64
+ t = DoJobAppDialog("Copy To")
65
+ t.DoModal()
66
+ return t
67
+
68
+
69
+ if __name__ == "__main__":
70
+ import demoutils
71
+
72
+ demoutils.NeedApp()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/app/helloapp.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##
2
+ ## helloapp.py
3
+ ##
4
+ ##
5
+ ## A nice, small 'hello world' Pythonwin application.
6
+ ## NOT an MDI application - just a single, normal, top-level window.
7
+ ##
8
+ ## MUST be run with the command line "pythonwin.exe /app helloapp.py"
9
+ ## (or if you are really keen, rename "pythonwin.exe" to something else, then
10
+ ## using MSVC or similar, edit the string section in the .EXE to name this file)
11
+ ##
12
+ ## Originally by Willy Heineman <[email protected]>
13
+
14
+
15
+ import win32con
16
+ import win32ui
17
+ from pywin.mfc import afxres, dialog, window
18
+ from pywin.mfc.thread import WinApp
19
+
20
+
21
+ # The main frame.
22
+ # Does almost nothing at all - doesnt even create a child window!
23
+ class HelloWindow(window.Wnd):
24
+ def __init__(self):
25
+ # The window.Wnd ctor creates a Window object, and places it in
26
+ # self._obj_. Note the window object exists, but the window itself
27
+ # does not!
28
+ window.Wnd.__init__(self, win32ui.CreateWnd())
29
+
30
+ # Now we ask the window object to create the window itself.
31
+ self._obj_.CreateWindowEx(
32
+ win32con.WS_EX_CLIENTEDGE,
33
+ win32ui.RegisterWndClass(0, 0, win32con.COLOR_WINDOW + 1),
34
+ "Hello World!",
35
+ win32con.WS_OVERLAPPEDWINDOW,
36
+ (100, 100, 400, 300),
37
+ None,
38
+ 0,
39
+ None,
40
+ )
41
+
42
+
43
+ # The application object itself.
44
+ class HelloApp(WinApp):
45
+ def InitInstance(self):
46
+ self.frame = HelloWindow()
47
+ self.frame.ShowWindow(win32con.SW_SHOWNORMAL)
48
+ # We need to tell MFC what our main frame is.
49
+ self.SetMainFrame(self.frame)
50
+
51
+
52
+ # Now create the application object itself!
53
+ app = HelloApp()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/cmdserver.py ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # cmdserver.py
2
+
3
+ # Demo code that is not Pythonwin related, but too good to throw away...
4
+
5
+ import _thread
6
+ import sys
7
+ import traceback
8
+
9
+ import win32api
10
+ from pywin.framework import winout
11
+
12
+
13
+ class ThreadWriter:
14
+ "Assign an instance to sys.stdout for per-thread printing objects - Courtesy Guido!"
15
+
16
+ def __init__(self):
17
+ "Constructor -- initialize the table of writers"
18
+ self.writers = {}
19
+ self.origStdOut = None
20
+
21
+ def register(self, writer):
22
+ "Register the writer for the current thread"
23
+ self.writers[_thread.get_ident()] = writer
24
+ if self.origStdOut is None:
25
+ self.origStdOut = sys.stdout
26
+ sys.stdout = self
27
+
28
+ def unregister(self):
29
+ "Remove the writer for the current thread, if any"
30
+ try:
31
+ del self.writers[_thread.get_ident()]
32
+ except KeyError:
33
+ pass
34
+ if len(self.writers) == 0:
35
+ sys.stdout = self.origStdOut
36
+ self.origStdOut = None
37
+
38
+ def getwriter(self):
39
+ "Return the current thread's writer, default sys.stdout"
40
+ try:
41
+ return self.writers[_thread.get_ident()]
42
+ except KeyError:
43
+ return self.origStdOut
44
+
45
+ def write(self, str):
46
+ "Write to the current thread's writer, default sys.stdout"
47
+ self.getwriter().write(str)
48
+
49
+
50
+ def Test():
51
+ num = 1
52
+ while num < 1000:
53
+ print("Hello there no " + str(num))
54
+ win32api.Sleep(50)
55
+ num = num + 1
56
+
57
+
58
+ class flags:
59
+ SERVER_BEST = 0
60
+ SERVER_IMMEDIATE = 1
61
+ SERVER_THREAD = 2
62
+ SERVER_PROCESS = 3
63
+
64
+
65
+ def StartServer(cmd, title=None, bCloseOnEnd=0, serverFlags=flags.SERVER_BEST):
66
+ out = winout.WindowOutput(title, None, winout.flags.WQ_IDLE)
67
+ if not title:
68
+ title = cmd
69
+ out.Create(title)
70
+ # ServerThread((out, cmd, title, bCloseOnEnd))
71
+ # out = sys.stdout
72
+ _thread.start_new_thread(ServerThread, (out, cmd, title, bCloseOnEnd))
73
+
74
+
75
+ def ServerThread(myout, cmd, title, bCloseOnEnd):
76
+ try:
77
+ writer.register(myout)
78
+ print('Executing "%s"\n' % cmd)
79
+ bOK = 1
80
+ try:
81
+ import __main__
82
+
83
+ exec(cmd + "\n", __main__.__dict__)
84
+ except:
85
+ bOK = 0
86
+ if bOK:
87
+ print("Command terminated without errors.")
88
+ else:
89
+ t, v, tb = sys.exc_info()
90
+ print(t, ": ", v)
91
+ traceback.print_tb(tb)
92
+ tb = None # prevent a cycle
93
+ print("Command terminated with an unhandled exception")
94
+ writer.unregister()
95
+ if bOK and bCloseOnEnd:
96
+ myout.frame.DestroyWindow()
97
+
98
+ # Unhandled exception of any kind in a thread kills the gui!
99
+ except:
100
+ t, v, tb = sys.exc_info()
101
+ print(t, ": ", v)
102
+ traceback.print_tb(tb)
103
+ tb = None
104
+ print("Thread failed")
105
+
106
+
107
+ # assist for reloading (when debugging) - use only 1 tracer object,
108
+ # else a large chain of tracer objects will exist.
109
+ # try:
110
+ # writer
111
+ # except NameError:
112
+ # writer=ThreadWriter()
113
+ if __name__ == "__main__":
114
+ import demoutils
115
+
116
+ demoutils.NotAScript()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/createwin.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # Window creation example
3
+ #
4
+ # This example creates a minimal "control" that just fills in its
5
+ # window with red. To make your own control, subclass Control and
6
+ # write your own OnPaint() method. See PyCWnd.HookMessage for what
7
+ # the parameters to OnPaint are.
8
+ #
9
+
10
+ import win32api
11
+ import win32con
12
+ import win32ui
13
+ from pywin.mfc import dialog, window
14
+
15
+
16
+ class Control(window.Wnd):
17
+ """Generic control class"""
18
+
19
+ def __init__(self):
20
+ window.Wnd.__init__(self, win32ui.CreateWnd())
21
+
22
+ def OnPaint(self):
23
+ dc, paintStruct = self.BeginPaint()
24
+ self.DoPaint(dc)
25
+ self.EndPaint(paintStruct)
26
+
27
+ def DoPaint(self, dc): # Override this!
28
+ pass
29
+
30
+
31
+ class RedBox(Control):
32
+ def DoPaint(self, dc):
33
+ dc.FillSolidRect(self.GetClientRect(), win32api.RGB(255, 0, 0))
34
+
35
+
36
+ class RedBoxWithPie(RedBox):
37
+ def DoPaint(self, dc):
38
+ RedBox.DoPaint(self, dc)
39
+ r = self.GetClientRect()
40
+ dc.Pie(r[0], r[1], r[2], r[3], 0, 0, r[2], r[3] // 2)
41
+
42
+
43
+ def MakeDlgTemplate():
44
+ style = (
45
+ win32con.DS_MODALFRAME
46
+ | win32con.WS_POPUP
47
+ | win32con.WS_VISIBLE
48
+ | win32con.WS_CAPTION
49
+ | win32con.WS_SYSMENU
50
+ | win32con.DS_SETFONT
51
+ )
52
+ cs = win32con.WS_CHILD | win32con.WS_VISIBLE
53
+
54
+ w = 64
55
+ h = 64
56
+
57
+ dlg = [
58
+ ["Red box", (0, 0, w, h), style, None, (8, "MS Sans Serif")],
59
+ ]
60
+
61
+ s = win32con.WS_TABSTOP | cs
62
+
63
+ dlg.append(
64
+ [
65
+ 128,
66
+ "Cancel",
67
+ win32con.IDCANCEL,
68
+ (7, h - 18, 50, 14),
69
+ s | win32con.BS_PUSHBUTTON,
70
+ ]
71
+ )
72
+
73
+ return dlg
74
+
75
+
76
+ class TestDialog(dialog.Dialog):
77
+ def OnInitDialog(self):
78
+ rc = dialog.Dialog.OnInitDialog(self)
79
+ self.redbox = RedBox()
80
+ self.redbox.CreateWindow(
81
+ None,
82
+ "RedBox",
83
+ win32con.WS_CHILD | win32con.WS_VISIBLE,
84
+ (5, 5, 90, 68),
85
+ self,
86
+ 1003,
87
+ )
88
+ return rc
89
+
90
+
91
+ class TestPieDialog(dialog.Dialog):
92
+ def OnInitDialog(self):
93
+ rc = dialog.Dialog.OnInitDialog(self)
94
+ self.control = RedBoxWithPie()
95
+ self.control.CreateWindow(
96
+ None,
97
+ "RedBox with Pie",
98
+ win32con.WS_CHILD | win32con.WS_VISIBLE,
99
+ (5, 5, 90, 68),
100
+ self,
101
+ 1003,
102
+ )
103
+
104
+
105
+ def demo(modal=0):
106
+ d = TestPieDialog(MakeDlgTemplate())
107
+ if modal:
108
+ d.DoModal()
109
+ else:
110
+ d.CreateWindow()
111
+
112
+
113
+ if __name__ == "__main__":
114
+ demo(1)
MLPY/Lib/site-packages/pythonwin/pywin/Demos/demoutils.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Utilities for the demos
2
+
3
+ import sys
4
+
5
+ import win32api
6
+ import win32con
7
+ import win32ui
8
+
9
+ NotScriptMsg = """\
10
+ This demo program is not designed to be run as a Script, but is
11
+ probably used by some other test program. Please try another demo.
12
+ """
13
+
14
+ NeedGUIMsg = """\
15
+ This demo program can only be run from inside of Pythonwin
16
+
17
+ You must start Pythonwin, and select 'Run' from the toolbar or File menu
18
+ """
19
+
20
+
21
+ NeedAppMsg = """\
22
+ This demo program is a 'Pythonwin Application'.
23
+
24
+ It is more demo code than an example of Pythonwin's capabilities.
25
+
26
+ To run it, you must execute the command:
27
+ pythonwin.exe /app "%s"
28
+
29
+ Would you like to execute it now?
30
+ """
31
+
32
+
33
+ def NotAScript():
34
+ import win32ui
35
+
36
+ win32ui.MessageBox(NotScriptMsg, "Demos")
37
+
38
+
39
+ def NeedGoodGUI():
40
+ from pywin.framework.app import HaveGoodGUI
41
+
42
+ rc = HaveGoodGUI()
43
+ if not rc:
44
+ win32ui.MessageBox(NeedGUIMsg, "Demos")
45
+ return rc
46
+
47
+
48
+ def NeedApp():
49
+ import win32ui
50
+
51
+ rc = win32ui.MessageBox(NeedAppMsg % sys.argv[0], "Demos", win32con.MB_YESNO)
52
+ if rc == win32con.IDYES:
53
+ try:
54
+ parent = win32ui.GetMainFrame().GetSafeHwnd()
55
+ win32api.ShellExecute(
56
+ parent, None, "pythonwin.exe", '/app "%s"' % sys.argv[0], None, 1
57
+ )
58
+ except win32api.error as details:
59
+ win32ui.MessageBox("Error executing command - %s" % (details), "Demos")
60
+
61
+
62
+ from pywin.framework.app import HaveGoodGUI
63
+
64
+ if __name__ == "__main__":
65
+ import demoutils
66
+
67
+ demoutils.NotAScript()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/dibdemo.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A demo which creates a view and a frame which displays a PPM format bitmap
2
+ #
3
+ # This hasnnt been run in a while, as I dont have many of that format around!
4
+
5
+ import win32api
6
+ import win32con
7
+ import win32ui
8
+
9
+
10
+ class DIBView:
11
+ def __init__(self, doc, dib):
12
+ self.dib = dib
13
+ self.view = win32ui.CreateView(doc)
14
+ self.width = self.height = 0
15
+ # set up message handlers
16
+ # self.view.OnPrepareDC = self.OnPrepareDC
17
+ self.view.HookMessage(self.OnSize, win32con.WM_SIZE)
18
+
19
+ def OnSize(self, params):
20
+ lParam = params[3]
21
+ self.width = win32api.LOWORD(lParam)
22
+ self.height = win32api.HIWORD(lParam)
23
+
24
+ def OnDraw(self, ob, dc):
25
+ # set sizes used for "non strecth" mode.
26
+ self.view.SetScrollSizes(win32con.MM_TEXT, self.dib.GetSize())
27
+ dibSize = self.dib.GetSize()
28
+ dibRect = (0, 0, dibSize[0], dibSize[1])
29
+ # stretch BMP.
30
+ # self.dib.Paint(dc, (0,0,self.width, self.height),dibRect)
31
+ # non stretch.
32
+ self.dib.Paint(dc)
33
+
34
+
35
+ class DIBDemo:
36
+ def __init__(self, filename, *bPBM):
37
+ # init data members
38
+ f = open(filename, "rb")
39
+ dib = win32ui.CreateDIBitmap()
40
+ if len(bPBM) > 0:
41
+ magic = f.readline()
42
+ if magic != "P6\n":
43
+ print("The file is not a PBM format file")
44
+ raise ValueError("Failed - The file is not a PBM format file")
45
+ # check magic?
46
+ rowcollist = f.readline().split()
47
+ cols = int(rowcollist[0])
48
+ rows = int(rowcollist[1])
49
+ f.readline() # whats this one?
50
+ dib.LoadPBMData(f, (cols, rows))
51
+ else:
52
+ dib.LoadWindowsFormatFile(f)
53
+ f.close()
54
+ # create doc/view
55
+ self.doc = win32ui.CreateDoc()
56
+ self.dibView = DIBView(self.doc, dib)
57
+ self.frame = win32ui.CreateMDIFrame()
58
+ self.frame.LoadFrame() # this will force OnCreateClient
59
+ self.doc.SetTitle("DIB Demo")
60
+ self.frame.ShowWindow()
61
+
62
+ # display the sucka
63
+ self.frame.ActivateFrame()
64
+
65
+ def OnCreateClient(self, createparams, context):
66
+ self.dibView.view.CreateWindow(self.frame)
67
+ return 1
68
+
69
+
70
+ if __name__ == "__main__":
71
+ import demoutils
72
+
73
+ demoutils.NotAScript()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/dlgtest.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A Demo of Pythonwin's Dialog and Property Page support.
2
+
3
+ ###################
4
+ #
5
+ # First demo - use the built-in to Pythonwin "Tab Stop" dialog, but
6
+ # customise it heavily.
7
+ #
8
+ # ID's for the tabstop dialog - out test.
9
+ #
10
+ import win32con
11
+ import win32ui
12
+ from pywin.mfc import dialog
13
+ from win32con import IDCANCEL
14
+ from win32ui import IDC_EDIT_TABS, IDC_PROMPT_TABS, IDD_SET_TABSTOPS
15
+
16
+
17
+ class TestDialog(dialog.Dialog):
18
+ def __init__(self, modal=1):
19
+ dialog.Dialog.__init__(self, IDD_SET_TABSTOPS)
20
+ self.counter = 0
21
+ if modal:
22
+ self.DoModal()
23
+ else:
24
+ self.CreateWindow()
25
+
26
+ def OnInitDialog(self):
27
+ # Set the caption of the dialog itself.
28
+ self.SetWindowText("Used to be Tab Stops!")
29
+ # Get a child control, remember it, and change its text.
30
+ self.edit = self.GetDlgItem(IDC_EDIT_TABS) # the text box.
31
+ self.edit.SetWindowText("Test")
32
+ # Hook a Windows message for the dialog.
33
+ self.edit.HookMessage(self.KillFocus, win32con.WM_KILLFOCUS)
34
+ # Get the prompt control, and change its next.
35
+ prompt = self.GetDlgItem(IDC_PROMPT_TABS) # the prompt box.
36
+ prompt.SetWindowText("Prompt")
37
+ # And the same for the button..
38
+ cancel = self.GetDlgItem(IDCANCEL) # the cancel button
39
+ cancel.SetWindowText("&Kill me")
40
+
41
+ # And just for demonstration purposes, we hook the notify message for the dialog.
42
+ # This allows us to be notified when the Edit Control text changes.
43
+ self.HookCommand(self.OnNotify, IDC_EDIT_TABS)
44
+
45
+ def OnNotify(self, controlid, code):
46
+ if code == win32con.EN_CHANGE:
47
+ print("Edit text changed!")
48
+ return 1 # I handled this, so no need to call defaults!
49
+
50
+ # kill focus for the edit box.
51
+ # Simply increment the value in the text box.
52
+ def KillFocus(self, msg):
53
+ self.counter = self.counter + 1
54
+ if self.edit != None:
55
+ self.edit.SetWindowText(str(self.counter))
56
+
57
+ # Called when the dialog box is terminating...
58
+ def OnDestroy(self, msg):
59
+ del self.edit
60
+ del self.counter
61
+
62
+
63
+ # A very simply Property Sheet.
64
+ # We only make a new class for demonstration purposes.
65
+ class TestSheet(dialog.PropertySheet):
66
+ def __init__(self, title):
67
+ dialog.PropertySheet.__init__(self, title)
68
+ self.HookMessage(self.OnActivate, win32con.WM_ACTIVATE)
69
+
70
+ def OnActivate(self, msg):
71
+ pass
72
+
73
+
74
+ # A very simply Property Page, which will be "owned" by the above
75
+ # Property Sheet.
76
+ # We create a new class, just so we can hook a control notification.
77
+ class TestPage(dialog.PropertyPage):
78
+ def OnInitDialog(self):
79
+ # We use the HookNotify function to allow Python to respond to
80
+ # Windows WM_NOTIFY messages.
81
+ # In this case, we are interested in BN_CLICKED messages.
82
+ self.HookNotify(self.OnNotify, win32con.BN_CLICKED)
83
+
84
+ def OnNotify(self, std, extra):
85
+ print("OnNotify", std, extra)
86
+
87
+
88
+ # Some code that actually uses these objects.
89
+ def demo(modal=0):
90
+ TestDialog(modal)
91
+
92
+ # property sheet/page demo
93
+ ps = win32ui.CreatePropertySheet("Property Sheet/Page Demo")
94
+ # Create a completely standard PropertyPage.
95
+ page1 = win32ui.CreatePropertyPage(win32ui.IDD_PROPDEMO1)
96
+ # Create our custom property page.
97
+ page2 = TestPage(win32ui.IDD_PROPDEMO2)
98
+ ps.AddPage(page1)
99
+ ps.AddPage(page2)
100
+ if modal:
101
+ ps.DoModal()
102
+ else:
103
+ style = (
104
+ win32con.WS_SYSMENU
105
+ | win32con.WS_POPUP
106
+ | win32con.WS_CAPTION
107
+ | win32con.DS_MODALFRAME
108
+ | win32con.WS_VISIBLE
109
+ )
110
+ styleex = win32con.WS_EX_DLGMODALFRAME | win32con.WS_EX_PALETTEWINDOW
111
+ ps.CreateWindow(win32ui.GetMainFrame(), style, styleex)
112
+
113
+
114
+ def test(modal=1):
115
+ # dlg=dialog.Dialog(1010)
116
+ # dlg.CreateWindow()
117
+ # dlg.EndDialog(0)
118
+ # del dlg
119
+ # return
120
+ # property sheet/page demo
121
+ ps = TestSheet("Property Sheet/Page Demo")
122
+ page1 = win32ui.CreatePropertyPage(win32ui.IDD_PROPDEMO1)
123
+ page2 = win32ui.CreatePropertyPage(win32ui.IDD_PROPDEMO2)
124
+ ps.AddPage(page1)
125
+ ps.AddPage(page2)
126
+ del page1
127
+ del page2
128
+ if modal:
129
+ ps.DoModal()
130
+ else:
131
+ ps.CreateWindow(win32ui.GetMainFrame())
132
+ return ps
133
+
134
+
135
+ def d():
136
+ dlg = win32ui.CreateDialog(win32ui.IDD_DEBUGGER)
137
+ dlg.datalist.append((win32ui.IDC_DBG_RADIOSTACK, "radio"))
138
+ print("data list is ", dlg.datalist)
139
+ dlg.data["radio"] = 1
140
+ dlg.DoModal()
141
+ print(dlg.data["radio"])
142
+
143
+
144
+ if __name__ == "__main__":
145
+ demo(1)
MLPY/Lib/site-packages/pythonwin/pywin/Demos/dyndlg.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # dyndlg.py
2
+ # contributed by Curt Hagenlocher <[email protected]>
3
+
4
+ # Dialog Template params:
5
+ # Parameter 0 - Window caption
6
+ # Parameter 1 - Bounds (rect tuple)
7
+ # Parameter 2 - Window style
8
+ # Parameter 3 - Extended style
9
+ # Parameter 4 - Font tuple
10
+ # Parameter 5 - Menu name
11
+ # Parameter 6 - Window class
12
+ # Dialog item params:
13
+ # Parameter 0 - Window class
14
+ # Parameter 1 - Text
15
+ # Parameter 2 - ID
16
+ # Parameter 3 - Bounds
17
+ # Parameter 4 - Style
18
+ # Parameter 5 - Extended style
19
+ # Parameter 6 - Extra data
20
+
21
+
22
+ import win32con
23
+ import win32ui
24
+ from pywin.mfc import dialog, window
25
+
26
+
27
+ def MakeDlgTemplate():
28
+ style = (
29
+ win32con.DS_MODALFRAME
30
+ | win32con.WS_POPUP
31
+ | win32con.WS_VISIBLE
32
+ | win32con.WS_CAPTION
33
+ | win32con.WS_SYSMENU
34
+ | win32con.DS_SETFONT
35
+ )
36
+ cs = win32con.WS_CHILD | win32con.WS_VISIBLE
37
+ dlg = [
38
+ ["Select Warehouse", (0, 0, 177, 93), style, None, (8, "MS Sans Serif")],
39
+ ]
40
+ dlg.append([130, "Current Warehouse:", -1, (7, 7, 69, 9), cs | win32con.SS_LEFT])
41
+ dlg.append([130, "ASTORIA", 128, (16, 17, 99, 7), cs | win32con.SS_LEFT])
42
+ dlg.append([130, "New &Warehouse:", -1, (7, 29, 69, 9), cs | win32con.SS_LEFT])
43
+ s = win32con.WS_TABSTOP | cs
44
+ # dlg.append([131, None, 130, (5, 40, 110, 48),
45
+ # s | win32con.LBS_NOTIFY | win32con.LBS_SORT | win32con.LBS_NOINTEGRALHEIGHT | win32con.WS_VSCROLL | win32con.WS_BORDER])
46
+ dlg.append(
47
+ [
48
+ "{8E27C92B-1264-101C-8A2F-040224009C02}",
49
+ None,
50
+ 131,
51
+ (5, 40, 110, 48),
52
+ win32con.WS_TABSTOP,
53
+ ]
54
+ )
55
+
56
+ dlg.append(
57
+ [128, "OK", win32con.IDOK, (124, 5, 50, 14), s | win32con.BS_DEFPUSHBUTTON]
58
+ )
59
+ s = win32con.BS_PUSHBUTTON | s
60
+ dlg.append([128, "Cancel", win32con.IDCANCEL, (124, 22, 50, 14), s])
61
+ dlg.append([128, "&Help", 100, (124, 74, 50, 14), s])
62
+
63
+ return dlg
64
+
65
+
66
+ def test1():
67
+ win32ui.CreateDialogIndirect(MakeDlgTemplate()).DoModal()
68
+
69
+
70
+ def test2():
71
+ dialog.Dialog(MakeDlgTemplate()).DoModal()
72
+
73
+
74
+ def test3():
75
+ dlg = win32ui.LoadDialogResource(win32ui.IDD_SET_TABSTOPS)
76
+ dlg[0][0] = "New Dialog Title"
77
+ dlg[0][1] = (80, 20, 161, 60)
78
+ dlg[1][1] = "&Confusion:"
79
+ cs = (
80
+ win32con.WS_CHILD
81
+ | win32con.WS_VISIBLE
82
+ | win32con.WS_TABSTOP
83
+ | win32con.BS_PUSHBUTTON
84
+ )
85
+ dlg.append([128, "&Help", 100, (111, 41, 40, 14), cs])
86
+ dialog.Dialog(dlg).DoModal()
87
+
88
+
89
+ def test4():
90
+ page1 = dialog.PropertyPage(win32ui.LoadDialogResource(win32ui.IDD_PROPDEMO1))
91
+ page2 = dialog.PropertyPage(win32ui.LoadDialogResource(win32ui.IDD_PROPDEMO2))
92
+ ps = dialog.PropertySheet("Property Sheet/Page Demo", None, [page1, page2])
93
+ ps.DoModal()
94
+
95
+
96
+ def testall():
97
+ test1()
98
+ test2()
99
+ test3()
100
+ test4()
101
+
102
+
103
+ if __name__ == "__main__":
104
+ testall()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/fontdemo.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Demo of Generic document windows, DC, and Font usage
2
+ # by Dave Brennan ([email protected])
3
+
4
+ # usage examples:
5
+
6
+ # >>> from fontdemo import *
7
+ # >>> d = FontDemo('Hello, Python')
8
+ # >>> f1 = { 'name':'Arial', 'height':36, 'weight':win32con.FW_BOLD}
9
+ # >>> d.SetFont(f1)
10
+ # >>> f2 = {'name':'Courier New', 'height':24, 'italic':1}
11
+ # >>> d.SetFont (f2)
12
+
13
+ import win32api
14
+ import win32con
15
+ import win32ui
16
+ from pywin.mfc import docview
17
+
18
+ # font is a dictionary in which the following elements matter:
19
+ # (the best matching font to supplied parameters is returned)
20
+ # name string name of the font as known by Windows
21
+ # size point size of font in logical units
22
+ # weight weight of font (win32con.FW_NORMAL, win32con.FW_BOLD)
23
+ # italic boolean; true if set to anything but None
24
+ # underline boolean; true if set to anything but None
25
+
26
+
27
+ class FontView(docview.ScrollView):
28
+ def __init__(
29
+ self, doc, text="Python Rules!", font_spec={"name": "Arial", "height": 42}
30
+ ):
31
+ docview.ScrollView.__init__(self, doc)
32
+ self.font = win32ui.CreateFont(font_spec)
33
+ self.text = text
34
+ self.width = self.height = 0
35
+ # set up message handlers
36
+ self.HookMessage(self.OnSize, win32con.WM_SIZE)
37
+
38
+ def OnAttachedObjectDeath(self):
39
+ docview.ScrollView.OnAttachedObjectDeath(self)
40
+ del self.font
41
+
42
+ def SetFont(self, new_font):
43
+ # Change font on the fly
44
+ self.font = win32ui.CreateFont(new_font)
45
+ # redraw the entire client window
46
+ selfInvalidateRect(None)
47
+
48
+ def OnSize(self, params):
49
+ lParam = params[3]
50
+ self.width = win32api.LOWORD(lParam)
51
+ self.height = win32api.HIWORD(lParam)
52
+
53
+ def OnPrepareDC(self, dc, printinfo):
54
+ # Set up the DC for forthcoming OnDraw call
55
+ self.SetScrollSizes(win32con.MM_TEXT, (100, 100))
56
+ dc.SetTextColor(win32api.RGB(0, 0, 255))
57
+ dc.SetBkColor(win32api.GetSysColor(win32con.COLOR_WINDOW))
58
+ dc.SelectObject(self.font)
59
+ dc.SetTextAlign(win32con.TA_CENTER | win32con.TA_BASELINE)
60
+
61
+ def OnDraw(self, dc):
62
+ if self.width == 0 and self.height == 0:
63
+ left, top, right, bottom = self.GetClientRect()
64
+ self.width = right - left
65
+ self.height = bottom - top
66
+ x, y = self.width // 2, self.height // 2
67
+ dc.TextOut(x, y, self.text)
68
+
69
+
70
+ def FontDemo():
71
+ # create doc/view
72
+ template = docview.DocTemplate(win32ui.IDR_PYTHONTYPE, None, None, FontView)
73
+ doc = template.OpenDocumentFile(None)
74
+ doc.SetTitle("Font Demo")
75
+ # print "template is ", template, "obj is", template._obj_
76
+ template.close()
77
+
78
+
79
+ # print "closed"
80
+ # del template
81
+
82
+ if __name__ == "__main__":
83
+ import demoutils
84
+
85
+ if demoutils.NeedGoodGUI():
86
+ FontDemo()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/guidemo.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GUI Demo - just a worker script to invoke all the other demo/test scripts.
2
+ import sys
3
+
4
+ import __main__
5
+ import regutil
6
+ import win32api
7
+ import win32ui
8
+
9
+ demos = [ # ('Font', 'import fontdemo;fontdemo.FontDemo()'),
10
+ ("Open GL Demo", "import openGLDemo;openGLDemo.test()"),
11
+ ("Threaded GUI", "import threadedgui;threadedgui.ThreadedDemo()"),
12
+ ("Tree View Demo", "import hiertest;hiertest.demoboth()"),
13
+ ("3-Way Splitter Window", "import splittst;splittst.demo()"),
14
+ ("Custom Toolbars and Tooltips", "import toolbar;toolbar.test()"),
15
+ ("Progress Bar", "import progressbar;progressbar.demo()"),
16
+ ("Slider Control", "import sliderdemo;sliderdemo.demo()"),
17
+ ("Dynamic window creation", "import createwin;createwin.demo()"),
18
+ ("Various Dialog demos", "import dlgtest;dlgtest.demo()"),
19
+ ("OCX Control Demo", "from ocx import ocxtest;ocxtest.demo()"),
20
+ ("OCX Serial Port Demo", "from ocx import ocxserialtest; ocxserialtest.test()"),
21
+ (
22
+ "IE4 Control Demo",
23
+ 'from ocx import webbrowser; webbrowser.Demo("http://www.python.org")',
24
+ ),
25
+ ]
26
+
27
+
28
+ def demo():
29
+ try:
30
+ # seeif I can locate the demo files.
31
+ import fontdemo
32
+ except ImportError:
33
+ # else put the demos direectory on the path (if not already)
34
+ try:
35
+ instPath = regutil.GetRegistryDefaultValue(
36
+ regutil.BuildDefaultPythonKey() + "\\InstallPath"
37
+ )
38
+ except win32api.error:
39
+ print(
40
+ "The InstallPath can not be located, and the Demos directory is not on the path"
41
+ )
42
+ instPath = "."
43
+
44
+ demosDir = win32ui.FullPath(instPath + "\\Demos")
45
+ for path in sys.path:
46
+ if win32ui.FullPath(path) == demosDir:
47
+ break
48
+ else:
49
+ sys.path.append(demosDir)
50
+ import fontdemo
51
+
52
+ import sys
53
+
54
+ if "/go" in sys.argv:
55
+ for name, cmd in demos:
56
+ try:
57
+ exec(cmd)
58
+ except:
59
+ print(
60
+ "Demo of %s failed - %s:%s"
61
+ % (cmd, sys.exc_info()[0], sys.exc_info()[1])
62
+ )
63
+ return
64
+ # Otherwise allow the user to select the demo to run
65
+
66
+ import pywin.dialogs.list
67
+
68
+ while 1:
69
+ rc = pywin.dialogs.list.SelectFromLists("Select a Demo", demos, ["Demo Title"])
70
+ if rc is None:
71
+ break
72
+ title, cmd = demos[rc]
73
+ try:
74
+ exec(cmd)
75
+ except:
76
+ print(
77
+ "Demo of %s failed - %s:%s"
78
+ % (title, sys.exc_info()[0], sys.exc_info()[1])
79
+ )
80
+
81
+
82
+ if __name__ == __main__.__name__:
83
+ import demoutils
84
+
85
+ if demoutils.NeedGoodGUI():
86
+ demo()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/hiertest.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import commctrl
4
+ import win32ui
5
+ from pywin.mfc import docview, window
6
+ from pywin.tools import hierlist
7
+
8
+
9
+ # directory listbox
10
+ # This has obvious limitations - doesnt track subdirs, etc. Demonstrates
11
+ # simple use of Python code for querying the tree as needed.
12
+ # Only use strings, and lists of strings (from curdir())
13
+ class DirHierList(hierlist.HierList):
14
+ def __init__(self, root, listBoxID=win32ui.IDC_LIST1):
15
+ hierlist.HierList.__init__(self, root, win32ui.IDB_HIERFOLDERS, listBoxID)
16
+
17
+ def GetText(self, item):
18
+ return os.path.basename(item)
19
+
20
+ def GetSubList(self, item):
21
+ if os.path.isdir(item):
22
+ ret = [os.path.join(item, fname) for fname in os.listdir(item)]
23
+ else:
24
+ ret = None
25
+ return ret
26
+
27
+ # if the item is a dir, it is expandable.
28
+ def IsExpandable(self, item):
29
+ return os.path.isdir(item)
30
+
31
+ def GetSelectedBitmapColumn(self, item):
32
+ return self.GetBitmapColumn(item) + 6 # Use different color for selection
33
+
34
+
35
+ class TestDocument(docview.Document):
36
+ def __init__(self, template):
37
+ docview.Document.__init__(self, template)
38
+ self.hierlist = hierlist.HierListWithItems(
39
+ HLIFileDir("\\"), win32ui.IDB_HIERFOLDERS, win32ui.AFX_IDW_PANE_FIRST
40
+ )
41
+
42
+
43
+ class HierListView(docview.TreeView):
44
+ def OnInitialUpdate(self):
45
+ rc = self._obj_.OnInitialUpdate()
46
+ self.hierList = self.GetDocument().hierlist
47
+ self.hierList.HierInit(self.GetParent())
48
+ self.hierList.SetStyle(
49
+ commctrl.TVS_HASLINES | commctrl.TVS_LINESATROOT | commctrl.TVS_HASBUTTONS
50
+ )
51
+ return rc
52
+
53
+
54
+ class HierListFrame(window.MDIChildWnd):
55
+ pass
56
+
57
+
58
+ def GetTestRoot():
59
+ tree1 = ("Tree 1", [("Item 1", "Item 1 data"), "Item 2", 3])
60
+ tree2 = ("Tree 2", [("Item 2.1", "Item 2 data"), "Item 2.2", 2.3])
61
+ return ("Root", [tree1, tree2, "Item 3"])
62
+
63
+
64
+ def demoboth():
65
+ template = docview.DocTemplate(
66
+ win32ui.IDR_PYTHONTYPE, TestDocument, HierListFrame, HierListView
67
+ )
68
+ template.OpenDocumentFile(None).SetTitle("Hierlist demo")
69
+
70
+ demomodeless()
71
+
72
+
73
+ def demomodeless():
74
+ testList2 = DirHierList("\\")
75
+ dlg = hierlist.HierDialog("hier list test", testList2)
76
+ dlg.CreateWindow()
77
+
78
+
79
+ def demodlg():
80
+ testList2 = DirHierList("\\")
81
+ dlg = hierlist.HierDialog("hier list test", testList2)
82
+ dlg.DoModal()
83
+
84
+
85
+ def demo():
86
+ template = docview.DocTemplate(
87
+ win32ui.IDR_PYTHONTYPE, TestDocument, HierListFrame, HierListView
88
+ )
89
+ template.OpenDocumentFile(None).SetTitle("Hierlist demo")
90
+
91
+
92
+ #
93
+ # Demo/Test for HierList items.
94
+ #
95
+ # Easy to make a better directory program.
96
+ #
97
+ class HLIFileDir(hierlist.HierListItem):
98
+ def __init__(self, filename):
99
+ self.filename = filename
100
+ hierlist.HierListItem.__init__(self)
101
+
102
+ def GetText(self):
103
+ try:
104
+ return "%-20s %d bytes" % (
105
+ os.path.basename(self.filename),
106
+ os.stat(self.filename)[6],
107
+ )
108
+ except os.error as details:
109
+ return "%-20s - %s" % (self.filename, details[1])
110
+
111
+ def IsExpandable(self):
112
+ return os.path.isdir(self.filename)
113
+
114
+ def GetSubList(self):
115
+ ret = []
116
+ for newname in os.listdir(self.filename):
117
+ if newname not in (".", ".."):
118
+ ret.append(HLIFileDir(os.path.join(self.filename, newname)))
119
+ return ret
120
+
121
+
122
+ def demohli():
123
+ template = docview.DocTemplate(
124
+ win32ui.IDR_PYTHONTYPE,
125
+ TestDocument,
126
+ hierlist.HierListFrame,
127
+ hierlist.HierListView,
128
+ )
129
+ template.OpenDocumentFile(None).SetTitle("Hierlist demo")
130
+
131
+
132
+ if __name__ == "__main__":
133
+ import demoutils
134
+
135
+ if demoutils.HaveGoodGUI():
136
+ demoboth()
137
+ else:
138
+ demodlg()
MLPY/Lib/site-packages/pythonwin/pywin/Demos/menutest.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Run this as a python script, to gray "close" off the edit window system menu.
2
+ import win32con
3
+ from pywin.framework import interact
4
+
5
+ if __name__ == "__main__":
6
+ import demoutils
7
+
8
+ if demoutils.NeedGoodGUI():
9
+ win = interact.edit.currentView.GetParent()
10
+ menu = win.GetSystemMenu()
11
+ id = menu.GetMenuItemID(6)
12
+ menu.EnableMenuItem(id, win32con.MF_BYCOMMAND | win32con.MF_GRAYED)
13
+ print("The interactive window's 'Close' menu item is now disabled.")