~gladex/gladex/0.4

« back to all changes in this revision

Viewing changes to plugins/python/pcg.py

  • Committer: Christopher Pax
  • Date: 2008-03-11 02:44:00 UTC
  • Revision ID: chris@school-20080311024400-cvqd2p6ckhxl68ag
Fixed bug #200825 where '4 spaces' tab option would not work in generated function code

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
plugdir =os.path.split(__file__)[0]
33
33
tree = None
34
34
widgets = {}
 
35
indent = "\t" #default
35
36
 
36
37
def info():
37
38
        pass
117
118
        This function is executed when the execute button is pressed from
118
119
        the main window.
119
120
        """
 
121
        global indent
120
122
        valid = "._abcdefghijklmnopqrstuvwxyz"
121
123
        valid += valid.upper()
122
124
        
178
180
        if style == "Full": 
179
181
                styledir = plugdir+"/styles/no-rewrite/"
180
182
        nmbs="0123456789"
 
183
        
 
184
        indent_style = (indent,"\\t")[indent=="\t"]
181
185
        replace = {
182
186
                "{I}":indent,
 
187
                "{INDENT_STYLE}":indent_style,
183
188
                "{CLASS_NAME}":class_name,
184
189
                "{DICTIONARY}":get_dictionary(indent),
185
190
                "{GLADE_FILE_TITLE_EXT}":glade_file.title_ext,
290
295
        this function will return a string of all the functions that
291
296
        have not been defined yet in the callbacks file.
292
297
        """
 
298
        global indent
293
299
        #round about method to import from absloute path import
294
300
        sys.path.insert(0, working_directory)
295
301
        call_file_name = working_directory+callbacks_file_name
302
308
                # if function is already defined, then move on to the next one
303
309
                if c in funcs: continue
304
310
                else:
305
 
                        a+="\ndef "+c+"(widget, data, wtree):\n\tprint \"function '"+c+"' not implemented\"\n\tpass\n"
 
311
                        a+="\ndef "+c+"(widget, data, wtree):\n"+indent+"print \"function '"+c+"' not implemented\"\n"+indent+"pass\n"
306
312
        return a
307
313
#
308
314