android-widgets 0.1.4__tar.gz → 0.1.6__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,23 +1,20 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: android-widgets
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: This would be used to auto gen XMLs for Android Home Screen widgets.
5
5
  Author-email: Fabian <fector101@yahoo.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/Fector101/kivy-androidwidgets
8
8
  Project-URL: Documentation, https://github.com/Fector101/kivy-androidwidgets
9
9
  Project-URL: Source, https://github.com/Fector101/kivy-androidwidgets
10
10
  Project-URL: Tracker, https://github.com/Fector101/kivy-androidwidgets/issues
11
11
  Keywords: kivy,android,widgets,hello-world,python-package
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Operating System :: Android
15
14
  Classifier: Development Status :: 3 - Alpha
16
15
  Classifier: Intended Audience :: Developers
17
16
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
- Requires-Python: >=3.7
19
17
  Description-Content-Type: text/markdown
20
- Requires-Dist: kivy>=2.0.0
21
18
 
22
19
  Kivy-androidwidgets
23
20
  ---
@@ -68,8 +65,8 @@ Create preview image png in right path`res/drawable/ic_launcher_foreground.png`
68
65
 
69
66
  ### step 3: Create a `AppWidgetProvider` it's used to receive events for widget.
70
67
  path: `src/SimpleWidget.java`.
