ScreenMagnifier 1.11.0.post8__py3-none-any.whl

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.

Potentially problematic release.


This version of ScreenMagnifier might be problematic. Click here for more details.

Files changed (117) hide show
  1. ScreenMagnifier/__init__.py +68 -0
  2. ScreenMagnifier/__main__.py +17 -0
  3. ScreenMagnifier/advancedoverlay.py +593 -0
  4. ScreenMagnifier/advancedpanel.py +521 -0
  5. ScreenMagnifier/analysiscontroller.py +533 -0
  6. ScreenMagnifier/analysisserver.py +404 -0
  7. ScreenMagnifier/colordetector/__init__.py +28 -0
  8. ScreenMagnifier/colordetector/colordetector.py +570 -0
  9. ScreenMagnifier/colordetector/core.py +434 -0
  10. ScreenMagnifier/colordetector/main.py +23 -0
  11. ScreenMagnifier/colordetector/mainwindow.py +182 -0
  12. ScreenMagnifier/colorpanel.py +424 -0
  13. ScreenMagnifier/colorswatches/__init__.py +16 -0
  14. ScreenMagnifier/colorswatches/colorswatches.py +316 -0
  15. ScreenMagnifier/colorswatches/main.py +23 -0
  16. ScreenMagnifier/colorswatches/mainwindow.py +60 -0
  17. ScreenMagnifier/controlpanel.py +234 -0
  18. ScreenMagnifier/detectionpanel.py +790 -0
  19. ScreenMagnifier/facedetector/__init__.py +24 -0
  20. ScreenMagnifier/facedetector/core.py +314 -0
  21. ScreenMagnifier/facedetector/facedetector.py +288 -0
  22. ScreenMagnifier/facedetector/main.py +23 -0
  23. ScreenMagnifier/facedetector/mainwindow.py +122 -0
  24. ScreenMagnifier/facedetector/models/__init__.py +4 -0
  25. ScreenMagnifier/facepointer.py +1121 -0
  26. ScreenMagnifier/features.py +50 -0
  27. ScreenMagnifier/hotkeys/__init__.py +16 -0
  28. ScreenMagnifier/hotkeys/hotkeys.py +379 -0
  29. ScreenMagnifier/hotkeys/main.py +23 -0
  30. ScreenMagnifier/hotkeys/mainwindow.py +56 -0
  31. ScreenMagnifier/imagefilters/__init__.py +24 -0
  32. ScreenMagnifier/imagefilters/core.py +172 -0
  33. ScreenMagnifier/imagefilters/imagefilters.py +220 -0
  34. ScreenMagnifier/imagefilters/main.py +23 -0
  35. ScreenMagnifier/imagefilters/mainwindow.py +120 -0
  36. ScreenMagnifier/magnifierview/__init__.py +16 -0
  37. ScreenMagnifier/magnifierview/magnifierview.py +1249 -0
  38. ScreenMagnifier/magnifierview/main.py +23 -0
  39. ScreenMagnifier/magnifierview/mainwindow.py +91 -0
  40. ScreenMagnifier/main.py +157 -0
  41. ScreenMagnifier/mainwindow.py +1368 -0
  42. ScreenMagnifier/mousecatcher/__init__.py +16 -0
  43. ScreenMagnifier/mousecatcher/main.py +23 -0
  44. ScreenMagnifier/mousecatcher/mainwindow.py +78 -0
  45. ScreenMagnifier/mousecatcher/mousecatcher.py +251 -0
  46. ScreenMagnifier/mousemove.py +259 -0
  47. ScreenMagnifier/netprotocol/__init__.py +25 -0
  48. ScreenMagnifier/netprotocol/main.py +23 -0
  49. ScreenMagnifier/netprotocol/mainwindow.py +91 -0
  50. ScreenMagnifier/netprotocol/netprotocol.py +372 -0
  51. ScreenMagnifier/netprotocol/wire.py +189 -0
  52. ScreenMagnifier/regionselector/__init__.py +16 -0
  53. ScreenMagnifier/regionselector/main.py +23 -0
  54. ScreenMagnifier/regionselector/mainwindow.py +70 -0
  55. ScreenMagnifier/regionselector/regionselector.py +549 -0
  56. ScreenMagnifier/remoteclient.py +636 -0
  57. ScreenMagnifier/resources/icon-128.png +0 -0
  58. ScreenMagnifier/resources/icon-16.png +0 -0
  59. ScreenMagnifier/resources/icon-24.png +0 -0
  60. ScreenMagnifier/resources/icon-256.png +0 -0
  61. ScreenMagnifier/resources/icon-32.png +0 -0
  62. ScreenMagnifier/resources/icon-48.png +0 -0
  63. ScreenMagnifier/resources/icon-512.png +0 -0
  64. ScreenMagnifier/resources/icon-64.png +0 -0
  65. ScreenMagnifier/resources/icon.icns +0 -0
  66. ScreenMagnifier/resources/icon.ico +0 -0
  67. ScreenMagnifier/screengrabber/__init__.py +16 -0
  68. ScreenMagnifier/screengrabber/main.py +23 -0
  69. ScreenMagnifier/screengrabber/mainwindow.py +79 -0
  70. ScreenMagnifier/screengrabber/screengrabber.py +558 -0
  71. ScreenMagnifier/server.py +150 -0
  72. ScreenMagnifier/serverpanel.py +379 -0
  73. ScreenMagnifier/shortcuteditor/__init__.py +16 -0
  74. ScreenMagnifier/shortcuteditor/main.py +23 -0
  75. ScreenMagnifier/shortcuteditor/mainwindow.py +54 -0
  76. ScreenMagnifier/shortcuteditor/shortcuteditor.py +411 -0
  77. ScreenMagnifier/shortcuts.py +118 -0
  78. ScreenMagnifier/shortcutspanel.py +140 -0
  79. ScreenMagnifier/support.py +127 -0
  80. ScreenMagnifier/translations/ar.json +387 -0
  81. ScreenMagnifier/translations/de.json +387 -0
  82. ScreenMagnifier/translations/es.json +387 -0
  83. ScreenMagnifier/translations/fr.json +387 -0
  84. ScreenMagnifier/translations/it.json +387 -0
  85. ScreenMagnifier/translations/ja.json +387 -0
  86. ScreenMagnifier/translations/ko.json +387 -0
  87. ScreenMagnifier/translations/pt_BR.json +387 -0
  88. ScreenMagnifier/translations/ru.json +387 -0
  89. ScreenMagnifier/translations/tr.json +387 -0
  90. ScreenMagnifier/translations/zh_CN.json +387 -0
  91. ScreenMagnifier/translator/__init__.py +16 -0
  92. ScreenMagnifier/translator/main.py +23 -0
  93. ScreenMagnifier/translator/mainwindow.py +62 -0
  94. ScreenMagnifier/translator/translator.py +284 -0
  95. ScreenMagnifier/upscaler/__init__.py +24 -0
  96. ScreenMagnifier/upscaler/core.py +315 -0
  97. ScreenMagnifier/upscaler/main.py +23 -0
  98. ScreenMagnifier/upscaler/mainwindow.py +128 -0
  99. ScreenMagnifier/upscaler/models/FSRCNN-small_x2.pb +0 -0
  100. ScreenMagnifier/upscaler/models/FSRCNN-small_x3.pb +0 -0
  101. ScreenMagnifier/upscaler/models/FSRCNN-small_x4.pb +0 -0
  102. ScreenMagnifier/upscaler/models/FSRCNN_x2.pb +0 -0
  103. ScreenMagnifier/upscaler/models/FSRCNN_x3.pb +0 -0
  104. ScreenMagnifier/upscaler/models/FSRCNN_x4.pb +0 -0
  105. ScreenMagnifier/upscaler/models/LICENSE-FSRCNN +201 -0
  106. ScreenMagnifier/upscaler/models/__init__.py +4 -0
  107. ScreenMagnifier/upscaler/upscaler.py +285 -0
  108. ScreenMagnifier/wincheck.py +65 -0
  109. ScreenMagnifier/zoomoverlay/__init__.py +16 -0
  110. ScreenMagnifier/zoomoverlay/main.py +23 -0
  111. ScreenMagnifier/zoomoverlay/mainwindow.py +99 -0
  112. ScreenMagnifier/zoomoverlay/zoomoverlay.py +1779 -0
  113. screenmagnifier-1.11.0.post8.dist-info/METADATA +591 -0
  114. screenmagnifier-1.11.0.post8.dist-info/RECORD +117 -0
  115. screenmagnifier-1.11.0.post8.dist-info/WHEEL +5 -0
  116. screenmagnifier-1.11.0.post8.dist-info/entry_points.txt +5 -0
  117. screenmagnifier-1.11.0.post8.dist-info/top_level.txt +1 -0
