pyloid 0.23.18__tar.gz → 0.23.20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyloid
3
- Version: 0.23.18
3
+ Version: 0.23.20
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;">
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyloid"
3
- version = "0.23.18"
3
+ version = "0.23.20"
4
4
  description = ""
5
5
  authors = ["aesthetics-of-record <111675679+aesthetics-of-record@users.noreply.github.com>"]
6
6
  readme = "README.md"
@@ -10,7 +10,7 @@ packages = [
10
10
 
11
11
  [tool.poetry.dependencies]
12
12
  python = ">=3.9,<3.14"
13
- pyside6 = "^6.8.2.1"
13
+ pyside6 = "6.8.3"
14
14
  platformdirs = "^4.3.7"
15
15
  pickledb = "^1.3.2"
16
16
  aiohttp-cors = "^0.8.1"
@@ -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
@@ -93,13 +93,6 @@ def custom_message_handler(mode, context, message):
93
93
 
94
94
  qInstallMessageHandler(custom_message_handler)
95
95
 
96
-
97
- class _WindowController(QObject):
98
- create_window_signal = Signal(
99
- QApplication, str, int, int, int, int, bool, bool, bool, PyloidRPC
100
- )
101
-
102
-
103
96
  # Only Work in Main Thread
104
97
  class _Pyloid(QApplication):
105
98
  def __init__(
@@ -151,10 +144,7 @@ class _Pyloid(QApplication):
151
144
  if self.single_instance:
152
145
  self._init_single_instance()
153
146
 
154
- self.controller = _WindowController()
155
- self.controller.create_window_signal.connect(
156
- self._create_window_signal_function
157
- )
147
+
158
148
 
159
149
  self.file_watcher = FileWatcher()
160
150
 
@@ -289,38 +279,8 @@ class _Pyloid(QApplication):
289
279
  >>> window = app.create_window(title="New Window", width=1024, height=768)
290
280
  >>> window.show()
291
281
  """
292
- self.controller.create_window_signal.emit(
293
- self,
294
- title,
295
- width,
296
- height,
297
- x,
298
- y,
299
- frame,
300
- context_menu,
301
- dev_tools,
302
- rpc,
303
- )
304
- latest_window_id = list(self.windows_dict.keys())[-1]
305
- return self.windows_dict[latest_window_id]
306
-
307
- def _create_window_signal_function(
308
- self,
309
- app,
310
- title: str,
311
- width: int,
312
- height: int,
313
- x: int,
314
- y: int,
315
- frame: bool,
316
- context_menu: bool,
317
- dev_tools: bool,
318
- # js_apis: List[PyloidAPI] = [],
319
- rpc: Optional[PyloidRPC] = None,
320
- ) -> BrowserWindow:
321
- """Function to create a new browser window."""
322
282
  window = BrowserWindow(
323
- app,
283
+ self,
324
284
  title,
325
285
  width,
326
286
  height,
@@ -332,6 +292,7 @@ class _Pyloid(QApplication):
332
292
  rpc,
333
293
  )
334
294
  self.windows_dict[window._window.id] = window
295
+ # latest_window_id = list(self.windows_dict.keys())[-1]
335
296
  return window
336
297
 
337
298
  def run(self):
@@ -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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes