pyloid 0.23.18__py3-none-any.whl → 0.23.19__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.
pyloid/pyloid.py CHANGED
@@ -37,7 +37,7 @@ import threading
37
37
  import signal
38
38
 
39
39
  # software backend
40
- os.environ["QT_QUICK_BACKEND"] = "software"
40
+ # os.environ["QT_QUICK_BACKEND"] = "software"
41
41
 
42
42
  #########################################################################
43
43
  # for linux debug
pyloid/utils.py CHANGED
@@ -46,7 +46,7 @@ def get_production_path(path: Optional[str] = None) -> Optional[str]:
46
46
  '/tmp/_MEIabcde'
47
47
  """
48
48
  if is_production():
49
- if hasattr(sys, '_MEIPASS'):
49
+ if hasattr(sys, "_MEIPASS"):
50
50
  # PyInstaller
51
51
  base_path = sys._MEIPASS
52
52
  else:
@@ -57,7 +57,6 @@ def get_production_path(path: Optional[str] = None) -> Optional[str]:
57
57
  # 환경변수가 없는 경우 실행 파일 디렉토리 사용
58
58
  base_path = os.path.dirname(os.path.abspath(sys.argv[0]))
59
59
 
60
-
61
60
  return os.path.join(base_path, path) if path else base_path
62
61
  else:
63
62
  return path
@@ -81,10 +80,10 @@ def is_production() -> bool:
81
80
  >>> print("Not in production environment.")
82
81
  """
83
82
  # Nuitka 환경 확인을 추가
84
- if '__compiled__' in globals():
83
+ if "__compiled__" in globals():
85
84
  return True
86
85
  # PyInstaller 환경 확인
87
- return getattr(sys, 'frozen', False)
86
+ return getattr(sys, "frozen", False)
88
87
 
89
88
 
90
89
  def get_platform() -> str:
@@ -108,20 +107,17 @@ def get_platform() -> str:
108
107
  windows
109
108
  """
110
109
  os_name = platform.system().lower()
111
- os_type = {
112
- 'darwin': 'macos',
113
- 'linux': 'linux',
114
- 'windows': 'windows'
115
- }.get(os_name)
110
+ os_type = {"darwin": "macos", "linux": "linux", "windows": "windows"}.get(os_name)
116
111
  if os_type is None:
117
112
  raise ValueError(f"Unsupported platform: {os_name}")
118
-
113
+
119
114
  return os_type
120
115
 
116
+
121
117
  def get_absolute_path(path: str) -> str:
122
118
  """
123
119
  Returns the absolute path of the given relative path.
124
-
120
+
125
121
  Parameters
126
122
  ----------
127
123
  path : str
@@ -131,7 +127,7 @@ def get_absolute_path(path: str) -> str:
131
127
  -------
132
128
  str
133
129
  The absolute path of the given relative path.
134
-
130
+
135
131
  Examples
136
132
  --------
137
133
  >>> from pyloid.utils import get_absolute_path
@@ -141,19 +137,20 @@ def get_absolute_path(path: str) -> str:
141
137
  """
142
138
  return os.path.normpath(os.path.abspath(path))
143
139
 
140
+
144
141
  def get_free_port() -> int:
145
142
  """
146
143
  Finds and returns an available random network port number from the operating system.
147
-
144
+
148
145
  This function creates a socket and binds it to port '0', allowing the operating system
149
146
  to allocate a random available port. It retrieves the port number and safely closes
150
147
  the socket afterward.
151
-
148
+
152
149
  Returns
153
150
  -------
154
151
  int
155
152
  An available network port number (typically in the range 1024-65535)
156
-
153
+
157
154
  Notes
158
155
  -----
159
156
  - Since this function closes the socket immediately after finding a port, there is a
@@ -161,18 +158,51 @@ def get_free_port() -> int:
161
158
  - It is recommended to use the port number quickly after receiving it.
162
159
  - This function interacts with the operating system's network stack, so its behavior
163
160
  may vary depending on firewall or network settings.
164
-
161
+
165
162
  Examples
166
163
  --------
167
164
  >>> from pyloid.utils import get_free_port
168
165
  >>> port = get_free_port()
169
166
  >>> print(f"Found available port: {port}")
170
167
  Found available port: 49152
171
-
168
+
172
169
  >>> # Web server example
173
170
  >>> import http.server
174
171
  >>> server = http.server.HTTPServer(('localhost', port), http.server.SimpleHTTPRequestHandler)
