This repository has been archived by the owner on Mar 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
send.py
101 lines (78 loc) · 3.27 KB
/
send.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
# Copyright (C) 2009, Lucian Branescu Mihaila
#
# 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
from gettext import gettext as _
import logging
import urllib2
import gobject
import gtk
import pango
from sugar.graphics import style
class BundleView(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
self.set_decorated(False)
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
self.set_border_width(style.LINE_WIDTH)
width = gtk.gdk.screen_width() - style.GRID_CELL_SIZE * 2
height = gtk.gdk.screen_height() - style.GRID_CELL_SIZE * 2
self.set_size_request(width, height)
vbox = gtk.VBox()
self.add(vbox)
vbox.show()
# address entry
hbox = gtk.HBox()
vbox.pack_start(hbox, expand=False)
hbox.show()
self._add_button = gtk.Button(label='Add')
hbox.pack_start(self._add_button, expand=False)
self._add_button.connect('button-press-event', self.__add_cb)
self._add_button.show()
self._entry = gtk.Entry()
hbox.pack_start(self._entry, expand=True)
self._entry.show()
self._send_button = gtk.Button(label='Send')
hbox.pack_start(self._send_button, expand=False)
self._send_button.connect('button-press-event', self.__send_cb)
self._send_button.show()
# object list
sw = gtk.ScrolledWindow()
sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
vbox.pack_start(sw)
sw.show()
self._tree_view = gtk.TreeView()
sw.add(self._tree_view)
self._tree_view.set_model(gtk.ListStore(str, str))
selection = self._tree_view.get_selection()
cell = gtk.CellRendererText()
cell.props.wrap_mode = pango.WRAP_WORD
cell.props.wrap_width = gtk.gdk.screen_width()
column = gtk.TreeViewColumn()
column.pack_start(cell, expand=False)
column.add_attribute(cell, 'text', 1)
self._tree_view.append_column(column)
self._tree_view.set_search_column(0)
self._tree_view.props.headers_visible = False
self._tree_view.show()
def __add_cb(self, button, response_id):
model = self._tree_view.get_model()
model.append(['journal id', 'obj name'])
def __send_cb(self, button, response_id):
model = self._tree_view.get_model()
model.clear()
self.hide()
class Toolbar(gtk.Toolbar):
pass