From f1f58e4254723ecbba168a9b30e39075005c3550 Mon Sep 17 00:00:00 2001 From: ObaraEmmanuel Date: Sun, 14 Jun 2020 16:43:32 +0300 Subject: [PATCH] polishing up for release 0.1.0 --- formation/__init__.py | 2 ++ formation/loader.py | 16 +++++++++++++++ hoverset/ui/dialogs.py | 2 ++ setup.cfg | 2 ++ setup.py | 45 ++++++++++++++++++++++++++++++++++++++++++ studio/ui/about.py | 30 ++++++++++++++++++++++++++++ win_requirements.txt | 1 + 7 files changed, 98 insertions(+) create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 studio/ui/about.py diff --git a/formation/__init__.py b/formation/__init__.py index b8f77f1..dfc1096 100644 --- a/formation/__init__.py +++ b/formation/__init__.py @@ -1 +1,3 @@ from .loader import Builder, AppBuilder + +__version__ = '0.1.0' diff --git a/formation/loader.py b/formation/loader.py index 8368457..26c56ef 100644 --- a/formation/loader.py +++ b/formation/loader.py @@ -315,6 +315,22 @@ class AppBuilder(Builder): def __init__(self, path, app=None, screenName=None, baseName=None, className: str = 'Tk', useTk=1, sync=0, use=None): + """ + Create a builder object that automatically adds itself into a toplevel window + and resizes the window accordingly. The underlying toplevel window can + be accesses as builder_object._app. The private accessor undrscore is to + free as much as of the builder namespace to your user defined names and prevent + possible issues + :param path: Path to xml file created by the formation designer + :param app: optional custom external toplevel to use, if unspecified a toplevel window is + created for you + The rest of the parameters are specific to the underlying toplevel window + Return a new Toplevel widget on screen :param screenName. A new Tcl interpreter will + be created. :param baseName will be used for the identification of the profile file (see + readprofile). + It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME + is the name of the widget class + """ if app is None: self._parent = self._app = tk.Tk(screenName, baseName, className, useTk, sync, use) else: diff --git a/hoverset/ui/dialogs.py b/hoverset/ui/dialogs.py index a8d2f20..0338e5f 100644 --- a/hoverset/ui/dialogs.py +++ b/hoverset/ui/dialogs.py @@ -40,6 +40,8 @@ def __init__(self, master, render_routine=None, **kw): self.transient(master) # take the screen focus self.grab_set() + # prevent resizing by default + self.resizable(False, False) self.bar = None # Common dialogs routines = { diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..224a779 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.md \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..cb76734 --- /dev/null +++ b/setup.py @@ -0,0 +1,45 @@ +from setuptools import setup +import formation +import sys + +requirements = ['lxml', 'Pillow>=6.0.0', 'pyscreenshot'] +if sys.platform == 'win32': + requirements.append('pywin32') + +setup( + name='formation', + packages=['hoverset', 'hoverset.data', 'hoverset.platform', 'hoverset.ui', 'hoverset.util', + 'formation', + 'studio', 'studio.feature', 'studio.lib', 'studio.parsers', 'studio.ui'], + version=formation.__version__, + license='MIT', + description='Simplify GUI development in python', + author='Hoverset', + author_email='emmanuelobarany@gmail.com', + url='https://github.com/ObaraEmmanuel/Formation', + keywords=['formation', 'gui', 'graphical-user-interface', 'drag drop', 'tkinter', 'hoverset'], + install_requires=requirements, + package_data={ + 'hoverset.data': ['image.*'], + 'hoverset.ui': ['themes/*'], + 'studio': ['resources/*/*'] + }, + entry_points={ + 'gui_scripts': [ + 'formation-studio = studio.main:main', + ] + }, + classifiers=[ + 'Development Status :: 3 - Alpha', + # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" + 'Intended Audience :: Developers', + 'Topic :: Software Development :: Build Tools', + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Utilities', + 'Topic :: Software Development :: User Interfaces', + 'Operating System :: OS Independent' + ], +) diff --git a/studio/ui/about.py b/studio/ui/about.py new file mode 100644 index 0000000..2c05cb7 --- /dev/null +++ b/studio/ui/about.py @@ -0,0 +1,30 @@ +import os + +from hoverset.ui.widgets import Frame, Label +from hoverset.ui.dialogs import MessageDialog +from hoverset.data.images import load_tk_image + +import formation + + +class About(Frame): + + def __init__(self, parent): + super().__init__(parent) + self.config(**self.style.dark) + image = load_tk_image(os.path.join("..", "resources", "images", "logo.png"), 400, 129) + Label(self, image=image, **self.style.dark).pack(side="top", fill="y") + Label(self, text="Version {} alpha".format(formation.__version__), + **self.style.dark_text).pack(side="top", fill="y", pady=15) + Label(self, text="Make designing user interfaces in python a breeze!", + **self.style.dark_text).pack(side="top", fill="y", pady=5) + copy_right = "Copyright © 2019-2020 Hoverset group" + Label(self, text=copy_right, **self.style.dark_text_passive).pack(side="top", fill="y") + self.pack(fill="both", expand=True) + + +def about_window(parent): + dialog = MessageDialog(parent, About) + dialog.title("Formation") + dialog.focus_set() + return dialog diff --git a/win_requirements.txt b/win_requirements.txt index 8519776..9d8510e 100644 --- a/win_requirements.txt +++ b/win_requirements.txt @@ -1,3 +1,4 @@ pyscreenshot Pillow>=6.2.1 +lxml pywin32 \ No newline at end of file