175
172
  """
176
173
  with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
177
- s.bind(('', 0))
174
+ s.bind(("", 0))
178
175
  return s.getsockname()[1]
176
+
177
+
178
+ def set_qt_backend(backend="software"):
179
+ """
180
+ Sets the Qt Quick backend to force a specific rendering mode.
181
+
182
+ This function allows changing the Qt Quick rendering backend by setting
183
+ the QT_QUICK_BACKEND environment variable. Setting it to 'software'
184
+ forces software rendering, which can be useful in environments with
185
+ graphics driver issues or where hardware acceleration is not available.
186
+
187
+ Parameters
188
+ ----------
189
+ backend : str, optional
190
+ The backend to use for Qt Quick rendering. Default is 'software'.
191
+
192
+ Returns
193
+ -------
194
+ None
195
+
196
+ Notes
197
+ -----
198
+ - This setting must be applied before the Qt application is initialized
199
+ - Software rendering may be slower but more compatible across systems
200
+
201
+ Examples
202
+ --------
203
+ >>> from pyloid.utils import set_qt_backend
204
+ >>> # Force software rendering
205
+ >>> set_qt_backend("software")
206
+ """
207
+ print(f"Setting QT_QUICK_BACKEND to {backend}.")
208
+ os.environ["QT_QUICK_BACKEND"] = backend
@@ -198,4 +198,4 @@ Apache License
198
198
  distributed under the License is distributed on an "AS IS" BASIS,
199
199
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
200
  See the License for the specific language governing permissions and
201
- limitations under the License.
201
+ limitations under the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyloid
3
- Version: 0.23.18
3
+ Version: 0.23.19
4
4
  Summary:
5
5
  Author: aesthetics-of-record
6
6
  Author-email: 111675679+aesthetics-of-record@users.noreply.github.com
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.13
14
14
  Requires-Dist: aiohttp-cors (>=0.8.1,<0.9.0)
15
15
  Requires-Dist: pickledb (>=1.3.2,<2.0.0)
16
16
  Requires-Dist: platformdirs (>=4.3.7,<5.0.0)
17
- Requires-Dist: pyside6 (>=6.8.2.1,<7.0.0.0)
17
+ Requires-Dist: pyside6 (==6.8.3)
18
18
  Description-Content-Type: text/markdown
19
19
 
20
20
  <h1 style="text-align: center; font-size: 200px; font-weight: 500;">
@@ -8,7 +8,7 @@ pyloid/js_api/base.py,sha256=XD3sqWYAb1nw6VgY3xXsU4ls5xLGrxpOqmLRJm_vBso,8669
8
8
  pyloid/js_api/event_api.py,sha256=w0z1DcmwcmseqfcoZWgsQmFC2iBCgTMVJubTaHeXI1c,957
9
9
  pyloid/js_api/window_api.py,sha256=-isphU3m2wGB5U0yZrSuK_4XiBz2mG45HsjYTUq7Fxs,7348
10
10
  pyloid/monitor.py,sha256=1mXvHm5deohnNlTLcRx4sT4x-stnOIb0dUQnnxN50Uo,28295
11
- pyloid/pyloid.py,sha256=qc6b5ppSRam-ILNIVAhMdPQe7THo6JmkVruqR9VkXbI,85142
11
+ pyloid/pyloid.py,sha256=J_4ikznMq8FXVBIykn1jwgPfaxvgMHGj8YmdmgvHlG0,85144
12
12
  pyloid/rpc.py,sha256=U3G6d5VgCibT0XwSX6eNhLePNyUG8ejfJSf8F43zBpk,18601
13
13
  pyloid/serve.py,sha256=wJIBqiLr1-8FvBdV3yybeBtVXsu94FfWYKjHL0eQ68s,1444
14
14
  pyloid/store.py,sha256=teoa-HYzwm93Rivcw3AhKw6rAmQqQ_kmF6XYSkC3G_I,4541
@@ -16,8 +16,8 @@ pyloid/thread_pool.py,sha256=fKOBb8jMfZn_7crA_fJCno8dObBRZE31EIWaNQ759aw,14616
16
16
  pyloid/timer.py,sha256=RqMsChFUd93cxMVgkHWiIKrci0QDTBgJSTULnAtYT8M,8712
17
17
  pyloid/tray.py,sha256=D12opVEc2wc2T4tK9epaN1oOdeziScsIVNM2uCN7C-A,1710
18
18
  pyloid/url_interceptor.py,sha256=AFjPANDELc9-E-1TnVvkNVc-JZBJYf0677dWQ8LDaqw,726
19
- pyloid/utils.py,sha256=NqB8W-irXDtTGb74rrJ2swU6tgzU0HSE8lGewrStOKc,5685
20
- pyloid-0.23.18.dist-info/LICENSE,sha256=F96EzotgWhhpnQTW2TcdoqrMDir1jyEo6H915tGQ-QE,11524
21
- pyloid-0.23.18.dist-info/METADATA,sha256=rPQtz8ZdYfgl70JofirvU9315qfO3fhciBqPzho5nmE,2216
22
- pyloid-0.23.18.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
23
- pyloid-0.23.18.dist-info/RECORD,,
19
+ pyloid/utils.py,sha256=J6owgVE1YDOEfcOPmoP9m9Q6nbYDyNEo9uqPsJs5p5g,6644
20
+ pyloid-0.23.19.dist-info/LICENSE,sha256=MTYF-6xpRekyTUglRweWtbfbwBL1I_3Bgfbm_SNOuI8,11525
21
+ pyloid-0.23.19.dist-info/METADATA,sha256=NzCC1oR3oEWo0X4VnsQiba3DCfMZFUq5ePCxyMgfDDM,2205
22
+ pyloid-0.23.19.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
23
+ pyloid-0.23.19.dist-info/RECORD,,