This file is indexed.

/usr/share/pyshared/gtkmvc/progen/templates.py is in python-gtkmvc 1.99.1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
## This file contains the default templates used when creating a
## project
# >>>   IMPORTANT!  <<<<
# Notice that default license is GPL

__all__ = ( "DEFAULT_HEADER", "DEFAULT_MAP" )

import gtkmvc

header = """#  -------------------------------------------------------------------------
#  This file was initially generated by gtkmvc progen-$version
#  Generation timestamp: $date 
#  -------------------------------------------------------------------------
#
#  Author: $author  $email
#
#  $copyright
#
#  This file is part of ${name}.
#
$license
#  -------------------------------------------------------------------------

$comment
"""


gpl = """#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

model = """
from gtkmvc import ${base_class_name}

class ${class_name} (${base_class_name}):

    # Observable properties
    somevalue = 0
    __observables__ = ("somevalue",)
    
    def __init__(self):
        ${base_class_name}.__init__(self)
        return
    
    pass # end of class ${class_name}
"""

ctrl = """
from gtkmvc import Controller
from gtkmvc import adapters
import gtk

class ${class_name} (${base_class_name}):
    
    def __init__(self, model, view):
        ${base_class_name}.__init__(self, model, view)
        return

    def register_view(self, view):
        # setup of widgets
        self.view['${top_widget}'].connect('delete-event', self.on_${top_widget}_delete_event)
        return

    def register_adapters(self):
        # setup of adapters
        return

    # ---------------------------------------------------------------
    #        Signal handlers
    # ---------------------------------------------------------------
    def on_${top_widget}_delete_event(self, win, event):
        gtk.main_quit() # say goodbye
        return True

    # ---------------------------------------------------------------
    #        Notifications from observable properties
    # ---------------------------------------------------------------
    
    # For value-change notifications
#     @Controller.observe("<property_name_here>", assign=True)
#     def value_change(self, model, prop_name, info):
#         # info contains 'new' and 'old' values
#         return

    # For value-change of containers like lists, maps, or method calls for observable class instances. 
    # There exist 'before' and 'after' versions, you can use both or only one, depending on your need.
#     @Controller.observe("<property_name_here>", before=True, after=True)
#     def method_call(self, model, prop_name, info):
#         # Info contains:
#         # 'instance' is the object that is being changed (the list for example)
#         # 'method_name' is the name of the method that is used to change it ('append' for example)
#         # 'args' is the list of arguments of the invoked method 'name'
#         # 'kwargs' is the keywords map of the invoked method 'name'
#         # 'result' (only for 'after' notifications) the value returned by the method after the call
#         return
#

    @Controller.observe("somevalue", assign=True)
    def somevalue_change(self, model, prop_name, info):
        return
   
    pass # end of class ${class_name}
"""

view_glade = """
from gtkmvc import View
import utils.globals

import gtk
import os.path

class ${class_name} (${base_class_name}):
    glade = os.path.join(utils.globals.GLADE_DIR, "${glade_fn}")
    top = "${top_widget}"
    def __init__(self):
        ${base_class_name}.__init__(self)

        # construction of manual widgets and other settings
        return

    pass # end of class ${class_name}
"""


view_noglade = """
from gtkmvc import View
import gtk

class ${class_name} (${base_class_name}):

    def __init__(self):
        ${base_class_name}.__init__(self)

        # construction of manual widgets and other settings
        w = gtk.Window()
        w.set_title("Hello ${name}")
        h = gtk.VBox(); w.add(h)
        lbl = gtk.Label()
        lbl.set_markup("<big><b>Hello ${author}!</b></big>")
        h.add(lbl)
        self['label1'] = lbl

        lbl = gtk.Label()
        lbl.set_markup('''This is a demo of a <b>gtkmvc</b>-based application
without a <i>glade</i> file''')
        h.add(lbl)
        self['label2'] = lbl

        w.show_all()
        self['${top_widget}'] = w
        return

    pass # end of class ${class_name}
"""

glob = """
import os.path
import sys

if sys.argv[0]: top_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
else: top_dir = "."

# ----------------------------------------------------------------------
TOPDIR = top_dir
RESOURCES_DIR = os.path.join(TOPDIR, "${res_name}")
GLADE_DIR = os.path.join(RESOURCES_DIR, "glade")
STYLES_DIR = os.path.join(RESOURCES_DIR, "styles")
APPL_SHORT_NAME = "${name}"
APPL_VERSION = (1, 0, 0)
# ----------------------------------------------------------------------

"""


main = '''
import gtk

def setup_path():
    """Sets up the python include paths to include needed directories"""
    import os.path; import sys
    from ${src_name}.utils.globals import TOPDIR 
    sys.path.insert(0, reduce(os.path.join, (TOPDIR, "${res_name}", "external")))
    sys.path.insert(0, os.path.join(TOPDIR, "${src_name}"))
    return


def check_requirements():
    """Checks versions and other requirements"""
    import gtkmvc; gtkmvc.require("1.99.1")
    return

def main(*args, **kargs):
    ${model_import} as ApplModel
    ${ctrl_import} as ApplCtrl
    ${view_import} as ApplView

    m = ApplModel()
    v = ApplView()
    c = ApplCtrl(m, v)

    gtk.main()    
    return

if __name__ == "__main__":
    setup_path()
    check_requirements()
    main()
    pass
'''

glade_file = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.0 on Thu Oct  4 16:50:42 2007 by roboogle@gmail.com-->
<glade-interface>
  <widget class="GtkWindow" id="${top_widget}">
    <property name="visible">True</property>
    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
    <property name="border_width">12</property>    
    <property name="title" translatable="yes">Hello ${name}</property>
    <child>
      <widget class="GtkVBox" id="vbox1">
        <property name="visible">True</property>
        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
        <property name="spacing">12</property>
        <child>
          <widget class="GtkLabel" id="label1">
            <property name="visible">True</property>
            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
            <property name="label" translatable="yes">&lt;big&gt;&lt;b&gt;Hello ${author}!&lt;/b&gt;&lt;/big&gt;

This is a demo from gtkmvc Project Generator</property>
            <property name="use_markup">True</property>
            <property name="justify">GTK_JUSTIFY_CENTER</property>
          </widget>
          <packing>
            <property name="expand">False</property>
          </packing>
        </child>
        <child>
          <widget class="GtkLabel" id="label2">
            <property name="visible">True</property>
            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
            <property name="label" translatable="yes">To start editing your project:
1. Change glade file into resources/glade by using &lt;tt&gt;Glade&lt;/tt&gt;
2. Adapt skeleton source code that has been generated

Hope you will enjoy designing and developing with gtkmvc!

For further information take a tour at 
&lt;u&gt;http://sourceforge.net/apps/trac/pygtkmvc/wiki&lt;/u&gt;</property>
            <property name="use_markup">True</property>
          </widget>
          <packing>
            <property name="position">1</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>
'''

# These are exported outside
# ----------------------------------------------------------------------
DEFAULT_HEADER = header
VERSION=map(str, gtkmvc.get_version())
DEFAULT_MAP = { 'license' : gpl, 'version' : ".".join(VERSION) }
# ----------------------------------------------------------------------