@@ -0,0 +1,23 @@
1
+ # coding=utf-8
2
+ """
3
+ Entry point for the MagnifierViewWidget demo.
4
+ """
5
+ from os.path import dirname
6
+ from sys import path
7
+
8
+ if not __package__ and dirname(__file__) not in path:
9
+ path.append(dirname(__file__))
10
+
11
+ try:
12
+ from .mainwindow import MainWindow
13
+ except:
14
+ from mainwindow import MainWindow
15
+
16
+ if __name__ == '__main__':
17
+ from ManyQt.QtWidgets import QApplication
18
+ from sys import argv, exit
19
+
20
+ a = QApplication(argv) # type: QApplication
21
+ w = MainWindow() # type: MainWindow
22
+ w.show()
23
+ exit(a.exec_())
@@ -0,0 +1,91 @@
1
+ # coding=utf-8
2
+ """
3
+ Demo window for MagnifierViewWidget, fed with a synthetic image.
4
+ """
5
+ from ManyQt.QtWidgets import QMainWindow, QVBoxLayout, QHBoxLayout, QWidget, QCheckBox, QPushButton, QLabel
6
+ from ManyQt.QtGui import QImage, QPainter, QColor, QFont, QPen, QLinearGradient
7
+ from ManyQt.QtCore import Qt, QPoint, QRectF, pyqtSlot
8
+ from os.path import dirname
9
+ from sys import path
10
+
11
+ if not __package__ and dirname(__file__) not in path:
12
+ path.append(dirname(__file__))
13
+
14
+ try:
15
+ from .magnifierview import MagnifierViewWidget
16
+ except:
17
+ from magnifierview import MagnifierViewWidget
18
+
19
+
20
+ def makeSample():
21
+ """
22
+ :return: QImage
23
+ """
24
+ img = QImage(240, 160, QImage.Format_RGB32) # type: QImage
25
+ img.fill(QColor('#F4F5F8'))
26
+ p = QPainter(img) # type: QPainter
27
+ p.setRenderHint(QPainter.Antialiasing, True)
28
+ g = QLinearGradient(0, 0, 240, 0) # type: QLinearGradient
29
+ g.setColorAt(0, QColor('#5227FF'))
30
+ g.setColorAt(1, QColor('#FF3B6B'))
31
+ p.fillRect(QRectF(0, 0, 240, 22), g)
32
+ p.setPen(Qt.white)
33
+ p.setFont(QFont('Sans Serif', 9, QFont.Bold))
34
+ p.drawText(QRectF(8, 0, 230, 22), Qt.AlignVCenter, 'MagnifierViewWidget')
35
+ p.setPen(QColor('#22252E'))
36
+ p.setFont(QFont('Sans Serif', 8))
37
+ p.drawText(QRectF(8, 30, 230, 60), Qt.AlignLeft, 'Wheel: zoom at cursor\nDrag: pan\nDouble-click: fit')
38
+ for i in range(8):
39
+ p.fillRect(8 + i * 12, 100, 10, 10, QColor.fromHsv(i * 45, 200, 230))
40
+ p.setPen(QPen(QColor('#1E88E5'), 1))
41
+ p.drawLine(8, 150, 230, 118)
42
+ p.end()
43
+ return img
44
+
45
+
46
+ class MainWindow(QMainWindow):
47
+ """
48
+ MainWindow class.
49
+ """
50
+
51
+ def __init__(self, *args, **kwargs):
52
+ """
53
+ :param args: any
54
+ :param kwargs: any
55
+ """
56
+ super(MainWindow, self).__init__(*args, **kwargs)
57
+ self.setWindowTitle(self.tr(u'MagnifierView demo'))
58
+ self.resize(900, 620)
59
+ self.__m_view = MagnifierViewWidget(
60
+ zoom=4.0, showGrid=True, showCrosshair=False, pixelHovered=self.onPixel) # type: MagnifierViewWidget
61
+ self.__m_view.setFrame(makeSample())
62
+ self.__m_info = QLabel() # type: QLabel
63
+ bar = QHBoxLayout() # type: QHBoxLayout
64
+ for text, slot, on in ((self.tr(u'Grid'), self.__m_view.setShowGrid, True),
65
+ (self.tr(u'Crosshair'), self.__m_view.setShowCrosshair, False),
66
+ (self.tr(u'Invert'), self.__m_view.setInvertColors, False)):
67
+ box = QCheckBox(text) # type: QCheckBox
68
+ box.setChecked(on)
69
+ box.toggled.connect(slot)
70
+ bar.addWidget(box)
71
+ for text, slot in (
72
+ ('-', self.__m_view.zoomOut), ('+', self.__m_view.zoomIn), (self.tr(u'Fit'), self.__m_view.fitToView)):
73
+ btn = QPushButton(text) # type: QPushButton
74
+ btn.clicked.connect(slot)
75
+ bar.addWidget(btn)
76
+ bar.addStretch(1)
77
+ bar.addWidget(self.__m_info)
78
+ wdg = QWidget() # type: QWidget
79
+ layout = QVBoxLayout(wdg) # type: QVBoxLayout
80
+ layout.addLayout(bar)
81
+ layout.addWidget(self.__m_view, 1)
82
+ self.setCentralWidget(wdg)
83
+
84
+ @pyqtSlot(QPoint, QColor)
85
+ def onPixel(self, pos, color):
86
+ """
87
+ :param pos: QPoint
88
+ :param color: QColor
89
+ :return:
90
+ """
91
+ self.__m_info.setText('' if pos.x() < 0 else '({}, {}) {}'.format(pos.x(), pos.y(), color.name().upper()))
@@ -0,0 +1,157 @@
1
+ # coding=utf-8
2
+ """
3
+ Screen Magnifier entry point.
4
+ Usage: ScreenMagnifier | python -m ScreenMagnifier | python ScreenMagnifier/main.py [--tray] [--selftest] [--version]
5
+ --tray start hidden in the system tray, ready for gaming.
6
+ --selftest build the whole application headless, exercise upscaling / detection, print a report, exit
7
+ (0 = ok); used by the release workflow on every built binary.
8
+ """
9
+ from os.path import dirname
10
+ from os import environ
11
+ from sys import path
12
+
13
+ if not __package__ and dirname(__file__) not in path:
14
+ path.append(dirname(__file__))
15
+
16
+ try: # Version of the package (pip install), overridden by release builds below.
17
+ from . import __version__ as VERSION
18
+ except:
19
+ VERSION = 'dev' # type: str
20
+ try: # Written by .github/packaging/build.py in release builds: version and the bundled Qt binding.
21
+ from ._buildinfo import QT_API as BUILD_QT_API, VERSION
22
+ except:
23
+ try:
24
+ from _buildinfo import QT_API as BUILD_QT_API, VERSION
25
+ except:
26
+ BUILD_QT_API = '' # type: str
27
+ if BUILD_QT_API:
28
+ environ.setdefault('QT_API', BUILD_QT_API)
29
+
30
+ try:
31
+ from .support import qtBindingProblem
32
+ except:
33
+ from support import qtBindingProblem
34
+
35
+
36
+ def mainWindowClass():
37
+ """
38
+ Imported on demand, after the Qt binding check (a missing binding gets a clear message, not a traceback).
39
+ :return: type
40
+ """
41
+ try:
42
+ from .mainwindow import MainWindow
43
+ except:
44
+ from mainwindow import MainWindow
45
+ return MainWindow
46
+
47
+
48
+ def selfTest(app, window):
49
+ """
50
+ :param app: QApplication
51
+ :param window: MainWindow
52
+ :return: (int) Exit code: 0 when every mandatory part works.
53
+ """
54
+ from ManyQt.QtGui import QImage, QColor
55
+ from ManyQt.QtCore import QSize
56
+ from sys import argv, platform
57
+ try:
58
+ from .colordetector import ColorDetector
59
+ from .facedetector import FaceDetector
60
+ from .upscaler import Upscaler
61
+ except:
62
+ from colordetector import ColorDetector
63
+ from facedetector import FaceDetector
64
+ from upscaler import Upscaler
65
+ img = QImage(64, 48, QImage.Format_RGB32) # type: QImage
66
+ img.fill(QColor('#3A7BD5'))
67
+ up = Upscaler() # type: Upscaler
68
+ out = up.process(img, QSize(256, 192)) # type: QImage
69
+ colors = ColorDetector(targetColors=['#3A7BD5']).analyze(img) if ColorDetector.isAvailable() else {}
70
+ faces = FaceDetector() # type: FaceDetector
71
+ try:
72
+ from .hotkeys import GlobalHotkeys
73
+ except:
74
+ from hotkeys import GlobalHotkeys
75
+ try:
76
+ from pynput import mouse # noqa: F401 (screen color picker click capture on Windows / macOS)
77
+ mouseHook = True # type: bool
78
+ except:
79
+ mouseHook = False # type: bool
80
+ report = {'version': VERSION, 'qtApi': environ.get('QT_API', 'auto'), 'window': window is not None,
81
+ 'upscaled': [out.width(), out.height()], 'upscaleMethods': [n for m, n in up.availableMethods()],
82
+ 'colorDetection': ColorDetector.isAvailable(), 'colorRegions': len(colors.get('detections', [])),
83
+ 'faceBackend': faces.getActiveBackend() or 'unavailable',
84
+ 'hotkeyBackend': GlobalHotkeys.detectBackend() or 'none', 'mouseHook': mouseHook,
85
+ 'languages': [c for c, n in window.getLanguageManager().availableLanguages()],
86
+ 'language': window.getLanguageManager().getLanguage()} # type: dict
87
+ print('SELFTEST ' + u'{}'.format(report))
88
+ if '--selftest-report' in argv: # Windowed Windows builds have no stdout: also write the report to a file.
89
+ with open(argv[argv.index('--selftest-report') + 1], 'w') as f:
90
+ f.write('SELFTEST ' + u'{}'.format(report))
91
+ ok = out.width() == 256 and (not ColorDetector.isAvailable() or report['colorRegions'] == 1) # type: bool
92
+ ok = ok and len(report['languages']) >= 5 # the translation catalogs are bundled
93
+ if platform in ('win32', 'darwin'): # Global input must be bundled (Linux headless CI has no X display for it).
94
+ ok = ok and report['hotkeyBackend'] != 'none' and mouseHook
95
+ return 0 if ok else 1
96
+
97
+ def run():
98
+ """
99
+ Application entry point: the ScreenMagnifier command, python -m ScreenMagnifier or python main.py.
100
+ :return:
101
+ """
102
+ from sys import argv, exit, stderr, platform
103
+ if '--version' in argv:
104
+ print(VERSION)
105
+ exit(0)
106
+ problem = qtBindingProblem() # type: str
107
+ if problem:
108
+ stderr.write(problem + '\n')
109
+ exit(1)
110
+ if platform == 'win32': # Own taskbar entry and icon (not python.exe's) when started from Python / pip.
111
+ try:
112
+ from ctypes import windll
113
+ windll.shell32.SetCurrentProcessExplicitAppUserModelID(u'UsamaTN.ScreenMagnifier')
114
+ except:
115
+ pass
116
+ if '--wait-pid' in argv: # Restarted by the previous instance (e.g. new language): let it release everything.
117
+ try:
118
+ from .support import waitForExit
119
+ except:
120
+ from support import waitForExit
121
+ waitForExit(int(argv[argv.index('--wait-pid') + 1]))
122
+ from ManyQt.QtWidgets import QApplication
123
+ from ManyQt.QtCore import Qt
124
+ MainWindow = mainWindowClass()
125
+ try:
126
+ from .translator import LanguageManager
127
+ except:
128
+ from translator import LanguageManager
129
+ from ManyQt.QtCore import QSettings
130
+ from os.path import dirname, join
131
+
132
+ for attr in ('AA_EnableHighDpiScaling', 'AA_UseHighDpiPixmaps'): # Qt5 only, always on in Qt6.
133
+ if hasattr(Qt, attr):
134
+ QApplication.setAttribute(getattr(Qt, attr), True)
135
+ if '--selftest' in argv:
136
+ environ.setdefault('QT_QPA_PLATFORM', 'offscreen')
137
+ a = QApplication(argv) # type: QApplication
138
+ a.setApplicationName('Screen Magnifier')
139
+ language = u'{}'.format(QSettings('ScreenMagnifier', 'General').value('language', 'auto')) # type: str
140
+ if '--lang' in argv: # one-time override: python -m ScreenMagnifier --lang fr
141
+ language = argv[argv.index('--lang') + 1]
142
+ languages = LanguageManager(folder=join(dirname(__file__), 'translations'), language=language,
143
+ parent=a) # type: LanguageManager # before any window: every tr() is translated
144
+ w = MainWindow(languageManager=languages) # type: MainWindow
145
+ if '--selftest' in argv:
146
+ code = selfTest(a, w) # type: int
147
+ w.quitApp()
148
+ exit(code)
149
+ if '--tray' in argv and w.hasTray():
150
+ pass # Start hidden in the tray: only the global hotkeys / advanced zoom are active.
151
+ else:
152
+ w.show()
153
+ exit(a.exec_())
154
+
155
+
156
+ if __name__ == '__main__':
157
+ run()