File: README

package info (click to toggle)
tepache 1.1-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 120 kB
  • ctags: 53
  • sloc: python: 618; makefile: 30
file content (210 lines) | stat: -rw-r--r-- 6,011 bytes parent folder | download
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210

                     Tepache
                     -------
Author:
    Sandino "tigrux" Flores-Moreno
Email:
    tigrux_at_ximian_dot_com
Current version:
    1.1
Release date:
    Jul 4 2005
                     

License
-------

This program is covered by the LGPL.


A spanish soup and a mexican beverage
-------------------------------------

The gazpacho is a soup made of fresh tomatoes.
It is commonly prepared and drinken in summer in Spain, when spanish are
thirsty and want to get fresh.

The tepache is a mexican beverage made of brewed pineapple.
It is commonly prepared and drinken in summer in Mexico, when mexicans are
thirsty and want to get cool.

gazpacho is also the name of a designer of graphical interfaces, that started
in Spain (AFAIK), and compatible with glade. So, naming this program as
tepache is very convenient since the similarities in the meaning of both names.
Guess where I am from? :-) 

                     
What is tepache?
----------------

Tepache is a code sketcher for python that uses pygtk and glade.
It could look like other glade codegens, but it is totally different.
Not glade codegen but a code sketcher

Not glade codegen but a code sketcher
-------------------------------------

There is libglade, there is pygtk-libglade. Then, tepache does not have to
create any code for creating the graphical interfaces.
It creates pure python modules with classes that are clean abstractions for
the toplevel widgets of the glade files.
That is why we say tepache is not a code generator, it is a code sketcher.

Typical code generators overwrite your own code every time they are executed.
Tepache won't lost your code because it uses a very simple system of using
context comments for protecting your code. It could look a little verbose
but works very well.


Supported platforms
-------------------

It will run un any platform with python 2.3+, patch and diff.
It has been tested in GNU/Linux, Windows and MacOSX.
For running in Windows you need to install patch and diff from
gnuwin32 [http://gnuwin32.sourceforge.net/packages.html]
and pywin32 extensions [http://sourceforge.net/projects/pywin32]


Install
-------

Just download tepache, chmod it to 0755 and use it as any other executable script.

It can optionally be integrated to glade by applying a patch for glade

A tarball provides all the required files as well an installer based on distutils.
Runnin python setup.py will install it.

Rpms of glade compiled in Mandrake and tested in Ubuntu are also provided. 


Usage
----------------

[tigrux@garritas tepache]$ tepache
usage: tepache [options] [GLADE_FILE] [OUTPUT_FILE]

write a sketch of python code from a glade file.

options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -g GLADE_FILE, --glade=GLADE_FILE
                        file to parse
  -o OUTPUT_FILE, --output=OUTPUT_FILE
                        file to write the sketch of the code
  -n, --no-helper       Do not write the helper module
  -t, --use-tabs        Use tabs instead of 4 spaces for indenting. Discouraged according to PEP-8.

[tigrux@garritas tepache]$ tepache sample.glade
written file sample.py
			
Generated sketch of code
--------------

sample.py

#!/usr/bin/env python
# -*- coding: UTF8 -*-

# Python module sample.py
# Autogenerated from sample.glade
# Generated on Sat Jul  2 23:59:38 2005

# Warning: Do not modify any context comment such as #--
# They are required to keep user's code

import os

import gtk
import gnome

from SimpleGladeApp import SimpleGladeApp
from SimpleGladeApp import bindtextdomain

app_name = "sample"
app_version = "0.0.1"

glade_dir = ""
locale_dir = ""

bindtextdomain(app_name, locale_dir)


class MainWindow(SimpleGladeApp):

    def __init__(self, path="sample.glade",
                 root="main_window",
                 domain=app_name, **kwargs):
        path = os.path.join(glade_dir, path)
        SimpleGladeApp.__init__(self, path, root, domain, **kwargs)

    #-- MainWindow.new {
    def new(self):
        print "A new %s has been created" % self.__class__.__name__
    #-- MainWindow.new }

    #-- MainWindow custom methods {
    #   Write your own methods here
    #-- MainWindow custom methods }

    #-- MainWindow.on_button1_clicked {
    def on_button1_clicked(self, widget, *args):
        print "on_button1_clicked called with self.%s" % widget.get_name()
    #-- MainWindow.on_button1_clicked }

    #-- MainWindow.on_entry1_activate {
    def on_entry1_activate(self, widget, *args):
        print "on_entry1_activate called with self.%s" % widget.get_name()
    #-- MainWindow.on_entry1_activate }

    #-- MainWindow.on_hscale1_value_changed {
    def on_hscale1_value_changed(self, widget, *args):
        print "on_hscale1_value_changed called with self.%s" % widget.get_name()
    #-- MainWindow.on_hscale1_value_changed }


class FileDialog(SimpleGladeApp):

    def __init__(self, path="sample.glade",
                 root="file_dialog",
                 domain=app_name, **kwargs):
        path = os.path.join(glade_dir, path)
        SimpleGladeApp.__init__(self, path, root, domain, **kwargs)

    #-- FileDialog.new {
    def new(self):
        print "A new %s has been created" % self.__class__.__name__
    #-- FileDialog.new }

    #-- FileDialog custom methods {
    #   Write your own methods here
    #-- FileDialog custom methods }

    #-- FileDialog.on_file_dialog_response {
    def on_file_dialog_response(self, widget, *args):
        print "on_file_dialog_response called with self.%s" % widget.get_name()
    #-- FileDialog.on_file_dialog_response }


#-- main {

def main():
    gnome.program_init("sample", "0.0.1")
    main_window = MainWindow()
    file_dialog = FileDialog()

    main_window.run()

if __name__ == "__main__":
    main()

#-- main }


Future enhancements
-------------------

Future versions of tepache will support both glade and gazpacho.
A plugin for gazpacho is being planned.