71
- This will receive an event when widget is add to change it's text
72
-
68
+ - This will receive an event when widget is add to change it's text
69
+ - You Can use [python to make changes](https://github.com/Fector101/kivy-androidwidgets/blob/main/using-python-to-update-widget.md#changing-text-with-python), but i don't to make it recive events like swipes and taps to widget
73
70
  ```java
74
71
  package org.wally.waller; // Change here from buildozer.spec package.domain+package.name
75
72
 
@@ -47,8 +47,8 @@ Create preview image png in right path`res/drawable/ic_launcher_foreground.png`
47
47
 
48
48
  ### step 3: Create a `AppWidgetProvider` it's used to receive events for widget.
49
49
  path: `src/SimpleWidget.java`.
50
- This will receive an event when widget is add to change it's text
51
-
50
+ - This will receive an event when widget is add to change it's text
51
+ - You Can use [python to make changes](https://github.com/Fector101/kivy-androidwidgets/blob/main/using-python-to-update-widget.md#changing-text-with-python), but i don't to make it recive events like swipes and taps to widget
52
52
  ```java
53
53
  package org.wally.waller; // Change here from buildozer.spec package.domain+package.name
54
54
 
@@ -6,7 +6,6 @@ from .config import is_platform_android
6
6
  from .aw_logging import logger, enable_logging
7
7
 
8
8
 
9
- __all__ = ["logger"]
10
9
 
11
10
  from .config import get_python_activity_context
12
11
 
@@ -139,6 +138,9 @@ class AppWidgetManager:
139
138
  logger.info(f"Found Layout: {java_file_path}")
140
139
  return None
141
140
 
141
+
142
+
143
+ # Tests
142
144
  # try:
143
145
  # print("-"*5,'test 1','-'*5)
144
146
  # appWidgetManager = AppWidgetManager("Image")
@@ -1,7 +1,6 @@
1
- print("----------------------Running android_widget.maker-----------------")
2
-
3
1
  from dataclasses import dataclass
4
2
  from typing import List, Optional
3
+ from android_widgets.tools import SpecFile
5
4
 
6
5
 
7
6
  @dataclass
@@ -14,7 +13,13 @@ class Receiver:
14
13
  meta_name: Optional[str] = "android.appwidget.provider"
15
14
  meta_resource: Optional[str] = None
16
15
 
17
- def to_xml(self, package: str) -> str:
16
+ def to_xml(self, package: str = None, spec_file_path: str = None) -> str:
17
+ if not package and spec_file_path:
18
+ specFile = SpecFile(spec_file_path)
19
+ package_name = specFile.get("app", "package.name")
20
+ package_domain = specFile.get("app", "package.domain")
21
+ package = f"{package_domain}.{package_name}"
22
+
18
23
  attrs = [
19
24
  f'android:name="{package}.{self.name}"',
20
25
  f'android:enabled="{str(self.enabled).lower()}"',
@@ -24,8 +29,7 @@ class Receiver:
24
29
  if self.label:
25
30
  attrs.append(f'android:label="{self.label}"')
26
31
 
27
- xml = [f"<receiver {' '.join(attrs)}>"]
28
- xml.append(" <intent-filter>")
32
+ xml = [f"<receiver {' '.join(attrs)}>", " <intent-filter>"]
29
33
 
30
34
  for action in self.actions:
31
35
  xml.append(f' <action android:name="{action}" />')
@@ -42,7 +46,7 @@ class Receiver:
42
46
  return "\n".join(xml)
43
47
 
44
48
 
45
- def generate_receivers(package: str) -> str:
49
+ def test_generate_receivers(package: str = None) -> str:
46
50
  receivers = [
47
51
  Receiver(
48
52
  name="Action1",
@@ -73,15 +77,15 @@ def generate_receivers(package: str) -> str:
73
77
  return "\n\n".join(r.to_xml(package) for r in receivers)
74
78
 
75
79
 
76
-
77
-
78
80
  def inject_foreground_service_types(
79
- manifest_text: str,
80
- package: str,
81
- services: dict[str, str],
81
+ manifest_text: str,
82
+ services: dict[str, str],
83
+ package: str = None,
84
+ spec_file_path: str = None
82
85
  ) -> str:
83
86
  """
84
87
  Inject android:foregroundServiceType into <service /> tags.
88
+ :param spec_file_path:
85
89
  :param manifest_text: AndroidManifest.xml file Text Content
86
90
  :param package: package.domain + "." + package.name
87
91
  :param services:
@@ -91,6 +95,11 @@ def inject_foreground_service_types(
91
95
  "location": "location"
92
96
  }
93
97
  """
98
+ if not package and spec_file_path:
99
+ specFile = SpecFile(spec_file_path)
100
+ package_name = specFile.get("app", "package.name")
101
+ package_domain = specFile.get("app", "package.domain")
102
+ package = f"{package_domain}.{package_name}"
94
103
 
95
104
  for name, fgs_type in services.items():
96
105
  service_name = f"{package}.Service{name.capitalize()}"
@@ -125,3 +134,7 @@ def inject_foreground_service_types(
125
134
  )
126
135
 
127
136
  return manifest_text
137
+
138
+
139
+ if __name__ == "__main__":
140
+ print(test_generate_receivers())
@@ -41,3 +41,9 @@ class SpecFile:
41
41
 
42
42
  def section(self, section: str) -> dict:
43
43
  return self.data.get(section, {}).copy()
44
+
45
+ if __name__ == "__main__":
46
+ specFile = SpecFile("/home/fabian/Documents/Laner/mobile/buildozer.spec")
47
+ package_name = specFile.get("app","package.name")
48
+ package_domain = specFile.get("app","package.domain")
49
+ print("-"*20,f"{package_name}.{package_domain}","-"*20)
@@ -1,23 +1,20 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: android-widgets
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: This would be used to auto gen XMLs for Android Home Screen widgets.
5
5
  Author-email: Fabian <fector101@yahoo.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/Fector101/kivy-androidwidgets
8
8
  Project-URL: Documentation, https://github.com/Fector101/kivy-androidwidgets
9
9
  Project-URL: Source, https://github.com/Fector101/kivy-androidwidgets
10
10
  Project-URL: Tracker, https://github.com/Fector101/kivy-androidwidgets/issues
11
11
  Keywords: kivy,android,widgets,hello-world,python-package
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Operating System :: Android
15
14
  Classifier: Development Status :: 3 - Alpha
16
15
  Classifier: Intended Audience :: Developers
17
16
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
- Requires-Python: >=3.7
19
17
  Description-Content-Type: text/markdown
20
- Requires-Dist: kivy>=2.0.0
21
18
 
22
19
  Kivy-androidwidgets
23
20
  ---
@@ -68,8 +65,8 @@ Create preview image png in right path`res/drawable/ic_launcher_foreground.png`
68
65
 
69
66
  ### step 3: Create a `AppWidgetProvider` it's used to receive events for widget.
70
67
  path: `src/SimpleWidget.java`.
71
- This will receive an event when widget is add to change it's text
72
-
68
+ - This will receive an event when widget is add to change it's text
69
+ - You Can use [python to make changes](https://github.com/Fector101/kivy-androidwidgets/blob/main/using-python-to-update-widget.md#changing-text-with-python), but i don't to make it recive events like swipes and taps to widget
73
70
  ```java
74
71
  package org.wally.waller; // Change here from buildozer.spec package.domain+package.name
75
72
 
@@ -10,5 +10,5 @@ android_widgets/tools.py
10
10
  android_widgets.egg-info/PKG-INFO
11
11
  android_widgets.egg-info/SOURCES.txt
12
12
  android_widgets.egg-info/dependency_links.txt
13
- android_widgets.egg-info/requires.txt
14
- android_widgets.egg-info/top_level.txt
13
+ android_widgets.egg-info/top_level.txt
14
+ venv/bin/activate_this.py
@@ -1,3 +1,4 @@
1
1
  android_widgets
2
2
  dist
3
3
  imgs
4
+ venv
@@ -1,20 +1,17 @@
1
1
  [build-system]
2
- requires = ["setuptools>=77.0.0", "wheel"]
2
+ requires = ["setuptools"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "android-widgets"
7
- version = "0.1.4"
7
+ version = "0.1.6"
8
8
  description = "This would be used to auto gen XMLs for Android Home Screen widgets."
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  authors = [
11
11
  { name = "Fabian", email = "fector101@yahoo.com" }
12
12
  ]
13
- license = { text = "MIT" }
14
- requires-python = ">=3.7"
15
- dependencies = [
16
- "kivy>=2.0.0"
17
- ]
13
+ license = "MIT"
14
+
18
15
  keywords = [
19
16
  "kivy",
20
17
  "android",
@@ -24,7 +21,6 @@ keywords = [
24
21
  ]
25
22
  classifiers = [
26
23
  "Programming Language :: Python :: 3",
27
- "License :: OSI Approved :: MIT License",
28
24
  "Operating System :: Android",
29
25
  "Development Status :: 3 - Alpha",
30
26
  "Intended Audience :: Developers",
@@ -0,0 +1,36 @@
1
+ """
2
+ Activate virtualenv for current interpreter:
3
+
4
+ Use exec(open(this_file).read(), {'__file__': this_file}).
5
+
6
+ This can be used when you must use an existing Python interpreter, not the virtualenv bin/python.
7
+ """ # noqa: D415
8
+ from __future__ import annotations
9
+
10
+ import os
11
+ import site
12
+ import sys
13
+
14
+ try:
15
+ abs_file = os.path.abspath(__file__)
16
+ except NameError as exc:
17
+ msg = "You must use exec(open(this_file).read(), {'__file__': this_file})"
18
+ raise AssertionError(msg) from exc
19
+
20
+ bin_dir = os.path.dirname(abs_file)
21
+ base = bin_dir[: -len("bin") - 1] # strip away the bin part from the __file__, plus the path separator
22
+
23
+ # prepend bin to PATH (this file is inside the bin directory)
24
+ os.environ["PATH"] = os.pathsep.join([bin_dir, *os.environ.get("PATH", "").split(os.pathsep)])
25
+ os.environ["VIRTUAL_ENV"] = base # virtual env is right above bin directory
26
+ os.environ["VIRTUAL_ENV_PROMPT"] = "" or os.path.basename(base) # noqa: SIM222
27
+
28
+ # add the virtual environments libraries to the host python import mechanism
29
+ prev_length = len(sys.path)
30
+ for lib in "../lib/python3.12/site-packages".split(os.pathsep):
31
+ path = os.path.realpath(os.path.join(bin_dir, lib))
32
+ site.addsitedir(path.decode("utf-8") if "" else path)
33
+ sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]
34
+
35
+ sys.real_prefix = sys.prefix
36
+ sys.prefix = base
@@ -1 +0,0 @@
1
- kivy>=2.0.0