forked from alejandroautalan/pygubu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
150 lines (119 loc) · 3.9 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/usr/bin/env python3
# encoding: UTF-8
"""Build tar.gz for pygubu
Needed packages to run (using Debian/Ubuntu package names):
python3-tk
"""
from __future__ import print_function
import sys
import os
import shutil
import platform
import pygubu
VERSION = pygubu.__version__
try:
from setuptools.command.install import install
from setuptools import setup
except:
from distutils.command.install import install
from distutils.core import setup
class CustomInstall(install):
"""Custom installation class on package files.
"""
def run(self):
"""Run parent install, and then save the install dir in the script."""
install.run(self)
#
# Remove old pygubu.py from scripts path if exists
spath = os.path.join(self.install_scripts, 'pygubu')
for ext in ('.py', '.pyw'):
filename = spath + ext
if os.path.exists(filename):
os.remove(filename)
#
# Remove old pygubu-designer.bat
if platform.system() == 'Windows':
spath = os.path.join(self.install_scripts, 'pygubu-designer.bat')
if os.path.exists(spath):
os.remove(spath)
long_description = \
"""
Welcome to pygubu a GUI designer for tkinter
============================================
Pygubu is a RAD tool to enable quick & easy development of user interfaces
for the python tkinter module.
The user interfaces designed are saved as XML, and by using the pygubu builder
these can be loaded by applications dynamically as needed.
Pygubu is inspired by Glade.
Installation
------------
Pygubu requires python >= 2.7 (Tested only in python 2.7.3 and 3.2.3
with tk8.5)
Download and extract the tarball. Open a console in the extraction
path and execute:
::
python setup.py install
Usage
-----
Create an UI definition using pygubu and save it to a file. Then, create
your aplication script as shown below:
::
#test.py
import tkinter as tk
import pygubu
class Application:
def __init__(self, master):
#1: Create a builder
self.builder = builder = pugubu.Builder()
#2: Load an ui file
builder.add_from_file('test.ui')
#3: Create the widget using a master as parent
self.mainwindow = builder.get_object('mainwindow', master)
if __name__ == '__main__':
root = tk.Tk()
app = Application(root)
root.mainloop()
See the examples directory or watch this hello world example on
video http://youtu.be/wuzV9P8geDg
"""
setup(
name='pygubu',
version=VERSION,
license='GPL-3',
author='Alejandro Autalán',
author_email='[email protected]',
description='A tkinter GUI builder.',
long_description=long_description,
url='https://github.com/alejandroautalan/pygubu',
packages=['pygubu', 'pygubu.builder', 'pygubu.builder.widgets',
'pygubu.widgets', 'pygubudesigner', 'pygubudesigner.util',
'pygubudesigner.widgets'],
package_data={
'pygubudesigner': [
'images/*.gif', 'images/widgets/*/*.gif',
'ui/*.ui',
'locale/*/*/*.mo'],
},
# scripts=["bin/pygubu-designer"],
entry_points={
'gui_scripts': [
'pygubu-designer = pygubudesigner.main:start_pygubu',
]
},
cmdclass={
'install': CustomInstall,
},
install_requires=['appdirs>=1.3'],
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Utilities",
"Topic :: Software Development :: User Interfaces",
],
)