Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflavio <fdanesse@gmail.com>2012-07-27 19:52:48 (GMT)
committer flavio <fdanesse@gmail.com>2012-07-27 19:52:48 (GMT)
commitb3ff69682391662c6fde5f12ec7741c87aae2b21 (patch)
tree9fe3ef2ce5d9011c6a62308996deb057912a864b
parent9d451122e98ccb946049ad903ef4d5f24121d9b2 (diff)
ComboBoxText Corrections
-rw-r--r--activity.py35
-rw-r--r--face.py6
2 files changed, 16 insertions, 25 deletions
diff --git a/activity.py b/activity.py
index e164e7c..7abd7bb 100644
--- a/activity.py
+++ b/activity.py
@@ -98,12 +98,11 @@ class SpeakActivity(SharedActivity):
self.connect("notify::active", self._activeCb)
# make a box to type into
- self.entrycombo = Gtk.ComboBoxText()
+ self.entrycombo = Gtk.ComboBoxText.new_with_entry()
self.entrycombo.connect("changed", self._combo_changed_cb)
self.entry = self.entrycombo.get_child()
- # FIXME: unknown signal name: activate
- #self.entry.can_activate_accel(True)
- #self.entry.connect('activate', self._entry_activate_cb)
+ self.entry.can_activate_accel(True)
+ self.entry.connect('activate', self._entry_activate_cb)
self.entry.connect("key-press-event", self._entry_key_press_cb)
self.input_font = Pango.FontDescription('sans bold 24')
self.entry.modify_font(self.input_font)
@@ -139,10 +138,8 @@ class SpeakActivity(SharedActivity):
# make the text box active right away
self.entry.grab_focus()
- # FIXME: unknown signal name: move-cursor
- #self.entry.connect("move-cursor", self._cursor_moved_cb)
- # FIXME: unknown signal name: changed
- #self.entry.connect("changed", self._cursor_moved_cb)
+ self.entry.connect("move-cursor", self._cursor_moved_cb)
+ self.entry.connect("changed", self._cursor_moved_cb)
# toolbar
toolbox = ToolbarBox()
@@ -301,22 +298,19 @@ class SpeakActivity(SharedActivity):
self.eye_shape_combo.select(status.eyes[0])
self.numeyesadj.set_value(len(status.eyes))
- # FIXME: gi._gobject.GProps object has no attribute text
- #self.entry.props.text = cfg['text'].encode('utf-8', 'ignore')
+ self.entry.props.text = cfg['text'].encode('utf-8', 'ignore')
for i in cfg['history']:
self.entrycombo.append_text(i.encode('utf-8', 'ignore'))
self.new_instance()
def save_instance(self, file_path):
- # FIXME: object has no attribute text
- #cfg = {'status': self.face.status.serialize(),
- # 'text': unicode(self.entry.props.text, 'utf-8', 'ignore'),
- # 'history': [unicode(i[0], 'utf-8', 'ignore') \
- # for i in self.entrycombo.get_model()],
- # }
- #file(file_path, 'w').write(cjson.encode(cfg))
- pass
+ cfg = {'status': self.face.status.serialize(),
+ 'text': unicode(self.entry.props.text, 'utf-8', 'ignore'),
+ 'history': [unicode(i[0], 'utf-8', 'ignore') \
+ for i in self.entrycombo.get_model()],
+ }
+ file(file_path, 'w').write(cjson.encode(cfg))
def share_instance(self, connection, is_initiator):
self.chat.messenger = Messenger(connection, is_initiator, self.chat)
@@ -326,7 +320,7 @@ class SpeakActivity(SharedActivity):
index = entry.props.cursor_position
layout = entry.get_layout()
pos = layout.get_cursor_pos(index)
- x = pos[0][0] / Pango.SCALE - entry.props.scroll_offset
+ x = pos[0].x / Pango.SCALE - entry.props.scroll_offset
y = entry.get_allocation().y
self.face.look_at(pos=(x, y))
@@ -456,8 +450,7 @@ class SpeakActivity(SharedActivity):
# when a new item is chosen, make sure the text is selected
if not self.entry.is_focus():
self.entry.grab_focus()
- # FIXME: CellView object has no attribute select_region
- #self.entry.select_region(0, -1)
+ self.entry.select_region(0, -1)
def _entry_key_press_cb(self, combo, event):
# make the up/down arrows navigate through our history
diff --git a/face.py b/face.py
index 6aa3151..197b59c 100644
--- a/face.py
+++ b/face.py
@@ -139,10 +139,8 @@ class View(Gtk.EventBox):
def look_at(self, pos=None):
if self._eyes:
if pos is None:
- display = Gdk.Display()
- # FIXME: Bug in gi
- # screen_, x, y, modifiers_ = display.get_pointer()
- x, y = self.get_pointer()
+ display = Gdk.Display.get_default()
+ screen, x, y, modifiers = display.get_pointer()
else:
x, y = pos
map(lambda e, x=x, y=y: e.look_at(x, y), self._eyes)