/usr/share/doc/python-gtkmvc-doc/examples/mini-yoman/yomanlib/views/appview.py is in python-gtkmvc-doc 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 | ## ===========================================================================
## This file is part of Yoman, a notebook program.
##
## Author: Baruch Even <baruch@ev-en.org>
##
## Copyright (c) 2006 by Baruch Even
##
## 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
##
## The author may be contact at his email <baruch@ev-en.org>.
##
## ===========================================================================
from yomanlib.utils import _importer
from yomanlib.utils import globals
from gtkmvc import View
import gtk, gobject
import os
class BaseView(View):
GLADE_FILE = 'glade/yoman.glade'
def __init__(self, parent_view=None):
View.__init__(self, self.GLADE_FILE, self.TOP_WIDGET, parent=parent_view)
class AppView(BaseView):
TOP_WIDGET = 'window_main'
def __init__(self):
BaseView.__init__(self)
self.main = MainView()
self.note = NoteView()
self['scrolledwindow_main'].add(self.main['treeview_main'])
self['scrolledwindow_note'].add(self.note['viewport_note'])
return
class BaseTreeView(BaseView):
def __init__(self):
BaseView.__init__(self)
treeview = self[self.TOP_WIDGET[0]]
treeview.set_reorderable(True)
cell = gtk.CellRendererText()
tvcolumn = gtk.TreeViewColumn('Title', cell, text=0)
treeview.append_column(tvcolumn)
return
class MainView(BaseTreeView):
TOP_WIDGET = ('treeview_main', 'main_popup')
class NoteView(BaseView):
TOP_WIDGET = ('viewport_note', 'textview_note', 'entry_title')
def __init__(self):
BaseView.__init__(self)
self['textview_note'].set_wrap_mode(gtk.WRAP_WORD)
class AppAboutView(BaseView):
TOP_WIDGET = 'aboutdialog'
def __init__(self, parent_view):
BaseView.__init__(self, parent_view=parent_view)
def run(self):
f = open(os.path.join(globals.TOPDIR, "LICENSE"), "r")
self['aboutdialog'].set_license(f.read())
f.close()
w = self.get_top_widget()
res = w.run()
w.destroy()
return res
|